detailsPage.vue 39 KB

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