detailsPage.vue 55 KB

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