addInvoiceDialog.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. v-if="visible"
  6. :visible.sync="visible"
  7. :title="title"
  8. :close-on-click-modal="false"
  9. :append-to-body="true"
  10. width="70%"
  11. @close="cancel"
  12. :maxable="true"
  13. :resizable="true"
  14. >
  15. <el-form
  16. ref="form"
  17. :model="form"
  18. :rules="rules"
  19. class="el-form-box"
  20. label-width="120px"
  21. >
  22. <headerTitle title="发货确认单信息"></headerTitle>
  23. <el-row :gutter="12">
  24. <el-col :span="12">
  25. <el-form-item label="发货单" prop="sendNo">
  26. <el-input
  27. clearable
  28. v-model="form.sendNo"
  29. @click.native="handleSendOrderBtn"
  30. placeholder="请输入"
  31. />
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="12">
  35. <el-form-item prop="repliedFiles" label="回执附件">
  36. <fileMain v-model="form.repliedFiles"></fileMain>
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. <headerTitle title="发货信息"></headerTitle>
  41. <el-row :gutter="12">
  42. <el-col :span="12">
  43. <el-form-item label="销售订单" prop="orderNo">
  44. <el-input
  45. clearable
  46. v-model="form.orderNo"
  47. disabled
  48. @click.native="handleOrderBtn"
  49. placeholder="请输入"
  50. />
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="12">
  54. <el-form-item label="受托收货单">
  55. <el-input
  56. clearable
  57. disabled
  58. v-model="form.entrustedCode"
  59. @click.native="handleEntrustedReceive"
  60. placeholder="请输入"
  61. />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row :gutter="12">
  66. <el-col :span="12">
  67. <el-form-item label="客户名称" prop="contactName">
  68. <el-input v-model="form.contactName" disabled></el-input>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="12">
  72. <el-form-item label="客户联系人" prop="linkName">
  73. <el-input
  74. clearable
  75. v-model="form.linkName"
  76. disabled
  77. placeholder="请输入"
  78. />
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. <el-row :gutter="12">
  83. <el-col :span="12">
  84. <el-form-item label="客户电话" prop="linkPhone">
  85. <el-input
  86. clearable
  87. v-model="form.linkPhone"
  88. disabled
  89. placeholder="请输入"
  90. />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="12">
  94. <el-form-item label="收货地址" prop="receiveAddress">
  95. <el-input
  96. disabled
  97. clearable
  98. v-model="form.receiveAddress"
  99. placeholder="请输入"
  100. />
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="12">
  104. <el-form-item label="项目名称" prop="projectName">
  105. <el-input clearable v-model="form.projectName" :disabled="true" />
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="12">
  109. <el-form-item prop="sendFiles" label="发货附件">
  110. <fileMain v-model="form.sendFiles" type="view"></fileMain>
  111. </el-form-item>
  112. </el-col>
  113. </el-row>
  114. </el-form>
  115. <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
  116. <el-tab-pane label="收货产品明细" name="first">
  117. <ele-pro-table
  118. ref="table"
  119. :needPage="false"
  120. :columns="columns"
  121. @columns-change="handleColumnChange"
  122. :cache-key="cacheKeyUrl"
  123. :datasource="form.productList"
  124. row-key="id"
  125. >
  126. <template v-slot:isException="scope">
  127. <el-select v-model="scope.row.isException" placeholder="请选择">
  128. <el-option
  129. v-for="item in options"
  130. :key="item.value"
  131. :label="item.label"
  132. :value="item.value"
  133. >
  134. </el-option>
  135. </el-select>
  136. </template>
  137. <template v-slot:notaxSinglePrice="scope">
  138. <el-input
  139. v-model="scope.row.notaxSinglePrice"
  140. placeholder="请输入"
  141. type="number"
  142. >
  143. <template slot="append">元</template>
  144. </el-input>
  145. </template>
  146. </ele-pro-table>
  147. </el-tab-pane>
  148. <el-tab-pane label="托盘清单" name="second">
  149. <!-- <palletTable ref="palletTableRef" type="view"></palletTable> -->
  150. <ele-pro-table
  151. ref="table"
  152. :needPage="false"
  153. :columns="trayListColumns"
  154. :toolkit="[]"
  155. :datasource="trayListData"
  156. row-key="id"
  157. >
  158. <template v-slot:type="scope">
  159. <el-select v-model="scope.row.type" placeholder="请选择">
  160. <el-option
  161. v-for="item in options1"
  162. :key="item.value"
  163. :label="item.label"
  164. :value="item.value"
  165. >
  166. </el-option>
  167. </el-select>
  168. </template>
  169. </ele-pro-table>
  170. </el-tab-pane>
  171. <el-tab-pane label="装载车叉车信息" name="third">
  172. <stowageTable ref="stowageTableRef" dialogType="view"></stowageTable>
  173. </el-tab-pane>
  174. <el-tab-pane label="运输清单" name="fourth">
  175. <taskInfoTable ref="taskInfoTableRef" dialogType="view"></taskInfoTable>
  176. </el-tab-pane>
  177. </el-tabs>
  178. <div slot="footer" class="footer">
  179. <el-button type="primary" @click="save" v-click-once>保存</el-button>
  180. <el-button
  181. type="primary"
  182. v-if="isNeed_process_is_close"
  183. @click="save('sub')"
  184. v-click-once
  185. >提交</el-button
  186. >
  187. <el-button @click="cancel">返回</el-button>
  188. </div>
  189. <sendListDialog
  190. ref="orderListDialogRef"
  191. @changeParent="changeOrder"
  192. :contactData="contactData"
  193. ></sendListDialog>
  194. <!--出库详情-->
  195. <outbound-details-dialog
  196. v-if="outboundDetailsDialogFlag"
  197. ref="outboundDetailsDialogRef"
  198. :outboundDetailsDialogFlag.sync="outboundDetailsDialogFlag"
  199. @saveDate="saveDate"
  200. ></outbound-details-dialog>
  201. <process-submit-dialog
  202. :isNotNeedProcess="false"
  203. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  204. v-if="processSubmitDialogFlag"
  205. ref="processSubmitDialogRef"
  206. @reload="reload"
  207. ></process-submit-dialog>
  208. </ele-modal>
  209. </template>
  210. <script>
  211. import { acceptUnpackoptions } from '@/enum/dict';
  212. import fileUpload from '@/components/upload/fileUpload';
  213. import dictMixins from '@/mixins/dictMixins';
  214. import outboundDetailsDialog from '@/views/saleManage/saleOrder/returnGoods/components/outboundDetailsDialog.vue';
  215. import taskInfoTable from '../../invoice/components/taskInfoTable.vue';
  216. import {
  217. getSendSaleOrderrecordDetailSplit
  218. } from '@/api/saleManage/saleordersendrecord';
  219. import inventoryTable from '../../invoice/components/inventoryTable.vue';
  220. import stowageTable from '../../invoice/components/stowageTable.vue';
  221. import sendListDialog from './sendListDialog.vue';
  222. import { copyObj } from '@/utils/util';
  223. // import fileMain from '@/components/addDoc/index.vue';
  224. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  225. import getDynamicsColumns from '@/mixins/getDynamicsColumns';
  226. import {
  227. addSendConfirmInformation,
  228. getSendSaleOrderConfirmDetail,
  229. UpdateSendConfirmInformation
  230. } from '@/api/saleManage/invoiceConfirm';
  231. import tabMixins from '@/mixins/tableColumnsMixin';
  232. import { levelList } from '@/enum/dict.js';
  233. export default {
  234. mixins: [dictMixins, getDynamicsColumns,tabMixins],
  235. components: {
  236. processSubmitDialog,
  237. // fileMain,
  238. // PalletTable,
  239. sendListDialog,
  240. taskInfoTable,
  241. fileUpload,
  242. inventoryTable,
  243. stowageTable,
  244. outboundDetailsDialog
  245. },
  246. //客户管理数据
  247. props: {
  248. contactData: {
  249. type: Object,
  250. default: () => {
  251. return {};
  252. }
  253. },
  254. saleOrderData: {
  255. type: Object,
  256. default: () => {
  257. return {};
  258. }
  259. }
  260. },
  261. data() {
  262. let formDef = {
  263. id: '',
  264. sendNo: '',
  265. sendId: '',
  266. contactId: '',
  267. contactName: '',
  268. entrustedCode: '',
  269. entrustedId: '',
  270. pricingWay: 1,
  271. sendFiles: [],
  272. repliedFiles: [],
  273. productList: [],
  274. projectName: '',
  275. projectId: '',
  276. receiveAddress: '',
  277. deviceName: '',
  278. deviceId: '',
  279. carNo: '',
  280. linkName: '',
  281. linkPhone: '',
  282. orderNo: '',
  283. orderId: '',
  284. replied: 0
  285. };
  286. return {
  287. fullscreen: false,
  288. outboundDetailsDialogFlag: false,
  289. payWayOptions: [],
  290. delDetailIds: [],
  291. linkNameOptions: [],
  292. productList: [],
  293. trayList: [],
  294. trayListData: [],
  295. cacheKeyUrl:'eos-saleManage-invoiceConfirm-inventoryTable',
  296. acceptUnpackoptions,
  297. visible: false,
  298. entrustedReceiveDialogFlag: false,
  299. processSubmitDialogFlag: false,
  300. title: '',
  301. row: {},
  302. activeName: 'first',
  303. formDef,
  304. options: [
  305. { value: 0, label: '已发货' },
  306. { value: 1, label: '未发货' }
  307. ],
  308. options1: [
  309. { value: 0, label: '未回收' },
  310. { value: 1, label: '已回收' }
  311. ],
  312. columns: [
  313. {
  314. width: 45,
  315. type: 'index',
  316. columnKey: 'index',
  317. align: 'center',
  318. fixed: 'left'
  319. },
  320. {
  321. minWidth: 160,
  322. prop: 'productCode',
  323. label: '编码',
  324. showOverflowTooltip: true,
  325. align: 'center'
  326. },
  327. {
  328. minWidth: 120,
  329. prop: 'productName',
  330. label: '名称',
  331. showOverflowTooltip: true,
  332. align: 'center'
  333. },
  334. {
  335. minWidth: 160,
  336. prop: 'batchNo',
  337. label: '批次号',
  338. showOverflowTooltip: true,
  339. slot: 'batchNo',
  340. align: 'center'
  341. },
  342. {
  343. minWidth: 160,
  344. prop: 'barcodes',
  345. label: '发货条码',
  346. showOverflowTooltip: true,
  347. slot: 'barcodes',
  348. align: 'center'
  349. },
  350. {
  351. minWidth: 120,
  352. prop: 'materielDesignation',
  353. label: '物料代号',
  354. showOverflowTooltip: true,
  355. align: 'center'
  356. },
  357. {
  358. minWidth: 120,
  359. prop: 'clientCode',
  360. label: '客户代号',
  361. showOverflowTooltip: true,
  362. align: 'center'
  363. },
  364. {
  365. minWidth: 120,
  366. prop: 'engrave',
  367. label: '刻码',
  368. showOverflowTooltip: true,
  369. align: 'center'
  370. },
  371. {
  372. minWidth: 160,
  373. prop: 'packageNo',
  374. align: 'center',
  375. label: '包装编码',
  376. showOverflowTooltip: true
  377. },
  378. {
  379. minWidth: 100,
  380. prop: 'packingQuantity',
  381. align: 'center',
  382. label: '包装数量',
  383. showOverflowTooltip: true
  384. },
  385. {
  386. minWidth: 120,
  387. prop: 'packingUnit',
  388. align: 'center',
  389. label: '包装单位',
  390. showOverflowTooltip: true
  391. },
  392. {
  393. minWidth: 100,
  394. prop: 'totalCount',
  395. label: '计量数量',
  396. showOverflowTooltip: true,
  397. align: 'center'
  398. },
  399. {
  400. minWidth: 150,
  401. prop: 'measuringUnit',
  402. label: '计量单位',
  403. showOverflowTooltip: true,
  404. align: 'center'
  405. },
  406. {
  407. width: 160,
  408. prop: 'pricingWay',
  409. label: '计价方式',
  410. slot: 'pricingWay',
  411. align: 'center',
  412. formatter: (row, column) => {
  413. return row.pricingWay == 1
  414. ? '按数量计费'
  415. : row.pricingWay == 2
  416. ? '按重量计费'
  417. : '';
  418. }
  419. },
  420. {
  421. width: 160,
  422. prop: 'goodsPriceType',
  423. label: '价格类型',
  424. formatter: (row, column) => {
  425. return this.getDictValue('商品价格类型', row.goodsPriceType);
  426. },
  427. align: 'center'
  428. },
  429. {
  430. width: 100,
  431. prop: 'singlePrice',
  432. label: '单价',
  433. slot: 'singlePrice',
  434. align: 'center'
  435. },
  436. {
  437. width: 150,
  438. prop: 'notaxSinglePrice',
  439. label: '不含税单价',
  440. align: 'center'
  441. },
  442. {
  443. width: 140,
  444. prop: 'taxRate',
  445. label: '税率',
  446. formatter: (row, column) => {
  447. return row.taxRate?row.taxRate+'%':''
  448. },
  449. align: 'center'
  450. },
  451. {
  452. width: 100,
  453. prop: 'totalPrice',
  454. label: '合计',
  455. align: 'center'
  456. },
  457. {
  458. minWidth: 80,
  459. prop: 'sendTotalWeight',
  460. label: '重量',
  461. showOverflowTooltip: true,
  462. align: 'center'
  463. },
  464. {
  465. minWidth: 100,
  466. prop: 'weightUnit',
  467. label: '重量单位',
  468. showOverflowTooltip: true,
  469. align: 'center'
  470. },
  471. {
  472. prop: 'provenance',
  473. label: '产地',
  474. slot: 'provenance',
  475. align: 'center',
  476. // show:this.contractBookType==2,
  477. minWidth: 200,
  478. showOverflowTooltip: true,
  479. formatter: (row, column) => {
  480. return row.provenance && row.provenance.length
  481. ? row.provenance
  482. .map((item) => this.getDictValue('产地', item))
  483. .join(',')
  484. : '';
  485. }
  486. },
  487. {
  488. minWidth: 120,
  489. prop: 'goodsLevel',
  490. label: '物品级别',
  491. formatter: (_row, _column, cellValue) => {
  492. return levelList.find(item=>item.value==_row.goodsLevel)?.label
  493. },
  494. align: 'center'
  495. },
  496. {
  497. width: 220,
  498. prop: 'remark',
  499. label: '备注',
  500. slot: 'remark',
  501. align: 'center'
  502. },
  503. {
  504. width: 120,
  505. slot: 'isException',
  506. prop: 'isException',
  507. label: '发货状态',
  508. align: 'center',
  509. fixed: 'right'
  510. }
  511. ],
  512. trayListColumns: [
  513. {
  514. width: 45,
  515. type: 'index',
  516. columnKey: 'index',
  517. align: 'center',
  518. fixed: 'left'
  519. },
  520. {
  521. minWidth: 160,
  522. prop: 'productCode',
  523. label: '编码',
  524. showOverflowTooltip: true,
  525. align: 'center'
  526. },
  527. {
  528. minWidth: 120,
  529. prop: 'productName',
  530. label: '名称',
  531. showOverflowTooltip: true,
  532. align: 'center'
  533. },
  534. {
  535. minWidth: 160,
  536. prop: 'batchNo',
  537. label: '批次号',
  538. showOverflowTooltip: true,
  539. align: 'center'
  540. },
  541. {
  542. minWidth: 160,
  543. prop: 'barcodes',
  544. label: '发货条码',
  545. showOverflowTooltip: true,
  546. align: 'center'
  547. },
  548. {
  549. minWidth: 120,
  550. prop: 'materielDesignation',
  551. label: '物料代号',
  552. showOverflowTooltip: true,
  553. align: 'center'
  554. },
  555. {
  556. minWidth: 120,
  557. prop: 'clientCode',
  558. label: '客户代号',
  559. showOverflowTooltip: true,
  560. align: 'center'
  561. },
  562. {
  563. minWidth: 120,
  564. prop: 'engrave',
  565. label: '刻码',
  566. showOverflowTooltip: true,
  567. align: 'center'
  568. },
  569. {
  570. minWidth: 160,
  571. prop: 'packageNo',
  572. align: 'center',
  573. label: '包装编码',
  574. showOverflowTooltip: true
  575. },
  576. {
  577. minWidth: 100,
  578. prop: 'packingQuantity',
  579. align: 'center',
  580. label: '包装数量',
  581. showOverflowTooltip: true
  582. },
  583. {
  584. minWidth: 120,
  585. prop: 'packingUnit',
  586. align: 'center',
  587. label: '包装单位',
  588. showOverflowTooltip: true
  589. },
  590. {
  591. minWidth: 100,
  592. prop: 'totalCount',
  593. label: '计量数量',
  594. showOverflowTooltip: true,
  595. align: 'center'
  596. },
  597. {
  598. minWidth: 150,
  599. prop: 'measuringUnit',
  600. label: '计量单位',
  601. showOverflowTooltip: true,
  602. align: 'center'
  603. },
  604. {
  605. width: 120,
  606. slot: 'type',
  607. prop: 'type',
  608. label: '回收状态',
  609. align: 'center',
  610. fixed: 'right'
  611. }
  612. ],
  613. form: copyObj(formDef),
  614. tableBankData: [],
  615. tableLinkData: [],
  616. oldId: '',
  617. oldDocNo: '',
  618. // 组织机构树形结构数据
  619. groupTreeData: [],
  620. groupData: [],
  621. rules: {
  622. sendNo: [
  623. { required: true, message: '请选择发货单', trigger: 'change' }
  624. ],
  625. repliedFiles: [
  626. { required: true, message: '请上传回执附件', trigger: 'change' }
  627. ]
  628. },
  629. // 提交状态
  630. loading: false,
  631. // 是否是修改
  632. isUpdate: false,
  633. businessId: ''
  634. };
  635. },
  636. created() {
  637. this.requestDict('产地');
  638. this.requestDict('商品价格类型');
  639. },
  640. computed: {},
  641. methods: {
  642. //选择发货单回调
  643. changeOrder(obj) {
  644. this.form = Object.assign({}, this.form, {
  645. sendId: obj.id,
  646. sendNo: obj.docNo
  647. });
  648. this.getSaleOrderDetail(obj.id);
  649. },
  650. //发货单详情
  651. async getSaleOrderDetail(id) {
  652. this.loading = true;
  653. const data = await getSendSaleOrderrecordDetailSplit(id);
  654. this.loading = false;
  655. if (data) {
  656. this.form = data;
  657. this.form.sendId = data.id;
  658. this.form.sendNo = data.docNo;
  659. this.form.docNo = this.oldDocNo;
  660. this.form.id = this.oldId;
  661. this.form.reviewStatus = 0;
  662. this.form.processInstanceId = '';
  663. this.$refs.taskInfoTableRef &&
  664. this.$refs.taskInfoTableRef.putTableValue(
  665. data.logisticTrakListNoteVOList
  666. );
  667. this.$refs.stowageTableRef &&
  668. this.$refs.stowageTableRef.putTableValue(data.carList);
  669. this.trayList = data.trayList;
  670. this.productList = data.productList;
  671. this.form.productList = [];
  672. this.handleSelectGoods();
  673. }
  674. },
  675. //选择退货明细
  676. handleSelectGoods(list) {
  677. this.outboundDetailsDialogFlag = true;
  678. this.$nextTick(() => {
  679. this.$refs.outboundDetailsDialogRef.init(
  680. { ...this.form, type: 10 },
  681. list
  682. );
  683. });
  684. },
  685. saveDate(data) {
  686. data.forEach((item) => {
  687. item['totalCount'] = item.measureQuantity;
  688. // item['qmsResult'] = item.result;
  689. // item['qmsStatus'] = item.status;
  690. item['sendProductId'] = item.categoryId;
  691. item['sendTotalWeight'] = item.weight;
  692. this.productList.forEach((val) => {
  693. if (item.productCode == val.productCode) {
  694. item['singlePrice'] = val.singlePrice;
  695. item['notaxSinglePrice'] = val.notaxSinglePrice;
  696. item['taxRate'] = val.taxRate;
  697. item['goodsLevel'] = val.goodsLevel;
  698. item['goodsId'] = val.goodsId;
  699. item['goodsPriceId'] = val.goodsPriceId;
  700. item['goodsPriceType'] = val.goodsPriceType;
  701. item['clientCode'] = item.clientCode || val.customerMark;
  702. item['pricingWay'] = val.pricingWay || 1;
  703. if (item.pricingWay == 1) {
  704. item.totalPrice = item.singlePrice * item.measureQuantity;
  705. }
  706. if (item.pricingWay == 2) {
  707. item.totalPrice =
  708. item.singlePrice *
  709. item.measureQuantity *
  710. item.sendTotalWeight;
  711. }
  712. }
  713. });
  714. });
  715. let trayListCodes = this.trayList.map((item) => item.productCode);
  716. this.form.productList = data.filter(
  717. (item) => !trayListCodes.includes(item.productCode)
  718. );
  719. this.form.productList.forEach((item, index) => {
  720. this.$set(this.form.productList[index], 'isException', 0);
  721. });
  722. this.trayListData = data.filter((item) => {
  723. if (trayListCodes.includes(item.productCode)) {
  724. item['orderProductType'] = 1;
  725. return item;
  726. }
  727. });
  728. this.trayListData.forEach((item, index) => {
  729. this.$set(this.trayListData[index], 'type', 0);
  730. });
  731. },
  732. // //发货单确认详情
  733. async getSendSaleOrderDetail(id) {
  734. this.businessId = id;
  735. this.loading = true;
  736. const data = await getSendSaleOrderConfirmDetail(id);
  737. this.oldId = data.id;
  738. this.oldDocNo = data.docNo;
  739. this.loading = false;
  740. if (data) {
  741. this.form = data;
  742. this.trayListData = data.trayList;
  743. this.$nextTick(() => {
  744. this.$refs.inventoryTableref &&
  745. this.$refs.inventoryTableref.putTableValue(data.productList);
  746. this.$refs.stowageTableRef &&
  747. this.$refs.stowageTableRef.putTableValue(data.carList);
  748. this.$refs.taskInfoTableRef &&
  749. this.$refs.taskInfoTableRef.putTableValue(
  750. data.logisticTrakListNoteVOList
  751. );
  752. });
  753. }
  754. },
  755. //选择订单弹框
  756. handleSendOrderBtn(e) {
  757. if (e.target.nodeName == 'I') {
  758. this.form = Object.assign({}, this.form, {
  759. sendId: '',
  760. sendNo: '',
  761. contactId: '',
  762. contactName: '',
  763. carNo: '',
  764. deviceName: '',
  765. deviceId: '',
  766. linkName: '',
  767. linkPhone: '',
  768. orderNo: '',
  769. orderId: '',
  770. orderIds: '',
  771. pricingWay: '',
  772. receiveAddress: '',
  773. entrustedCode: '',
  774. entrustedId: '',
  775. productList: [],
  776. sendFiles: [],
  777. repliedFiles: []
  778. });
  779. this.$refs.stowageTableRef &&
  780. this.$refs.stowageTableRef.putTableValue([]);
  781. this.$refs.taskInfoTableRef &&
  782. this.$refs.taskInfoTableRef.putTableValue([]);
  783. this.trayListData = [];
  784. this.trayList = [];
  785. return;
  786. }
  787. let item = {
  788. id: this.form.sendId
  789. };
  790. this.$refs.orderListDialogRef.open(item);
  791. },
  792. //打开新增编辑弹框
  793. async open(type, row, invoiceData) {
  794. this.title = type === 'add' ? '新增发货确认单' : '修改';
  795. this.row = row;
  796. this.visible = true;
  797. if (row && row?.id) {
  798. await this.getSendSaleOrderDetail(row?.id);
  799. }
  800. if (invoiceData) {
  801. this.changeOrder(invoiceData);
  802. }
  803. this.isUpdate = type != 'add';
  804. },
  805. totalCountChange(row) {
  806. if (row.totalCount > row.sendTotalCount) {
  807. row.totalCount = row.sendTotalCount;
  808. }
  809. if (row.totalCount < 0) {
  810. row.totalCount = 0;
  811. }
  812. },
  813. getValidate() {
  814. return Promise.all([
  815. new Promise((resolve, reject) => {
  816. this.$refs.form.validate((valid) => {
  817. if (!valid) {
  818. reject(false);
  819. } else {
  820. resolve(true);
  821. }
  822. });
  823. })
  824. ]).catch((e) => {
  825. this.$message.warning('有必填项未填写,请检查');
  826. return Promise.reject(e);
  827. });
  828. },
  829. // 添加
  830. handlAdd() {
  831. if (!this.form.sendNo) return this.$message.error('请先选择来源单据');
  832. this.handleSelectGoods();
  833. },
  834. async save(type) {
  835. try {
  836. await this.getValidate();
  837. // 表单验证通过,执行保存操作
  838. this.loading = true;
  839. if (!this.isUpdate) {
  840. delete this.form.id;
  841. }
  842. this.form.repliedFiles = this.form.repliedFiles || [];
  843. this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
  844. let commitData = Object.assign({}, this.form, {
  845. trayList: this.trayListData,
  846. carList: this.$refs.stowageTableRef.getTableValue(),
  847. trakNoteList: this.$refs.taskInfoTableRef.getTableValue()
  848. });
  849. const API = this.isUpdate
  850. ? UpdateSendConfirmInformation
  851. : addSendConfirmInformation;
  852. API(commitData)
  853. .then((res) => {
  854. this.loading = false;
  855. this.$message.success('修改成功');
  856. if (type === 'sub') {
  857. this.sendSubmit(res);
  858. return;
  859. }
  860. this.cancel();
  861. this.$emit('done');
  862. })
  863. .catch((e) => {
  864. //this.loading = false;
  865. });
  866. } catch (error) {
  867. console.log(error);
  868. // 表单验证未通过,不执行保存操作
  869. }
  870. },
  871. async sendSubmit(res) {
  872. const data = await getSendSaleOrderConfirmDetail(
  873. this.businessId || res
  874. );
  875. this.processSubmitDialogFlag = true;
  876. this.$nextTick(() => {
  877. let params = {
  878. businessId: this.businessId || res,
  879. businessKey: 'sales_sendconfirm_approve',
  880. formCreateUserId: data.createUserId,
  881. variables: {
  882. businessCode: data.docNo,
  883. businessName: data.contactName,
  884. businessType: '发货确认单'
  885. }
  886. };
  887. this.$refs.processSubmitDialogRef.init(params);
  888. });
  889. },
  890. remove(index) {
  891. this.form.productList.splice(index, 1);
  892. },
  893. reload() {
  894. this.cancel();
  895. this.$emit('done');
  896. },
  897. cancel() {
  898. this.$nextTick(() => {
  899. this.activeName = 'first';
  900. // 关闭后,销毁所有的表单数据
  901. this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
  902. this.$refs['formRef'] && this.$refs['formRef'].resetFields();
  903. this.$store.commit('order/clearUserData');
  904. this.form = copyObj(this.formDef);
  905. this.visible = false;
  906. this.trayListData = [];
  907. this.trayLis = [];
  908. });
  909. }
  910. }
  911. };
  912. </script>
  913. <style scoped lang="scss">
  914. .TotalAmount {
  915. font-size: 16px;
  916. padding-right: 30px;
  917. }
  918. .headbox {
  919. display: flex;
  920. justify-content: flex-start;
  921. align-items: center;
  922. .amount {
  923. font-size: 14px;
  924. font-weight: bold;
  925. margin-right: 20px;
  926. }
  927. }
  928. </style>