detailsPage.vue 37 KB

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