collectionPlanDialog.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <el-dialog
  3. :title="type == 2 ? '选择付款计划' : '选择收款计划'"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="collectionPlanDialogFlag"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="70%"
  12. >
  13. <el-card shadow="never">
  14. <div>
  15. <el-form label-width="90px" :inline="true">
  16. <el-form-item>
  17. <el-form-item
  18. label="客户名称"
  19. >
  20. <el-select
  21. clearable
  22. v-model="customerName"
  23. placeholder="请选择"
  24. :filterable="true"
  25. >
  26. <el-option
  27. label="1"
  28. value="1"
  29. ></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-dropdown
  35. ref="dropdownref"
  36. trigger="click"
  37. :hide-on-click="false"
  38. v-model="dropdownVisible"
  39. @keydown.enter.native.stop="search"
  40. >
  41. <div v-if="seekList.length > formLength">
  42. <span class="el-dropdown-link">
  43. 更多选项<i class="el-icon-arrow-down el-icon--right"></i>
  44. </span>
  45. <el-dropdown-menu slot="dropdown">
  46. <div class="padding">
  47. <el-form label-position="left">
  48. <el-form-item
  49. v-for="(item, i) in deboListRow"
  50. :key="i"
  51. :inline="true"
  52. label-position="left"
  53. >
  54. <el-form-item
  55. :label-width="
  56. item.labelWidth ? item.labelWidth : '90' + 'px'
  57. "
  58. :inline="true"
  59. :label="item.label"
  60. >
  61. <div v-if="item.type == 'input'">
  62. <el-input
  63. clearable
  64. v-model="defaultWhere[item.value]"
  65. :placeholder="item.placeholder || '请输入内容'"
  66. :style="{
  67. width: item.width ? item.width + 'px' : '220px'
  68. }"
  69. @keydown.enter.native="() => search()"
  70. @keyup.enter.native="() => search()"
  71. />
  72. </div>
  73. <div v-if="item.type == 'select'">
  74. <el-select
  75. clearable
  76. v-model="defaultWhere[item.value]"
  77. :multiple="item.multiple ? item.multiple : false"
  78. :filterable="item.filterable ? item.filterable : true"
  79. :placeholder="item.placeholder || '请输入内容'"
  80. :style="{
  81. width: item.width ? item.width + 'px' : '220px'
  82. }"
  83. @visible-change="change"
  84. @change="handerChange"
  85. >
  86. <el-option
  87. v-for="(op, i) in item.planList"
  88. :label="op.label"
  89. :value="op.value"
  90. :key="i"
  91. ></el-option>
  92. </el-select>
  93. </div>
  94. <div v-if="item.type == 'date'">
  95. <el-date-picker
  96. v-model="defaultWhere[item.value]"
  97. @blur="change"
  98. :type="item.dateType || 'daterange'"
  99. range-separator="至"
  100. start-placeholder="开始日期"
  101. end-placeholder="结束日期"
  102. value-format="yyyy-MM-dd HH:mm:ss"
  103. :style="{
  104. width: item.width ? item.width + 'px' : '220px'
  105. }"
  106. >
  107. </el-date-picker>
  108. </div>
  109. <div v-if="item.type == 'DictSelection'">
  110. <DictSelection
  111. v-model="defaultWhere[item.value]"
  112. :placeholder="item.placeholder || '请选择内容'"
  113. :multiple="item.multiple ? item.multiple : false"
  114. :style="{
  115. width: item.width ? item.width + 'px' : '220px'
  116. }"
  117. :dictName="item.dictName"
  118. />
  119. </div>
  120. <div v-if="item.type == 'picker'">
  121. <el-date-picker
  122. v-model="defaultWhere[item.value]"
  123. @blur="change"
  124. value-format="yyyy-MM-dd"
  125. :style="{
  126. width: item.width ? item.width + 'px' : '220px'
  127. }"
  128. >
  129. </el-date-picker>
  130. </div>
  131. </el-form-item>
  132. </el-form-item>
  133. </el-form>
  134. </div>
  135. </el-dropdown-menu>
  136. </div>
  137. </el-dropdown>
  138. </el-form-item>
  139. <el-form-item>
  140. <el-button
  141. type="primary"
  142. icon="el-icon-search"
  143. class="ele-btn-icon"
  144. @click="search"
  145. >
  146. 查询
  147. </el-button>
  148. <el-button @click="reset" icon="el-icon-refresh-left" type="primary"
  149. >重置</el-button
  150. >
  151. </el-form-item>
  152. </el-form>
  153. </div>
  154. <ele-pro-table
  155. ref="table"
  156. :columns="columns"
  157. :datasource="datasource"
  158. row-key="id"
  159. height="calc(100vh - 500px)"
  160. class="dict-table"
  161. :selection.sync="selection"
  162. @columns-change="handleColumnChange"
  163. >
  164. <!-- 表头工具栏 -->
  165. <template v-slot:action="{ row }">
  166. <el-button size="mini" type="text" @click="handleSelect(row)"
  167. >对账明细</el-button
  168. >
  169. </template>
  170. </ele-pro-table>
  171. </el-card>
  172. <div slot="footer">
  173. <el-button size="small" type="primary" @click="handleSelect">
  174. 选择
  175. </el-button>
  176. <el-button size="small" @click="handleClose">关闭</el-button>
  177. </div>
  178. <!-- 对账明细 -->
  179. <accountInfoDialog
  180. ref="accountInfoDialogRef"
  181. v-if="accountInfoDialogFlag"
  182. :account-info-dialog-flag.sync="accountInfoDialogFlag"
  183. @getAccountInfo="getAccountInfo"
  184. ></accountInfoDialog>
  185. </el-dialog>
  186. </template>
  187. <script>
  188. import dictMixins from '@/mixins/dictMixins';
  189. import tabMixins from '@/mixins/tableColumnsMixin';
  190. import accountInfoDialog from './accountInfoDialog.vue';
  191. import { shippingModeOp, transactionMethodsOp, paymentStatus, paymentType, invoiceStatusOp } from '@/enum/dict.js';
  192. import { receiptPaymentPlanPage } from '@/api/financialManage/payAndCollectPlan';
  193. export default {
  194. mixins: [dictMixins, tabMixins],
  195. components: {
  196. accountInfoDialog
  197. },
  198. props: {
  199. form: {
  200. type: Object,
  201. default: () => {
  202. return {};
  203. }
  204. },
  205. type: {
  206. type: String,
  207. default: '1'
  208. },
  209. collectionPlanDialogFlag: {
  210. default: false,
  211. type: Boolean
  212. },
  213. contactData: {
  214. type: Object,
  215. default: () => {
  216. return {};
  217. }
  218. }
  219. },
  220. computed: {
  221. columns() {
  222. return [
  223. {
  224. width: 45,
  225. type: 'selection',
  226. columnKey: 'selection',
  227. align: 'center',
  228. fixed: 'left'
  229. },
  230. {
  231. columnKey: 'index',
  232. label: '序号',
  233. type: 'index',
  234. width: 55,
  235. align: 'center',
  236. showOverflowTooltip: true,
  237. fixed: 'left'
  238. },
  239. {
  240. prop: 'detailNo',
  241. label: this.type == 2 ? '付款计划编码' : '收款计划编码',
  242. align: 'center',
  243. sortable: true,
  244. slot: 'detailNo',
  245. showOverflowTooltip: true,
  246. minWidth: 200,
  247. },
  248. {
  249. prop: 'sourceOrderNo',
  250. label: '订单编码',
  251. align: 'center',
  252. sortable: true,
  253. slot: 'sourceOrderNo',
  254. showOverflowTooltip: true,
  255. minWidth: 200,
  256. },
  257. {
  258. prop: 'sourceOrderType',
  259. label: '订单类型',
  260. align: 'center',
  261. sortable: true,
  262. showOverflowTooltip: true,
  263. minWidth: 200,
  264. formatter: (row) => {
  265. return row.sourceOrderType == 2 ? '采购订单' : '销售订单';
  266. }
  267. },
  268. {
  269. prop: 'contractNo',
  270. label: '合同编码',
  271. align: 'center',
  272. sortable: true,
  273. showOverflowTooltip: true,
  274. minWidth: 200,
  275. },
  276. {
  277. prop: 'contractCode',
  278. label: '合同编号',
  279. align: 'center',
  280. sortable: true,
  281. showOverflowTooltip: true,
  282. minWidth: 200,
  283. },
  284. {
  285. prop: 'contractName',
  286. label: '合同名称',
  287. align: 'center',
  288. sortable: true,
  289. showOverflowTooltip: true,
  290. minWidth: 200,
  291. },
  292. {
  293. prop: 'invoiceOrderNo',
  294. label: '发票号',
  295. align: 'center',
  296. sortable: true,
  297. showOverflowTooltip: true,
  298. minWidth: 200,
  299. },
  300. {
  301. prop: 'relatedReceivableOrderNo',
  302. label: this.type == 2 ? '关联应付编码' : '关联应收编码',
  303. align: 'center',
  304. showOverflowTooltip: true,
  305. minWidth: 150
  306. },
  307. {
  308. prop: 'customerCode',
  309. label: '客户编号',
  310. align: 'center',
  311. slot: 'customerCode',
  312. showOverflowTooltip: true,
  313. minWidth: 250
  314. },
  315. {
  316. prop: 'customerName',
  317. label: '客户名称',
  318. align: 'center',
  319. showOverflowTooltip: true,
  320. minWidth: 200
  321. },
  322. {
  323. prop: 'settlementMode',
  324. label: '结算方式',
  325. align: 'center',
  326. showOverflowTooltip: true,
  327. minWidth: 140,
  328. formatter: (row) => {
  329. return this.getDictValue('结算方式', row.settlementMode);
  330. }
  331. },
  332. {
  333. prop: 'transactionMode',
  334. label: '交易方式',
  335. align: 'center',
  336. showOverflowTooltip: true,
  337. minWidth: 200,
  338. formatter: (row) => {
  339. return this.transactionMethodsOp.find(item => item.value == row.transactionMode)?.label || '';
  340. }
  341. },
  342. {
  343. prop: 'deliveryMode',
  344. label: '发货模式',
  345. align: 'center',
  346. showOverflowTooltip: true,
  347. minWidth: 130,
  348. formatter: (row) => {
  349. return this.shippingModeOp.find(item => item.value == row.deliveryMode)?.label || '';
  350. }
  351. },
  352. {
  353. prop: 'issueNumber',
  354. label: '期数',
  355. align: 'center',
  356. showOverflowTooltip: true,
  357. minWidth: 130
  358. },
  359. {
  360. prop: 'paymentType',
  361. label: '款项类型',
  362. align: 'center',
  363. showOverflowTooltip: true,
  364. minWidth: 200
  365. },
  366. {
  367. prop: 'moneyName',
  368. label: '款项名称',
  369. align: 'center',
  370. showOverflowTooltip: true,
  371. minWidth: 140
  372. },
  373. {
  374. prop: 'paymentRatio',
  375. label: '比例',
  376. align: 'center',
  377. showOverflowTooltip: true,
  378. minWidth: 140
  379. },
  380. {
  381. prop: 'planPaymentAmount',
  382. label: this.type == 2 ? '计划付款金额' : '计划收款金额',
  383. align: 'center',
  384. showOverflowTooltip: true,
  385. minWidth: 140
  386. },
  387. {
  388. prop: 'planPaymentDate',
  389. label: this.type == 2 ? '计划付款日期' : '计划收款日期',
  390. align: 'center',
  391. showOverflowTooltip: true,
  392. minWidth: 140
  393. },
  394. {
  395. prop: 'isInvoice',
  396. label: '是否已开票',
  397. align: 'center',
  398. showOverflowTooltip: true,
  399. minWidth: 150,
  400. formatter: (_row, _column, cellValue) => {
  401. return cellValue ? '是' : '否';
  402. }
  403. },
  404. {
  405. prop: 'invoiceAmount',
  406. label: '已开票金额',
  407. align: 'center',
  408. showOverflowTooltip: true,
  409. minWidth: 120
  410. },
  411. {
  412. prop: 'invoiceDate',
  413. label: '开票日期',
  414. align: 'center',
  415. showOverflowTooltip: true,
  416. minWidth: 130
  417. },
  418. {
  419. prop: 'isGenerateReceivablePayment',
  420. label: this.type == 2 ? '是否生成应付款项' : '是否生成应收款项',
  421. align: 'center',
  422. showOverflowTooltip: true,
  423. minWidth: 130,
  424. formatter: (_row, _column, cellValue) => {
  425. return cellValue == 1 ? '是' : '否';
  426. }
  427. },
  428. {
  429. prop: 'receivableAmount',
  430. label: this.type == 2 ? '应付金额' : '应收金额',
  431. align: 'center',
  432. showOverflowTooltip: true,
  433. minWidth: 140
  434. },
  435. {
  436. prop: 'receivedAmount',
  437. label: this.type == 2 ? '已付款金额' : '已收款金额',
  438. align: 'center',
  439. showOverflowTooltip: true,
  440. minWidth: 170
  441. },
  442. {
  443. prop: 'actualReceivablePaymentDate',
  444. label: this.type == 2 ? '实际付款日期' : '实际收款日期',
  445. align: 'center',
  446. showOverflowTooltip: true,
  447. minWidth: 170
  448. },
  449. {
  450. prop: 'deliveryStatus',
  451. label: this.type == 2 ? '收货状态' : '发货状态',
  452. align: 'center',
  453. showOverflowTooltip: true,
  454. formatter: (_row, _column, cellValue) => {
  455. let options = this.menu === 'purchase' ? [
  456. { value: 0, label: '待收货' },
  457. { value: 1, label: '部分收货' },
  458. { value: 2, label: '全部收货' }
  459. ] : [
  460. { value: 0, label: '待发货' },
  461. { value: 1, label: '部分发货' },
  462. { value: 2, label: '全部发货' }
  463. ];
  464. return options.find(item => item.value == cellValue)?.label || '';
  465. },
  466. minWidth: 120
  467. },
  468. {
  469. prop: 'reconciliationStatus',
  470. label: '对账状态',
  471. align: 'center',
  472. showOverflowTooltip: true,
  473. minWidth: 100,
  474. formatter: (_row, _column, cellValue) => {
  475. let options = [
  476. { value: 0, label: '未对账' },
  477. { value: 1, label: '部分对账' },
  478. { value: 2, label: '全部对账' }
  479. ];
  480. return options.find(item => item.value == cellValue)?.label || '';
  481. }
  482. },
  483. {
  484. prop: 'invoiceStatus',
  485. label: '开票状态',
  486. align: 'center',
  487. showOverflowTooltip: true,
  488. minWidth: 100,
  489. formatter: (_row, _column, cellValue) => {
  490. return this.invoiceStatusOp.find(item => item.value == cellValue)?.label || '';
  491. }
  492. },
  493. {
  494. prop: 'paymentStatus',
  495. label: this.type == 2 ? '付款状态' : '收款状态',
  496. align: 'center',
  497. showOverflowTooltip: true,
  498. minWidth: 100,
  499. formatter: (_row, _column, cellValue) => {
  500. let options = this.menu === 'purchase' ? this.paymentType : this.paymentStatus;
  501. return options.find(item => item.value == cellValue)?.label || '';
  502. }
  503. },
  504. {
  505. prop: 'overdueStatus',
  506. label: '逾期状态',
  507. align: 'center',
  508. showOverflowTooltip: true,
  509. minWidth: 100,
  510. formatter: (_row, _column, cellValue) => {
  511. return _row.overdueStatus == 1 ? '逾期中' : '未逾期';
  512. }
  513. },
  514. // {
  515. // columnKey: 'action',
  516. // label: '操作',
  517. // width: 180,
  518. // align: 'center',
  519. // resizable: false,
  520. // slot: 'action',
  521. // showOverflowTooltip: true,
  522. // fixed: 'right'
  523. // }
  524. ]
  525. }
  526. },
  527. data() {
  528. return {
  529. currentIndex: null,
  530. accountInfoDialogFlag: false,
  531. currentRow: {},
  532. radio: null,
  533. shippingModeOp,
  534. transactionMethodsOp,
  535. selection: [],
  536. paymentStatus,
  537. paymentType,
  538. invoiceStatusOp
  539. };
  540. },
  541. created() {
  542. this.requestDict('结算方式');
  543. },
  544. methods: {
  545. init(item = {}, currentIndex = '') {
  546. this.currentIndex = currentIndex;
  547. // if (item.id) {
  548. // this.radio = item.id;
  549. // }
  550. },
  551. getAccountInfo(item) {
  552. this.currentRow.children = item;
  553. this.$emit('getAccountData', this.currentRow);
  554. this.handleClose();
  555. },
  556. /* 表格数据源 */
  557. datasource({ page, limit, where, order }) {
  558. if (this.contactData.id) {
  559. where['contactId'] = this.contactData.id;
  560. }
  561. return receiptPaymentPlanPage({
  562. pageNum: page,
  563. size: limit,
  564. ...where,
  565. // reviewStatus: 2,
  566. sourceType: this.type
  567. });
  568. },
  569. /* 刷新表格 */
  570. reload(where) {
  571. this.$refs.table.reload({ pageNum: 1, where: where });
  572. },
  573. handleSelect(row, index) {
  574. if(this.selection.length == 0) {
  575. this.$message({
  576. message: '请选择计划',
  577. type: 'warning'
  578. });
  579. return;
  580. }
  581. let customerIds = this.selection.map((item) => item.customerId);
  582. let initiatorIds = this.selection.map((item) => item.initiatorId);
  583. let invoiceStatus = this.selection.map((item) => item.invoiceStatus);
  584. console.log(customerIds, initiatorIds);
  585. let flag = false
  586. if(this.type == 2) {
  587. this.selection.forEach(item => {
  588. if(item.transactionMode == 2 && item.paymentStatus == 0) {
  589. console.log('selection', item);
  590. flag = true
  591. }
  592. })
  593. }
  594. console.log(customerIds, initiatorIds, flag);
  595. if(flag) {
  596. this.$message.warning('先款后票的计划需要付款后再开票!');
  597. return
  598. }
  599. if(invoiceStatus.includes(2)) {
  600. this.$message.warning('请选择未开票的计划!');
  601. return
  602. }
  603. if(this.selection.length == 0 || new Set(customerIds).size != 1 || new Set(initiatorIds).size != 1) {
  604. this.$message.warning('请选择相同客户和销售方的计划!');
  605. return
  606. }
  607. this.$emit('getPlanData', this.selection)
  608. this.handleClose()
  609. // this.currentRow = row;
  610. // this.accountInfoDialogFlag = true;
  611. // this.$nextTick(() => {
  612. // this.$refs.accountInfoDialogRef.init(row, index);
  613. // });
  614. },
  615. handleClose() {
  616. this.$emit('update:collectionPlanDialogFlag', false);
  617. }
  618. }
  619. };
  620. </script>
  621. <style lang="scss" scoped>
  622. .tree_col {
  623. border: 1px solid #eee;
  624. padding: 10px 0;
  625. box-sizing: border-box;
  626. height: 500px;
  627. overflow: auto;
  628. }
  629. .table_col {
  630. padding-left: 10px;
  631. ::v-deep .el-table th.el-table__cell {
  632. background: #f2f2f2;
  633. }
  634. }
  635. .pagination {
  636. text-align: right;
  637. padding: 10px 0;
  638. }
  639. .btns {
  640. text-align: center;
  641. padding: 10px 0;
  642. }
  643. .topsearch {
  644. margin-bottom: 15px;
  645. }
  646. </style>