detailsPage.vue 37 KB

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