detailsPage.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  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. row: true
  324. },
  325. {
  326. label: "仓库名称",
  327. prop: "storageId",
  328. span: 8
  329. },
  330. {
  331. label: "仓库类型",
  332. prop: "warehouseType",
  333. span: 8
  334. },
  335. {
  336. label: "收货日期",
  337. prop: "businessDate",
  338. span: 8,
  339. type: "date",
  340. format: "yyyy-MM-dd",
  341. valueFormat: "yyyy-MM-dd 00:00:00",
  342. rules: [
  343. {
  344. required: true,
  345. message: "",
  346. trigger: "blur"
  347. }
  348. ],
  349. row: true
  350. },
  351. {
  352. label: "入库金额",
  353. prop: "deliveryAmount",
  354. span: 8
  355. },
  356. {
  357. label: "入库数量",
  358. prop: "totalQuantity",
  359. span: 8
  360. },
  361. {
  362. label: "费用合计",
  363. prop: "totalCost",
  364. span: 8
  365. },
  366. {
  367. label: "制单时间",
  368. prop: "createTime",
  369. span: 8,
  370. type: "date",
  371. format: "yyyy-MM-dd",
  372. valueFormat: "yyyy-MM-dd 00:00:00",
  373. disabled: true
  374. },
  375. {
  376. label: "备注",
  377. prop: "deliveryRemarks",
  378. type: "textarea",
  379. minRows: 2,
  380. span: 24
  381. }
  382. ]
  383. },
  384. treeOption: {
  385. nodeKey: "id",
  386. lazy: true,
  387. treeLoad: function(node, resolve) {
  388. const parentId = node.level === 0 ? 0 : node.data.id;
  389. getDeptLazyTree(parentId).then(res => {
  390. resolve(
  391. res.data.data.map(item => {
  392. return {
  393. ...item,
  394. leaf: !item.hasChildren
  395. };
  396. })
  397. );
  398. });
  399. },
  400. addBtn: false,
  401. menu: false,
  402. size: "small",
  403. props: {
  404. label: "title",
  405. value: "value",
  406. children: "children"
  407. }
  408. },
  409. page: {
  410. pageSize: 10,
  411. currentPage: 1,
  412. total: 0
  413. },
  414. loading: false,
  415. goodsOption: {},
  416. data: [],
  417. goodsList: [],
  418. selectionList: [],
  419. treeDeptId: null,
  420. orderFeesList: [],
  421. orderFilesList: [],
  422. itemtypeList: [],
  423. reData: null
  424. };
  425. },
  426. props: {
  427. detailData: {
  428. type: Object
  429. }
  430. },
  431. components: {
  432. reportDialog,
  433. feeInfo,
  434. uploadFile
  435. },
  436. async created() {
  437. this.tableOption = await this.getColumnData(
  438. this.getColumnName(7),
  439. tableOption
  440. );
  441. this.goodsOption = await this.getColumnData(
  442. this.getColumnName(29),
  443. goodsOption
  444. );
  445. if (this.$route.query.pageType == "Generate") {
  446. this.getGenerate(JSON.parse(this.$route.query.data));
  447. }
  448. if (this.detailData.id) {
  449. this.getDetail(this.detailData.id);
  450. }
  451. if (this.detailData.status == 1) {
  452. this.option.disabled = true;
  453. }
  454. let _this = this;
  455. this.tableOption.column.forEach(e => {
  456. if (e.prop == "taxRate") {
  457. e.formatter = function(row) {
  458. return _this.textFormat(
  459. Number(row.taxRate ? row.taxRate : 0) / 100,
  460. "0.00%"
  461. );
  462. };
  463. }
  464. if (e.prop == "contractAmount" || e.prop == "price") {
  465. e.formatter = function(row) {
  466. return _this.textFormat(
  467. Number(row.contractAmount ? row.contractAmount : 0),
  468. "#,##0.00"
  469. );
  470. };
  471. }
  472. });
  473. this.getWorkDicts("product_properties").then(res => {
  474. this.findObject(this.tableOption.column, "itemProp").dicData =
  475. res.data.data;
  476. });
  477. },
  478. methods: {
  479. rePick(row, index) {
  480. this.reData = {
  481. ...row,
  482. index: index
  483. };
  484. this.newDetails();
  485. },
  486. getGenerate(data) {
  487. this.form = data;
  488. this.data = data.orderItemsList;
  489. this.orderFeesList = data.deliveryFeesList ? data.deliveryFeesList : [];
  490. this.configuration.dicData = data.corpName;
  491. },
  492. itemTypeFocus(row) {
  493. this.itemtypeList = [];
  494. getSpecification({ goodId: row.itemId }).then(res => {
  495. const data = res.data.data;
  496. this.itemtypeList = data.map(item => ({ value: item }));
  497. });
  498. },
  499. //编辑
  500. rowCell(row, index) {
  501. if (row.$cellEdit == true) {
  502. this.$set(row, "$cellEdit", false);
  503. } else {
  504. this.$set(row, "$cellEdit", true);
  505. }
  506. },
  507. priceChange(row) {
  508. console.log(row);
  509. if (!row.price) {
  510. row.price = 0;
  511. } else {
  512. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  513. 2
  514. );
  515. }
  516. },
  517. quantityChange(row) {
  518. if (!row.actualQuantity) {
  519. row.actualQuantity = 0;
  520. } else {
  521. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  522. 2
  523. );
  524. }
  525. },
  526. taxRateChange(row) {
  527. if (Number(row.taxRate) >= 100) {
  528. row.taxRate = 0;
  529. this.$message.error("税率不能超过100%");
  530. }
  531. },
  532. rowSave(row) {
  533. console.log(row);
  534. this.$set(row, "$cellEdit", false);
  535. },
  536. rowDel(row, index) {
  537. this.$confirm("确定删除数据?", {
  538. confirmButtonText: "确定",
  539. cancelButtonText: "取消",
  540. type: "warning"
  541. }).then(() => {
  542. if (row.id) {
  543. delItem(row.id).then(res => {
  544. this.$message({
  545. type: "success",
  546. message: "删除成功!"
  547. });
  548. this.data.splice(index, 1);
  549. });
  550. } else {
  551. this.$message({
  552. type: "success",
  553. message: "删除成功!"
  554. });
  555. this.data.splice(index, 1);
  556. }
  557. });
  558. },
  559. importGoods() {
  560. if (this.reData) {
  561. console.log(this.reData);
  562. if (this.selectionList.length != 1) {
  563. return this.$message.error("重新选择的时候只能选择一条数据");
  564. } else {
  565. this.selectionList.forEach(e => {
  566. this.data.forEach((item, index) => {
  567. if (index == this.reData.index) {
  568. item.itemId = e.id;
  569. item.code = e.code;
  570. item.cname = e.cname;
  571. item.priceCategory = e.goodsTypeName;
  572. item.itemUrl = e.url;
  573. item.itemProp = this.reData.itemProp;
  574. item.itemDescription = e.cnameDescription;
  575. item.itemType = this.reData.itemType;
  576. item.tradeTerms = this.reData.tradeTerms;
  577. item.price = this.reData.price;
  578. item.orderQuantity = this.reData.orderQuantity;
  579. item.insurance = this.reData.insurance;
  580. item.freight = this.reData.freight;
  581. item.discount = this.reData.discount;
  582. item.amount = this.reData.amount;
  583. item.taxRate = this.reData.taxRate;
  584. item.unit = e.unit;
  585. item.remarks = this.reData.remarks;
  586. item.$cellEdit = true;
  587. }
  588. });
  589. });
  590. }
  591. } else {
  592. this.selectionList.forEach(e => {
  593. this.data.push({
  594. itemId: e.id,
  595. code: e.code,
  596. cname: e.cname,
  597. priceCategory: e.goodsTypeName,
  598. itemUrl: e.url,
  599. itemProp: null,
  600. itemDescription: e.cnameDescription,
  601. itemType: null,
  602. tradeTerms: null,
  603. price: 0,
  604. orderQuantity: 0,
  605. insurance: 0,
  606. freight: 0,
  607. discount: null,
  608. amount: 0,
  609. taxRate: 0,
  610. unit: e.unit,
  611. remarks: null,
  612. $cellEdit: true
  613. });
  614. });
  615. }
  616. },
  617. closeGoods() {
  618. this.selectionList = [];
  619. this.treeDeptId = "";
  620. this.reData = null;
  621. },
  622. selectionChange(list) {
  623. this.selectionList = list;
  624. },
  625. rowClick(row) {
  626. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  627. },
  628. nodeClick(data) {
  629. this.treeDeptId = data.id;
  630. this.page.currentPage = 1;
  631. this.onLoad(this.page);
  632. },
  633. //费用查询
  634. onLoad(page, params = {}) {
  635. this.loading = true;
  636. getGoods(page.currentPage, page.pageSize, this.treeDeptId).then(res => {
  637. const data = res.data.data;
  638. this.page.total = data.total;
  639. this.goodsList = data.records;
  640. this.loading = false;
  641. if (this.page.total) {
  642. this.goodsOption.height = window.innerHeight - 550;
  643. } else {
  644. this.goodsOption.height = window.innerHeight - 475;
  645. }
  646. });
  647. },
  648. //商品明细导入
  649. newDetails() {
  650. this.dialogVisible = !this.dialogVisible;
  651. },
  652. getDetail(id) {
  653. detail(id).then(res => {
  654. this.form = res.data.data;
  655. this.data = res.data.data.deliveryItemsList;
  656. this.orderFeesList = res.data.data.deliveryFeesList;
  657. this.orderFilesList = res.data.data.deliveryFilesList;
  658. this.configuration.dicData = this.form.corpName;
  659. });
  660. },
  661. //修改提交触发
  662. editCustomer(status) {
  663. this.$refs["form"].validate((valid, done) => {
  664. done();
  665. if (valid) {
  666. let orderFeesList = this.$refs.feeInfo.submitData();
  667. for (let i = 0; i < orderFeesList.length; i++) {
  668. if (orderFeesList[i].corpId == null) {
  669. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  670. }
  671. if (orderFeesList[i].price == 0) {
  672. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  673. }
  674. if (orderFeesList[i].actualQuantity == 0) {
  675. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  676. }
  677. }
  678. const orderFilesList = this.$refs.uploadFile.submitData();
  679. if (status == "submit") {
  680. submit({
  681. ...this.form,
  682. deliveryItemsList: this.data,
  683. deliveryFeesList: orderFeesList,
  684. deliveryFilesList: orderFilesList
  685. }).then(res => {
  686. this.form = res.data.data;
  687. this.data = res.data.data.deliveryItemsList;
  688. this.orderFeesList = res.data.data.deliveryFeesList;
  689. this.orderFilesList = res.data.data.deliveryFilesList;
  690. this.configuration.dicData = this.form.corpName;
  691. this.$message.success(this.form.id ? "修改成功" : "提交成功");
  692. });
  693. }
  694. if (status == "save") {
  695. this.$confirm("此操作将确认收货, 是否继续?", "提示", {
  696. confirmButtonText: "确定",
  697. cancelButtonText: "取消",
  698. type: "warning"
  699. }).then(() => {
  700. save({
  701. ...this.form,
  702. deliveryItemsList: this.data,
  703. deliveryFeesList: orderFeesList,
  704. deliveryFilesList: orderFilesList
  705. }).then(res => {
  706. this.form = res.data.data;
  707. this.data = res.data.data.deliveryItemsList;
  708. this.orderFeesList = res.data.data.deliveryFeesList;
  709. this.orderFilesList = res.data.data.deliveryFilesList;
  710. this.configuration.dicData = this.form.corpName;
  711. this.$message.success("提交成功");
  712. });
  713. });
  714. }
  715. if (status == "repeal") {
  716. this.$confirm("此操作将撤销收货, 是否继续?", "提示", {
  717. confirmButtonText: "确定",
  718. cancelButtonText: "取消",
  719. type: "warning"
  720. }).then(() => {
  721. repeal({
  722. ...this.form,
  723. deliveryItemsList: this.data,
  724. deliveryFeesList: orderFeesList,
  725. deliveryFilesList: orderFilesList
  726. }).then(res => {
  727. this.form = res.data.data;
  728. this.data = res.data.data.deliveryItemsList;
  729. this.orderFeesList = res.data.data.deliveryFeesList;
  730. this.orderFilesList = res.data.data.deliveryFilesList;
  731. this.configuration.dicData = this.form.corpName;
  732. this.$message.success("撤销成功");
  733. });
  734. });
  735. }
  736. } else {
  737. return false;
  738. }
  739. });
  740. },
  741. //返回列表
  742. backToList() {
  743. this.$emit("goBack");
  744. },
  745. openReport() {
  746. this.switchDialog = !this.switchDialog;
  747. },
  748. onClose(val) {
  749. this.switchDialog = val;
  750. },
  751. summaryMethod({ columns, data }) {
  752. const sums = [];
  753. if (columns.length > 0) {
  754. columns.forEach((item, index) => {
  755. sums[0] = "合计";
  756. if (
  757. item.property == "actualQuantity" ||
  758. item.property == "contractAmount"
  759. ) {
  760. let qtySum = 0;
  761. let amountSum = 0;
  762. data.forEach(e => {
  763. qtySum = _.add(qtySum, Number(e.actualQuantity));
  764. amountSum = _.add(amountSum, Number(e.contractAmount));
  765. });
  766. //数量总计
  767. if (item.property == "actualQuantity") {
  768. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  769. }
  770. //金额总计
  771. if (item.property == "contractAmount") {
  772. sums[index] = micrometerFormat(amountSum);
  773. }
  774. }
  775. });
  776. }
  777. return sums;
  778. },
  779. async saveColumn() {
  780. const inSave = await this.saveColumnData(
  781. this.getColumnName(7),
  782. this.tableOption
  783. );
  784. if (inSave) {
  785. this.$message.success("保存成功");
  786. //关闭窗口
  787. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  788. }
  789. },
  790. async saveGoodsColumn() {
  791. const inSave = await this.saveColumnData(
  792. this.getColumnName(29),
  793. this.goodsOption
  794. );
  795. if (inSave) {
  796. this.$message.success("保存成功");
  797. //关闭窗口
  798. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  799. }
  800. }
  801. }
  802. };
  803. </script>
  804. <style lang="scss" scoped>
  805. .customer-head {
  806. position: fixed;
  807. top: 105px;
  808. width: 100%;
  809. margin-left: -10px;
  810. height: 62px;
  811. background: #ffffff;
  812. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  813. z-index: 999;
  814. }
  815. .customer-back {
  816. cursor: pointer;
  817. line-height: 62px;
  818. font-size: 16px;
  819. color: #323233;
  820. font-weight: 400;
  821. }
  822. .back-icon {
  823. line-height: 64px;
  824. font-size: 20px;
  825. margin-right: 8px;
  826. }
  827. .receipt-customer-btn {
  828. position: fixed;
  829. right: 244px;
  830. top: 115px;
  831. }
  832. .copy-customer-btn {
  833. position: fixed;
  834. right: 140px;
  835. top: 115px;
  836. }
  837. .add-customer-btn {
  838. position: fixed;
  839. right: 36px;
  840. top: 115px;
  841. }
  842. ::v-deep .el-form-item {
  843. margin-bottom: 8px;
  844. }
  845. ::v-deep .el-form-item__error {
  846. display: none;
  847. }
  848. ::v-deep .select-component {
  849. display: flex;
  850. }
  851. </style>