detailsPage.vue 27 KB

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