detailsPage.vue 27 KB

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