detailsPage.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button
  7. type="danger"
  8. style="border: none;background: none;color: red"
  9. icon="el-icon-arrow-left"
  10. @click="backToList"
  11. >返回列表
  12. </el-button>
  13. </div>
  14. <div class="add-customer-btn" v-if="showBut">
  15. <el-button
  16. type="primary"
  17. size="small"
  18. v-if="detailData.status == 1"
  19. class="el-button--small-yh "
  20. @click.stop="openEdit"
  21. >编辑
  22. </el-button>
  23. <el-button
  24. type="info"
  25. @click.stop="editCustomer('save')"
  26. v-if="form.deliveryStatus == '录入'"
  27. size="small"
  28. >确认发货</el-button
  29. >
  30. <el-button
  31. type="info"
  32. @click.stop="editCustomer('repeal')"
  33. v-if="form.deliveryStatus != '录入'"
  34. size="small"
  35. >撤销发货</el-button
  36. >
  37. <el-button
  38. type="success"
  39. :disabled="!form.id"
  40. size="small"
  41. @click="copyDoc"
  42. >
  43. 复制单据
  44. </el-button>
  45. <el-button
  46. type="primary"
  47. :disabled="disabled"
  48. @click="editCustomer('submit')"
  49. :loading="subLoading"
  50. v-if="detailData.status != 1"
  51. size="small"
  52. >保存数据
  53. </el-button>
  54. </div>
  55. </div>
  56. <div class="customer-main">
  57. <containerTitle title="基础信息"></containerTitle>
  58. <basic-container>
  59. <avue-form
  60. ref="form"
  61. class="trading-form"
  62. v-model="form"
  63. :option="option"
  64. >
  65. <template slot="corpId">
  66. <crop-select
  67. v-model="form.corpId"
  68. corpType="KH"
  69. :disabled="detailData.status == 1"
  70. ></crop-select>
  71. </template>
  72. <template slot="storageId">
  73. <warehouse-select
  74. v-model="form.storageId"
  75. :configuration="configuration2"
  76. :disabled="detailData.status == 1"
  77. ></warehouse-select>
  78. </template>
  79. </avue-form>
  80. </basic-container>
  81. <containerTitle title="商品信息"></containerTitle>
  82. <basic-container>
  83. <avue-crud
  84. ref="crud"
  85. :data="data"
  86. :option="tableOption"
  87. @row-del="rowDel"
  88. @saveColumn="saveColumn"
  89. @resetColumn="resetColumn"
  90. :summary-method="summaryMethod"
  91. :cell-style="cellStyle"
  92. >
  93. <template slot="menuLeft">
  94. <el-button
  95. type="primary"
  96. icon="el-icon-plus"
  97. size="small"
  98. @click.stop="newDetails"
  99. :disabled="detailData.status == 1"
  100. >录入明细</el-button
  101. >
  102. <el-button
  103. type="info"
  104. icon="el-icon-printer"
  105. size="small"
  106. @click.stop="openReport()"
  107. >报 表</el-button
  108. >
  109. </template>
  110. <template slot-scope="{ row }" slot="corpId">
  111. {{ row.corpsName }}
  112. </template>
  113. <template slot="itemType" slot-scope="{ row }">
  114. <el-select
  115. v-if="row.$cellEdit"
  116. v-model="row.itemType"
  117. filterable
  118. allow-create
  119. default-first-option
  120. placeholder="请输入"
  121. @focus="itemTypeFocus(row)"
  122. >
  123. <el-option
  124. v-for="(item, index) in itemtypeList"
  125. :key="index"
  126. :label="item.value"
  127. :value="item.value"
  128. >
  129. </el-option>
  130. </el-select>
  131. <span v-else>{{ row.itemType }}</span>
  132. </template>
  133. <template slot="cname" slot-scope="{ row, index }">
  134. <el-button
  135. size="small"
  136. type="text"
  137. @click="rePick(row, index)"
  138. :disabled="disabled"
  139. class="picker"
  140. style="padding:4px 10px;float:left"
  141. >选择</el-button
  142. >
  143. <span> {{ row.cname }}</span>
  144. </template>
  145. <template slot="taxRate" slot-scope="{ row }">
  146. <el-input
  147. v-if="row.$cellEdit"
  148. size="mini"
  149. v-model="row.taxRate"
  150. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  151. @change="taxRateChange(row)"
  152. placeholder="请输入"
  153. />
  154. <span v-else>{{ row.taxRate }}</span>
  155. </template>
  156. <template slot="menu" slot-scope="{ row, index }">
  157. <el-button
  158. size="small"
  159. icon="el-icon-edit"
  160. type="text"
  161. @click="rowCell(row, index)"
  162. :disabled="disabled"
  163. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  164. >
  165. <el-button
  166. size="small"
  167. icon="el-icon-edit"
  168. type="text"
  169. @click="rowDel(row, index)"
  170. >删 除</el-button
  171. >
  172. </template>
  173. <template slot="price" slot-scope="{ row }">
  174. <el-input
  175. v-if="row.$cellEdit"
  176. v-model="row.price"
  177. size="small"
  178. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  179. @change="priceChange(row)"
  180. ></el-input>
  181. <span v-else>{{ row.price }}</span>
  182. </template>
  183. <template slot="actualQuantity" slot-scope="{ row }">
  184. <el-input
  185. v-if="row.$cellEdit"
  186. v-model="row.actualQuantity"
  187. size="small"
  188. oninput='this.value=this.value.replace(/[^(\d)]/g,"")'
  189. @change="quantityChange(row)"
  190. ></el-input>
  191. <span v-else>{{ row.actualQuantity | IntegerFormat }}</span>
  192. </template>
  193. </avue-crud>
  194. </basic-container>
  195. <fee-info
  196. ref="feeInfo"
  197. :orderFeesList="orderFeesList"
  198. :disabled="detailData.status == 1"
  199. feeUrl="/blade-deliver-goods/deliveryfees/update"
  200. />
  201. <containerTitle title="合同附件"></containerTitle>
  202. <c-upload
  203. typeUpload="CK"
  204. :data="orderFilesList"
  205. :disabled="detailData.status == 1"
  206. :enumerationValue="76"
  207. deleteUrl="/blade-deliver-goods/deliveryfiles/update"
  208. />
  209. </div>
  210. <el-dialog
  211. title="导入商品"
  212. append-to-body
  213. class="el-dialogDeep"
  214. :visible.sync="dialogVisible"
  215. width="80%"
  216. :close-on-click-modal="false"
  217. :destroy-on-close="true"
  218. :close-on-press-escape="false"
  219. @close="closeGoods"
  220. top="5vh"
  221. v-dialog-drag
  222. >
  223. <span>
  224. <el-row>
  225. <el-col :span="4">
  226. <div>
  227. <el-scrollbar>
  228. <basic-container>
  229. <avue-tree
  230. :option="treeOption"
  231. @node-click="nodeClick"
  232. :style="treeStyle"
  233. />
  234. </basic-container>
  235. </el-scrollbar>
  236. </div>
  237. </el-col>
  238. <el-col :span="20">
  239. <avue-crud
  240. :option="goodsOption"
  241. :table-loading="loading"
  242. :data="goodsList"
  243. ref="goodsCrud"
  244. @refresh-change="refreshChange"
  245. @selection-change="selectionChange"
  246. @row-click="rowClick"
  247. :page.sync="page"
  248. @on-load="onLoad"
  249. @saveColumn="saveGoodsColumn"
  250. @resetColumn="resetGoodsColumn"
  251. :cell-style="cellStyle"
  252. ></avue-crud>
  253. </el-col>
  254. </el-row>
  255. </span>
  256. <span slot="footer" class="dialog-footer">
  257. <el-button @click="dialogVisible = false">取 消</el-button>
  258. <el-button
  259. type="primary"
  260. @click="importGoods"
  261. :disabled="selectionList.length == 0"
  262. >导入</el-button
  263. >
  264. </span>
  265. </el-dialog>
  266. <report-dialog
  267. :switchDialog="switchDialog"
  268. :reportId="form.id"
  269. reportName="客户询价"
  270. @onClose="onClose()"
  271. ></report-dialog>
  272. </div>
  273. </template>
  274. <script>
  275. import tableOption from "./config/customerContact.json";
  276. import goodsOption from "./config/commodity.json";
  277. import feeInfo from "@/components/fee-info/main";
  278. import {
  279. detail,
  280. submit,
  281. delItem,
  282. getDeptLazyTree,
  283. getGoods,
  284. getSpecification,
  285. save,
  286. repeal
  287. } from "@/api/basicData/invoice";
  288. import uploadFile from "@/components/upload-file/main";
  289. import reportDialog from "@/components/report-dialog/main";
  290. import { micrometerFormat, IntegerFormat } from "@/util/validate";
  291. import { contrastObj, contrastList } from "@/util/contrastData";
  292. import _ from "lodash";
  293. export default {
  294. name: "detailsPageEdit",
  295. data() {
  296. return {
  297. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  298. configuration2: {
  299. multipleChoices: false,
  300. multiple: false,
  301. collapseTags: false,
  302. placeholder: "请点击右边按钮选择",
  303. dicData: []
  304. },
  305. switchDialog: false,
  306. form: {
  307. deliveryStatus: "录入"
  308. },
  309. disabled: false,
  310. dialogVisible: false,
  311. tableOption: {},
  312. option: {
  313. menuBtn: false,
  314. labelWidth: 100,
  315. disabled: false,
  316. column: [
  317. {
  318. label: "客户名称",
  319. prop: "corpId",
  320. rules: [
  321. {
  322. required: true,
  323. message: "",
  324. trigger: "blur"
  325. }
  326. ],
  327. span: 16,
  328. slot: true
  329. },
  330. {
  331. label: "系统号",
  332. prop: "sysNo",
  333. span: 8
  334. },
  335. {
  336. label: "销售订单号",
  337. prop: "srcOrderNo",
  338. span: 8
  339. },
  340. {
  341. label: "订单状态",
  342. prop: "deliveryStatus",
  343. span: 8,
  344. type: "select",
  345. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  346. props: {
  347. label: "dictValue",
  348. value: "dictValue"
  349. },
  350. disabled: true,
  351. row: true
  352. },
  353. {
  354. label: "仓库名称",
  355. prop: "storageId",
  356. span: 8
  357. },
  358. {
  359. label: "仓库类型",
  360. prop: "warehouseType",
  361. span: 8
  362. },
  363. {
  364. label: "发货日期",
  365. prop: "businessDate",
  366. span: 8,
  367. type: "date",
  368. format: "yyyy-MM-dd",
  369. valueFormat: "yyyy-MM-dd 00:00:00",
  370. rules: [
  371. {
  372. required: true,
  373. message: "",
  374. trigger: "blur"
  375. }
  376. ]
  377. },
  378. {
  379. label: "出库数量",
  380. prop: "totalQuantity",
  381. span: 8,
  382. disabled: true
  383. },
  384. {
  385. label: "出库金额",
  386. prop: "deliveryAmount",
  387. span: 8,
  388. disabled: true
  389. },
  390. {
  391. label: "费用合计",
  392. prop: "totalCost",
  393. span: 8
  394. },
  395. {
  396. label: "收货人",
  397. prop: "arrivalContact",
  398. span: 8
  399. },
  400. {
  401. label: "收货电话",
  402. prop: "arrivalTel",
  403. span: 8
  404. },
  405. {
  406. label: "收货地址",
  407. prop: "arrivalAddress",
  408. span: 8
  409. },
  410. {
  411. label: "制单时间",
  412. prop: "createTime",
  413. span: 8,
  414. type: "date",
  415. format: "yyyy-MM-dd",
  416. valueFormat: "yyyy-MM-dd 00:00:00",
  417. disabled: true
  418. },
  419. {
  420. label: "备注",
  421. prop: "deliveryRemarks",
  422. type: "textarea",
  423. minRows: 2,
  424. span: 24
  425. }
  426. ]
  427. },
  428. treeOption: {
  429. nodeKey: "id",
  430. lazy: true,
  431. treeLoad: function(node, resolve) {
  432. const parentId = node.level === 0 ? 0 : node.data.id;
  433. getDeptLazyTree(parentId).then(res => {
  434. resolve(
  435. res.data.data.map(item => {
  436. return {
  437. ...item,
  438. leaf: !item.hasChildren
  439. };
  440. })
  441. );
  442. });
  443. },
  444. addBtn: false,
  445. menu: false,
  446. size: "small",
  447. props: {
  448. label: "title",
  449. value: "value",
  450. children: "children"
  451. }
  452. },
  453. page: {
  454. pageSize: 10,
  455. currentPage: 1,
  456. total: 0
  457. },
  458. goodsOption: {},
  459. data: [],
  460. goodsList: [],
  461. selectionList: [],
  462. treeDeptId: null,
  463. orderFeesList: [],
  464. orderFilesList: [],
  465. itemtypeList: [],
  466. oldform: {
  467. deliveryStatus: "录入"
  468. },
  469. olddata: [],
  470. oldorderFeesList: [],
  471. oldorderFilesList: [],
  472. reData: null,
  473. loading: false,
  474. subLoading: false,
  475. pageLoading: false,
  476. showBut: true
  477. };
  478. },
  479. props: {
  480. detailData: {
  481. type: Object
  482. }
  483. },
  484. components: {
  485. reportDialog,
  486. feeInfo,
  487. uploadFile
  488. },
  489. async created() {
  490. if (this.$route.query.pageType == "Generate") {
  491. this.getGenerate(JSON.parse(this.$route.query.data));
  492. }
  493. if (this.detailData.id) {
  494. this.getDetail(this.detailData.id);
  495. }
  496. this.tableOption = await this.getColumnData(
  497. this.getColumnName(9),
  498. tableOption
  499. );
  500. this.goodsOption = await this.getColumnData(
  501. this.getColumnName(30),
  502. goodsOption
  503. );
  504. if (this.detailData.status == 1) {
  505. this.option.disabled = true;
  506. }
  507. this.getWorkDicts("product_properties").then(res => {
  508. this.findObject(this.tableOption.column, "itemProp").dicData =
  509. res.data.data;
  510. });
  511. this.getWorkDicts("unit").then(res => {
  512. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  513. });
  514. },
  515. filters: {
  516. IntegerFormat(num) {
  517. return IntegerFormat(num);
  518. }
  519. },
  520. methods: {
  521. cellStyle() {
  522. return "padding:0;height:40px;";
  523. },
  524. copyDoc() {
  525. this.$emit("copyOrder", this.form.id);
  526. },
  527. rePick(row, index) {
  528. this.reData = {
  529. ...row,
  530. index: index
  531. };
  532. this.newDetails();
  533. },
  534. itemTypeFocus(row) {
  535. this.itemtypeList = [];
  536. getSpecification({ goodId: row.itemId }).then(res => {
  537. const data = res.data.data;
  538. this.itemtypeList = data.map(item => ({ value: item }));
  539. });
  540. },
  541. //编辑
  542. rowCell(row, index) {
  543. if (row.$cellEdit == true) {
  544. this.$set(row, "$cellEdit", false);
  545. } else {
  546. this.$set(row, "$cellEdit", true);
  547. }
  548. },
  549. priceChange(row) {
  550. console.log(row);
  551. if (!row.price) {
  552. row.price = 0;
  553. } else {
  554. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  555. 2
  556. );
  557. }
  558. },
  559. quantityChange(row) {
  560. if (!row.actualQuantity) {
  561. row.actualQuantity = 0;
  562. } else {
  563. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  564. 2
  565. );
  566. }
  567. },
  568. taxRateChange(row) {
  569. if (Number(row.taxRate) >= 100) {
  570. row.taxRate = 0;
  571. this.$message.error("税率不能超过100%");
  572. }
  573. },
  574. rowSave(row) {
  575. console.log(row);
  576. this.$set(row, "$cellEdit", false);
  577. },
  578. rowDel(row, index) {
  579. this.$confirm("确定删除数据?", {
  580. confirmButtonText: "确定",
  581. cancelButtonText: "取消",
  582. type: "warning"
  583. }).then(() => {
  584. if (row.id) {
  585. delItem(row.id).then(res => {
  586. this.$message({
  587. type: "success",
  588. message: "删除成功!"
  589. });
  590. this.data.splice(index, 1);
  591. });
  592. } else {
  593. this.$message({
  594. type: "success",
  595. message: "删除成功!"
  596. });
  597. this.data.splice(index, 1);
  598. }
  599. });
  600. },
  601. importGoods() {
  602. if (this.reData) {
  603. console.log(this.reData);
  604. if (this.selectionList.length != 1) {
  605. return this.$message.error("重新选择的时候只能选择一条数据");
  606. } else {
  607. this.selectionList.forEach(e => {
  608. this.data.forEach((item, index) => {
  609. if (index == this.reData.index) {
  610. item.itemId = e.id;
  611. item.code = e.code;
  612. item.cname = e.cname;
  613. item.priceCategory = e.goodsTypeName;
  614. item.itemUrl = e.url;
  615. item.itemProp = this.reData.itemProp;
  616. item.productDesc = e.cnameDescription;
  617. item.itemType = this.reData.itemType;
  618. item.tradeTerms = this.reData.tradeTerms;
  619. item.price = this.reData.price;
  620. item.orderQuantity = this.reData.orderQuantity;
  621. item.insurance = this.reData.insurance;
  622. item.freight = this.reData.freight;
  623. item.discount = this.reData.discount;
  624. item.amount = this.reData.amount;
  625. item.taxRate = this.reData.taxRate;
  626. item.unit = e.unit;
  627. item.remarks = this.reData.remarks;
  628. item.$cellEdit = true;
  629. }
  630. });
  631. });
  632. }
  633. } else {
  634. this.selectionList.forEach(e => {
  635. this.data.push({
  636. itemId: e.id,
  637. code: e.code,
  638. cname: e.cname,
  639. priceCategory: e.goodsTypeName,
  640. itemUrl: e.url,
  641. itemProp: null,
  642. productDesc: e.cnameDescription,
  643. itemType: null,
  644. tradeTerms: null,
  645. price: 0,
  646. orderQuantity: 0,
  647. insurance: 0,
  648. freight: 0,
  649. discount: null,
  650. amount: 0,
  651. taxRate: 0,
  652. unit: e.unit,
  653. remarks: null,
  654. $cellEdit: true
  655. });
  656. });
  657. }
  658. this.dialogVisible = false;
  659. },
  660. closeGoods() {
  661. this.selectionList = [];
  662. this.treeDeptId = "";
  663. this.reData = null;
  664. },
  665. selectionChange(list) {
  666. this.selectionList = list;
  667. },
  668. rowClick(row) {
  669. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  670. },
  671. nodeClick(data) {
  672. this.treeDeptId = data.id;
  673. this.page.currentPage = 1;
  674. this.onLoad(this.page);
  675. },
  676. //费用查询
  677. onLoad(page, params = {}) {
  678. this.loading = true;
  679. getGoods(page.currentPage, page.pageSize, this.treeDeptId).then(res => {
  680. const data = res.data.data;
  681. this.page.total = data.total;
  682. this.goodsList = data.records;
  683. this.loading = false;
  684. if (this.page.total) {
  685. this.goodsOption.height = window.innerHeight - 350;
  686. }
  687. });
  688. },
  689. //商品明细导入
  690. newDetails() {
  691. this.dialogVisible = !this.dialogVisible;
  692. },
  693. getDetail(id) {
  694. this.loading = true;
  695. this.showBut = false;
  696. this.pageLoading = true;
  697. detail(id)
  698. .then(res => {
  699. if (this.detailData.status == "copy") {
  700. delete res.data.data.id;
  701. delete res.data.data.sysNo;
  702. delete res.data.data.orderNo;
  703. delete res.data.data.orgOrderNo;
  704. delete res.data.data.srcOrderNo;
  705. delete res.data.data.createTime;
  706. delete res.data.data.createUser;
  707. delete res.data.data.createUserName;
  708. delete res.data.data.updateTime;
  709. delete res.data.data.updateUser;
  710. delete res.data.data.updateUserName;
  711. delete res.data.data.morderNo;
  712. delete res.data.data.status;
  713. delete res.data.data.ifEnquiry;
  714. delete res.data.data.ifShipping;
  715. res.data.data.orderStatus = "录入";
  716. res.data.data.deliveryItemsList.forEach(e => {
  717. delete e.id;
  718. delete e.pid;
  719. delete e.createTime;
  720. delete e.createUser;
  721. delete e.updateTime;
  722. delete e.updateUser;
  723. delete e.orgOrderNo;
  724. delete e.srcId;
  725. delete e.status;
  726. delete e.isDeleted;
  727. });
  728. res.data.data.deliveryFeesList.forEach(e => {
  729. delete e.id;
  730. delete e.pid;
  731. delete e.createTime;
  732. delete e.createUser;
  733. delete e.updateTime;
  734. delete e.updateUser;
  735. delete e.status;
  736. delete e.isDeleted;
  737. });
  738. res.data.data.deliveryFilesList.forEach(e => {
  739. delete e.id;
  740. delete e.pid;
  741. delete e.createTime;
  742. delete e.createUser;
  743. delete e.updateTime;
  744. delete e.updateUser;
  745. delete e.status;
  746. delete e.isDeleted;
  747. });
  748. }
  749. this.form = res.data.data;
  750. this.data = res.data.data.deliveryItemsList;
  751. this.orderFeesList = res.data.data.deliveryFeesList;
  752. this.orderFilesList = res.data.data.deliveryFilesList;
  753. this.oldform = res.data.data;
  754. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  755. this.oldorderFeesList = this.deepClone(
  756. res.data.data.deliveryFeesList
  757. );
  758. this.oldorderFilesList = this.deepClone(
  759. res.data.data.deliveryFilesList
  760. );
  761. })
  762. .finally(() => {
  763. this.loading = false;
  764. this.showBut = true;
  765. this.pageLoading = false;
  766. });
  767. },
  768. getGenerate(data) {
  769. this.form = data;
  770. this.data = data.orderItemsList;
  771. this.orderFeesList = data.deliveryFeesList;
  772. },
  773. //修改提交触发
  774. editCustomer(status, status2) {
  775. this.$refs["form"].validate((valid, done) => {
  776. done();
  777. if (valid) {
  778. let orderFeesList = this.$refs.feeInfo.submitData();
  779. for (let i = 0; i < orderFeesList.length; i++) {
  780. if (orderFeesList[i].corpId == null) {
  781. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  782. }
  783. if (orderFeesList[i].price == 0) {
  784. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  785. }
  786. if (orderFeesList[i].actualQuantity == 0) {
  787. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  788. }
  789. }
  790. const orderFilesList = this.$refs.uploadFile.submitData();
  791. if (status == "submit") {
  792. this.subLoading = true;
  793. submit({
  794. ...this.form,
  795. deliveryItemsList: this.data,
  796. deliveryFeesList: orderFeesList,
  797. deliveryFilesList: this.orderFilesList
  798. })
  799. .then(res => {
  800. this.$message.success("保存成功");
  801. this.form = res.data.data;
  802. this.data = res.data.data.deliveryItemsList;
  803. this.orderFeesList = res.data.data.deliveryFeesList;
  804. this.orderFilesList = res.data.data.deliveryFilesList;
  805. this.oldform = res.data.data;
  806. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  807. this.oldorderFeesList = this.deepClone(
  808. res.data.data.deliveryFeesList
  809. );
  810. this.oldorderFilesList = this.deepClone(
  811. res.data.data.deliveryFilesList
  812. );
  813. if (status2 == "goBack") {
  814. if (this.form.id) {
  815. this.unLock({
  816. moduleName: "fh",
  817. tableName: "business_order",
  818. billId: this.form.id,
  819. billNo: this.form.orgOrderNo
  820. });
  821. }
  822. this.$emit("goBack");
  823. this.leaveDetailsKey(this.$route.name);
  824. }
  825. })
  826. .finally(() => {
  827. this.subLoading = false;
  828. });
  829. }
  830. if (status == "save") {
  831. this.$confirm("此操作将确认发货, 是否继续?", "提示", {
  832. confirmButtonText: "确定",
  833. cancelButtonText: "取消",
  834. type: "warning"
  835. }).then(() => {
  836. save({
  837. ...this.form,
  838. deliveryItemsList: this.data,
  839. deliveryFeesList: orderFeesList,
  840. deliveryFilesList: this.orderFilesList
  841. }).then(res => {
  842. this.form = res.data.data;
  843. this.data = res.data.data.deliveryItemsList;
  844. this.orderFeesList = res.data.data.deliveryFeesList;
  845. this.orderFilesList = res.data.data.deliveryFilesList;
  846. this.oldform = res.data.data;
  847. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  848. this.oldorderFeesList = this.deepClone(
  849. res.data.data.deliveryFeesList
  850. );
  851. this.oldorderFilesList = this.deepClone(
  852. res.data.data.deliveryFilesList
  853. );
  854. this.$message.success("提交成功");
  855. });
  856. });
  857. }
  858. if (status == "repeal") {
  859. this.$confirm("此操作将撤销发货, 是否继续?", "提示", {
  860. confirmButtonText: "确定",
  861. cancelButtonText: "取消",
  862. type: "warning"
  863. }).then(() => {
  864. repeal({
  865. ...this.form,
  866. deliveryItemsList: this.data,
  867. deliveryFeesList: orderFeesList,
  868. deliveryFilesList: this.orderFilesList
  869. }).then(res => {
  870. this.form = res.data.data;
  871. this.data = res.data.data.deliveryItemsList;
  872. this.orderFeesList = res.data.data.deliveryFeesList;
  873. this.orderFilesList = res.data.data.deliveryFilesList;
  874. this.$message.success("撤销成功");
  875. this.oldform = res.data.data;
  876. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  877. this.oldorderFeesList = this.deepClone(
  878. res.data.data.deliveryFeesList
  879. );
  880. this.oldorderFilesList = this.deepClone(
  881. res.data.data.deliveryFilesList
  882. );
  883. });
  884. });
  885. }
  886. } else {
  887. return false;
  888. }
  889. });
  890. },
  891. //返回列表
  892. backToList() {
  893. let orderFeesList = this.$refs.feeInfo.submitData();
  894. if (
  895. contrastObj(this.form, this.oldform) ||
  896. contrastList(this.data, this.olddata) ||
  897. contrastList(orderFeesList, this.oldorderFeesList) ||
  898. contrastList(this.orderFilesList, this.oldorderFilesList)
  899. ) {
  900. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  901. confirmButtonText: "确定",
  902. cancelButtonText: "取消",
  903. type: "warning"
  904. })
  905. .then(() => {
  906. this.editCustomer("submit", "goBack");
  907. })
  908. .catch(() => {
  909. if (this.form.id) {
  910. this.unLock({
  911. moduleName: "fh",
  912. tableName: "business_order",
  913. billId: this.form.id,
  914. billNo: this.form.orgOrderNo
  915. });
  916. }
  917. this.$emit("goBack");
  918. this.leaveDetailsKey(this.$route.name);
  919. });
  920. } else {
  921. if (this.form.id) {
  922. this.unLock({
  923. moduleName: "fh",
  924. tableName: "business_order",
  925. billId: this.form.id,
  926. billNo: this.form.orgOrderNo
  927. });
  928. }
  929. this.$emit("goBack");
  930. this.leaveDetailsKey(this.$route.name);
  931. }
  932. },
  933. openReport() {
  934. this.switchDialog = !this.switchDialog;
  935. },
  936. onClose(val) {
  937. this.switchDialog = val;
  938. },
  939. summaryMethod({ columns, data }) {
  940. const sums = [];
  941. if (columns.length > 0) {
  942. columns.forEach((item, index) => {
  943. sums[0] = "合计";
  944. if (
  945. item.property == "actualQuantity" ||
  946. item.property == "contractAmount"
  947. ) {
  948. let qtySum = 0;
  949. let amountSum = 0;
  950. data.forEach(e => {
  951. qtySum = _.add(qtySum, Number(e.actualQuantity));
  952. amountSum = _.add(amountSum, Number(e.contractAmount));
  953. this.form.totalQuantity = qtySum;
  954. this.form.deliveryAmount = amountSum;
  955. });
  956. //数量总计
  957. if (item.property == "actualQuantity") {
  958. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  959. }
  960. //金额总计
  961. if (item.property == "contractAmount") {
  962. sums[index] = micrometerFormat(amountSum);
  963. }
  964. }
  965. });
  966. }
  967. return sums;
  968. },
  969. openEdit() {
  970. const data = {
  971. moduleName: "fh",
  972. tableName: "business_order",
  973. billId: this.form.id,
  974. no: localStorage.getItem("browserID"),
  975. billNo: this.form.orgOrderNo
  976. };
  977. this.inDetailsKey(this.$route.name, {
  978. moduleName: "fh",
  979. tableName: "business_order",
  980. billId: this.form.id,
  981. billNo: this.form.orgOrderNo
  982. });
  983. this.checkLock(data).then(res => {
  984. if (res.data.code == 200) {
  985. this.onLock(data);
  986. this.detailData.status = 2;
  987. this.option = this.$options.data().option;
  988. }
  989. });
  990. },
  991. async saveColumn() {
  992. const inSave = await this.saveColumnData(
  993. this.getColumnName(9),
  994. this.tableOption
  995. );
  996. if (inSave) {
  997. this.$message.success("保存成功");
  998. //关闭窗口
  999. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1000. }
  1001. },
  1002. async resetColumn() {
  1003. this.tableOption = tableOption;
  1004. const inSave = await this.delColumnData(
  1005. this.getColumnName(9),
  1006. tableOption
  1007. );
  1008. if (inSave) {
  1009. this.$message.success("重置成功");
  1010. //关闭窗口
  1011. setTimeout(() => {
  1012. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1013. }, 1000);
  1014. }
  1015. },
  1016. async saveGoodsColumn() {
  1017. const inSave = await this.saveColumnData(
  1018. this.getColumnName(30),
  1019. this.goodsOption
  1020. );
  1021. if (inSave) {
  1022. this.$message.success("保存成功");
  1023. //关闭窗口
  1024. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1025. }
  1026. },
  1027. async resetGoodsColumn() {
  1028. this.goodsOption = goodsOption;
  1029. const inSave = await this.delColumnData(
  1030. this.getColumnName(30),
  1031. goodsOption
  1032. );
  1033. if (inSave) {
  1034. this.$message.success("重置成功");
  1035. //关闭窗口
  1036. setTimeout(() => {
  1037. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1038. }, 1000);
  1039. }
  1040. }
  1041. }
  1042. };
  1043. </script>
  1044. <style lang="scss" scoped>
  1045. .trading-form ::v-deep .el-form-item {
  1046. margin-bottom: 8px !important;
  1047. }
  1048. ::v-deep .el-form-item__error {
  1049. display: none !important;
  1050. }
  1051. ::v-deep .select-component {
  1052. display: flex !important;
  1053. }
  1054. </style>