detailsPage.vue 32 KB

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