addInvoiceDialog.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. <template>
  2. <div>
  3. <div class="switch">
  4. <div class="switch_left">
  5. <ul>
  6. <li
  7. v-for="item in tabOptions"
  8. :key="item.key"
  9. :class="{ active: activeComp == item.key }"
  10. @click="changeActive(item)"
  11. >
  12. {{ item.name }}
  13. </li>
  14. </ul>
  15. </div>
  16. </div>
  17. <div v-show="activeComp == 'main'">
  18. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  19. <headerTitle title="发货信息"></headerTitle>
  20. <el-row :gutter="20">
  21. <el-col :span="12">
  22. <el-form-item
  23. label="选择订单"
  24. prop="orderNo"
  25. style="margin-bottom: 22px"
  26. >
  27. <el-input
  28. clearable
  29. v-model="form.orderNo"
  30. @click.native="handleOrderBtn"
  31. placeholder="请输入"
  32. />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="受托发货单" style="margin-bottom: 22px">
  37. <el-input
  38. clearable
  39. v-model="form.entrustedCode"
  40. @click.native="handleEntrustedReceive"
  41. placeholder="请输入"
  42. />
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. <el-row :gutter="20">
  47. <el-col :span="12">
  48. <el-form-item
  49. label="客户名称"
  50. prop="contactName"
  51. style="margin-bottom: 22px"
  52. >
  53. <el-input v-model="form.contactName" disabled></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="12">
  57. <el-form-item
  58. label="客户联系人"
  59. prop="linkName"
  60. style="margin-bottom: 22px"
  61. >
  62. <el-input
  63. clearable
  64. v-model="form.linkName"
  65. placeholder="请输入"
  66. />
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. <el-row :gutter="20">
  71. <el-col :span="12">
  72. <el-form-item
  73. label="客户电话"
  74. prop="linkPhone"
  75. style="margin-bottom: 22px"
  76. >
  77. <el-input
  78. clearable
  79. v-model="form.linkPhone"
  80. placeholder="请输入"
  81. />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="12">
  85. <el-form-item
  86. label="车辆号"
  87. prop="carNo"
  88. style="margin-bottom: 22px"
  89. >
  90. <el-input clearable v-model="form.carNo" placeholder="请输入" />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="12">
  94. <el-form-item
  95. label="收货地址"
  96. prop="receiveAddress"
  97. style="margin-bottom: 22px"
  98. >
  99. <el-input
  100. clearable
  101. v-model="form.receiveAddress"
  102. placeholder="请输入"
  103. />
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="12">
  107. <el-form-item prop="sendFiles" label="发货附件">
  108. <fileMain v-model="form.sendFiles"></fileMain>
  109. <!-- <fileUpload-->
  110. <!-- v-model="form.sendFiles"-->
  111. <!-- module="main"-->
  112. <!-- :showLib="false"-->
  113. <!-- :limit="10"-->
  114. <!-- />-->
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="12">
  118. <el-form-item prop="repliedFiles" label="回执附件">
  119. <fileMain v-model="form.repliedFiles"></fileMain>
  120. <!-- <fileUpload-->
  121. <!-- v-model="form.repliedFiles"-->
  122. <!-- module="main"-->
  123. <!-- :showLib="false"-->
  124. <!-- :limit="10"-->
  125. <!-- />-->
  126. </el-form-item>
  127. </el-col>
  128. </el-row>
  129. </el-form>
  130. <headerTitle title="物品清单" style="margin-top: 30px"></headerTitle>
  131. <inventoryTable
  132. :pricingWay="form.pricingWay"
  133. :entrustedCode="form.entrustedCode"
  134. ref="inventoryTableref"
  135. :orderId="form.orderId"
  136. v-show="taskDefinitionKey != 'salesmanUploadReceipt'"
  137. ></inventoryTable>
  138. <ele-pro-table
  139. ref="table"
  140. :needPage="false"
  141. :columns="competAnalysisListcolumns"
  142. :toolkit="[]"
  143. :datasource="form.productList"
  144. row-key="id"
  145. v-show="taskDefinitionKey == 'salesmanUploadReceipt'"
  146. >
  147. <!-- <template v-slot:toolbar>
  148. <div class="headbox">
  149. <span class="amount">总计:{{detailData.totalAmount}}元</span>
  150. <span class="amount">应付金额:{{detailData.payAmount}}元</span>
  151. </div>
  152. </template> -->
  153. <template v-slot:technicalDrawings="{ row }">
  154. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  155. <!-- <div v-if="row.technicalDrawings && row.technicalDrawings?.length">-->
  156. <!-- <el-link-->
  157. <!-- v-for="link in row.technicalDrawings"-->
  158. <!-- :key="link.id"-->
  159. <!-- type="primary"-->
  160. <!-- :underline="false"-->
  161. <!-- @click="downloadFile(link)"-->
  162. <!-- >-->
  163. <!-- {{ link.name }}</el-link-->
  164. <!-- >-->
  165. <!-- </div>-->
  166. </template>
  167. </ele-pro-table>
  168. <orderListDialog
  169. ref="orderListDialogRef"
  170. @changeParent="changeOrder"
  171. ></orderListDialog>
  172. <!-- 受托发货单 -->
  173. <entrusted-receive-dialog
  174. :entrusted-receive-dialog-flag.sync="entrustedReceiveDialogFlag"
  175. v-if="entrustedReceiveDialogFlag"
  176. @changeParent="getInfo"
  177. ref="entrustedReceiveDialogRef"
  178. ></entrusted-receive-dialog>
  179. </div>
  180. <detailDialog
  181. type="sourceBizNo"
  182. :businessId="form.docNo"
  183. v-if="activeComp == 'outBound'"
  184. ></detailDialog>
  185. <!-- <detailDialog type="sourceBizNo" :businessId="form.docNo" v-if="activeComp == 'outBound'"></detailDialog> -->
  186. </div>
  187. </template>
  188. <script>
  189. import fileUpload from '@/components/upload/fileUpload';
  190. // import detailDialog from '@/views/bpm/handleTask/components/outBound/detailDialog.vue'
  191. import detailDialog from '@/views/bpm/outgoingManagement/details.vue';
  192. import dictMixins from '@/mixins/dictMixins';
  193. import {
  194. getSaleOrderDetail,
  195. getSendSaleOrderrecordDetail
  196. } from '@/api/bpm/components/saleManage/saleorder';
  197. import { getFile } from '@/api/system/file';
  198. import inventoryTable from './inventoryTable.vue';
  199. import orderListDialog from './orderListDialog.vue';
  200. import { copyObj } from '@/utils/util';
  201. import EntrustedReceiveDialog from '@/views/bpm/handleTask/components/saleOrder/invoice/entrustedReceiveDialog.vue';
  202. import fileMain from "@/BIZComponents/addDoc/index.vue";
  203. export default {
  204. mixins: [dictMixins],
  205. components: {
  206. fileMain,
  207. EntrustedReceiveDialog,
  208. fileUpload,
  209. inventoryTable,
  210. orderListDialog,
  211. detailDialog
  212. },
  213. data() {
  214. let formDef = {
  215. id: '',
  216. contractId: '',
  217. sendFiles: [],
  218. repliedFiles: [],
  219. contractName: '',
  220. receiveAddress: '',
  221. pricingWay: 1,
  222. carNo: '',
  223. carId: '',
  224. linkName: '',
  225. linkPhone: '',
  226. orderNo: '',
  227. orderId: ''
  228. };
  229. return {
  230. activeComp: 'main',
  231. tabOptions: [{ key: 'main', name: '发货单详情' }],
  232. detailData: {},
  233. payWayOptions: [],
  234. delDetailIds: [],
  235. linkNameOptions: [],
  236. visible: false,
  237. entrustedReceiveDialogFlag: false,
  238. title: '',
  239. row: {},
  240. activeName: 'base',
  241. formDef,
  242. form: copyObj(formDef),
  243. tableBankData: [],
  244. tableLinkData: [],
  245. // 组织机构树形结构数据
  246. groupTreeData: [],
  247. groupData: [],
  248. rules: {
  249. partaName: [
  250. { required: true, message: '请选择客户名称', trigger: 'change' }
  251. ],
  252. linkName: [
  253. { required: true, message: '请输入', trigger: ['blur', 'change'] }
  254. ],
  255. orderNo: [{ required: true, message: '请选择', trigger: 'change' }]
  256. },
  257. // 提交状态
  258. loading: false,
  259. // 是否是修改
  260. isUpdate: false,
  261. competAnalysisListcolumns: [
  262. {
  263. width: 45,
  264. type: 'index',
  265. columnKey: 'index',
  266. align: 'center',
  267. fixed: 'left'
  268. },
  269. {
  270. width: 200,
  271. prop: 'productName',
  272. label: '名称',
  273. slot: 'productName',
  274. align: 'center'
  275. },
  276. {
  277. width: 120,
  278. prop: 'productCode',
  279. label: '编码',
  280. slot: 'productCode',
  281. align: 'center'
  282. },
  283. {
  284. width: 200,
  285. prop: 'productCategoryName',
  286. label: '类型',
  287. slot: 'productCategoryName',
  288. align: 'center'
  289. },
  290. {
  291. width: 160,
  292. prop: 'productBrand',
  293. label: '牌号',
  294. slot: 'productBrand',
  295. align: 'center'
  296. },
  297. {
  298. width: 120,
  299. prop: 'modelType',
  300. label: '型号',
  301. slot: 'modelType',
  302. align: 'center'
  303. },
  304. {
  305. width: 120,
  306. prop: 'specification',
  307. label: '规格',
  308. slot: 'specification',
  309. align: 'center'
  310. },
  311. {
  312. width: 200,
  313. prop: 'customerMark',
  314. label: '客户代号',
  315. slot: 'customerMark',
  316. align: 'center'
  317. },
  318. {
  319. width: 200,
  320. prop: 'warehouseName',
  321. label: '仓库名称',
  322. slot: 'warehouseName',
  323. align: 'center'
  324. },
  325. {
  326. width: 120,
  327. prop: 'totalCount',
  328. label: '数量',
  329. slot: 'totalCount',
  330. align: 'center'
  331. },
  332. {
  333. width: 120,
  334. prop: 'measuringUnit',
  335. label: '计量单位',
  336. slot: 'measuringUnit',
  337. align: 'center'
  338. },
  339. {
  340. width: 120,
  341. prop: 'singleWeight',
  342. label: '单重',
  343. slot: 'singleWeight',
  344. align: 'center'
  345. },
  346. {
  347. width: 100,
  348. prop: 'receiveTotalWeight',
  349. label: '收货总重',
  350. slot: 'receiveTotalWeight',
  351. align: 'center'
  352. },
  353. {
  354. width: 200,
  355. prop: 'sendTotalWeight',
  356. label: '发货总重',
  357. slot: 'sendTotalWeight',
  358. align: 'center',
  359. headerSlot: 'headerTotalCount'
  360. },
  361. {
  362. width: 100,
  363. prop: 'increaseTotalWeight',
  364. label: '增重重量',
  365. slot: 'increaseTotalWeight',
  366. align: 'center'
  367. },
  368. {
  369. width: 100,
  370. prop: 'weightUnit',
  371. label: '重量单位',
  372. slot: 'weightUnit',
  373. align: 'center'
  374. },
  375. {
  376. width: 160,
  377. prop: 'pricingWay',
  378. label: '计价方式',
  379. slot: 'pricingWay',
  380. align: 'center',
  381. formatter: (row, column) => {
  382. return row.pricingWay == 1 ? '按数量计费' : row.pricingWay == 2 ? '按重量计费':'';
  383. }
  384. },
  385. {
  386. width: 160,
  387. prop: 'singlePrice',
  388. label: '单价',
  389. slot: 'singlePrice',
  390. align: 'center'
  391. },
  392. {
  393. width: 120,
  394. prop: 'totalPrice',
  395. label: '销售总金额',
  396. slot: 'totalPrice',
  397. formatter: (_row, _column, cellValue) => {
  398. return _row.totalPrice + '元';
  399. },
  400. align: 'center'
  401. },
  402. {
  403. width: 120,
  404. prop: 'deliveryDays',
  405. label: '交期(天)',
  406. slot: 'deliveryDays',
  407. align: 'center'
  408. },
  409. {
  410. width: 200,
  411. prop: 'guaranteePeriod',
  412. label: '有效期',
  413. slot: 'guaranteePeriod',
  414. formatter: (_row, _column, cellValue) => {
  415. return (
  416. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  417. );
  418. },
  419. align: 'center'
  420. },
  421. // {
  422. // width: 120,
  423. // prop: 'guaranteePeriodUnitCode',
  424. // label: '',
  425. // slot: 'guaranteePeriodUnitCode'
  426. // },
  427. {
  428. width: 120,
  429. prop: 'technicalAnswerName',
  430. label: '技术答疑人',
  431. slot: 'technicalAnswerName',
  432. align: 'center'
  433. },
  434. {
  435. width: 220,
  436. prop: 'technicalParams',
  437. label: '技术参数',
  438. slot: 'technicalParams',
  439. align: 'center'
  440. },
  441. {
  442. width: 240,
  443. prop: 'technicalDrawings',
  444. label: '技术图纸',
  445. slot: 'technicalDrawings',
  446. formatter: (_row, _column, cellValue) => {
  447. return (
  448. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  449. );
  450. },
  451. align: 'center'
  452. },
  453. {
  454. width: 220,
  455. prop: 'remark',
  456. label: '备注',
  457. slot: 'remark',
  458. align: 'center'
  459. }
  460. ]
  461. };
  462. },
  463. props: {
  464. businessId: {
  465. default: ''
  466. },
  467. taskDefinitionKey: {}
  468. },
  469. created() {
  470. this.getSendSaleOrderDetail(this.businessId);
  471. if (this.taskDefinitionKey == 'salesmanUploadReceipt') {
  472. this.tabOptions.push({ key: 'outBound', name: '出库单' });
  473. }
  474. },
  475. methods: {
  476. changeActive(item) {
  477. this.activeComp = item.key;
  478. this.$emit('activeCompChange', item.key);
  479. },
  480. //选择订单回调
  481. changeOrder(obj) {
  482. this.form = Object.assign({}, this.form, {
  483. orderId: obj.id,
  484. orderNo: obj.orderNo
  485. });
  486. this.getSaleOrderDetail(obj.id);
  487. },
  488. //获取订单详情
  489. async getSaleOrderDetail(id) {
  490. this.loading = true;
  491. const data = await getSaleOrderDetail(id);
  492. this.loading = false;
  493. if (data) {
  494. this.$nextTick(() => {
  495. let {
  496. partaId,
  497. partaName,
  498. partaTel,
  499. orderNo,
  500. id,
  501. partaLinkName,
  502. receiveAddress,
  503. productList,
  504. totalAmount,
  505. payAmount
  506. } = data;
  507. if (productList && productList.length > 0) {
  508. productList.forEach((v) => {
  509. v.orderTotalCount = v.totalCount;
  510. });
  511. }
  512. this.form = Object.assign({}, this.form, {
  513. contactId: partaId,
  514. contactName: partaName,
  515. linkName: partaLinkName,
  516. linkPhone: partaTel,
  517. orderNo,
  518. orderId: id,
  519. receiveAddress,
  520. productList,
  521. totalAmount,
  522. payAmount
  523. });
  524. this.$refs.inventoryTableref &&
  525. this.$refs.inventoryTableref.putTableValue(productList);
  526. });
  527. }
  528. },
  529. //发货单详情
  530. async getSendSaleOrderDetail(id) {
  531. this.loading = true;
  532. const data = await getSendSaleOrderrecordDetail(id);
  533. this.loading = false;
  534. if (data) {
  535. this.form = data;
  536. this.form.pricingWay = data?.saleOrder?.pricingWay;
  537. data.productList.forEach
  538. this.$nextTick(() => {
  539. this.$refs.inventoryTableref &&
  540. this.$refs.inventoryTableref.putTableValue(data.productList);
  541. });
  542. }
  543. },
  544. //选择受托收货单弹框
  545. handleEntrustedReceive(e) {
  546. if (e.target.nodeName == 'I') {
  547. this.form = Object.assign({}, this.form, {
  548. carNo: '',
  549. carId: '',
  550. linkName: '',
  551. linkPhone: '',
  552. orderNo: '',
  553. orderId: '',
  554. contactId: '',
  555. contactName: '',
  556. entrustedCode: '',
  557. entrustedId: '',
  558. sendNoteNo: '',
  559. pricingWay: ''
  560. });
  561. this.$refs.inventoryTableref &&
  562. this.$refs.inventoryTableref.putTableValue([]);
  563. return;
  564. }
  565. this.searchParams = {
  566. orderId: this.form.orderId
  567. };
  568. this.entrustedReceiveDialogFlag = true;
  569. this.$nextTick(() => {
  570. this.$refs.entrustedReceiveDialogRef.init();
  571. });
  572. },
  573. //获取受托收货单数据回调
  574. async getInfo(row) {
  575. const data = await getPSaleEntrustedReceiveDetailAPI(row.id);
  576. this.$nextTick(() => {
  577. let {
  578. carNo,
  579. carId,
  580. code,
  581. id,
  582. linkName,
  583. linkPhone,
  584. orderId,
  585. orderNo,
  586. productList,
  587. contactId,
  588. contactName,
  589. pricingWay = data?.saleOrder?.pricingWay
  590. } = data;
  591. if (productList && productList.length > 0) {
  592. productList.forEach((v) => {
  593. v.orderTotalCount = v.orderTotalCount || v.totalCount;
  594. });
  595. }
  596. this.form = Object.assign({}, this.form, {
  597. contactId,
  598. contactName,
  599. linkName,
  600. linkPhone,
  601. orderNo,
  602. orderId,
  603. productList,
  604. carNo,
  605. carId,
  606. pricingWay,
  607. entrustedCode: code,
  608. entrustedId: id
  609. });
  610. productList.forEach((item) => {
  611. item.id = '';
  612. });
  613. this.$refs.inventoryTableref &&
  614. this.$refs.inventoryTableref.putTableValue(productList, code);
  615. });
  616. },
  617. //选择订单弹框
  618. handleOrderBtn() {
  619. if (e.target.nodeName == 'I') {
  620. this.form = Object.assign({}, this.form, {
  621. contactId: '',
  622. contactName: '',
  623. carNo: '',
  624. carId: '',
  625. linkName: '',
  626. linkPhone: '',
  627. orderNo: '',
  628. orderId: '',
  629. pricingWay: '',
  630. entrustedCode: '',
  631. entrustedId: ''
  632. });
  633. this.$refs.inventoryTableref &&
  634. this.$refs.inventoryTableref.putTableValue([]);
  635. return;
  636. }
  637. let item = {
  638. id: this.form.orderId
  639. };
  640. this.$refs.orderListDialogRef.open(item);
  641. },
  642. downloadFile(file) {
  643. getFile({ objectName: file.storePath }, file.name);
  644. },
  645. // //打开新增编辑弹框
  646. // async open(type, row, orderId) {
  647. // this.title = type === 'add' ? '新增发货单' : '修改';
  648. // this.row = row;
  649. // this.visible = true;
  650. // if (orderId) {
  651. // this.getSaleOrderDetail(orderId);
  652. // }
  653. // if (row && row?.id) {
  654. // this.getSendSaleOrderDetail(row?.id);
  655. // }
  656. // if (type == 'add') {
  657. // this.isUpdate = false;
  658. // } else {
  659. // this.isUpdate = true;
  660. // }
  661. // },
  662. salesmanChange(val, info) {
  663. this.otherForm.salesmanName = info.name;
  664. },
  665. settlementModeChange(info) {
  666. this.form.settlementModeName = info.dictValue;
  667. },
  668. ifChiefChange(value, idx) {
  669. if (value === 1) {
  670. this.tableLinkData.forEach((e) => (e.ifChief = 0));
  671. this.tableLinkData[idx].ifChief = 1;
  672. }
  673. },
  674. getValidate() {
  675. return Promise.all([
  676. new Promise((resolve, reject) => {
  677. this.$refs.form.validate((valid) => {
  678. if (!valid) {
  679. reject(false);
  680. } else {
  681. resolve(true);
  682. }
  683. });
  684. }),
  685. new Promise((resolve, reject) => {
  686. if (this.taskDefinitionKey == 'salesmanUploadReceipt') {
  687. resolve(true);
  688. return;
  689. }
  690. this.$refs.inventoryTableref.validateForm((valid) => {
  691. if (!valid) {
  692. reject(false);
  693. } else {
  694. resolve(true);
  695. }
  696. });
  697. })
  698. ]);
  699. },
  700. async getTableValue() {
  701. try {
  702. await this.getValidate();
  703. // 表单验证通过,执行保存操作
  704. this.loading = true;
  705. this.form.repliedFiles = this.form.repliedFiles || [];
  706. this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
  707. let commitData = Object.assign({}, this.form, {
  708. productList: this.$refs.inventoryTableref.getTableValue()
  709. });
  710. return commitData;
  711. } catch (error) {
  712. console.log(error);
  713. // 表单验证未通过,不执行保存操作
  714. }
  715. },
  716. cancel() {
  717. this.$nextTick(() => {
  718. this.activeName = 'base';
  719. // 关闭后,销毁所有的表单数据
  720. this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
  721. this.$refs['formRef'] && this.$refs['formRef'].resetFields();
  722. this.$store.commit('order/clearUserData');
  723. this.form = copyObj(this.formDef);
  724. this.visible = false;
  725. });
  726. }
  727. }
  728. };
  729. </script>
  730. <style scoped lang="scss">
  731. .TotalAmount {
  732. font-size: 16px;
  733. padding-right: 30px;
  734. }
  735. .headbox {
  736. display: flex;
  737. justify-content: flex-start;
  738. align-items: center;
  739. .amount {
  740. font-size: 14px;
  741. font-weight: bold;
  742. margin-right: 20px;
  743. }
  744. }
  745. </style>