detailsPage.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button
  6. type="danger"
  7. style="border: none;background: none;color: red"
  8. icon="el-icon-arrow-left"
  9. @click="backToList"
  10. >返回列表
  11. </el-button>
  12. </div>
  13. <div class="add-customer-btn" v-if="showBut">
  14. <el-button type="info" @click="saveSell" size="small"
  15. >生成采购单</el-button
  16. >
  17. <el-button type="success" disabled size="small">
  18. 复制新单
  19. </el-button>
  20. <el-button
  21. type="primary"
  22. :disabled="disabled"
  23. @click="editCustomer"
  24. :loading="subLoading"
  25. v-if="detailData.status != 1"
  26. size="small"
  27. >{{ form.id ? "确认修改" : "确认新增" }}
  28. </el-button>
  29. </div>
  30. </div>
  31. <div class="customer-main">
  32. <containerTitle title="基础信息"></containerTitle>
  33. <basic-container>
  34. <avue-form
  35. ref="form"
  36. class="trading-form"
  37. v-model="form"
  38. :option="option"
  39. >
  40. <template slot="portOfLoad">
  41. <port-info
  42. v-model="form.portOfLoad"
  43. :disabled="detailData.status == 1"
  44. />
  45. </template>
  46. <template slot="portOfDestination">
  47. <port-info
  48. v-model="form.portOfDestination"
  49. :disabled="detailData.status == 1"
  50. />
  51. </template>
  52. <template slot="corpId">
  53. <crop-select
  54. v-model="form.corpId"
  55. @getCorpData="getCorpData"
  56. corpType="KH"
  57. :disabled="detailData.status == 1"
  58. ></crop-select>
  59. </template>
  60. <template slot="belongToCorpId">
  61. <crop-select
  62. v-model="form.belongToCorpId"
  63. corpType="GS"
  64. :disabled="detailData.status == 1"
  65. ></crop-select>
  66. </template>
  67. <template slot="priceTerms">
  68. <el-select
  69. size="small"
  70. v-model="form.priceTerms"
  71. placeholder="请选择"
  72. @change="priceTermsChange"
  73. clearable
  74. >
  75. <el-option
  76. v-for="item in priceTermsList"
  77. :key="item.id"
  78. :label="item.dictValue"
  79. :value="item.dictValue"
  80. >
  81. </el-option>
  82. </el-select>
  83. </template>
  84. <template slot="paymentType">
  85. <el-select
  86. size="small"
  87. v-model="form.paymentType"
  88. placeholder="请选择"
  89. @change="paymentTypeChange"
  90. clearable
  91. >
  92. <el-option
  93. v-for="item in paymentTermList"
  94. :key="item.id"
  95. :label="item.dictValue"
  96. :value="item.dictValue"
  97. >
  98. </el-option>
  99. </el-select>
  100. </template>
  101. <template slot="currency">
  102. <el-select
  103. size="small"
  104. v-model="form.currency"
  105. placeholder="请选择"
  106. @change="currencyChange"
  107. >
  108. <el-option
  109. v-for="item in currencyList"
  110. :key="item.id"
  111. :label="item.dictValue"
  112. :value="item.dictValue"
  113. >
  114. </el-option>
  115. </el-select>
  116. </template>
  117. <template slot="exchangeRate">
  118. <el-input
  119. size="small"
  120. v-model="form.exchangeRate"
  121. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  122. placeholder="请输入 汇率"
  123. :disabled="detailData.status == 1"
  124. @change="exchangeRateChange"
  125. />
  126. </template>
  127. <template slot="boxNumber">
  128. <el-input
  129. size="mini"
  130. v-model="form.boxNumber"
  131. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  132. placeholder="请输入 起订量"
  133. :disabled="detailData.status == 1"
  134. />
  135. </template>
  136. <template slot="minOrder">
  137. <el-input
  138. size="mini"
  139. v-model="form.minOrder"
  140. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  141. placeholder="请输入 起订量"
  142. :disabled="detailData.status == 1"
  143. />
  144. </template>
  145. <template slot="predictOceanFreight">
  146. <el-input
  147. size="mini"
  148. v-model="form.predictOceanFreight"
  149. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  150. placeholder="请输入 预计海运费"
  151. :disabled="detailData.status == 1"
  152. />
  153. </template>
  154. <template slot="referenceOceanFreight">
  155. <el-input
  156. size="mini"
  157. v-model="form.referenceOceanFreight"
  158. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  159. placeholder="请输入 参考海运费"
  160. :disabled="detailData.status == 1"
  161. />
  162. </template>
  163. <template slot="oceanFreight">
  164. <el-input
  165. size="mini"
  166. v-model="form.oceanFreight"
  167. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  168. placeholder="请输入 实际海运费"
  169. :disabled="detailData.status == 1"
  170. />
  171. </template>
  172. <template slot="orderNo">
  173. <el-input
  174. size="mini"
  175. v-model="form.orderNo"
  176. oninput="this.value=this.value.toUpperCase()"
  177. placeholder="请输入 "
  178. :disabled="detailData.status == 1"
  179. />
  180. </template>
  181. </avue-form>
  182. </basic-container>
  183. <div>
  184. <containerTitle title="商品信息"></containerTitle>
  185. <basic-container>
  186. <avue-crud
  187. ref="crud"
  188. :data="data"
  189. :option="tableOption"
  190. @row-del="rowDel"
  191. @selection-change="goodsSelectionChange"
  192. @saveColumn="saveColumn"
  193. @resetColumn="resetColumn"
  194. :summary-method="summaryMethod"
  195. :cell-style="cellStyle"
  196. >
  197. <template slot="cname" slot-scope="{ row, index }">
  198. <span v-if="row.$cellEdit" style="display:flex">
  199. <el-select
  200. v-model="row.cname"
  201. placeholder="请选择"
  202. size="small"
  203. style="width:60%"
  204. @change="cnameChange(row, index)"
  205. >
  206. <el-option
  207. v-for="item in goodsoptions"
  208. :key="item.id"
  209. :label="item.cname"
  210. :value="item.cname"
  211. >
  212. </el-option>
  213. </el-select>
  214. <el-button
  215. icon="el-icon-search"
  216. size="small"
  217. @click="rePick(row, index)"
  218. ></el-button>
  219. </span>
  220. <span v-else> {{ row.cname }}</span>
  221. </template>
  222. <template slot="partsDescribe" slot-scope="{ row, index }">
  223. <span v-if="row.$cellEdit" style="display:flex">
  224. <el-input
  225. v-model="row.partsDescribe"
  226. :readonly="true"
  227. size="small"
  228. placeholder="请点击右边按钮"
  229. ></el-input>
  230. <el-button
  231. icon="el-icon-edit"
  232. size="mini"
  233. @click="partrePick(row, index)"
  234. ></el-button>
  235. </span>
  236. <span v-else>{{ row.partsDescribe }}</span>
  237. </template>
  238. <template slot="itemType" slot-scope="{ row }">
  239. <el-select
  240. v-if="row.$cellEdit"
  241. v-model="row.itemType"
  242. filterable
  243. allow-create
  244. default-first-option
  245. placeholder="请输入"
  246. size="small"
  247. @focus="itemTypeFocus(row)"
  248. >
  249. <el-option
  250. v-for="(item, index) in itemtypeList"
  251. :key="index"
  252. :label="item.value"
  253. :value="item.value"
  254. >
  255. </el-option>
  256. </el-select>
  257. <span v-else>{{ row.itemType }}</span>
  258. </template>
  259. <template slot="itemProp" slot-scope="{ row, index }">
  260. <span v-if="row.$cellEdit" style="display:flex">
  261. <el-input
  262. v-model="row.itemProp"
  263. :readonly="true"
  264. size="small"
  265. placeholder="请点击右边按钮"
  266. ></el-input>
  267. <el-button
  268. icon="el-icon-edit"
  269. size="mini"
  270. @click="openProperty(row, index)"
  271. ></el-button>
  272. </span>
  273. <span v-else>{{ row.itemProp }}</span>
  274. </template>
  275. <template slot="priorityReferrer" slot-scope="{ row }">
  276. <el-checkbox
  277. :disabled="!row.$cellEdit"
  278. v-model="row.priorityReferrer"
  279. :true-label="1"
  280. :false-label="0"
  281. />
  282. </template>
  283. <template slot="corpId" slot-scope="{ row, index }">
  284. <crop-select
  285. v-show="row.$cellEdit"
  286. v-model="row.corpId"
  287. :cropIndex="index"
  288. @getCorpData="rowCorpData"
  289. corpType="GYS"
  290. ></crop-select>
  291. <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
  292. </template>
  293. <template slot="purchaseAmount" slot-scope="{ row }">
  294. <el-input
  295. v-if="row.$cellEdit"
  296. v-model="row.purchaseAmount"
  297. size="small"
  298. placeholder="请输入"
  299. @change="purchaseAmountChange(row)"
  300. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  301. ></el-input>
  302. <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
  303. </template>
  304. <template slot="price" slot-scope="{ row }">
  305. <el-input
  306. v-if="row.$cellEdit"
  307. v-model="row.price"
  308. size="small"
  309. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  310. @change="priceChange(row)"
  311. ></el-input>
  312. <span v-else>{{ row.price | micrometerFormat }}</span>
  313. </template>
  314. <template slot="amount" slot-scope="{ row }">
  315. <span>{{ row.amount | micrometerFormat }}</span>
  316. </template>
  317. <template slot="orderQuantity" slot-scope="{ row }">
  318. <el-input
  319. v-if="row.$cellEdit"
  320. v-model="row.orderQuantity"
  321. size="small"
  322. oninput='this.value=this.value.replace(/[^(\d)]/g,"")'
  323. @change="priceChange(row)"
  324. ></el-input>
  325. <span v-else>{{ row.orderQuantity }}</span>
  326. </template>
  327. <template slot="discount" slot-scope="{ row }">
  328. <el-input
  329. v-if="row.$cellEdit"
  330. v-model="row.discount"
  331. size="small"
  332. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  333. @change="discountChange(row)"
  334. ></el-input>
  335. <span v-else>{{ row.discount | isDiscount }}</span>
  336. </template>
  337. <template slot="insurance" slot-scope="{ row }">
  338. <el-input
  339. v-if="row.$cellEdit"
  340. v-model="row.insurance"
  341. size="small"
  342. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  343. @change="priceChange(row)"
  344. ></el-input>
  345. <span v-else>{{ row.insurance | micrometerFormat }}</span>
  346. </template>
  347. <template slot="freight" slot-scope="{ row }">
  348. <el-input
  349. v-if="row.$cellEdit"
  350. v-model="row.freight"
  351. size="small"
  352. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  353. @change="priceChange(row)"
  354. ></el-input>
  355. <span v-else>{{ row.freight | micrometerFormat }}</span>
  356. </template>
  357. <template slot="taxRate" slot-scope="{ row }">
  358. <el-input
  359. v-if="row.$cellEdit"
  360. v-model="row.taxRate"
  361. size="small"
  362. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  363. @change="taxRateChange(row)"
  364. ></el-input>
  365. <span v-else>{{ row.taxRate | isPercentage }}</span>
  366. </template>
  367. <template slot="menuLeft">
  368. <el-button
  369. type="primary"
  370. icon="el-icon-plus"
  371. size="small"
  372. @click.stop="newDetails"
  373. :disabled="detailData.status == 1"
  374. >新增明细</el-button
  375. >
  376. <el-button
  377. type="primary"
  378. icon="el-icon-plus"
  379. size="small"
  380. @click.stop="addLibrary"
  381. :disabled="detailData.status == 1"
  382. >出口价格库</el-button
  383. >
  384. <el-button
  385. type="info"
  386. icon="el-icon-printer"
  387. size="small"
  388. @click.stop="openReport()"
  389. >报 表</el-button
  390. >
  391. <el-button
  392. type="warning"
  393. icon="el-icon-plus"
  394. size="small"
  395. :disabled="detailData.status == 1 || orderItemIds.length == 0"
  396. @click="getInvoice"
  397. >生成发货单
  398. </el-button>
  399. </template>
  400. <template slot="menu" slot-scope="{ row, index }">
  401. <el-button
  402. size="small"
  403. icon="el-icon-edit"
  404. type="text"
  405. @click="rowCell(row, index)"
  406. :disabled="disabled"
  407. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  408. >
  409. <el-button
  410. size="small"
  411. icon="el-icon-edit"
  412. type="text"
  413. @click="rowDel(row, index)"
  414. :disabled="detailData.status == 1"
  415. >删 除</el-button
  416. >
  417. </template>
  418. </avue-crud>
  419. </basic-container>
  420. </div>
  421. <fee-info
  422. ref="feeInfo"
  423. :orderFeesList="orderFeesList"
  424. :disabled="detailData.status == 1"
  425. feeUrl="/blade-purchase-sales/orderfees/update"
  426. />
  427. <upload-file
  428. ref="uploadFile"
  429. title="合同附件"
  430. :orderFilesList="orderFilesList"
  431. :disabled="detailData.status == 1"
  432. delUrl="/blade-purchase-sales/orderfiles/update"
  433. />
  434. <div>
  435. <containerTitle title="银行信息"></containerTitle>
  436. <basic-container>
  437. <avue-form
  438. class="trading-form"
  439. ref="form"
  440. v-model="form"
  441. :option="bankOption"
  442. />
  443. </basic-container>
  444. </div>
  445. <div>
  446. <containerTitle title="保险信息"></containerTitle>
  447. <basic-container>
  448. <avue-form
  449. class="trading-form"
  450. ref="form"
  451. v-model="form"
  452. :option="insuranceOption"
  453. />
  454. </basic-container>
  455. </div>
  456. <div>
  457. <containerTitle title="唛头"></containerTitle>
  458. <basic-container>
  459. <avue-form
  460. class="trading-form"
  461. ref="form"
  462. v-model="form"
  463. :option="markOption"
  464. />
  465. </basic-container>
  466. </div>
  467. </div>
  468. <el-dialog
  469. title="导入商品"
  470. append-to-body
  471. class="el-dialogDeep"
  472. :visible.sync="dialogVisible"
  473. width="80%"
  474. :close-on-click-modal="false"
  475. :destroy-on-close="true"
  476. :close-on-press-escape="false"
  477. @close="closeGoods"
  478. top="5vh"
  479. v-dialog-drag
  480. >
  481. <span>
  482. <el-row>
  483. <el-col :span="4">
  484. <div>
  485. <el-scrollbar>
  486. <basic-container>
  487. <avue-tree
  488. :option="treeOption"
  489. @node-click="nodeClick"
  490. :style="treeStyle"
  491. />
  492. </basic-container>
  493. </el-scrollbar>
  494. </div>
  495. </el-col>
  496. <el-col :span="20">
  497. <avue-crud
  498. :option="goodsOption"
  499. :table-loading="loading"
  500. :data="goodsList"
  501. ref="goodsCrud"
  502. @refresh-change="refreshChange"
  503. @selection-change="selectionChange"
  504. @row-click="rowClick"
  505. :page.sync="page"
  506. @on-load="onLoad"
  507. @saveColumn="saveGoodsColumn"
  508. :cell-style="cellStyle"
  509. ></avue-crud>
  510. </el-col>
  511. </el-row>
  512. </span>
  513. <span slot="footer" class="dialog-footer">
  514. <el-button @click="dialogVisible = false">取 消</el-button>
  515. <el-button
  516. type="primary"
  517. @click="importGoods"
  518. :disabled="selectionList.length == 0"
  519. >导入</el-button
  520. >
  521. </span>
  522. </el-dialog>
  523. <report-dialog
  524. :switchDialog="switchDialog"
  525. :reportId="form.id"
  526. reportName="销售明细(E)"
  527. @onClose="onClose()"
  528. ></report-dialog>
  529. <part-dialog
  530. ref="part"
  531. :partList="partList"
  532. @importPart="importPart"
  533. @partClosed="partClosed"
  534. />
  535. <price-library ref="library" @importLibray="importLibray" />
  536. <property-dialog ref="property" @importProperty="importProperty" />
  537. </div>
  538. </template>
  539. <script>
  540. import tableOption from "./config/customerContact.json";
  541. import goodsOption from "./config/commodity.json";
  542. import feeInfo from "@/components/fee-info/main";
  543. import uploadFile from "@/components/upload-file/main";
  544. import {
  545. detail,
  546. submit,
  547. delItem,
  548. getDeptLazyTree,
  549. getGoods,
  550. deliverGoods,
  551. getPorts,
  552. getSpecification,
  553. saveSell
  554. } from "@/api/basicData/salesContract";
  555. import _ from "lodash";
  556. import reportDialog from "@/components/report-dialog/main";
  557. import partDialog from "@/components/part-dialog/main";
  558. import { micrometerFormat } from "@/util/validate";
  559. import { contrastObj, contrastList } from "@/util/contrastData";
  560. import customerDialog from "@/components/customer-dialog/main";
  561. import priceLibrary from "@/components/price-Library/main";
  562. import propertyDialog from "@/components/property-dialog/main";
  563. import { dateFormat } from "@/util/date";
  564. import {
  565. productCal,
  566. sellingCal,
  567. amountCal,
  568. transformCal
  569. } from "@/util/calculate";
  570. export default {
  571. name: "detailsPageEdit",
  572. data() {
  573. return {
  574. oldExchange: null,
  575. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  576. configuration: {
  577. multipleChoices: false,
  578. multiple: false,
  579. collapseTags: false,
  580. placeholder: "请点击右边按钮选择",
  581. dicData: []
  582. },
  583. switchDialog: false,
  584. form: {
  585. orderStatus: "录入",
  586. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  587. currency: "USD"
  588. },
  589. disabled: false,
  590. dialogVisible: false,
  591. tableOption: {},
  592. option: {
  593. menuBtn: false,
  594. labelWidth: 100,
  595. column: [
  596. {
  597. label: "客户名称",
  598. prop: "corpId",
  599. rules: [
  600. {
  601. required: true,
  602. message: "",
  603. trigger: "blur"
  604. }
  605. ],
  606. span: 16,
  607. slot: true
  608. },
  609. {
  610. label: "系统号",
  611. prop: "sysNo",
  612. span: 8,
  613. disabled: true
  614. },
  615. {
  616. label: "联系人",
  617. prop: "corpAttn",
  618. span: 8
  619. },
  620. {
  621. label: "电话",
  622. prop: "corpTel",
  623. span: 8
  624. },
  625. {
  626. label: "订单状态",
  627. prop: "orderStatus",
  628. span: 8,
  629. type: "select",
  630. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  631. props: {
  632. label: "dictValue",
  633. value: "dictValue"
  634. }
  635. },
  636. {
  637. label: "公司主体",
  638. prop: "belongToCorpId",
  639. span: 16,
  640. row: true
  641. },
  642. {
  643. label: "起运港",
  644. prop: "portOfLoad",
  645. span: 8,
  646. type: "select",
  647. filterable: true,
  648. dicData: [],
  649. props: {
  650. label: "name",
  651. value: "name"
  652. }
  653. },
  654. {
  655. label: "目的港",
  656. prop: "portOfDestination",
  657. span: 8,
  658. type: "select",
  659. filterable: true,
  660. dicData: [],
  661. props: {
  662. label: "name",
  663. value: "name"
  664. }
  665. },
  666. {
  667. label: "运输方式",
  668. prop: "transport",
  669. span: 8,
  670. type: "select",
  671. dicUrl: "/api/blade-system/dict-biz/dictionary?code=mode_transport",
  672. props: {
  673. label: "dictValue",
  674. value: "dictValue"
  675. }
  676. },
  677. {
  678. label: "价格条款",
  679. prop: "priceTerms",
  680. span: 8
  681. // type: "select",
  682. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=pricing_terms",
  683. // props: {
  684. // label: "dictValue",
  685. // value: "dictValue"
  686. // }
  687. },
  688. {
  689. label: "条款说明",
  690. prop: "priceTermsDescription",
  691. span: 16
  692. },
  693. {
  694. label: "收款方式",
  695. prop: "paymentType",
  696. span: 8
  697. // type: "select",
  698. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_term",
  699. // props: {
  700. // label: "dictValue",
  701. // value: "dictValue"
  702. // }
  703. },
  704. {
  705. label: "收款说明",
  706. prop: "paymentTypeDescription",
  707. span: 16
  708. },
  709. {
  710. label: "订单日期",
  711. prop: "businesDate",
  712. span: 8,
  713. type: "date",
  714. format: "yyyy-MM-dd",
  715. valueFormat: "yyyy-MM-dd 00:00:00",
  716. rules: [
  717. {
  718. required: true,
  719. message: "",
  720. trigger: "blur"
  721. }
  722. ]
  723. },
  724. {
  725. label: "预交日期",
  726. prop: "plannedDeliveryDate",
  727. span: 8,
  728. type: "date",
  729. format: "yyyy-MM-dd",
  730. valueFormat: "yyyy-MM-dd 00:00:00"
  731. },
  732. {
  733. label: "销售订单号",
  734. prop: "orderNo",
  735. span: 8
  736. },
  737. {
  738. label: "币别",
  739. prop: "currency",
  740. span: 8,
  741. rules: [
  742. {
  743. required: true,
  744. message: "",
  745. trigger: "blur"
  746. }
  747. ]
  748. },
  749. {
  750. label: "汇率",
  751. prop: "exchangeRate",
  752. span: 8,
  753. row: true,
  754. rules: [
  755. {
  756. required: true,
  757. message: "",
  758. trigger: "blur"
  759. }
  760. ]
  761. },
  762. {
  763. label: "箱型",
  764. prop: "boxPile",
  765. type: "select",
  766. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxType",
  767. props: {
  768. label: "dictValue",
  769. value: "dictValue"
  770. },
  771. span: 8
  772. },
  773. {
  774. label: "箱量",
  775. prop: "boxNumber",
  776. span: 8
  777. },
  778. {
  779. label: "起订量",
  780. prop: "minOrder",
  781. span: 8
  782. },
  783. {
  784. label: "预计海运费",
  785. prop: "predictOceanFreight",
  786. span: 8
  787. },
  788. {
  789. label: "参考海运费",
  790. prop: "referenceOceanFreight",
  791. span: 8
  792. },
  793. {
  794. label: "实际海运费",
  795. prop: "oceanFreight",
  796. span: 8
  797. },
  798. {
  799. label: "产品毛利",
  800. prop: "grossProfit",
  801. span: 8,
  802. disabled: true
  803. },
  804. {
  805. label: "产品利率",
  806. prop: "grossProfitRate",
  807. span: 8,
  808. append: "%",
  809. disabled: true
  810. },
  811. {
  812. label: "单票毛利",
  813. prop: "singleTicketMargin",
  814. span: 8,
  815. disabled: true
  816. },
  817. {
  818. label: "备注",
  819. prop: "orderRemark",
  820. type: "textarea",
  821. minRows: 2,
  822. span: 8
  823. },
  824. {
  825. label: "采购备注",
  826. prop: "purchaseRemark",
  827. type: "textarea",
  828. minRows: 2,
  829. span: 8
  830. },
  831. {
  832. label: "船务备注",
  833. prop: "shippingRemark",
  834. type: "textarea",
  835. minRows: 2,
  836. span: 8
  837. }
  838. ]
  839. },
  840. treeOption: {
  841. nodeKey: "id",
  842. lazy: true,
  843. treeLoad: function(node, resolve) {
  844. const parentId = node.level === 0 ? 0 : node.data.id;
  845. getDeptLazyTree(parentId).then(res => {
  846. resolve(
  847. res.data.data.map(item => {
  848. return {
  849. ...item,
  850. leaf: !item.hasChildren
  851. };
  852. })
  853. );
  854. });
  855. },
  856. addBtn: false,
  857. menu: false,
  858. size: "small",
  859. props: {
  860. label: "title",
  861. value: "value",
  862. children: "children"
  863. }
  864. },
  865. bankOption: {
  866. menuBtn: false,
  867. labelWidth: 100,
  868. column: [
  869. {
  870. label: "外币银行",
  871. prop: "banks",
  872. span: 8
  873. },
  874. {
  875. label: "银行信息",
  876. prop: "banksAccountName",
  877. span: 16,
  878. type: "textarea",
  879. minRows: 2
  880. }
  881. ]
  882. },
  883. insuranceOption: {
  884. menuBtn: false,
  885. labelWidth: 100,
  886. column: [
  887. {
  888. label: "保险描述",
  889. prop: "insuranceRemarks",
  890. span: 24,
  891. type: "textarea",
  892. minRows: 2
  893. }
  894. ]
  895. },
  896. markOption: {
  897. menuBtn: false,
  898. labelWidth: 100,
  899. column: [
  900. {
  901. label: "唛头描述",
  902. prop: "marks",
  903. span: 24,
  904. type: "textarea",
  905. minRows: 2
  906. }
  907. ]
  908. },
  909. page: {
  910. pageSize: 10,
  911. currentPage: 1,
  912. total: 0
  913. },
  914. loading: false,
  915. goodsOption: {},
  916. data: [],
  917. goodsList: [],
  918. selectionList: [],
  919. treeDeptId: null,
  920. orderFeesList: [],
  921. orderFilesList: [],
  922. orderItemIds: [],
  923. itemtypeList: [],
  924. reData: null,
  925. oldform: {
  926. orderStatus: "录入",
  927. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  928. currency: "USD"
  929. },
  930. olddata: [],
  931. oldorderFeesList: [],
  932. oldorderFilesList: [],
  933. subLoading: false,
  934. pageLoading: false,
  935. showBut: true,
  936. partType: false,
  937. partList: [],
  938. goodsoptions: [],
  939. priceTermsList: [],
  940. paymentTermList: [],
  941. currencyList: []
  942. };
  943. },
  944. props: {
  945. detailData: {
  946. type: Object
  947. }
  948. },
  949. components: {
  950. reportDialog,
  951. feeInfo,
  952. uploadFile,
  953. customerDialog,
  954. partDialog,
  955. priceLibrary,
  956. propertyDialog
  957. },
  958. async created() {
  959. if (this.detailData.id) {
  960. this.getDetail(this.detailData.id);
  961. }
  962. this.tableOption = await this.getColumnData(
  963. this.getColumnName(5),
  964. tableOption
  965. );
  966. this.goodsOption = await this.getColumnData(
  967. this.getColumnName(28),
  968. goodsOption
  969. );
  970. if (this.detailData.status == 1) {
  971. this.option.disabled = true;
  972. this.bankOption.disabled = true;
  973. this.insuranceOption.disabled = true;
  974. this.markOption.disabled = true;
  975. }
  976. getPorts().then(res => {
  977. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  978. this.findObject(this.option.column, "portOfDestination").dicData =
  979. res.data;
  980. });
  981. this.getWorkDicts("product_properties").then(res => {
  982. this.findObject(this.tableOption.column, "itemProp").dicData =
  983. res.data.data;
  984. });
  985. this.getWorkDicts("unit").then(res => {
  986. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  987. });
  988. this.getWorkDicts("pricing_terms").then(res => {
  989. this.priceTermsList = res.data.data;
  990. });
  991. this.getWorkDicts("payment_term").then(res => {
  992. this.paymentTermList = res.data.data;
  993. });
  994. this.getWorkDicts("currency").then(res => {
  995. this.currencyList = res.data.data;
  996. if (!this.detailData.id) {
  997. this.currencyList.forEach(e => {
  998. if (e.dictValue == "USD") {
  999. this.form.exchangeRate = e.remark;
  1000. this.oldform.exchangeRate = e.remark;
  1001. this.oldExchange = e.remark;
  1002. }
  1003. });
  1004. }
  1005. });
  1006. getGoods(1, 500).then(res => {
  1007. this.goodsoptions = res.data.data.records;
  1008. });
  1009. },
  1010. methods: {
  1011. cellStyle() {
  1012. return "padding:0;height:40px;";
  1013. },
  1014. rowCorpData(row) {
  1015. this.data[row.index].corpName = row.cname;
  1016. },
  1017. priceTermsChange(row) {
  1018. this.priceTermsList.forEach(e => {
  1019. if (row == e.dictValue) {
  1020. this.form.priceTermsDescription = e.remark;
  1021. }
  1022. });
  1023. },
  1024. paymentTypeChange(row) {
  1025. this.paymentTermList.forEach(e => {
  1026. if (row == e.dictValue) {
  1027. this.form.paymentTypeDescription = e.remark;
  1028. }
  1029. });
  1030. },
  1031. getCorpData(row) {
  1032. this.form.coefficient = row.coefficient;
  1033. if (this.data.length > 0) {
  1034. this.data.forEach(e => {
  1035. e.productPrice = productCal(
  1036. e.purchaseAmount,
  1037. e.partsPrice,
  1038. this.form.coefficient
  1039. );
  1040. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  1041. e.amount = amountCal(
  1042. e.price,
  1043. e.orderQuantity,
  1044. e.freight,
  1045. e.insurance,
  1046. e.discount
  1047. );
  1048. });
  1049. }
  1050. },
  1051. cnameChange(row) {
  1052. this.goodsoptions.forEach(e => {
  1053. if (e.cname == row.cname) {
  1054. row.itemId = e.id;
  1055. row.code = e.code;
  1056. row.priceCategory = e.goodsTypeName;
  1057. row.itemUrl = e.url;
  1058. row.itemDescription = e.cnameDescription;
  1059. row.unit = e.unit;
  1060. }
  1061. });
  1062. },
  1063. addLibrary() {
  1064. if (!this.form.corpId) {
  1065. return this.$message.error("请选择客户名称");
  1066. }
  1067. if (!this.form.currency) {
  1068. return this.$message.error("请选择币别");
  1069. }
  1070. this.$refs.library.init(false);
  1071. },
  1072. partrePick(row, index) {
  1073. this.partList = row.partsList;
  1074. this.$refs.part.init(index);
  1075. },
  1076. importPart(rows, sum, index) {
  1077. this.data[index].partsList = rows;
  1078. this.data[index].partsPrice = sum;
  1079. // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
  1080. this.data[index].productPrice = productCal(
  1081. this.data[index].purchaseAmount,
  1082. this.data[index].partsPrice,
  1083. this.form.coefficient
  1084. );
  1085. this.data[index].price = sellingCal(
  1086. this.data[index].productPrice,
  1087. this.form.exchangeRate
  1088. );
  1089. this.data[index].amount = amountCal(
  1090. this.data[index].price,
  1091. this.data[index].orderQuantity,
  1092. this.data[index].freight,
  1093. this.data[index].insurance,
  1094. this.data[index].discount
  1095. );
  1096. const names = [];
  1097. const namePrices = [];
  1098. rows.map(e => {
  1099. names.push(e.goodName);
  1100. namePrices.push(e.goodName + ":" + e.amout);
  1101. });
  1102. this.data[index].partsDescribe = names.join(",");
  1103. this.data[index].partsPriceDescribe = namePrices.join(";");
  1104. this.priceChange(this.data[index]);
  1105. },
  1106. importProperty(row, index) {
  1107. const arr = [];
  1108. for (let key in row) {
  1109. if (row[key]) {
  1110. arr.push(row[key]);
  1111. }
  1112. }
  1113. this.data[index].itemProp = arr.join(",");
  1114. this.data[index].remarksOne = row.remarksOne;
  1115. this.data[index].customTwo = row.customTwo;
  1116. this.data[index].customThree = row.customThree;
  1117. this.data[index].customFour = row.customFour;
  1118. this.data[index].customFive = row.customFive;
  1119. },
  1120. partClosed() {
  1121. this.partList = [];
  1122. },
  1123. saveSell() {
  1124. if (!this.form.id) {
  1125. return this.$message.error("此单据没有提交记录,请先提交");
  1126. }
  1127. this.$confirm("是否生成采购单?", {
  1128. confirmButtonText: "确定",
  1129. cancelButtonText: "取消",
  1130. type: "warning"
  1131. }).then(() => {
  1132. saveSell(this.form.id).then(res => {
  1133. if (res.data.code == 200) {
  1134. this.$message.success("生成成功");
  1135. }
  1136. });
  1137. });
  1138. },
  1139. rePick(row, index) {
  1140. this.reData = {
  1141. ...row,
  1142. index: index
  1143. };
  1144. this.newDetails();
  1145. },
  1146. rowCell(row, index) {
  1147. if (row.$cellEdit == true) {
  1148. this.$set(row, "$cellEdit", false);
  1149. } else {
  1150. this.$set(row, "$cellEdit", true);
  1151. }
  1152. },
  1153. itemTypeFocus(row) {
  1154. this.itemtypeList = [];
  1155. getSpecification({ goodId: row.itemId }).then(res => {
  1156. const data = res.data.data;
  1157. this.itemtypeList = data.map(item => ({ value: item }));
  1158. });
  1159. },
  1160. purchaseAmountChange(row) {
  1161. row.productPrice = productCal(
  1162. row.purchaseAmount,
  1163. row.partsPrice,
  1164. this.form.coefficient
  1165. );
  1166. row.price = sellingCal(row.productPrice, this.form.exchangeRate);
  1167. row.amount = amountCal(
  1168. row.price,
  1169. row.orderQuantity,
  1170. row.freight,
  1171. row.insurance,
  1172. row.discount
  1173. );
  1174. },
  1175. priceChange(row) {
  1176. row.amount = amountCal(
  1177. row.price,
  1178. row.orderQuantity,
  1179. row.freight,
  1180. row.insurance,
  1181. row.discount
  1182. );
  1183. },
  1184. quantityChange(row) {
  1185. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1186. row.orderQuantity = row.actualQuantity;
  1187. this.$message.error("修改的数量不能低于发货数量");
  1188. }
  1189. if (!row.orderQuantity) {
  1190. row.orderQuantity = 0;
  1191. } else {
  1192. row.amount = amountCal(
  1193. row.price,
  1194. row.orderQuantity,
  1195. row.freight,
  1196. row.insurance,
  1197. row.discount
  1198. );
  1199. }
  1200. },
  1201. currencyChange(row) {
  1202. this.currencyList.forEach(e => {
  1203. if (e.dictValue == row) {
  1204. this.form.exchangeRate = e.remark;
  1205. }
  1206. });
  1207. if (this.data.length > 0) {
  1208. this.data.forEach(e => {
  1209. e.freight = transformCal(
  1210. e.freight,
  1211. this.oldExchange,
  1212. this.form.exchangeRate
  1213. );
  1214. e.insurance = transformCal(
  1215. e.insurance,
  1216. this.oldExchange,
  1217. this.form.exchangeRate
  1218. );
  1219. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  1220. e.amount = amountCal(
  1221. e.price,
  1222. e.orderQuantity,
  1223. e.freight,
  1224. e.insurance,
  1225. e.discount
  1226. );
  1227. });
  1228. }
  1229. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1230. },
  1231. exchangeRateChange(row) {
  1232. if (this.data.length > 0) {
  1233. this.data.forEach(e => {
  1234. e.freight = transformCal(e.freight, this.oldExchange, row);
  1235. e.insurance = transformCal(e.insurance, this.oldExchange, row);
  1236. e.price = sellingCal(e.productPrice, row);
  1237. e.amount = amountCal(
  1238. e.price,
  1239. e.orderQuantity,
  1240. e.freight,
  1241. e.insurance,
  1242. e.discount
  1243. );
  1244. });
  1245. }
  1246. this.oldExchange = this.deepClone(row);
  1247. },
  1248. discountChange(row) {
  1249. if (row.discount >= 10) {
  1250. row.discount = null;
  1251. this.$message.error("请正确输入折扣");
  1252. }
  1253. this.priceChange(row);
  1254. },
  1255. taxRateChange(row) {
  1256. if (Number(row.taxRate) >= 100) {
  1257. row.taxRate = 0;
  1258. this.$message.error("税率不能超过100%");
  1259. }
  1260. },
  1261. rowSave(row) {
  1262. this.$set(row, "$cellEdit", false);
  1263. },
  1264. rowDel(row, index) {
  1265. this.$confirm("确定删除数据?", {
  1266. confirmButtonText: "确定",
  1267. cancelButtonText: "取消",
  1268. type: "warning"
  1269. }).then(() => {
  1270. if (row.id) {
  1271. delItem(row.id).then(res => {
  1272. this.$message({
  1273. type: "success",
  1274. message: "删除成功!"
  1275. });
  1276. this.data.splice(index, 1);
  1277. });
  1278. } else {
  1279. this.$message({
  1280. type: "success",
  1281. message: "删除成功!"
  1282. });
  1283. this.data.splice(index, 1);
  1284. }
  1285. });
  1286. },
  1287. importGoods() {
  1288. if (this.reData) {
  1289. if (this.selectionList.length != 1) {
  1290. return this.$message.error("重新选择的时候只能选择一条数据");
  1291. } else {
  1292. this.selectionList.forEach(e => {
  1293. this.data.forEach((item, index) => {
  1294. if (index == this.reData.index) {
  1295. item.itemId = e.id;
  1296. item.code = e.code;
  1297. item.cname = e.cname;
  1298. item.priceCategory = e.goodsTypeName;
  1299. item.itemUrl = e.url;
  1300. item.itemProp = this.reData.itemProp;
  1301. item.remarksOne = this.reData.remarksOne;
  1302. item.customTwo = this.reData.customTwo;
  1303. item.customThree = this.reData.customThree;
  1304. item.customFour = this.reData.customFour;
  1305. item.customFive = this.reData.customFive;
  1306. item.partsList = this.reData.partsList;
  1307. item.partsPrice = this.reData.ppartsPrice;
  1308. item.itemDescription = e.cnameDescription;
  1309. item.itemType = this.reData.itemType;
  1310. item.tradeTerms = this.reData.tradeTerms;
  1311. item.price = this.reData.price;
  1312. item.orderQuantity = this.reData.orderQuantity;
  1313. item.insurance = this.reData.insurance;
  1314. item.freight = this.reData.freight;
  1315. item.discount = this.reData.discount;
  1316. item.amount = this.reData.amount;
  1317. item.taxRate = this.reData.taxRate;
  1318. item.unit = e.unit;
  1319. item.remarks = this.reData.remarks;
  1320. item.$cellEdit = true;
  1321. }
  1322. });
  1323. });
  1324. }
  1325. } else {
  1326. this.selectionList.forEach(e => {
  1327. this.data.push({
  1328. itemId: e.id,
  1329. code: e.code,
  1330. cname: e.cname,
  1331. priceCategory: e.goodsTypeName,
  1332. itemUrl: e.url,
  1333. itemProp: null,
  1334. remarksOne: null,
  1335. customTwo: null,
  1336. customThree: null,
  1337. customFour: null,
  1338. customFive: null,
  1339. itemDescription: e.cnameDescription,
  1340. partsList: [],
  1341. partsPrice: 0,
  1342. itemType: null,
  1343. tradeTerms: null,
  1344. price: 0,
  1345. orderQuantity: 0,
  1346. insurance: 0,
  1347. freight: 0,
  1348. discount: null,
  1349. amount: 0,
  1350. taxRate: 0,
  1351. unit: e.unit,
  1352. remarks: null,
  1353. $cellEdit: true
  1354. });
  1355. });
  1356. }
  1357. this.dialogVisible = false;
  1358. },
  1359. closeGoods() {
  1360. this.selectionList = [];
  1361. this.treeDeptId = "";
  1362. this.reData = null;
  1363. },
  1364. goodsSelectionChange(list) {
  1365. this.orderItemIds = [];
  1366. list.map(e => {
  1367. this.orderItemIds.push(e.id);
  1368. });
  1369. },
  1370. selectionChange(list) {
  1371. this.selectionList = list;
  1372. },
  1373. rowClick(row) {
  1374. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  1375. },
  1376. nodeClick(data) {
  1377. this.treeDeptId = data.id;
  1378. this.page.currentPage = 1;
  1379. this.onLoad(this.page);
  1380. },
  1381. //费用查询
  1382. onLoad(page, params = {}) {
  1383. this.loading = true;
  1384. getGoods(page.currentPage, page.pageSize, this.treeDeptId).then(res => {
  1385. const data = res.data.data;
  1386. this.page.total = data.total;
  1387. this.goodsList = data.records;
  1388. this.loading = false;
  1389. if (this.page.total) {
  1390. this.goodsOption.height = window.innerHeight - 350;
  1391. }
  1392. });
  1393. },
  1394. importLibray(rows) {
  1395. rows.forEach(e => {
  1396. this.data.push({
  1397. itemId: e.itemId,
  1398. code: e.code,
  1399. cname: e.cname,
  1400. priceCategory: e.goodsTypeName,
  1401. purchaseAmount: e.purchaseAmount,
  1402. itemProp: null,
  1403. remarksOne: null,
  1404. customTwo: null,
  1405. customThree: null,
  1406. customFour: null,
  1407. customFive: null,
  1408. corpId: e.corpId,
  1409. corpName: e.corpName,
  1410. itemDescription: e.cnameDescription,
  1411. partsList: [],
  1412. partsPrice: 0,
  1413. itemType: e.specs,
  1414. tradeTerms: null,
  1415. productPrice: productCal(e.purchaseAmount, 0, this.form.coefficient),
  1416. price: sellingCal(
  1417. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1418. this.form.exchangeRate
  1419. ),
  1420. orderQuantity: 1,
  1421. insurance: 0,
  1422. freight: 0,
  1423. discount: null,
  1424. amount: sellingCal(
  1425. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1426. this.form.exchangeRate
  1427. ),
  1428. taxRate: 0,
  1429. unit: e.unit,
  1430. remarks: null,
  1431. $cellEdit: true
  1432. });
  1433. });
  1434. },
  1435. //商品明细导入
  1436. newDetails() {
  1437. if (!this.form.corpId) {
  1438. return this.$message.error("请选择客户名称");
  1439. }
  1440. this.dialogVisible = !this.dialogVisible;
  1441. },
  1442. getDetail(id) {
  1443. this.showBut = false;
  1444. this.pageLoading = true;
  1445. detail(id)
  1446. .then(res => {
  1447. this.form = res.data.data;
  1448. this.data = res.data.data.orderItemsList;
  1449. this.orderFeesList = res.data.data.orderFeesList;
  1450. this.orderFilesList = res.data.data.orderFilesList;
  1451. this.oldform = res.data.data;
  1452. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1453. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  1454. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  1455. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1456. })
  1457. .finally(() => {
  1458. this.showBut = true;
  1459. this.pageLoading = false;
  1460. });
  1461. },
  1462. //修改提交触发
  1463. editCustomer(status) {
  1464. this.$refs["form"].validate((valid, done) => {
  1465. done();
  1466. if (valid) {
  1467. if (this.data.length > 0) {
  1468. for (let i = 0; i < this.data.length; i++) {
  1469. if (this.data[i].corpId == null) {
  1470. return this.$message.error(`请输入第${i + 1}行的供应商`);
  1471. }
  1472. }
  1473. }
  1474. const orderFeesList = this.$refs.feeInfo.submitData();
  1475. for (let i = 0; i < orderFeesList.length; i++) {
  1476. if (orderFeesList[i].corpId == null) {
  1477. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  1478. }
  1479. if (orderFeesList[i].price == 0) {
  1480. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  1481. }
  1482. if (orderFeesList[i].quantity == 0) {
  1483. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  1484. }
  1485. }
  1486. const orderFilesList = this.$refs.uploadFile.submitData();
  1487. this.subLoading = true;
  1488. submit({
  1489. ...this.form,
  1490. orderItemsList: this.data,
  1491. orderFeesList: orderFeesList,
  1492. orderFilesList: orderFilesList
  1493. })
  1494. .then(res => {
  1495. this.form = res.data.data;
  1496. this.data = res.data.data.orderItemsList;
  1497. this.orderFeesList = res.data.data.orderFeesList;
  1498. this.orderFilesList = res.data.data.orderFilesList;
  1499. this.$message.success(this.form.id ? "修改成功" : "提交成功");
  1500. this.oldform = res.data.data;
  1501. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1502. this.oldorderFeesList = this.deepClone(
  1503. res.data.data.orderFeesList
  1504. );
  1505. this.oldorderFilesList = this.deepClone(
  1506. res.data.data.orderFilesList
  1507. );
  1508. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1509. if (status == "goBack") {
  1510. this.$emit("goBack");
  1511. }
  1512. })
  1513. .finally(() => {
  1514. this.subLoading = false;
  1515. });
  1516. } else {
  1517. return false;
  1518. }
  1519. });
  1520. },
  1521. //返回列表
  1522. backToList() {
  1523. let orderFeesList = this.$refs.feeInfo.submitData();
  1524. let orderFilesList = this.$refs.uploadFile.submitData();
  1525. if (
  1526. contrastObj(this.form, this.oldform) ||
  1527. contrastList(this.data, this.olddata) ||
  1528. contrastList(orderFeesList, this.oldorderFeesList) ||
  1529. contrastList(orderFilesList, this.oldorderFilesList)
  1530. ) {
  1531. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1532. confirmButtonText: "确定",
  1533. cancelButtonText: "取消",
  1534. type: "warning"
  1535. })
  1536. .then(() => {
  1537. this.editCustomer("goBack");
  1538. })
  1539. .catch(() => {
  1540. this.$emit("goBack");
  1541. });
  1542. } else {
  1543. this.$emit("goBack");
  1544. }
  1545. },
  1546. openReport() {
  1547. this.switchDialog = !this.switchDialog;
  1548. },
  1549. openProperty(row, index) {
  1550. this.$refs.property.init(row, index);
  1551. },
  1552. onClose(val) {
  1553. this.switchDialog = val;
  1554. },
  1555. getInvoice() {
  1556. if (this.$store.getters.outStatus) {
  1557. this.$alert("出口发货单存在,请保存发货单再进行操作", "温馨提示", {
  1558. confirmButtonText: "确定",
  1559. type: "warning",
  1560. callback: action => {
  1561. console.log(action);
  1562. }
  1563. });
  1564. } else {
  1565. this.inInvoice();
  1566. }
  1567. },
  1568. inInvoice() {
  1569. const data = { id: this.form.id, orderItemIds: this.orderItemIds };
  1570. deliverGoods(data).then(res => {
  1571. if (res.data.code == 200) {
  1572. this.$message.success("生成成功");
  1573. if (data) {
  1574. const data = res.data.data;
  1575. data.orderItemsList.forEach(e => {
  1576. e.actualQuantity = e.orderQuantity;
  1577. e.contractAmount = e.amount;
  1578. e.srcId = e.id;
  1579. e.specificationAndModel = e.itemType;
  1580. e.productDesc = e.itemDescription;
  1581. delete e.id;
  1582. delete e.version;
  1583. delete e.status;
  1584. delete e.createUser;
  1585. delete e.createTime;
  1586. delete e.updateUser;
  1587. delete e.updateTime;
  1588. delete e.isDeleted;
  1589. });
  1590. console.log(data);
  1591. const obj = {
  1592. corpId: data.corpId,
  1593. deliveryStatus: "录入",
  1594. srcOrderNo: data.sysNo,
  1595. orgOrderNo: data.orgOrderNo,
  1596. orderItemsList: data.orderItemsList,
  1597. orderFeesList: data.deliveryFeesList
  1598. };
  1599. this.$router.$avueRouter.closeTag("/exportTrade/invoice/index");
  1600. this.$router.push({
  1601. path: "/exportTrade/invoice/index",
  1602. query: {
  1603. pageType: "Generate",
  1604. data: JSON.stringify(obj)
  1605. }
  1606. });
  1607. }
  1608. }
  1609. });
  1610. },
  1611. async saveColumn() {
  1612. const inSave = await this.saveColumnData(
  1613. this.getColumnName(5),
  1614. this.tableOption
  1615. );
  1616. if (inSave) {
  1617. this.$message.success("保存成功");
  1618. //关闭窗口
  1619. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1620. }
  1621. },
  1622. async resetColumn() {
  1623. const inSave = await this.delColumnData(
  1624. this.getColumnName(5),
  1625. tableOption
  1626. );
  1627. if (inSave) {
  1628. this.$message.success("重置成功");
  1629. this.tableOption = tableOption;
  1630. //关闭窗口
  1631. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1632. }
  1633. },
  1634. summaryMethod({ columns, data }) {
  1635. const sums = [];
  1636. if (columns.length > 0) {
  1637. columns.forEach((item, index) => {
  1638. sums[0] = "合计";
  1639. if (item.property == "orderQuantity" || item.property == "amount") {
  1640. let qtySum = 0;
  1641. let amountSum = 0;
  1642. data.forEach(e => {
  1643. qtySum = _.add(qtySum, Number(e.orderQuantity));
  1644. amountSum = _.add(amountSum, Number(e.amount));
  1645. });
  1646. //数量总计
  1647. if (item.property == "orderQuantity") {
  1648. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  1649. }
  1650. //金额总计
  1651. if (item.property == "amount") {
  1652. sums[index] = micrometerFormat(amountSum);
  1653. }
  1654. }
  1655. });
  1656. }
  1657. return sums;
  1658. },
  1659. async saveGoodsColumn() {
  1660. const inSave = await this.saveColumnData(
  1661. this.getColumnName(28),
  1662. this.goodsOption
  1663. );
  1664. if (inSave) {
  1665. this.$message.success("保存成功");
  1666. //关闭窗口
  1667. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1668. }
  1669. }
  1670. }
  1671. };
  1672. </script>
  1673. <style lang="scss" scoped>
  1674. .trading-form ::v-deep .el-form-item {
  1675. margin-bottom: 8px !important;
  1676. }
  1677. ::v-deep .el-form-item__error {
  1678. display: none !important;
  1679. }
  1680. ::v-deep .select-component {
  1681. display: flex !important;
  1682. }
  1683. </style>