detailsPage.vue 32 KB

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