detailsPage.vue 32 KB

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