detailsPage.vue 39 KB

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