detailsPage.vue 28 KB

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