detailsPage.vue 24 KB

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