index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <template>
  2. <div class="invoiceApply pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 10px 80px">
  27. <el-col :span="24">
  28. <el-col :span="12" style="width: 470px">
  29. <el-select
  30. v-model="code"
  31. multiple
  32. filterable
  33. remote
  34. :multiple-limit="1"
  35. reserve-keyword
  36. :size="searchSize"
  37. style="width: 100%"
  38. placeholder="公司名称"
  39. :remote-method="remoteMethod"
  40. :loading="selectLoading"
  41. @change="selectChange"
  42. >
  43. <el-option
  44. v-for="item in activeOptions"
  45. :key="item.companyNo"
  46. :label="item.companyName"
  47. :value="item.companyNo"
  48. />
  49. </el-select>
  50. </el-col>
  51. <el-col
  52. :span="4"
  53. style="width: 66px; float: right"
  54. >
  55. <el-button
  56. :size="searchSize"
  57. type="primary"
  58. style="float: right"
  59. @click="searchList"
  60. >
  61. 刷新
  62. </el-button>
  63. </el-col>
  64. <el-col
  65. :span="4"
  66. style="width: 66px; float: right"
  67. >
  68. <el-button
  69. type="warning"
  70. class="fr"
  71. :size="searchSize"
  72. @click="restSearch"
  73. >
  74. 重置
  75. </el-button>
  76. </el-col>
  77. </el-col>
  78. </el-row>
  79. <el-row>
  80. <el-col :span="24">
  81. <el-col :span="4" style="width: 170px">
  82. <el-select
  83. v-model="parmValue.status"
  84. clearable
  85. :size="searchSize"
  86. style="width: 100%"
  87. placeholder="发票申请状态"
  88. @change="
  89. pageInfo.curr = 1;
  90. parmValue.page = 1;
  91. searchList();
  92. "
  93. >
  94. <el-option
  95. v-for="item in statusOptions"
  96. :key="item.id"
  97. :label="item.label"
  98. :value="item.id"
  99. >
  100. </el-option>
  101. </el-select>
  102. </el-col>
  103. <el-col :span="7" style="width: 200px; padding: 0 0 0 10px">
  104. <el-select
  105. style="width: 100%"
  106. :size="searchSize"
  107. v-model="parmValue.type_check"
  108. clearable
  109. placeholder="开票类型"
  110. @change="
  111. pageInfo.curr = 1;
  112. parmValue.page = 1;
  113. searchList();
  114. "
  115. >
  116. <el-option
  117. v-for="item in billType"
  118. :key="item.code"
  119. :label="item.name"
  120. :value="item.code"
  121. >
  122. </el-option>
  123. </el-select>
  124. </el-col>
  125. <el-col :span="6" style="width: 306px; padding: 0 0 0 10px">
  126. <period-date-picker
  127. :start="parmValue.starttime"
  128. :end="parmValue.endtime"
  129. :type="1"
  130. :width="'135px'"
  131. :size="searchSize"
  132. @timeReturned="timeReturned($event)"
  133. ></period-date-picker>
  134. </el-col>
  135. <el-col :span="3" style="width: 66px; float: right">
  136. <el-button
  137. v-if="powers.some((item) => item == '003')"
  138. :size="searchSize"
  139. type="success"
  140. style="float: right"
  141. @click="openModal('add', '003', '0', '0')"
  142. >
  143. 添加
  144. </el-button>
  145. </el-col>
  146. <el-col :span="3" style="width: 54px; float: right">
  147. <el-button
  148. :size="searchSize"
  149. type="primary"
  150. style="float: right"
  151. icon="el-icon-search"
  152. @click="searchList"
  153. /></el-col>
  154. </el-col>
  155. </el-row>
  156. </div>
  157. </template>
  158. <template #status="{ scope }">
  159. <el-tag
  160. :type="
  161. scope.row.status == '0'
  162. ? 'info'
  163. : scope.row.status == '5'
  164. ? 'success'
  165. : scope.row.status == '2'
  166. ? 'danger'
  167. : ''
  168. "
  169. size="mini"
  170. v-text="
  171. (statusOptions.find((item) => item.id == scope.row.status) || {})
  172. .label || '--'
  173. "
  174. ></el-tag>
  175. </template>
  176. <template #type_check="{ scope }">
  177. <el-tag
  178. size="mini"
  179. v-text="
  180. (billType.find((item) => item.code == scope.row.type_check) || {})
  181. .name || '--'
  182. "
  183. />
  184. </template>
  185. <template #operation="{ scope }">
  186. <el-tooltip
  187. v-if="powers.some((item) => item == '007')"
  188. effect="dark"
  189. content="详情"
  190. placement="top"
  191. >
  192. <i
  193. class="el-icon-view tb-icon"
  194. @click="
  195. openModal(scope.row.id, '007', scope.row.invNo, scope.row.status)
  196. "
  197. ></i>
  198. </el-tooltip>
  199. <el-tooltip
  200. v-if="
  201. (powers.some((item) => item == '005') &&
  202. scope.row.status === '0') ||
  203. (powers.some((item) => item == '005') && scope.row.status === '2')
  204. "
  205. effect="dark"
  206. content="修改"
  207. placement="top"
  208. >
  209. <i
  210. class="el-icon-edit tb-icon"
  211. @click="
  212. openModal(scope.row.id, '005', scope.row.invNo, scope.row.status)
  213. "
  214. ></i>
  215. </el-tooltip>
  216. <el-tooltip
  217. v-if="
  218. (powers.some((item) => item == '030') &&
  219. scope.row.status === '0') ||
  220. (powers.some((item) => item == '030') && scope.row.status === '2')
  221. "
  222. effect="dark"
  223. content="发起审核流程"
  224. placement="top"
  225. >
  226. <i
  227. class="el-icon-video-play tb-icon"
  228. @click="ApplyPay(scope.row.invNo)"
  229. ></i>
  230. </el-tooltip>
  231. <el-tooltip
  232. v-if="
  233. powers.some((item) => item == '029') && scope.row.status === '1'
  234. "
  235. effect="dark"
  236. content="财务审核"
  237. placement="top"
  238. >
  239. <i
  240. class="el-icon-finished tb-icon"
  241. @click="
  242. openModal(scope.row.id, '029', scope.row.invNo, scope.row.status)
  243. "
  244. ></i>
  245. </el-tooltip>
  246. <el-tooltip
  247. v-if="
  248. powers.some((item) => item == '036') && scope.row.status === '3'
  249. "
  250. effect="dark"
  251. content="财务开票"
  252. placement="top"
  253. >
  254. <i
  255. class="el-icon-printer tb-icon"
  256. @click="
  257. openModal(scope.row.id, '036', scope.row.invNo, scope.row.status)
  258. "
  259. ></i>
  260. </el-tooltip>
  261. <el-tooltip
  262. v-if="
  263. powers.some((item) => item == '037') && scope.row.status === '4'
  264. "
  265. effect="dark"
  266. content="填写物流"
  267. placement="top"
  268. >
  269. <i
  270. class="el-icon-truck tb-icon"
  271. @click="
  272. openModal(scope.row.id, '037', scope.row.invNo, scope.row.status)
  273. "
  274. ></i>
  275. </el-tooltip>
  276. <el-tooltip
  277. v-if="
  278. (powers.some((item) => item == '027') &&
  279. scope.row.status === '0') ||
  280. (powers.some((item) => item == '027') && scope.row.status === '2')
  281. "
  282. effect="dark"
  283. content="申请取消"
  284. placement="top"
  285. >
  286. <i
  287. class="el-icon-video-pause tb-icon"
  288. @click="changeStatus(scope.row.invNo)"
  289. ></i>
  290. </el-tooltip>
  291. </template>
  292. </ex-table>
  293. <no-auth v-else></no-auth>
  294. <!-- 弹窗 新增/修改 -->
  295. <add-edit1
  296. :id="modelId"
  297. :show-model="showModel1"
  298. :is-detail="isDetail"
  299. :invNo="invNo"
  300. :status="status"
  301. @refresh="searchList"
  302. @cancel="cancel"
  303. />
  304. <!-- 财务审核 -->
  305. <add-edit2
  306. :id="modelId"
  307. :show-model="showModel2"
  308. :is-detail="isDetail"
  309. :status="status"
  310. :invNo="invNo"
  311. @refresh="searchList"
  312. @cancel="cancel"
  313. />
  314. <!-- 财务开票 -->
  315. <add-edit3
  316. :id="modelId"
  317. :show-model="showModel3"
  318. :is-detail="isDetail"
  319. :status="status"
  320. :invNo="invNo"
  321. @refresh="searchList"
  322. @cancel="cancel"
  323. />
  324. <!-- 填写物流 -->
  325. <add-edit4
  326. :id="modelId"
  327. :show-model="showModel4"
  328. :is-detail="isDetail"
  329. :status="status"
  330. :invNo="invNo"
  331. @refresh="searchList"
  332. @cancel="cancel"
  333. />
  334. </div>
  335. </template>
  336. <script>
  337. import ExTable from "@/components/ExTableNew.vue";
  338. import addEdit1 from "./addEdit1";
  339. import addEdit2 from "./addEdit2";
  340. import addEdit3 from "./addEdit3";
  341. import addEdit4 from "./addEdit4";
  342. import asyncRequest from "@/apis/service/InvoiceSales/invoiceApply";
  343. import mixinPage from "@/mixins/elPaginationHandle";
  344. import { mapGetters } from "vuex";
  345. import PeriodDatePicker from "@/components/PeriodDatePicker";
  346. import resToken from "@/mixins/resToken";
  347. export default {
  348. name: "invoiceApply",
  349. mixins: [mixinPage, resToken],
  350. components: {
  351. ExTable,
  352. addEdit1,
  353. addEdit2,
  354. addEdit3,
  355. addEdit4,
  356. PeriodDatePicker,
  357. },
  358. computed: {
  359. //组件SIZE设置
  360. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  361. powers() {
  362. let tran =
  363. this.$store.getters.btnList.find(
  364. (item) => item.menu_route == "invoiceApply"
  365. ) || {};
  366. if (tran && tran.action && tran.action.length > 0) {
  367. return tran.action;
  368. } else {
  369. return [];
  370. }
  371. },
  372. },
  373. data() {
  374. return {
  375. showModel1: false,
  376. showModel2: false,
  377. showModel3: false,
  378. showModel4: false,
  379. isDetail: false,
  380. invNo: "0",
  381. status: "0",
  382. modelId: 0,
  383. selectLoading: false,
  384. billType: [
  385. {
  386. code: "1",
  387. name: "确认单开票",
  388. },
  389. {
  390. code: "2",
  391. name: "资金开票-资金未认领",
  392. },
  393. {
  394. code: "3",
  395. name: "资金开票-资金已认领",
  396. },
  397. ],
  398. activeOptions: [],
  399. // 状态
  400. statusOptions: [
  401. { id: 0, label: "待发起审核" },
  402. { id: 1, label: "待财务审核" },
  403. { id: 2, label: "审核驳回" },
  404. { id: 3, label: "待财务开票" },
  405. { id: 4, label: "待填写物流" },
  406. { id: 5, label: "开票已完成" },
  407. ],
  408. name: "",
  409. code: [],
  410. loading: true,
  411. formValue: {
  412. company: "", // 账户
  413. page: 1, // 页码
  414. size: 100, // 每页显示条数
  415. },
  416. parmValue: {
  417. companyNo: "",
  418. status: "",
  419. type_check: "",
  420. starttime: "",
  421. endtime: "",
  422. page: 1, // 页码
  423. size: 15, // 每页显示条数
  424. },
  425. // 表格 - 数据
  426. tableData: [],
  427. // 表格 - 参数
  428. table: {
  429. stripe: true,
  430. border: true,
  431. _defaultHeader_: ["setcol"],
  432. },
  433. // 表格 - 分页
  434. pageInfo: {
  435. size: 15,
  436. curr: 1,
  437. total: 0,
  438. },
  439. // 表格 - 列参数
  440. columns: [
  441. {
  442. prop: "invNo",
  443. label: "发票编号",
  444. width: "180px",
  445. },
  446. {
  447. prop: "inv_in",
  448. label: "客户企业编码",
  449. width: "130px",
  450. },
  451. {
  452. prop: "company",
  453. label: "客户企业名称",
  454. "min-width": "180px",
  455. },
  456. {
  457. prop: "kp_company",
  458. label: "销售方开票公司名称",
  459. "min-width": "180px",
  460. },
  461. {
  462. prop: "inv_value",
  463. label: "发票额度",
  464. width: "120px",
  465. },
  466. {
  467. prop: "type_check",
  468. label: "开票类型",
  469. _slot_: "type_check",
  470. width: "150px",
  471. },
  472. {
  473. prop: "apply_name",
  474. label: "申请人",
  475. width: "85px",
  476. },
  477. {
  478. prop: "status",
  479. label: "状态",
  480. _slot_: "status",
  481. width: "120px",
  482. },
  483. {
  484. prop: "addtime",
  485. label: "申请时间",
  486. sortable: true,
  487. width: "150px",
  488. },
  489. {
  490. prop: "",
  491. label: "操作",
  492. fixed: "right",
  493. _noset_: true,
  494. width: "150px",
  495. _slot_: "operation",
  496. },
  497. ],
  498. };
  499. },
  500. mounted() {
  501. this.searchList();
  502. },
  503. methods: {
  504. async selectChange() {
  505. let arr = JSON.parse(JSON.stringify(this.code));
  506. this.parmValue.companyNo = arr.join(",");
  507. this.parmValue.page = 1;
  508. await this.searchList();
  509. },
  510. restSearch() {
  511. // 表格 - 分页
  512. this.pageInfo = {
  513. size: 15,
  514. curr: 1,
  515. total: 0,
  516. };
  517. this.parmValue = {
  518. companyNo: "",
  519. status: "",
  520. type_check: "",
  521. starttime: "",
  522. endtime: "",
  523. page: 1, // 页码
  524. size: 15, // 每页显示条数
  525. };
  526. this.searchList();
  527. },
  528. async timeReturned(e) {
  529. if (e.startTime !== "") {
  530. this.parmValue.starttime = e.startTime;
  531. } else {
  532. this.parmValue.starttime = "";
  533. }
  534. if (e.endTime !== "") {
  535. this.parmValue.endtime = e.endTime;
  536. } else {
  537. this.parmValue.endtime = "";
  538. }
  539. if (this.parmValue.starttime !== "" && this.parmValue.endtime !== "") {
  540. this.parmValue.page = 1;
  541. await this.searchList();
  542. }
  543. },
  544. cancel() {
  545. this.showModel1 = false;
  546. this.showModel2 = false;
  547. this.showModel3 = false;
  548. this.showModel4 = false;
  549. },
  550. // 新建/编辑/详情
  551. openModal(id, isDetail, invNo, status) {
  552. this.modelId = id;
  553. this.isDetail = isDetail;
  554. this.invNo = invNo;
  555. this.status = status;
  556. if (isDetail === "003") {
  557. this.showModel1 = true;
  558. } else if (isDetail === "005") {
  559. this.showModel1 = true;
  560. } else if (isDetail === "007") {
  561. this.showModel1 = true;
  562. } else if (isDetail === "029") {
  563. this.showModel2 = true;
  564. } else if (isDetail === "036") {
  565. this.showModel3 = true;
  566. } else if (isDetail === "037") {
  567. this.showModel4 = true;
  568. }
  569. },
  570. /**
  571. * 启用/禁用
  572. * @param {String} invNo invNo
  573. */
  574. async changeStatus(invNo) {
  575. await this.$confirm(`确定要取消申请?`, {
  576. confirmButtonText: "确定",
  577. cancelButtonText: "取消",
  578. type: "warning",
  579. })
  580. .then(async () => {
  581. const model = {
  582. invNo: invNo,
  583. };
  584. const res = await asyncRequest.delete(model);
  585. if (res && res.code === 0) {
  586. this.$notify.success({
  587. title: "申请取消成功",
  588. message: "",
  589. });
  590. this.searchList();
  591. } else if (res && res.code >= 100 && res.code <= 104) {
  592. await this.logout();
  593. } else {
  594. this.$message.warning(res.message);
  595. }
  596. })
  597. .catch(() => {
  598. console.log("取消");
  599. });
  600. },
  601. /**
  602. * 发起审核流程
  603. * @param {String} invNo 发票编号
  604. */
  605. async ApplyPay(invNo) {
  606. await this.$confirm(`确定发起审核流程?`, {
  607. confirmButtonText: "确定",
  608. cancelButtonText: "取消",
  609. type: "warning",
  610. })
  611. .then(async () => {
  612. const model = {
  613. invNo: invNo,
  614. status: "1",
  615. };
  616. const res = await asyncRequest.status(model);
  617. if (res && res.code === 0) {
  618. this.$notify.success({
  619. title: "发起审核流程成功!",
  620. message: "",
  621. });
  622. this.searchList();
  623. } else if (res && res.code >= 100 && res.code <= 104) {
  624. await this.logout();
  625. } else {
  626. this.$message.warning(res.message);
  627. }
  628. })
  629. .catch(() => {
  630. console.log("取消");
  631. });
  632. },
  633. // 刷新表格
  634. async searchList() {
  635. if (this.parmValue.starttime !== "" && this.parmValue.endtime === "") {
  636. this.$message.error("结束时间不能为空!");
  637. return;
  638. }
  639. if (this.parmValue.starttime === "" && this.parmValue.endtime !== "") {
  640. this.$message.error("开始时间不能为空!");
  641. return;
  642. }
  643. this.loading = true;
  644. const res = await asyncRequest.list(this.parmValue);
  645. if (res && res.code === 0 && res.data) {
  646. this.tableData = res.data.list;
  647. this.pageInfo.total = Number(res.data.count);
  648. } else if (res && res.code >= 100 && res.code <= 104) {
  649. await this.logout();
  650. } else {
  651. this.tableData = [];
  652. this.pageInfo.total = 0;
  653. }
  654. this.loading = false;
  655. },
  656. async remoteMethod(query) {
  657. this.selectLoading = true;
  658. if (query !== "") {
  659. this.activeOptions = [];
  660. this.formValue.company = query;
  661. const res = await asyncRequest.clist(this.formValue);
  662. if (res && res.code === 0 && res.data && res.data.list) {
  663. this.activeOptions = res.data.list;
  664. } else if (res && res.code >= 100 && res.code <= 104) {
  665. await this.logout();
  666. } else {
  667. this.$message.warning(res.message);
  668. }
  669. } else {
  670. this.activeOptions = [];
  671. }
  672. this.selectLoading = false;
  673. },
  674. },
  675. };
  676. </script>
  677. <style lang="scss" scoped>
  678. </style>