detailsPage.vue 27 KB

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