detailsPage.vue 27 KB

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