detailsPage.vue 27 KB

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