detailsPage.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  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. <div class="add-customer-btn" v-if="showBut">
  15. <el-button
  16. type="primary"
  17. size="small"
  18. v-if="detailData.status == 1"
  19. class="el-button--small-yh "
  20. @click.stop="openEdit"
  21. >编辑
  22. </el-button>
  23. <!-- <el-button-->
  24. <!-- type="info"-->
  25. <!-- @click.stop="editCustomer('save')"-->
  26. <!-- v-if="form.deliveryStatus == '录入'"-->
  27. <!-- size="small"-->
  28. <!-- >确认发货</el-button-->
  29. <!-- >-->
  30. <!-- <el-button-->
  31. <!-- type="info"-->
  32. <!-- @click.stop="editCustomer('repeal')"-->
  33. <!-- v-if="form.deliveryStatus != '录入'"-->
  34. <!-- size="small"-->
  35. <!-- >撤销发货</el-button-->
  36. <!-- >-->
  37. <!-- <el-button-->
  38. <!-- type="success"-->
  39. <!-- :disabled="!form.id"-->
  40. <!-- size="small"-->
  41. <!-- @click="copyDoc"-->
  42. <!-- >-->
  43. <!-- 复制单据-->
  44. <!-- </el-button>-->
  45. <el-button
  46. type="primary"
  47. :disabled="disabled"
  48. @click="editCustomer('submit')"
  49. :loading="subLoading"
  50. v-if="detailData.status != 1"
  51. size="small"
  52. >保存数据
  53. </el-button>
  54. </div>
  55. </div>
  56. <div class="customer-main">
  57. <trade-card title="基础信息">
  58. <avue-form
  59. ref="form"
  60. class="trading-form"
  61. v-model="form"
  62. :option="option"
  63. >
  64. <template slot="corpId">
  65. <crop-select
  66. v-model="form.corpId"
  67. corpType="KH"
  68. :disabled="detailData.status == 1"
  69. ></crop-select>
  70. </template>
  71. <template slot="storageId">
  72. <warehouse-select
  73. v-model="form.storageId"
  74. :configuration="configuration2"
  75. :disabled="detailData.status == 1"
  76. ></warehouse-select>
  77. </template>
  78. </avue-form>
  79. </trade-card>
  80. <trade-card title="商品信息">
  81. <avue-crud
  82. ref="crud"
  83. :data="data"
  84. :option="tableOption"
  85. @row-del="rowDel"
  86. @saveColumn="saveColumn"
  87. @resetColumn="resetColumn"
  88. :summary-method="summaryMethod"
  89. :cell-style="cellStyle"
  90. >
  91. <template slot="headerSerial">
  92. <el-button
  93. type="primary"
  94. icon="el-icon-plus"
  95. size="mini"
  96. @click.stop="addRow"
  97. :disabled="detailData.status == 1"
  98. circle
  99. ></el-button>
  100. </template>
  101. <template slot="menuLeft">
  102. <el-button
  103. type="primary"
  104. icon="el-icon-plus"
  105. size="small"
  106. @click.stop="newDetails"
  107. :disabled="detailData.status == 1"
  108. >批量录入</el-button
  109. >
  110. <el-button
  111. type="info"
  112. icon="el-icon-printer"
  113. size="small"
  114. @click.stop="openReport()"
  115. >报表打印</el-button
  116. >
  117. <el-button type="info" size="small" :disabled="!form.id || form.customsStatus" @click.native="dialog = true;fudaSatus = 1"
  118. >已报关</el-button>
  119. <el-button type="info" size="small" :disabled="!form.id || form.shippingStatus" @click.native="dialog = true;fudaSatus = 2"
  120. >已出运</el-button>
  121. <el-button type="info" size="small" :disabled="!form.id || form.documentaryStatus != '跟单中'" @click.native="dialog = true;fudaSatus = 3"
  122. >已完成</el-button>
  123. </template>
  124. <template slot-scope="{ row }" slot="corpId">
  125. {{ row.corpsName }}
  126. </template>
  127. <template slot="itemType" slot-scope="{ row }">
  128. <el-select
  129. v-if="row.$cellEdit"
  130. v-model="row.itemType"
  131. filterable
  132. allow-create
  133. default-first-option
  134. placeholder="请输入"
  135. @focus="itemTypeFocus(row)"
  136. >
  137. <el-option
  138. v-for="(item, index) in itemtypeList"
  139. :key="index"
  140. :label="item.value"
  141. :value="item.value"
  142. >
  143. </el-option>
  144. </el-select>
  145. <span v-else>{{ row.itemType }}</span>
  146. </template>
  147. <template slot="cname" slot-scope="{ row, index }">
  148. <el-button
  149. size="small"
  150. type="text"
  151. @click="rePick(row, index)"
  152. :disabled="disabled"
  153. class="picker"
  154. style="padding:4px 10px;float:left"
  155. >选择</el-button
  156. >
  157. <span> {{ row.cname }}</span>
  158. </template>
  159. <template slot="taxRate" slot-scope="{ row }">
  160. <el-input
  161. v-if="row.$cellEdit"
  162. size="mini"
  163. v-model="row.taxRate"
  164. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  165. @change="taxRateChange(row)"
  166. placeholder="请输入"
  167. />
  168. <span v-else>{{ row.taxRate }}</span>
  169. </template>
  170. <template slot="menu" slot-scope="{ row, index }">
  171. <el-button
  172. size="small"
  173. icon="el-icon-edit"
  174. type="text"
  175. @click="rowCell(row, index)"
  176. :disabled="disabled"
  177. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  178. >
  179. <el-button
  180. size="small"
  181. icon="el-icon-edit"
  182. type="text"
  183. @click="rowDel(row)"
  184. >删 除</el-button
  185. >
  186. </template>
  187. <template slot="price" slot-scope="{ row }">
  188. <el-input
  189. v-if="row.$cellEdit"
  190. v-model="row.price"
  191. size="small"
  192. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  193. @change="priceChange(row)"
  194. ></el-input>
  195. <span v-else>{{ row.price }}</span>
  196. </template>
  197. <template slot="actualQuantity" slot-scope="{ row }">
  198. <el-input
  199. v-if="row.$cellEdit"
  200. v-model="row.actualQuantity"
  201. size="small"
  202. oninput='this.value=this.value.replace(/[^(\d)]/g,"")'
  203. @change="quantityChange(row)"
  204. ></el-input>
  205. <span v-else>{{ row.actualQuantity | IntegerFormat }}</span>
  206. </template>
  207. </avue-crud>
  208. </trade-card>
  209. <fee-info
  210. ref="feeInfo"
  211. :orderFeesList="orderFeesList"
  212. :disabled="detailData.status == 1"
  213. feeUrl="/blade-deliver-goods/deliveryfees/update"
  214. />
  215. <containerTitle title="合同附件"></containerTitle>
  216. <c-upload
  217. typeUpload="CK"
  218. :data="orderFilesList"
  219. :disabled="detailData.status == 1"
  220. :enumerationValue="76"
  221. deleteUrl="/blade-deliver-goods/deliveryfiles/update"
  222. />
  223. </div>
  224. <el-dialog
  225. title="导入商品"
  226. append-to-body
  227. class="el-dialogDeep"
  228. :visible.sync="dialogVisible"
  229. width="80%"
  230. :close-on-click-modal="false"
  231. :destroy-on-close="true"
  232. :close-on-press-escape="false"
  233. @close="closeGoods"
  234. top="5vh"
  235. v-dialog-drag
  236. >
  237. <span>
  238. <el-row>
  239. <el-col :span="4">
  240. <div>
  241. <el-scrollbar>
  242. <basic-container>
  243. <avue-tree
  244. :option="treeOption"
  245. @node-click="nodeClick"
  246. :style="treeStyle"
  247. />
  248. </basic-container>
  249. </el-scrollbar>
  250. </div>
  251. </el-col>
  252. <el-col :span="20">
  253. <avue-crud
  254. :option="goodsOption"
  255. :table-loading="loading"
  256. :data="goodsList"
  257. ref="goodsCrud"
  258. :search.sync="search"
  259. @search-change="searchChange"
  260. @refresh-change="refreshChange"
  261. @selection-change="selectionChange"
  262. @row-click="rowClick"
  263. :page.sync="page"
  264. @on-load="onLoad"
  265. @saveColumn="saveGoodsColumn"
  266. @resetColumn="resetGoodsColumn"
  267. :cell-style="cellStyle"
  268. ></avue-crud>
  269. </el-col>
  270. </el-row>
  271. </span>
  272. <span slot="footer" class="dialog-footer">
  273. <el-button @click="dialogVisible = false">取 消</el-button>
  274. <el-button
  275. type="primary"
  276. @click="importGoods"
  277. :disabled="selectionList.length == 0"
  278. >导入</el-button
  279. >
  280. </span>
  281. </el-dialog>
  282. <report-dialog
  283. :switchDialog="switchDialog"
  284. :reportId="form.id"
  285. reportName="客户询价"
  286. @onClose="onClose()"
  287. ></report-dialog>
  288. <el-dialog
  289. title="选择日期"
  290. :visible.sync="dialog"
  291. v-if="dialog"
  292. width="30%"
  293. append-to-body>
  294. <span>
  295. <el-date-picker
  296. v-model="pickerValue"
  297. type="date"
  298. style="width: 100%;"
  299. size="small"
  300. value-format="yyyy-MM-dd HH:ss:mm"
  301. placeholder="选择日期">
  302. </el-date-picker>
  303. </span>
  304. <span slot="footer" class="dialog-footer">
  305. <el-button @click="dialog = false;pickerValue = ''">取 消</el-button>
  306. <el-button type="primary" @click="PSModification(fudaSatus)">确 定</el-button>
  307. </span>
  308. </el-dialog>
  309. </div>
  310. </template>
  311. <script>
  312. import tableOption from "./config/customerContact.json";
  313. import goodsOption from "./config/commodity.json";
  314. import feeInfo from "@/components/fee-info/main";
  315. import {
  316. detail,
  317. submit,
  318. delItem,
  319. getDeptLazyTree,
  320. getGoods,
  321. getSpecification,
  322. save,
  323. repeal, purchaseStatusUpdate
  324. } from "@/api/basicData/invoice";
  325. import uploadFile from "@/components/upload-file/main";
  326. import reportDialog from "@/components/report-dialog/main";
  327. import { micrometerFormat, IntegerFormat } from "@/util/validate";
  328. import { contrastObj, contrastList } from "@/util/contrastData";
  329. import _ from "lodash";
  330. export default {
  331. name: "detailsPageEdit",
  332. data() {
  333. return {
  334. fudaSatus:0,
  335. dialog:false,
  336. pickerValue:'',
  337. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  338. configuration2: {
  339. multipleChoices: false,
  340. multiple: false,
  341. collapseTags: false,
  342. placeholder: "请点击右边按钮选择",
  343. dicData: []
  344. },
  345. switchDialog: false,
  346. form: {
  347. deliveryStatus: "录入"
  348. },
  349. disabled: false,
  350. dialogVisible: false,
  351. tableOption: {},
  352. option: {
  353. menuBtn: false,
  354. labelWidth: 100,
  355. disabled: false,
  356. column: [
  357. {
  358. label: "客户名称",
  359. prop: "corpId",
  360. rules: [
  361. {
  362. required: true,
  363. message: "",
  364. trigger: "blur"
  365. }
  366. ],
  367. span: 16,
  368. slot: true
  369. },
  370. {
  371. label: "系统号",
  372. prop: "sysNo",
  373. span: 8
  374. },
  375. {
  376. label: "销售订单号",
  377. prop: "srcOrderNo",
  378. span: 8
  379. },
  380. {
  381. label: "订单状态",
  382. prop: "deliveryStatus",
  383. span: 8,
  384. type: "select",
  385. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  386. props: {
  387. label: "dictValue",
  388. value: "dictValue"
  389. },
  390. disabled: true,
  391. }, {
  392. label: "提单号",
  393. prop: "billLadingNo",
  394. span: 8,
  395. rules: [
  396. {
  397. required: true,
  398. message: "",
  399. trigger: "blur"
  400. }
  401. ]
  402. },
  403. {
  404. label: "客户详情",
  405. prop: "clientMessage",
  406. span: 8,
  407. disabled: true,
  408. },{
  409. label: "订单日期",
  410. prop: "businesDate",
  411. span: 8,
  412. disabled: true,
  413. },{
  414. label: "计划交货日期",
  415. prop: "plannedDeliveryDate",
  416. span: 8,
  417. disabled: true,
  418. },{
  419. label: "起运港",
  420. prop: "portOfLoad",
  421. span: 8,
  422. disabled: true,
  423. },{
  424. label: "目的港",
  425. prop: "portOfDestination",
  426. span: 8,
  427. disabled: true,
  428. },{
  429. label: "运输方式",
  430. prop: "transport",
  431. span: 8,
  432. disabled: true,
  433. },{
  434. label: "日期条款",
  435. prop: "dateClause",
  436. span: 8,
  437. disabled: true,
  438. },{
  439. label: "日期说明",
  440. prop: "dateDesc",
  441. span: 8,
  442. disabled: true,
  443. },{
  444. label: "货物类型",
  445. prop: "cargoType",
  446. span: 8,
  447. disabled: true,
  448. },{
  449. label: "价格条款",
  450. prop: "priceTerms",
  451. span: 8,
  452. disabled: true,
  453. },{
  454. label: "价格条款描述",
  455. prop: "priceTermsDescription",
  456. span: 8,
  457. disabled: true,
  458. },{
  459. label: "付款方式",
  460. prop: "paymentType",
  461. span: 8,
  462. disabled: true,
  463. },{
  464. label: "收付款方式描述",
  465. prop: "paymentTypeDescription",
  466. span: 8,
  467. disabled: true,
  468. },{
  469. label: "币别",
  470. prop: "currency",
  471. span: 8,
  472. disabled: true,
  473. },{
  474. label: "汇率",
  475. prop: "exchangeRate",
  476. span: 8,
  477. disabled: true,
  478. },{
  479. label: "采购备注",
  480. prop: "purchaseRemark",
  481. type: "textarea",
  482. minRows: 2,
  483. disabled: true,
  484. span: 24
  485. },{
  486. label: "船务备注",
  487. prop: "shippingRemark",
  488. type: "textarea",
  489. minRows: 2,
  490. disabled: true,
  491. span: 24
  492. },
  493. {
  494. label: "备注",
  495. prop: "deliveryRemarks",
  496. type: "textarea",
  497. minRows: 2,
  498. span: 24
  499. }
  500. ]
  501. },
  502. treeOption: {
  503. nodeKey: "id",
  504. lazy: true,
  505. treeLoad: function(node, resolve) {
  506. const parentId = node.level === 0 ? 0 : node.data.id;
  507. getDeptLazyTree(parentId).then(res => {
  508. resolve(
  509. res.data.data.map(item => {
  510. return {
  511. ...item,
  512. leaf: !item.hasChildren
  513. };
  514. })
  515. );
  516. });
  517. },
  518. addBtn: false,
  519. menu: false,
  520. size: "small",
  521. props: {
  522. label: "title",
  523. value: "value",
  524. children: "children"
  525. }
  526. },
  527. page: {
  528. pageSize: 10,
  529. currentPage: 1,
  530. total: 0
  531. },
  532. goodsOption: {},
  533. data: [],
  534. goodsList: [],
  535. selectionList: [],
  536. treeDeptId: null,
  537. orderFeesList: [],
  538. orderFilesList: [],
  539. itemtypeList: [],
  540. oldform: {
  541. deliveryStatus: "录入"
  542. },
  543. olddata: [],
  544. oldorderFeesList: [],
  545. oldorderFilesList: [],
  546. reData: null,
  547. loading: false,
  548. subLoading: false,
  549. pageLoading: false,
  550. showBut: true,
  551. search: {}
  552. };
  553. },
  554. props: {
  555. detailData: {
  556. type: Object
  557. }
  558. },
  559. components: {
  560. reportDialog,
  561. feeInfo,
  562. uploadFile
  563. },
  564. async created() {
  565. if (this.$route.query.pageType == "Generate") {
  566. this.getGenerate(JSON.parse(this.$route.query.data));
  567. }
  568. if (this.detailData.id) {
  569. this.getDetail(this.detailData.id);
  570. }
  571. this.tableOption = await this.getColumnData(
  572. this.getColumnName(9),
  573. tableOption
  574. );
  575. this.goodsOption = await this.getColumnData(
  576. this.getColumnName(30),
  577. goodsOption
  578. );
  579. if (this.detailData.status == 1) {
  580. this.option.disabled = true;
  581. }
  582. this.getWorkDicts("product_properties").then(res => {
  583. this.findObject(this.tableOption.column, "itemProp").dicData =
  584. res.data.data;
  585. });
  586. this.getWorkDicts("unit").then(res => {
  587. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  588. });
  589. },
  590. filters: {
  591. IntegerFormat(num) {
  592. return IntegerFormat(num);
  593. }
  594. },
  595. methods: {
  596. cellStyle() {
  597. return "padding:0;height:40px;";
  598. },
  599. copyDoc() {
  600. this.$emit("copyOrder", this.form.id);
  601. },
  602. PSModification(type){
  603. if (!this.pickerValue)return this.$message.error("请选择日期")
  604. const loading = this.$loading({
  605. lock: true,
  606. text: '操作中',
  607. spinner: 'el-icon-loading',
  608. background: 'rgba(255,255,255,0.7)'
  609. });
  610. purchaseStatusUpdate({
  611. id:this.form.id,
  612. documentaryStatusType:type,
  613. documentaryDate:this.pickerValue,
  614. customsDate:this.pickerValue,
  615. shippingDate:this.pickerValue
  616. }).then(res=>{
  617. loading.close();
  618. this.$message.success("操作成功")
  619. this.pickerValue = ''
  620. this.dialog = false
  621. this.getDetail(this.form.id);
  622. }).catch(err=>{
  623. loading.close();
  624. this.pickerValue = ''
  625. this.dialog = false
  626. })
  627. },
  628. rePick(row, index) {
  629. this.reData = {
  630. ...row,
  631. index: index
  632. };
  633. this.newDetails();
  634. },
  635. itemTypeFocus(row) {
  636. this.itemtypeList = [];
  637. getSpecification({ goodId: row.itemId }).then(res => {
  638. const data = res.data.data;
  639. this.itemtypeList = data.map(item => ({ value: item }));
  640. });
  641. },
  642. //编辑
  643. rowCell(row, index) {
  644. if (row.$cellEdit == true) {
  645. this.$set(row, "$cellEdit", false);
  646. } else {
  647. this.$set(row, "$cellEdit", true);
  648. }
  649. },
  650. priceChange(row) {
  651. console.log(row);
  652. if (!row.price) {
  653. row.price = 0;
  654. } else {
  655. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  656. 2
  657. );
  658. }
  659. },
  660. quantityChange(row) {
  661. if (!row.actualQuantity) {
  662. row.actualQuantity = 0;
  663. } else {
  664. row.contractAmount = _.multiply(row.price, row.actualQuantity).toFixed(
  665. 2
  666. );
  667. }
  668. },
  669. taxRateChange(row) {
  670. if (Number(row.taxRate) >= 100) {
  671. row.taxRate = 0;
  672. this.$message.error("税率不能超过100%");
  673. }
  674. },
  675. rowSave(row) {
  676. console.log(row);
  677. this.$set(row, "$cellEdit", false);
  678. },
  679. rowDel(row) {
  680. this.$confirm("确定删除数据?", {
  681. confirmButtonText: "确定",
  682. cancelButtonText: "取消",
  683. type: "warning"
  684. }).then(() => {
  685. if (row.id) {
  686. delItem(row.id).then(res => {
  687. this.$message({
  688. type: "success",
  689. message: "删除成功!"
  690. });
  691. this.data.splice(row.$index, 1);
  692. });
  693. } else {
  694. this.$message({
  695. type: "success",
  696. message: "删除成功!"
  697. });
  698. this.data.splice(row.$index, 1);
  699. }
  700. });
  701. },
  702. importGoods() {
  703. if (this.reData) {
  704. console.log(this.reData);
  705. if (this.selectionList.length != 1) {
  706. return this.$message.error("重新选择的时候只能选择一条数据");
  707. } else {
  708. this.selectionList.forEach(e => {
  709. this.data.forEach((item, index) => {
  710. if (index == this.reData.index) {
  711. item.itemId = e.id;
  712. item.code = e.code;
  713. item.cname = e.cname;
  714. item.priceCategory = e.goodsTypeName;
  715. item.itemUrl = e.url;
  716. item.itemProp = this.reData.itemProp;
  717. item.productDesc = e.cnameDescription;
  718. item.itemType = this.reData.itemType;
  719. item.tradeTerms = this.reData.tradeTerms;
  720. item.price = this.reData.price;
  721. item.orderQuantity = this.reData.orderQuantity;
  722. item.insurance = this.reData.insurance;
  723. item.freight = this.reData.freight;
  724. item.discount = this.reData.discount;
  725. item.amount = this.reData.amount;
  726. item.taxRate = this.reData.taxRate;
  727. item.unit = e.unit;
  728. item.remarks = this.reData.remarks;
  729. item.$cellEdit = true;
  730. }
  731. });
  732. });
  733. }
  734. } else {
  735. this.selectionList.forEach(e => {
  736. this.data.push({
  737. itemId: e.id,
  738. code: e.code,
  739. cname: e.cname,
  740. priceCategory: e.goodsTypeName,
  741. itemUrl: e.url,
  742. itemProp: null,
  743. productDesc: e.cnameDescription,
  744. itemType: null,
  745. tradeTerms: null,
  746. price: 0,
  747. orderQuantity: 0,
  748. insurance: 0,
  749. freight: 0,
  750. discount: null,
  751. amount: 0,
  752. taxRate: 0,
  753. unit: e.unit,
  754. remarks: null,
  755. $cellEdit: true
  756. });
  757. });
  758. }
  759. this.dialogVisible = false;
  760. },
  761. refreshChange() {
  762. this.onLoad(this.page);
  763. },
  764. addRow() {
  765. this.data.push({ $cellEdit: true });
  766. },
  767. closeGoods() {
  768. this.selectionList = [];
  769. this.treeDeptId = "";
  770. this.reData = null;
  771. },
  772. selectionChange(list) {
  773. this.selectionList = list;
  774. },
  775. rowClick(row) {
  776. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  777. },
  778. nodeClick(data) {
  779. this.treeDeptId = data.id;
  780. this.page.currentPage = 1;
  781. this.onLoad(this.page);
  782. },
  783. searchChange(params, done) {
  784. this.search = this.deepClone(params);
  785. this.onLoad(this.page, params);
  786. done();
  787. },
  788. //费用查询
  789. onLoad(page, params = {}) {
  790. let obj = this.deepClone(Object.assign(params, this.search));
  791. this.loading = true;
  792. getGoods(page.currentPage, page.pageSize, this.treeDeptId, obj).then(
  793. res => {
  794. const data = res.data.data;
  795. this.page.total = data.total;
  796. this.goodsList = data.records;
  797. this.loading = false;
  798. if (this.page.total) {
  799. this.goodsOption.height = window.innerHeight - 350;
  800. }
  801. }
  802. );
  803. },
  804. //商品明细导入
  805. newDetails() {
  806. this.dialogVisible = !this.dialogVisible;
  807. },
  808. getDetail(id) {
  809. this.loading = true;
  810. this.showBut = false;
  811. this.pageLoading = true;
  812. const loading = this.$loading({
  813. lock: true,
  814. text: '操作中',
  815. spinner: 'el-icon-loading',
  816. background: 'rgba(255,255,255,0.7)'
  817. });
  818. detail(id)
  819. .then(res => {
  820. if (this.detailData.status == "copy") {
  821. delete res.data.data.id;
  822. delete res.data.data.sysNo;
  823. delete res.data.data.orderNo;
  824. delete res.data.data.orgOrderNo;
  825. delete res.data.data.srcOrderNo;
  826. delete res.data.data.createTime;
  827. delete res.data.data.createUser;
  828. delete res.data.data.createUserName;
  829. delete res.data.data.updateTime;
  830. delete res.data.data.updateUser;
  831. delete res.data.data.updateUserName;
  832. delete res.data.data.morderNo;
  833. delete res.data.data.status;
  834. delete res.data.data.ifEnquiry;
  835. delete res.data.data.ifShipping;
  836. res.data.data.orderStatus = "录入";
  837. res.data.data.deliveryItemsList.forEach(e => {
  838. delete e.id;
  839. delete e.pid;
  840. delete e.createTime;
  841. delete e.createUser;
  842. delete e.updateTime;
  843. delete e.updateUser;
  844. delete e.orgOrderNo;
  845. delete e.srcId;
  846. delete e.status;
  847. delete e.isDeleted;
  848. });
  849. res.data.data.deliveryFeesList.forEach(e => {
  850. delete e.id;
  851. delete e.pid;
  852. delete e.createTime;
  853. delete e.createUser;
  854. delete e.updateTime;
  855. delete e.updateUser;
  856. delete e.status;
  857. delete e.isDeleted;
  858. });
  859. res.data.data.deliveryFilesList.forEach(e => {
  860. delete e.id;
  861. delete e.pid;
  862. delete e.createTime;
  863. delete e.createUser;
  864. delete e.updateTime;
  865. delete e.updateUser;
  866. delete e.status;
  867. delete e.isDeleted;
  868. });
  869. }
  870. this.form = res.data.data;
  871. this.data = res.data.data.deliveryItemsList;
  872. this.orderFeesList = res.data.data.deliveryFeesList;
  873. this.orderFilesList = res.data.data.deliveryFilesList;
  874. this.oldform = res.data.data;
  875. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  876. this.oldorderFeesList = this.deepClone(
  877. res.data.data.deliveryFeesList
  878. );
  879. this.oldorderFilesList = this.deepClone(
  880. res.data.data.deliveryFilesList
  881. );
  882. loading.close();
  883. }).finally(() => {
  884. this.loading = false;
  885. this.showBut = true;
  886. this.pageLoading = false;
  887. loading.close();
  888. });
  889. },
  890. getGenerate(data) {
  891. this.form = data;
  892. this.data = data.orderItemsList;
  893. this.orderFeesList = data.deliveryFeesList;
  894. },
  895. //修改提交触发
  896. editCustomer(status, status2) {
  897. this.$refs["form"].validate((valid, done) => {
  898. done();
  899. if (valid) {
  900. let orderFeesList = this.$refs.feeInfo.submitData();
  901. for (let i = 0; i < orderFeesList.length; i++) {
  902. if (orderFeesList[i].corpId == null) {
  903. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  904. }
  905. if (orderFeesList[i].price == 0) {
  906. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  907. }
  908. if (orderFeesList[i].actualQuantity == 0) {
  909. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  910. }
  911. }
  912. this.data.forEach((e, index) => {
  913. e.sort = Number(index) + 1
  914. })
  915. const orderFilesList = this.$refs.uploadFile.submitData();
  916. if (status == "submit") {
  917. this.subLoading = true;
  918. submit({
  919. ...this.form,
  920. deliveryItemsList: this.data,
  921. deliveryFeesList: orderFeesList,
  922. deliveryFilesList: this.orderFilesList
  923. })
  924. .then(res => {
  925. this.$message.success("保存成功");
  926. this.form = res.data.data;
  927. this.data = res.data.data.deliveryItemsList;
  928. this.orderFeesList = res.data.data.deliveryFeesList;
  929. this.orderFilesList = res.data.data.deliveryFilesList;
  930. this.oldform = res.data.data;
  931. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  932. this.oldorderFeesList = this.deepClone(
  933. res.data.data.deliveryFeesList
  934. );
  935. this.oldorderFilesList = this.deepClone(
  936. res.data.data.deliveryFilesList
  937. );
  938. if (status2 == "goBack") {
  939. if (this.form.id) {
  940. this.unLock({
  941. moduleName: "fh",
  942. tableName: "business_order",
  943. billId: this.form.id,
  944. billNo: this.form.orgOrderNo
  945. });
  946. }
  947. this.$emit("goBack");
  948. this.leaveDetailsKey(this.$route.name);
  949. }
  950. })
  951. .finally(() => {
  952. this.subLoading = false;
  953. });
  954. }
  955. if (status == "save") {
  956. this.$confirm("此操作将确认发货, 是否继续?", "提示", {
  957. confirmButtonText: "确定",
  958. cancelButtonText: "取消",
  959. type: "warning"
  960. }).then(() => {
  961. save({
  962. ...this.form,
  963. deliveryItemsList: this.data,
  964. deliveryFeesList: orderFeesList,
  965. deliveryFilesList: this.orderFilesList
  966. }).then(res => {
  967. this.form = res.data.data;
  968. this.data = res.data.data.deliveryItemsList;
  969. this.orderFeesList = res.data.data.deliveryFeesList;
  970. this.orderFilesList = res.data.data.deliveryFilesList;
  971. this.oldform = res.data.data;
  972. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  973. this.oldorderFeesList = this.deepClone(
  974. res.data.data.deliveryFeesList
  975. );
  976. this.oldorderFilesList = this.deepClone(
  977. res.data.data.deliveryFilesList
  978. );
  979. this.$message.success("提交成功");
  980. });
  981. });
  982. }
  983. if (status == "repeal") {
  984. this.$confirm("此操作将撤销发货, 是否继续?", "提示", {
  985. confirmButtonText: "确定",
  986. cancelButtonText: "取消",
  987. type: "warning"
  988. }).then(() => {
  989. repeal({
  990. ...this.form,
  991. deliveryItemsList: this.data,
  992. deliveryFeesList: orderFeesList,
  993. deliveryFilesList: this.orderFilesList
  994. }).then(res => {
  995. this.form = res.data.data;
  996. this.data = res.data.data.deliveryItemsList;
  997. this.orderFeesList = res.data.data.deliveryFeesList;
  998. this.orderFilesList = res.data.data.deliveryFilesList;
  999. this.$message.success("撤销成功");
  1000. this.oldform = res.data.data;
  1001. this.olddata = this.deepClone(res.data.data.deliveryItemsList);
  1002. this.oldorderFeesList = this.deepClone(
  1003. res.data.data.deliveryFeesList
  1004. );
  1005. this.oldorderFilesList = this.deepClone(
  1006. res.data.data.deliveryFilesList
  1007. );
  1008. });
  1009. });
  1010. }
  1011. } else {
  1012. return false;
  1013. }
  1014. });
  1015. },
  1016. //返回列表
  1017. backToList() {
  1018. let orderFeesList = this.$refs.feeInfo.submitData();
  1019. if (
  1020. contrastObj(this.form, this.oldform) ||
  1021. contrastList(this.data, this.olddata) ||
  1022. contrastList(orderFeesList, this.oldorderFeesList) ||
  1023. contrastList(this.orderFilesList, this.oldorderFilesList)
  1024. ) {
  1025. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1026. confirmButtonText: "确定",
  1027. cancelButtonText: "取消",
  1028. type: "warning"
  1029. })
  1030. .then(() => {
  1031. this.editCustomer("submit", "goBack");
  1032. })
  1033. .catch(() => {
  1034. if (this.form.id) {
  1035. this.unLock({
  1036. moduleName: "fh",
  1037. tableName: "business_order",
  1038. billId: this.form.id,
  1039. billNo: this.form.orgOrderNo
  1040. });
  1041. }
  1042. this.$emit("goBack");
  1043. this.leaveDetailsKey(this.$route.name);
  1044. });
  1045. } else {
  1046. if (this.form.id) {
  1047. this.unLock({
  1048. moduleName: "fh",
  1049. tableName: "business_order",
  1050. billId: this.form.id,
  1051. billNo: this.form.orgOrderNo
  1052. });
  1053. }
  1054. this.$emit("goBack");
  1055. this.leaveDetailsKey(this.$route.name);
  1056. }
  1057. },
  1058. openReport() {
  1059. this.switchDialog = !this.switchDialog;
  1060. },
  1061. onClose(val) {
  1062. this.switchDialog = val;
  1063. },
  1064. summaryMethod({ columns, data }) {
  1065. const sums = [];
  1066. if (columns.length > 0) {
  1067. columns.forEach((item, index) => {
  1068. sums[0] = "合计";
  1069. if (
  1070. item.property == "actualQuantity" ||
  1071. item.property == "contractAmount"
  1072. ) {
  1073. let qtySum = 0;
  1074. let amountSum = 0;
  1075. data.forEach(e => {
  1076. qtySum = _.add(qtySum, Number(e.actualQuantity));
  1077. amountSum = _.add(amountSum, Number(e.contractAmount));
  1078. this.form.totalQuantity = qtySum;
  1079. this.form.deliveryAmount = amountSum;
  1080. });
  1081. //数量总计
  1082. if (item.property == "actualQuantity") {
  1083. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  1084. }
  1085. //金额总计
  1086. if (item.property == "contractAmount") {
  1087. sums[index] = micrometerFormat(amountSum);
  1088. }
  1089. }
  1090. });
  1091. }
  1092. return sums;
  1093. },
  1094. openEdit() {
  1095. const data = {
  1096. moduleName: "fh",
  1097. tableName: "business_order",
  1098. billId: this.form.id,
  1099. no: localStorage.getItem("browserID"),
  1100. billNo: this.form.orgOrderNo
  1101. };
  1102. this.inDetailsKey(this.$route.name, {
  1103. moduleName: "fh",
  1104. tableName: "business_order",
  1105. billId: this.form.id,
  1106. billNo: this.form.orgOrderNo
  1107. });
  1108. this.checkLock(data).then(res => {
  1109. if (res.data.code == 200) {
  1110. this.onLock(data).then(res => {
  1111. if (res.data.code == 200) {
  1112. this.detailData.status = 2;
  1113. this.option = this.$options.data().option;
  1114. this.$refs.crud.refreshTable();
  1115. }
  1116. });
  1117. }
  1118. });
  1119. },
  1120. async saveColumn() {
  1121. const inSave = await this.saveColumnData(
  1122. this.getColumnName(9),
  1123. this.tableOption
  1124. );
  1125. if (inSave) {
  1126. this.$nextTick(() => {
  1127. this.$refs.crud.doLayout();
  1128. });
  1129. this.$message.success("保存成功");
  1130. //关闭窗口
  1131. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1132. }
  1133. },
  1134. async resetColumn() {
  1135. this.tableOption = tableOption;
  1136. const inSave = await this.delColumnData(
  1137. this.getColumnName(9),
  1138. tableOption
  1139. );
  1140. if (inSave) {
  1141. this.$nextTick(() => {
  1142. this.$refs.crud.doLayout();
  1143. });
  1144. this.$message.success("重置成功");
  1145. //关闭窗口
  1146. setTimeout(() => {
  1147. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1148. }, 1000);
  1149. }
  1150. },
  1151. async saveGoodsColumn() {
  1152. const inSave = await this.saveColumnData(
  1153. this.getColumnName(30),
  1154. this.goodsOption
  1155. );
  1156. if (inSave) {
  1157. this.$nextTick(() => {
  1158. this.$refs.goodsCrud.doLayout();
  1159. });
  1160. this.$message.success("保存成功");
  1161. //关闭窗口
  1162. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1163. }
  1164. },
  1165. async resetGoodsColumn() {
  1166. this.goodsOption = goodsOption;
  1167. const inSave = await this.delColumnData(
  1168. this.getColumnName(30),
  1169. goodsOption
  1170. );
  1171. if (inSave) {
  1172. this.$nextTick(() => {
  1173. this.$refs.goodsCrud.doLayout();
  1174. });
  1175. this.$message.success("重置成功");
  1176. //关闭窗口
  1177. setTimeout(() => {
  1178. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1179. }, 1000);
  1180. }
  1181. }
  1182. }
  1183. };
  1184. </script>
  1185. <style lang="scss" scoped>
  1186. .trading-form ::v-deep .el-form-item {
  1187. margin-bottom: 8px !important;
  1188. }
  1189. ::v-deep .el-form-item__error {
  1190. display: none !important;
  1191. }
  1192. ::v-deep .select-component {
  1193. display: flex !important;
  1194. }
  1195. </style>