detailsPage.vue 39 KB

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