detailsPage.vue 26 KB

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