detailsPage.vue 26 KB

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