SampleChange.vue 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819
  1. <template>
  2. <div style="width: 100%; padding: 0px 15px">
  3. <byForm
  4. :formConfig="formConfig"
  5. :formOption="formOption"
  6. v-model="formData.data"
  7. :rules="rules"
  8. ref="submit"
  9. >
  10. <template #seller>
  11. <div style="width: 100%">
  12. <el-form-item prop="sellCorporationId">
  13. <el-select
  14. v-model="formData.data.sellCorporationId"
  15. style="width: 100%"
  16. disabled
  17. >
  18. <el-option
  19. v-for="item in corporationList"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-row style="margin-top: 20px; width: 100%">
  27. <el-col :span="8">
  28. <el-form-item label="地址" prop="sellCountryName">
  29. <el-input
  30. v-model="formData.data.sellCountryName"
  31. placeholder="请输入国家"
  32. />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="8">
  36. <el-form-item label=" " prop="sellProvinceName">
  37. <el-input
  38. v-model="formData.data.sellProvinceName"
  39. placeholder="请输入省/州"
  40. />
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-form-item label=" " prop="sellCityName">
  45. <el-input
  46. v-model="formData.data.sellCityName"
  47. placeholder="请输入城市"
  48. />
  49. </el-form-item>
  50. </el-col>
  51. </el-row>
  52. <el-row style="margin-top: 20px; width: 100%">
  53. <el-col :span="24">
  54. <el-form-item prop="sellAddress">
  55. <el-input v-model="formData.data.sellAddress" type="textarea">
  56. </el-input>
  57. </el-form-item>
  58. </el-col>
  59. </el-row>
  60. <el-row style="margin-top: 20px; width: 100%">
  61. <el-col :span="8">
  62. <el-form-item label="联系人" prop="sellContactName">
  63. <el-input
  64. v-model="formData.data.sellContactName"
  65. placeholder="请输入联系人"
  66. />
  67. </el-form-item>
  68. </el-col>
  69. <el-col :span="16">
  70. <el-form-item label=" " prop="sellContactNumber">
  71. <el-input
  72. v-model="formData.data.sellContactNumber"
  73. placeholder="请输入联系人电话"
  74. />
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. </div>
  79. </template>
  80. <template #buyer>
  81. <div style="width: 100%">
  82. <div style="width: 100%">
  83. <!-- <el-form-item prop="buyCorporationId">
  84. <el-select
  85. v-model="formData.data.buyCorporationId"
  86. style="width: 100%"
  87. @change="changeCustomer"
  88. >
  89. <el-option
  90. v-for="item in customerList"
  91. :key="item.value"
  92. :label="item.label"
  93. :value="item.value"
  94. />
  95. </el-select>
  96. </el-form-item> -->
  97. <el-form-item prop="buyCorporationId">
  98. <el-select
  99. v-model="formData.data.buyCorporationId"
  100. filterable
  101. remote
  102. reserve-keyword
  103. placeholder="请输入关键字"
  104. remote-show-suffix
  105. :remote-method="remoteMethod"
  106. :loading="loadingSearch"
  107. @input="remoteMethod"
  108. style="width: 100%"
  109. @change="changeCustomer"
  110. v-if="
  111. [30].includes(route.query.processType) ||
  112. !route.query.processType
  113. "
  114. >
  115. <el-option
  116. v-for="item in customerList"
  117. :key="item.value"
  118. :label="item.label"
  119. :value="item.value"
  120. />
  121. </el-select>
  122. <el-select
  123. v-model="formData.data.buyCorporationName"
  124. disabled
  125. v-else
  126. style="width: 100%"
  127. >
  128. </el-select>
  129. </el-form-item>
  130. <el-row style="margin-top: 20px; width: 100%">
  131. <el-col :span="6">
  132. <el-form-item label="地址" prop="countryId">
  133. <el-select
  134. v-model="formData.data.countryId"
  135. placeholder="国家"
  136. filterable
  137. @change="(val) => getCityData(val, '20', true)"
  138. >
  139. <el-option
  140. v-for="item in countryData"
  141. :label="item.name"
  142. :value="item.id"
  143. >
  144. </el-option>
  145. </el-select>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="6">
  149. <el-form-item label=" " prop="provinceName">
  150. <selectCity
  151. placeholder="省/洲"
  152. @change="(val) => getCityData(val, '30', true)"
  153. addressId="provinceId"
  154. addressName="provinceName"
  155. v-model="formData.data"
  156. :data="provinceData"
  157. >
  158. </selectCity>
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="6">
  162. <el-form-item label=" " prop="cityName">
  163. <selectCity
  164. placeholder="城市"
  165. addressId="cityId"
  166. addressName="cityName"
  167. v-model="formData.data"
  168. :data="cityData"
  169. >
  170. </selectCity>
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="6">
  174. <el-form-item label=" " prop="buyPostalCode">
  175. <el-input
  176. v-model="formData.data.buyPostalCode"
  177. placeholder="请输入邮编"
  178. />
  179. </el-form-item>
  180. </el-col>
  181. </el-row>
  182. <el-row style="margin-top: 20px; width: 100%">
  183. <el-col :span="24">
  184. <el-form-item prop="buyAddress">
  185. <el-input v-model="formData.data.buyAddress" type="textarea">
  186. </el-input>
  187. </el-form-item>
  188. </el-col>
  189. </el-row>
  190. <el-row style="margin-top: 20px; width: 100%">
  191. <el-col :span="8">
  192. <el-form-item label="联系人" prop="buyContactName">
  193. <el-autocomplete
  194. v-model="formData.data.buyContactName"
  195. :fetch-suggestions="querySearchPerson"
  196. clearable
  197. class="inline-input w-50"
  198. placeholder="请输入联系人"
  199. @select="handlePerson"
  200. >
  201. </el-autocomplete>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="16">
  205. <el-form-item label=" " prop="buyContactNumber">
  206. <el-input
  207. v-model="formData.data.buyContactNumber"
  208. placeholder="请输入联系人电话"
  209. />
  210. </el-form-item>
  211. </el-col>
  212. </el-row>
  213. </div>
  214. </div>
  215. </template>
  216. <template #payment>
  217. <div style="width: 100%">
  218. <el-row style="margin-top: 20px; width: 100%">
  219. <el-col :span="6">
  220. <el-form-item label="币种" prop="currency">
  221. <el-select
  222. v-model="formData.data.currency"
  223. placeholder="请选择币种"
  224. style="width: 100%"
  225. >
  226. <el-option
  227. v-for="item in accountCurrency"
  228. :key="item.value"
  229. :label="item.label"
  230. :value="item.value"
  231. />
  232. </el-select>
  233. </el-form-item>
  234. </el-col>
  235. <el-col :span="6">
  236. <el-form-item label="汇率" prop="rate">
  237. <el-input-number
  238. onmousewheel="return false;"
  239. v-model="formData.data.rate"
  240. placeholder="请输入汇率"
  241. style="width: 100%"
  242. :precision="4"
  243. :controls="false"
  244. :min="0"
  245. :max="100"
  246. />
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. <el-row style="margin-top: 20px; width: 100%">
  251. <el-col :span="6">
  252. <el-form-item label="付款方式" prop="paymentMethod">
  253. <el-select
  254. v-model="formData.data.paymentMethod"
  255. placeholder="请选择付款方式"
  256. style="width: 100%"
  257. >
  258. <el-option
  259. v-for="item in fundsPaymentMethod"
  260. :key="item.value"
  261. :label="item.label"
  262. :value="item.value"
  263. />
  264. </el-select>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="6">
  268. <el-form-item label="预付比例 (%)" prop="advanceRatio">
  269. <el-input-number
  270. onmousewheel="return false;"
  271. v-model="formData.data.advanceRatio"
  272. placeholder="请输入预付比例"
  273. style="width: 100%"
  274. :precision="2"
  275. :controls="false"
  276. :min="0"
  277. :max="100"
  278. />
  279. </el-form-item>
  280. </el-col>
  281. </el-row>
  282. <el-row style="margin-top: 20px; width: 100%">
  283. <el-col :span="18">
  284. <el-form-item label="付款条件" prop="remark">
  285. <el-input
  286. v-model="formData.data.remark"
  287. :rows="2"
  288. type="textarea"
  289. placeholder="请输入付款条件"
  290. />
  291. </el-form-item>
  292. </el-col>
  293. </el-row>
  294. <el-row style="margin-top: 20px; width: 100%">
  295. <el-col :span="9">
  296. <el-form-item label="收款账号" prop="shroffAccountId">
  297. <el-select
  298. v-model="formData.data.shroffAccountId"
  299. placeholder="请选择收款账号"
  300. style="width: 100%"
  301. @change="changeShroffAccount"
  302. >
  303. <el-option
  304. v-for="item in accountList"
  305. :key="item.value"
  306. :label="item.label"
  307. :value="item.value"
  308. />
  309. </el-select>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="9">
  313. <el-form-item label=" ">
  314. <el-button type="primary" @click="changeActiveName" text>
  315. <span v-if="activeName == '1'">收起</span>
  316. <span v-else>展开</span>
  317. </el-button>
  318. </el-form-item>
  319. </el-col>
  320. </el-row>
  321. <div style="width: 100%; margin-top: 34px">
  322. <el-collapse v-model="activeName" class="hideCollapse" accordion>
  323. <el-collapse-item title="" name="1">
  324. <el-row style="width: 100%">
  325. <el-col :span="9">
  326. <el-form-item
  327. label="Beneficiary Name"
  328. prop="beneficiaryName"
  329. >
  330. <el-input
  331. v-model="formData.data.beneficiaryName"
  332. placeholder="请输入Beneficiary Name"
  333. />
  334. </el-form-item>
  335. <div style="height: 20px"></div>
  336. <el-form-item
  337. label="Beneficiary Bank"
  338. prop="beneficiaryBank"
  339. >
  340. <el-input
  341. v-model="formData.data.beneficiaryBank"
  342. placeholder="请输入Beneficiary Bank"
  343. />
  344. </el-form-item>
  345. <div style="height: 20px"></div>
  346. <el-form-item
  347. label="Beneficiary Bank Address"
  348. prop="beneficiaryBankAddress"
  349. >
  350. <el-input
  351. v-model="formData.data.beneficiaryBankAddress"
  352. placeholder="请输入Beneficiary Bank Address"
  353. />
  354. </el-form-item>
  355. </el-col>
  356. <el-col :span="9">
  357. <el-form-item
  358. label="Beneficiary Account Number"
  359. prop="beneficiaryAccountNumber"
  360. >
  361. <el-input
  362. v-model="formData.data.beneficiaryAccountNumber"
  363. placeholder="请输入Beneficiary Account Number"
  364. />
  365. </el-form-item>
  366. <div style="height: 20px"></div>
  367. <el-form-item label="Swift Code" prop="swiftCode">
  368. <el-input
  369. v-model="formData.data.swiftCode"
  370. placeholder="请输入Swift Code"
  371. />
  372. </el-form-item>
  373. <div style="height: 20px"></div>
  374. <el-form-item
  375. label="Beneficiary Address"
  376. prop="beneficiaryAddress"
  377. >
  378. <el-input
  379. v-model="formData.data.beneficiaryAddress"
  380. placeholder="请输入Beneficiary Address"
  381. />
  382. </el-form-item>
  383. </el-col>
  384. </el-row>
  385. </el-collapse-item>
  386. </el-collapse>
  387. </div>
  388. </div>
  389. </template>
  390. <template #delivery>
  391. <div style="width: 100%">
  392. <el-row style="margin-top: 20px; width: 100%">
  393. <el-col :span="6">
  394. <el-form-item label="报价有效期 (天)" prop="effective">
  395. <el-input-number
  396. onmousewheel="return false;"
  397. v-model="formData.data.effective"
  398. placeholder="请输入有效期"
  399. style="width: 100%"
  400. :precision="0"
  401. :controls="false"
  402. :min="0"
  403. />
  404. </el-form-item>
  405. </el-col>
  406. <el-col :span="6">
  407. <el-form-item label="交货期限" prop="deliveryTime">
  408. <el-date-picker
  409. v-model="formData.data.deliveryTime"
  410. type="date"
  411. placeholder="请选择交货期限"
  412. value-format="YYYY-MM-DD"
  413. />
  414. </el-form-item>
  415. </el-col>
  416. <el-col :span="6">
  417. <el-form-item label="运输方式" prop="transportMethod">
  418. <el-select
  419. v-model="formData.data.transportMethod"
  420. placeholder="请选择运输方式"
  421. style="width: 100%"
  422. >
  423. <el-option
  424. v-for="item in shippingMethod"
  425. :key="item.value"
  426. :label="item.label"
  427. :value="item.value"
  428. />
  429. </el-select>
  430. </el-form-item>
  431. </el-col>
  432. <el-col :span="6">
  433. <el-form-item label="运输说明" prop="transportRemark">
  434. <el-input
  435. v-model="formData.data.transportRemark"
  436. placeholder="请输入运输说明"
  437. />
  438. </el-form-item>
  439. </el-col>
  440. </el-row>
  441. </div>
  442. </template>
  443. <template #commodity>
  444. <div style="width: 100%">
  445. <el-button type="primary" @click="openProductCompany = true" plain
  446. >标准产品库</el-button
  447. >
  448. <el-button type="primary" @click="clickCustomerProduct()" plain
  449. >客户产品库</el-button
  450. >
  451. <el-table
  452. :data="formData.data.sampleProductList"
  453. style="width: 100%; margin-top: 16px"
  454. >
  455. <el-table-column label="商品图片" width="80">
  456. <template #default="{ row }">
  457. <div v-if="row.fileUrl">
  458. <img
  459. :src="row.fileUrl"
  460. class="pic"
  461. @click="onPicture(row.fileUrl)"
  462. />
  463. </div>
  464. <div v-else></div>
  465. </template>
  466. </el-table-column>
  467. <el-table-column
  468. prop="productCnName"
  469. label="商品中文名"
  470. min-width="130"
  471. />
  472. <el-table-column label="商品英文名" min-width="180">
  473. <template #default="{ row, $index }">
  474. <div style="width: 100%">
  475. <el-form-item
  476. :prop="'sampleProductList.' + $index + '.productName'"
  477. :rules="rules.productName"
  478. :inline-message="true"
  479. class="shrinkPadding"
  480. >
  481. <el-input
  482. v-model="row.productName"
  483. placeholder="请输入商品名称"
  484. />
  485. </el-form-item>
  486. </div>
  487. </template>
  488. </el-table-column>
  489. <el-table-column label="尺寸 cm*cm*cm" width="140">
  490. <template #default="{ row, $index }">
  491. <div style="width: 100%">
  492. <el-form-item
  493. :prop="'sampleProductList.' + $index + '.productModel'"
  494. :rules="rules.productModel"
  495. :inline-message="true"
  496. class="shrinkPadding"
  497. >
  498. <el-input v-model="row.productModel" placeholder="请输入" />
  499. </el-form-item>
  500. </div>
  501. </template>
  502. </el-table-column>
  503. <el-table-column label="数量" width="130">
  504. <template #default="{ row, $index }">
  505. <div style="width: 100%">
  506. <el-form-item
  507. :prop="'sampleProductList.' + $index + '.quantity'"
  508. :rules="rules.quantity"
  509. :inline-message="true"
  510. class="shrinkPadding"
  511. >
  512. <el-input-number
  513. onmousewheel="return false;"
  514. v-model="row.quantity"
  515. placeholder="请输入"
  516. style="width: 100%"
  517. :precision="0"
  518. :controls="false"
  519. :min="0"
  520. @change="calculationAmount()"
  521. />
  522. </el-form-item>
  523. </div>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="单价" width="140">
  527. <template #default="{ row, $index }">
  528. <div style="width: 100%">
  529. <el-form-item
  530. :prop="'sampleProductList.' + $index + '.price'"
  531. :rules="rules.price"
  532. :inline-message="true"
  533. class="shrinkPadding"
  534. >
  535. <el-input-number
  536. onmousewheel="return false;"
  537. v-model="row.price"
  538. placeholder="请输入"
  539. style="width: 100%"
  540. :precision="2"
  541. :controls="false"
  542. :min="0"
  543. @change="calculationAmount()"
  544. />
  545. </el-form-item>
  546. </div>
  547. </template>
  548. </el-table-column>
  549. <el-table-column label="贸易方式" width="140">
  550. <template #default="{ row, $index }">
  551. <div style="width: 100%">
  552. <el-form-item
  553. :prop="'sampleProductList.' + $index + '.tradeMethods'"
  554. :rules="rules.tradeMethods"
  555. :inline-message="true"
  556. class="shrinkPadding"
  557. >
  558. <el-select
  559. v-model="row.tradeMethods"
  560. placeholder="请选择"
  561. style="width: 100%"
  562. >
  563. <el-option
  564. v-for="item in tradeMethods"
  565. :key="item.value"
  566. :label="item.label"
  567. :value="item.value"
  568. />
  569. </el-select>
  570. </el-form-item>
  571. </div>
  572. </template>
  573. </el-table-column>
  574. <el-table-column label="包装方式" width="180">
  575. <template #default="{ row, $index }">
  576. <div style="width: 100%">
  577. <el-form-item
  578. :prop="'sampleProductList.' + $index + '.packMethod'"
  579. :rules="rules.packMethod"
  580. :inline-message="true"
  581. class="shrinkPadding"
  582. >
  583. <el-input v-model="row.packMethod" placeholder="请输入" />
  584. </el-form-item>
  585. </div>
  586. </template>
  587. </el-table-column>
  588. <el-table-column
  589. prop="amount"
  590. :label="'金额 ( ' + formData.data.currency + ' )'"
  591. width="130"
  592. />
  593. <el-table-column
  594. label="操作"
  595. width="60"
  596. align="center"
  597. fixed="right"
  598. >
  599. <template #default="{ row, $index }">
  600. <el-button
  601. type="primary"
  602. link
  603. @click="handleRemove($index, row)"
  604. >删除</el-button
  605. >
  606. </template>
  607. </el-table-column>
  608. </el-table>
  609. </div>
  610. </template>
  611. <template #file>
  612. <div style="width: 100%">
  613. <el-upload
  614. v-model:fileList="formData.data.fileList"
  615. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  616. :data="uploadData"
  617. multiple
  618. :before-upload="uploadFile"
  619. :on-success="handleSuccess"
  620. :on-preview="onPreviewFile"
  621. >
  622. <el-button type="primary" plain>选择</el-button>
  623. </el-upload>
  624. </div>
  625. </template>
  626. <template #indication>
  627. <div style="width: 100%">
  628. <el-upload
  629. v-model:fileList="formData.data.packageFileList"
  630. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  631. :data="indicationUploadData"
  632. multiple
  633. :before-upload="indicationUploadFile"
  634. :on-success="handleSuccess"
  635. :on-preview="onPreviewFile"
  636. >
  637. <el-button type="primary" plain>选择</el-button>
  638. </el-upload>
  639. </div>
  640. </template>
  641. <template #otherCharge>
  642. <div style="width: 100%">
  643. <el-button type="primary" @click="clickAdd()">添加行</el-button>
  644. <el-table
  645. :data="formData.data.sampleProjectList"
  646. style="width: 100%; margin-top: 16px"
  647. >
  648. <el-table-column label="收费项目" width="220">
  649. <template #default="{ row, $index }">
  650. <div style="width: 100%">
  651. <el-form-item
  652. :prop="'sampleProjectList.' + $index + '.payName'"
  653. :rules="rules.payName"
  654. :inline-message="true"
  655. >
  656. <el-autocomplete
  657. v-model="row.payName"
  658. :fetch-suggestions="querySearch"
  659. clearable
  660. class="inline-input w-50"
  661. placeholder="请输入收费项目"
  662. />
  663. </el-form-item>
  664. </div>
  665. </template>
  666. </el-table-column>
  667. <el-table-column label="备注">
  668. <template #default="{ row, $index }">
  669. <div style="width: 100%">
  670. <el-form-item
  671. :prop="'sampleProjectList.' + $index + '.remark'"
  672. >
  673. <el-input v-model="row.remark" placeholder="请输入备注" />
  674. </el-form-item>
  675. </div>
  676. </template>
  677. </el-table-column>
  678. <el-table-column
  679. :label="'金额 ( ' + formData.data.currency + ' )'"
  680. width="130"
  681. >
  682. <template #default="{ row, $index }">
  683. <div style="width: 100%">
  684. <el-form-item
  685. :prop="'sampleProjectList.' + $index + '.amount'"
  686. :rules="rules.amount"
  687. :inline-message="true"
  688. class="shrinkPadding"
  689. >
  690. <el-input-number
  691. onmousewheel="return false;"
  692. v-model="row.amount"
  693. placeholder="请输入金额"
  694. style="width: 100%"
  695. :precision="2"
  696. :controls="false"
  697. :min="0"
  698. @change="totalAmount()"
  699. />
  700. </el-form-item>
  701. </div>
  702. </template>
  703. </el-table-column>
  704. <el-table-column
  705. label="操作"
  706. width="60"
  707. align="center"
  708. fixed="right"
  709. >
  710. <template #default="{ $index }">
  711. <el-button type="primary" link @click="handleDelete($index)"
  712. >删除</el-button
  713. >
  714. </template>
  715. </el-table-column>
  716. </el-table>
  717. </div>
  718. </template>
  719. <template #offerMoney>
  720. <div style="width: 100%; display: flex">
  721. <div style="width: calc(100% - 190px)"></div>
  722. <div style="width: 130px; padding: 0 12px">
  723. <el-form-item
  724. label="合同总金额"
  725. prop="amount"
  726. class="shrinkPadding"
  727. >
  728. <el-input
  729. v-model="formData.data.amount"
  730. placeholder="合同总金额"
  731. disabled
  732. />
  733. </el-form-item>
  734. </div>
  735. </div>
  736. </template>
  737. <template #shipment>
  738. <div style="width: 100%">
  739. <el-table
  740. :data="formData.data.sampleShipmentList"
  741. style="width: 100%; margin-top: 16px"
  742. >
  743. <el-table-column prop="productCode" label="商品编码" width="120" />
  744. <el-table-column prop="productName" label="商品名称" />
  745. <el-table-column label="出货日期" width="220">
  746. <template #default="{ row, $index }">
  747. <div style="width: 100%">
  748. <el-form-item
  749. :prop="'sampleShipmentList.' + $index + '.shipmentTime'"
  750. :rules="rules.shipmentTime"
  751. :inline-message="true"
  752. >
  753. <el-date-picker
  754. v-model="row.shipmentTime"
  755. type="date"
  756. placeholder="请选择出货日期"
  757. value-format="YYYY-MM-DD"
  758. />
  759. </el-form-item>
  760. </div>
  761. </template>
  762. </el-table-column>
  763. <el-table-column label="数量" width="160">
  764. <template #default="{ row, $index }">
  765. <div style="width: 100%">
  766. <el-form-item
  767. :prop="'sampleShipmentList.' + $index + '.quantity'"
  768. :inline-message="true"
  769. >
  770. <el-input-number
  771. onmousewheel="return false;"
  772. v-model="row.quantity"
  773. placeholder="请输入数量"
  774. style="width: 100%"
  775. :precision="0"
  776. :controls="false"
  777. :min="0"
  778. @change="calculationAmount()"
  779. />
  780. </el-form-item>
  781. </div>
  782. </template>
  783. </el-table-column>
  784. <el-table-column
  785. align="center"
  786. label="操作"
  787. width="120"
  788. fixed="right"
  789. >
  790. <template #default="{ row, $index }">
  791. <el-button type="primary" link @click="clickSplit(row)"
  792. >拆分</el-button
  793. >
  794. <el-button type="primary" link @click="clickDelete($index)"
  795. >删除</el-button
  796. >
  797. </template>
  798. </el-table-column>
  799. </el-table>
  800. </div>
  801. </template>
  802. </byForm>
  803. <el-dialog
  804. v-if="openProductCompany"
  805. v-model="openProductCompany"
  806. title="公司产品库"
  807. width="90%"
  808. append-to-body
  809. >
  810. <CompanyProduct
  811. :selectStatus="true"
  812. @selectProduct="selectProduct"
  813. ></CompanyProduct>
  814. </el-dialog>
  815. <el-dialog
  816. v-if="openProductCustomer"
  817. v-model="openProductCustomer"
  818. title="客户产品库"
  819. width="90%"
  820. append-to-body
  821. >
  822. <CustomerProduct
  823. :selectStatus="true"
  824. :buyCorporationId="formData.data.buyCorporationId"
  825. @selectProduct="selectProduct"
  826. ></CustomerProduct>
  827. </el-dialog>
  828. </div>
  829. </template>
  830. <script setup>
  831. import byForm from "@/components/byForm/index";
  832. import CompanyProduct from "@/views/EHSD/productLibrary/companyProduct/index";
  833. import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
  834. import { ElMessage } from "element-plus";
  835. import selectCity from "@/components/selectCity/index.vue";
  836. import { useRoute } from "vue-router";
  837. import { onMounted } from "vue";
  838. const route = useRoute();
  839. const { proxy } = getCurrentInstance();
  840. const innerMethod = ref([]);
  841. const outsideMethod = ref([]);
  842. const accountCurrency = ref([]);
  843. const fundsPaymentMethod = ref([]);
  844. const tradeMethods = ref([]);
  845. const shippingMethod = ref([]);
  846. const submitType = ref([]);
  847. const templateList = ref([]);
  848. const corporationList = ref([]);
  849. const customerList = ref([]);
  850. const accountList = ref([]);
  851. const countryData = ref([]);
  852. const provinceData = ref([]);
  853. const cityData = ref([]);
  854. const customerUserList = ref([]);
  855. const openProductCompany = ref(false);
  856. const openProductCustomer = ref(false);
  857. const activeName = ref("1");
  858. const formData = reactive({
  859. data: {
  860. currency: "",
  861. submitType: "2",
  862. amount: undefined,
  863. sampleProductList: [],
  864. sampleProjectList: [],
  865. fileList: [],
  866. packageFileList: [],
  867. sampleShipmentList: [],
  868. },
  869. });
  870. const submit = ref(null);
  871. const judgeStatus = () => {
  872. if (route.query.processType == 20 || route.query.processType == 10) {
  873. return true;
  874. }
  875. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  876. let data = props.queryData.recordList.filter(
  877. (item) => item.status === 2 && item.nodeType !== 1
  878. );
  879. if (data && data.length > 0) {
  880. return true;
  881. }
  882. }
  883. return false;
  884. };
  885. const formOption = reactive({
  886. inline: true,
  887. labelWidth: 100,
  888. itemWidth: 100,
  889. rules: [],
  890. disabled: false,
  891. });
  892. const uploadData = ref({});
  893. const indicationUploadData = ref({});
  894. const formConfig = computed(() => {
  895. return [
  896. {
  897. type: "title",
  898. title: "合同模板",
  899. label: "",
  900. },
  901. {
  902. type: "select",
  903. label: "选择合同模板",
  904. prop: "contractTemplateId",
  905. data: templateList.value,
  906. fn: (val) => {
  907. changeTemplate(val);
  908. },
  909. },
  910. {
  911. type: "slot",
  912. slotName: "seller",
  913. label: "卖方信息",
  914. itemWidth: 50,
  915. },
  916. {
  917. type: "slot",
  918. slotName: "buyer",
  919. label: "买方信息",
  920. itemWidth: 50,
  921. },
  922. {
  923. type: "slot",
  924. slotName: "payment",
  925. label: "付款信息",
  926. },
  927. {
  928. type: "slot",
  929. slotName: "delivery",
  930. label: "交付信息",
  931. },
  932. {
  933. type: "slot",
  934. slotName: "commodity",
  935. label: "商品信息",
  936. },
  937. {
  938. type: "slot",
  939. slotName: "file",
  940. label: "交接单",
  941. },
  942. {
  943. type: "slot",
  944. slotName: "indication",
  945. label: "包装指示",
  946. },
  947. {
  948. type: "slot",
  949. slotName: "otherCharge",
  950. label: "其他收费项目",
  951. },
  952. {
  953. type: "slot",
  954. slotName: "offerMoney",
  955. },
  956. {
  957. type: "slot",
  958. slotName: "shipment",
  959. label: "出货计划",
  960. },
  961. // {
  962. // type: "select",
  963. // label: "提交类型",
  964. // prop: "submitType",
  965. // data: submitType.value,
  966. // },
  967. ];
  968. });
  969. const rules = ref({
  970. contractTemplateId: [
  971. { required: true, message: "请选择合同模板", trigger: "change" },
  972. ],
  973. buyCorporationId: [
  974. { required: true, message: "请选择公司", trigger: "change" },
  975. ],
  976. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  977. sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  978. buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  979. buyContactName: [
  980. { required: true, message: "请输入联系人", trigger: ["change", "blur"] },
  981. ],
  982. buyContactNumber: [
  983. { required: true, message: "请输入联系电话", trigger: "blur" },
  984. ],
  985. productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
  986. productModel: [
  987. { required: true, message: "请输入尺寸 cm*cm*cm", trigger: "blur" },
  988. ],
  989. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  990. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  991. packMethod: [{ required: true, message: "请输入包装方式", trigger: "blur" }],
  992. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  993. payName: [
  994. { required: true, message: "请输入收费项目", trigger: ["change", "blur"] },
  995. ],
  996. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  997. effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
  998. deliveryTime: [
  999. { required: true, message: "请选择交货期限", trigger: "change" },
  1000. ],
  1001. paymentMethod: [
  1002. { required: true, message: "请选择付款方式", trigger: "change" },
  1003. ],
  1004. advanceRatio: [
  1005. { required: true, message: "请输入预付比例", trigger: "blur" },
  1006. ],
  1007. shroffAccountId: [
  1008. { required: true, message: "请选择收款账号", trigger: "change" },
  1009. ],
  1010. tradeMethods: [
  1011. { required: true, message: "请选择贸易方式", trigger: "change" },
  1012. ],
  1013. transportMethod: [
  1014. { required: true, message: "请选择运输方式", trigger: "change" },
  1015. ],
  1016. transportRemark: [
  1017. { required: true, message: "请输入运输说明", trigger: "blur" },
  1018. ],
  1019. remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
  1020. submitType: [
  1021. { required: true, message: "请选择提交类型", trigger: "change" },
  1022. ],
  1023. rate: [{ required: true, message: "请输入汇率", trigger: "blur" }],
  1024. });
  1025. const getDict = () => {
  1026. proxy.post("/customer/selPage", { pageNum: 1, pageSize: 50 }).then((res) => {
  1027. customerList.value = res.rows.map((x) => ({
  1028. ...x,
  1029. label: x.name,
  1030. value: x.id,
  1031. }));
  1032. });
  1033. proxy
  1034. .getDictOne([
  1035. "inner_packaging_method_ehsd",
  1036. "outside_packaging_method_ehsd",
  1037. "account_currency",
  1038. "funds_payment_method",
  1039. "trade_mode",
  1040. "shipping_method",
  1041. "submit_type",
  1042. ])
  1043. .then((res) => {
  1044. innerMethod.value = res["inner_packaging_method_ehsd"].map((x) => ({
  1045. label: x.dictValue,
  1046. value: x.dictKey,
  1047. }));
  1048. outsideMethod.value = res["outside_packaging_method_ehsd"].map((x) => ({
  1049. label: x.dictValue,
  1050. value: x.dictKey,
  1051. }));
  1052. accountCurrency.value = res["account_currency"].map((x) => ({
  1053. label: x.dictValue,
  1054. value: x.dictKey,
  1055. }));
  1056. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  1057. label: x.dictValue,
  1058. value: x.dictKey,
  1059. }));
  1060. tradeMethods.value = res["trade_mode"].map((x) => ({
  1061. label: x.dictValue,
  1062. value: x.dictKey,
  1063. }));
  1064. shippingMethod.value = res["shipping_method"].map((x) => ({
  1065. label: x.dictValue,
  1066. value: x.dictKey,
  1067. }));
  1068. submitType.value = res["submit_type"].map((x) => ({
  1069. label: x.dictValue,
  1070. value: x.dictKey,
  1071. }));
  1072. });
  1073. proxy
  1074. .post("/contractTemplate/page", { pageNum: 1, pageSize: 999 })
  1075. .then((res) => {
  1076. templateList.value = res.rows.map((item) => {
  1077. return {
  1078. ...item,
  1079. label: item.templateName,
  1080. value: item.id,
  1081. };
  1082. });
  1083. });
  1084. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1085. corporationList.value = res.rows.map((item) => {
  1086. return {
  1087. ...item,
  1088. label: item.name,
  1089. value: item.id,
  1090. };
  1091. });
  1092. });
  1093. proxy
  1094. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  1095. .then((res) => {
  1096. accountList.value = res.rows.map((item) => {
  1097. return {
  1098. ...item,
  1099. label: item.alias,
  1100. value: item.id,
  1101. };
  1102. });
  1103. });
  1104. };
  1105. getDict();
  1106. const changeTemplate = (val) => {
  1107. formData.data.sellCorporationId = "";
  1108. formData.data.sellContactName = "";
  1109. formData.data.sellContactNumber = "";
  1110. formData.data.sellCountryName = "";
  1111. formData.data.sellProvinceName = "";
  1112. formData.data.sellCityName = "";
  1113. formData.data.sellAddress = "";
  1114. if (val) {
  1115. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  1116. formData.data.sellCorporationId = res.corporationId;
  1117. if (res.corporationId) {
  1118. proxy
  1119. .post("/corporation/detail", { id: res.corporationId })
  1120. .then((detailCorporation) => {
  1121. proxy
  1122. .post("/customizeArea/list", { parentId: "0" })
  1123. .then((resCountry) => {
  1124. let sellCountryData = resCountry.filter(
  1125. (item) => item.id === detailCorporation.countryId
  1126. );
  1127. if (sellCountryData && sellCountryData.length > 0) {
  1128. formData.data.sellCountryName = sellCountryData[0].name;
  1129. } else {
  1130. formData.data.sellCountryName = "";
  1131. }
  1132. });
  1133. if (detailCorporation.countryId) {
  1134. proxy
  1135. .post("/customizeArea/list", {
  1136. parentId: detailCorporation.countryId,
  1137. })
  1138. .then((resProvince) => {
  1139. let sellProvinceData = resProvince.filter(
  1140. (item) => item.id === detailCorporation.provinceId
  1141. );
  1142. if (sellProvinceData && sellProvinceData.length > 0) {
  1143. formData.data.sellProvinceName = sellProvinceData[0].name;
  1144. } else {
  1145. formData.data.sellProvinceName = "";
  1146. }
  1147. });
  1148. } else {
  1149. formData.data.sellProvinceName = "";
  1150. }
  1151. if (detailCorporation.provinceId) {
  1152. proxy
  1153. .post("/customizeArea/list", {
  1154. parentId: detailCorporation.provinceId,
  1155. })
  1156. .then((resCity) => {
  1157. let sellCityData = resCity.filter(
  1158. (item) => item.id === detailCorporation.cityId
  1159. );
  1160. if (sellCityData && sellCityData.length > 0) {
  1161. formData.data.sellCityName = sellCityData[0].name;
  1162. } else {
  1163. formData.data.sellCityName = "";
  1164. }
  1165. });
  1166. } else {
  1167. formData.data.sellCityName = "";
  1168. }
  1169. formData.data.sellAddress = detailCorporation.address;
  1170. });
  1171. }
  1172. formData.data.sellContactName = res.contactName;
  1173. formData.data.sellContactNumber = res.contactNumber;
  1174. });
  1175. }
  1176. };
  1177. const getCityData = (id, type, isChange) => {
  1178. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1179. if (type === "20") {
  1180. provinceData.value = res;
  1181. if (isChange) {
  1182. formData.data.provinceId = "";
  1183. formData.data.provinceName = "";
  1184. formData.data.cityId = "";
  1185. formData.data.cityName = "";
  1186. }
  1187. } else if (type === "30") {
  1188. cityData.value = res;
  1189. if (isChange) {
  1190. formData.data.cityId = "";
  1191. formData.data.cityName = "";
  1192. }
  1193. } else {
  1194. countryData.value = res;
  1195. }
  1196. });
  1197. };
  1198. getCityData("0");
  1199. const changeCustomer = (val) => {
  1200. formData.data.sampleProductList = [];
  1201. formData.data.customerName = "";
  1202. formData.data.customerTel = "";
  1203. if (val) {
  1204. proxy.post("/customer/detail", { id: val }).then(
  1205. (res) => {
  1206. formData.data.buyCorporationName = res.name;
  1207. if (res.customerUserList && res.customerUserList.length > 0) {
  1208. formData.data.buyContactName = res.customerUserList[0].name;
  1209. if (res.customerUserList[0].contactJson) {
  1210. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  1211. if (contactJson && contactJson.length > 0) {
  1212. formData.data.buyContactNumber = contactJson[0].contactNo;
  1213. }
  1214. }
  1215. customerUserList.value = res.customerUserList.map((item) => {
  1216. return {
  1217. ...item,
  1218. value: item.name,
  1219. };
  1220. });
  1221. }
  1222. formData.data.countryId = res.countryId;
  1223. formData.data.provinceId = res.provinceId;
  1224. formData.data.cityId = res.cityId;
  1225. formData.data.buyPostalCode = res.zipCode;
  1226. formData.data.buyAddress = res.address;
  1227. getCityData(formData.data.countryId, "20");
  1228. if (formData.data.provinceId) {
  1229. getCityData(formData.data.provinceId, "30");
  1230. }
  1231. },
  1232. (err) => {
  1233. console.log(err);
  1234. formData.data.countryId = "";
  1235. formData.data.provinceId = "";
  1236. formData.data.cityId = "";
  1237. formData.data.buyPostalCode = "";
  1238. formData.data.buyAddress = "";
  1239. }
  1240. );
  1241. } else {
  1242. formData.data.countryId = "";
  1243. formData.data.provinceId = "";
  1244. formData.data.cityId = "";
  1245. formData.data.buyPostalCode = "";
  1246. formData.data.buyAddress = "";
  1247. }
  1248. };
  1249. const createFilter = (queryString) => {
  1250. return (restaurant) => {
  1251. return (
  1252. restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
  1253. );
  1254. };
  1255. };
  1256. const querySearchPerson = (queryString, callback) => {
  1257. const results = queryString
  1258. ? customerUserList.value.filter(createFilter(queryString))
  1259. : customerUserList.value;
  1260. callback(results);
  1261. };
  1262. const handlePerson = (item) => {
  1263. formData.data.customerTel = item.phone;
  1264. };
  1265. const selectProduct = (goods) => {
  1266. if (goods && goods.id) {
  1267. let data = formData.data.sampleProductList.filter(
  1268. (item) => item.productId === goods.id
  1269. );
  1270. if (data && data.length > 0) {
  1271. return ElMessage("该产品已添加");
  1272. }
  1273. let fileUrl = "";
  1274. if (goods.fileList && goods.fileList.length > 0) {
  1275. fileUrl = goods.fileList[0].fileUrl;
  1276. }
  1277. let packMethod = "";
  1278. if (goods.innerPackMethod) {
  1279. let innerPackMethod = goods.innerPackMethod.split(",");
  1280. innerPackMethod.map((item) => {
  1281. if (packMethod) {
  1282. packMethod =
  1283. packMethod + "," + proxy.dictValueLabel(item, innerMethod.value);
  1284. } else {
  1285. packMethod = proxy.dictValueLabel(item, innerMethod.value);
  1286. }
  1287. });
  1288. }
  1289. if (goods.outerPackMethod) {
  1290. let outerPackMethod = goods.outerPackMethod.split(",");
  1291. outerPackMethod.map((item) => {
  1292. if (packMethod) {
  1293. packMethod =
  1294. packMethod + "," + proxy.dictValueLabel(item, outsideMethod.value);
  1295. } else {
  1296. packMethod = proxy.dictValueLabel(item, outsideMethod.value);
  1297. }
  1298. });
  1299. }
  1300. if (
  1301. formData.data.sampleProductList &&
  1302. formData.data.sampleProductList.length > 0
  1303. ) {
  1304. formData.data.sampleProductList.push({
  1305. fileUrl: fileUrl,
  1306. productId: goods.id,
  1307. productCnName: goods.name,
  1308. productName: goods.nameEnglish,
  1309. productModel:
  1310. goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
  1311. quantity: undefined,
  1312. price: undefined,
  1313. amount: "",
  1314. tradeMethods: "",
  1315. packMethod: packMethod,
  1316. });
  1317. } else {
  1318. formData.data.sampleProductList = [
  1319. {
  1320. fileUrl: fileUrl,
  1321. productId: goods.id,
  1322. productCnName: goods.name,
  1323. productName: goods.nameEnglish,
  1324. productModel:
  1325. goods.productLong +
  1326. "*" +
  1327. goods.productWide +
  1328. "*" +
  1329. goods.productHigh,
  1330. quantity: undefined,
  1331. price: undefined,
  1332. amount: "",
  1333. tradeMethods: "",
  1334. packMethod: packMethod,
  1335. },
  1336. ];
  1337. }
  1338. formData.data.sampleShipmentList.push({
  1339. productCode: goods.code,
  1340. productId: goods.id,
  1341. productName: goods.nameEnglish,
  1342. shipmentTime: "",
  1343. quantity: undefined,
  1344. });
  1345. ElMessage({
  1346. message: "添加成功!",
  1347. type: "success",
  1348. });
  1349. } else {
  1350. return ElMessage("选择错误");
  1351. }
  1352. };
  1353. const onPicture = (path) => {
  1354. window.open(path, "_blank");
  1355. };
  1356. const handleRemove = async (index, row) => {
  1357. formData.data.sampleShipmentList = formData.data.sampleShipmentList.filter(
  1358. (item) => item.productId !== row.productId
  1359. );
  1360. await formData.data.sampleProductList.splice(index, 1);
  1361. totalAmount();
  1362. };
  1363. const calculationAmount = () => {
  1364. nextTick(() => {
  1365. if (
  1366. formData.data.sampleProductList &&
  1367. formData.data.sampleProductList.length > 0
  1368. ) {
  1369. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1370. let money = 0;
  1371. if (
  1372. formData.data.sampleProductList[i].quantity &&
  1373. formData.data.sampleProductList[i].price
  1374. ) {
  1375. money = parseFloat(
  1376. Number(formData.data.sampleProductList[i].quantity) *
  1377. Number(formData.data.sampleProductList[i].price)
  1378. ).toFixed(2);
  1379. }
  1380. formData.data.sampleProductList[i].amount = money;
  1381. }
  1382. }
  1383. nextTick(() => {
  1384. totalAmount();
  1385. });
  1386. });
  1387. };
  1388. const totalAmount = () => {
  1389. let money = 0;
  1390. if (
  1391. formData.data.sampleProductList &&
  1392. formData.data.sampleProductList.length > 0
  1393. ) {
  1394. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1395. if (formData.data.sampleProductList[i].amount) {
  1396. money = parseFloat(
  1397. Number(money) + Number(formData.data.sampleProductList[i].amount)
  1398. ).toFixed(2);
  1399. }
  1400. }
  1401. }
  1402. if (
  1403. formData.data.sampleProjectList &&
  1404. formData.data.sampleProjectList.length > 0
  1405. ) {
  1406. for (let i = 0; i < formData.data.sampleProjectList.length; i++) {
  1407. if (formData.data.sampleProjectList[i].amount) {
  1408. money = parseFloat(
  1409. Number(money) + Number(formData.data.sampleProjectList[i].amount)
  1410. ).toFixed(2);
  1411. }
  1412. }
  1413. }
  1414. formData.data.amount = money;
  1415. };
  1416. const clickAdd = () => {
  1417. if (
  1418. formData.data.sampleProjectList &&
  1419. formData.data.sampleProjectList.length > 0
  1420. ) {
  1421. formData.data.sampleProjectList.push({
  1422. payName: "",
  1423. amount: undefined,
  1424. remark: "",
  1425. });
  1426. } else {
  1427. formData.data.sampleProjectList = [
  1428. { payName: "", amount: undefined, remark: "" },
  1429. ];
  1430. }
  1431. };
  1432. const handleDelete = async (index) => {
  1433. await formData.data.sampleProjectList.splice(index, 1);
  1434. totalAmount();
  1435. };
  1436. const querySearch = (queryString, callback) => {
  1437. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  1438. if (res.rows && res.rows.length > 0) {
  1439. res.rows = res.rows.map((item) => {
  1440. return {
  1441. ...item,
  1442. value: item.payName,
  1443. };
  1444. });
  1445. callback(res.rows);
  1446. } else {
  1447. callback([]);
  1448. }
  1449. });
  1450. };
  1451. const handleSubmit = async () => {
  1452. let status = await submit.value.handleSubmit(() => {});
  1453. if (status) {
  1454. if (
  1455. !(
  1456. formData.data.sampleProductList &&
  1457. formData.data.sampleProductList.length > 0
  1458. )
  1459. ) {
  1460. ElMessage("请添加至少一件商品");
  1461. return false;
  1462. }
  1463. if (formData.data.fileList && formData.data.fileList.length > 0) {
  1464. for (let i = 0; i < formData.data.fileList.length; i++) {
  1465. if (formData.data.fileList[i].raw.uploadState) {
  1466. ElMessage("文件上传中,请稍后提交");
  1467. return false;
  1468. }
  1469. }
  1470. }
  1471. if (
  1472. formData.data.packageFileList &&
  1473. formData.data.packageFileList.length > 0
  1474. ) {
  1475. for (let i = 0; i < formData.data.packageFileList.length; i++) {
  1476. if (formData.data.packageFileList[i].raw.uploadState) {
  1477. ElMessage("文件上传中,请稍后提交");
  1478. return false;
  1479. }
  1480. }
  1481. }
  1482. if (
  1483. formData.data.sampleShipmentList &&
  1484. formData.data.sampleShipmentList.length > 0
  1485. ) {
  1486. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1487. let data = formData.data.sampleShipmentList.filter(
  1488. (item) =>
  1489. item.productId === formData.data.sampleProductList[i].productId
  1490. );
  1491. if (data && data.length > 0) {
  1492. let quantity = 0;
  1493. for (let j = 0; j < data.length; j++) {
  1494. quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
  1495. }
  1496. if (quantity > formData.data.sampleProductList[i].quantity) {
  1497. ElMessage("出货数量不能大于商品数量");
  1498. return false;
  1499. }
  1500. }
  1501. }
  1502. }
  1503. return true;
  1504. } else {
  1505. setTimeout(() => {
  1506. const errorDiv = document.getElementsByClassName("is-error");
  1507. errorDiv[0].scrollIntoView();
  1508. }, 0);
  1509. }
  1510. return status;
  1511. };
  1512. // 接收父组件的传值
  1513. const props = defineProps({
  1514. queryData: Object,
  1515. });
  1516. watch(
  1517. props.queryData,
  1518. () => {
  1519. formOption.disabled = judgeStatus();
  1520. return;
  1521. if (
  1522. props.queryData &&
  1523. ["10", "20", "30"].includes(route.query.processType)
  1524. ) {
  1525. for (var text in props.queryData) {
  1526. if (text === "fileList" || text === "packageFileList") {
  1527. if (props.queryData[text] && props.queryData[text].length > 0) {
  1528. formData.data[text] = props.queryData[text].map((item) => {
  1529. return {
  1530. raw: item,
  1531. name: item.fileName,
  1532. url: item.fileUrl,
  1533. };
  1534. });
  1535. }
  1536. } else {
  1537. formData.data[text] = props.queryData[text];
  1538. }
  1539. }
  1540. if (formData.data.countryId) {
  1541. getCityData(formData.data.countryId, "20");
  1542. }
  1543. if (formData.data.provinceId) {
  1544. getCityData(formData.data.provinceId, "30");
  1545. }
  1546. }
  1547. },
  1548. {
  1549. deep: true,
  1550. }
  1551. );
  1552. const clickCustomerProduct = () => {
  1553. if (!formData.data.buyCorporationId) {
  1554. return ElMessage("请先选择客户");
  1555. }
  1556. openProductCustomer.value = true;
  1557. };
  1558. const loadingSearch = ref(false);
  1559. const remoteMethod = (keyword) => {
  1560. if (keyword && typeof keyword === "string") {
  1561. loadingSearch.value = true;
  1562. proxy.post("/customer/selPage", { keyword }).then((res) => {
  1563. customerList.value = res.rows.map((x) => ({
  1564. ...x,
  1565. label: x.name,
  1566. value: x.id,
  1567. }));
  1568. loadingSearch.value = false;
  1569. });
  1570. }
  1571. return;
  1572. };
  1573. const getFormData = () => {
  1574. return proxy.deepClone(formData.data);
  1575. };
  1576. // 向父组件暴露
  1577. defineExpose({
  1578. getFormData,
  1579. handleSubmit,
  1580. });
  1581. const changeShroffAccount = (val) => {
  1582. if (val) {
  1583. let data = accountList.value.filter((item) => item.value === val);
  1584. if (data && data.length > 0) {
  1585. formData.data.beneficiaryName = data[0].beneficiaryName;
  1586. formData.data.beneficiaryBank = data[0].beneficiaryBank;
  1587. formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
  1588. formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
  1589. formData.data.swiftCode = data[0].swiftCode;
  1590. formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
  1591. }
  1592. }
  1593. };
  1594. const changeActiveName = () => {
  1595. if (activeName.value) {
  1596. activeName.value = "";
  1597. } else {
  1598. activeName.value = "1";
  1599. }
  1600. };
  1601. const uploadFile = async (file) => {
  1602. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1603. uploadData.value = res.uploadBody;
  1604. file.id = res.id;
  1605. file.fileName = res.fileName;
  1606. file.fileUrl = res.fileUrl;
  1607. file.uploadState = true;
  1608. return true;
  1609. };
  1610. const indicationUploadFile = async (file) => {
  1611. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1612. indicationUploadData.value = res.uploadBody;
  1613. file.id = res.id;
  1614. file.fileName = res.fileName;
  1615. file.fileUrl = res.fileUrl;
  1616. file.uploadState = true;
  1617. return true;
  1618. };
  1619. const handleSuccess = (any, UploadFile) => {
  1620. UploadFile.raw.uploadState = false;
  1621. };
  1622. const onPreviewFile = (file) => {
  1623. window.open(file.raw.fileUrl, "_blank");
  1624. };
  1625. const clickSplit = (item) => {
  1626. formData.data.sampleShipmentList.push({
  1627. productCode: item.code,
  1628. productId: item.productId,
  1629. productName: item.productName,
  1630. shipmentTime: "",
  1631. quantity: undefined,
  1632. });
  1633. };
  1634. const clickDelete = (index) => {
  1635. formData.data.sampleShipmentList.splice(index, 1);
  1636. };
  1637. onMounted(() => {
  1638. formOption.disabled = judgeStatus();
  1639. if (route.query && route.query.processType) {
  1640. let businessId = route.query.businessId;
  1641. proxy.post("/sample/detail", { id: businessId }).then((res) => {
  1642. res.sampleShipmentList = res.sampleShipmentLists;
  1643. res.countryId = res.buyCountryId;
  1644. res.provinceId = res.buyProvinceId;
  1645. res.cityId = res.buyCityId;
  1646. if (!res.fileList) {
  1647. res.fileList = [];
  1648. }
  1649. if (!res.packageFileList) {
  1650. res.packageFileList = [];
  1651. }
  1652. for (const key in res) {
  1653. formData.data[key] = res[key];
  1654. }
  1655. proxy
  1656. .post("/fileInfo/getList", {
  1657. businessIdList: [businessId],
  1658. })
  1659. .then((fileObj) => {
  1660. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  1661. formData.data.fileList = fileObj[businessId]
  1662. .filter((x) => x.businessType === "1")
  1663. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1664. formData.data.packageFileList = fileObj[businessId]
  1665. .filter((x) => x.businessType === "2")
  1666. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1667. }
  1668. });
  1669. if (
  1670. formData.data.sampleProductList &&
  1671. formData.data.sampleProductList.length > 0
  1672. ) {
  1673. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1674. const e = formData.data.sampleProductList[i];
  1675. if (e.ehsdJson) {
  1676. let obj = JSON.parse(e.ehsdJson);
  1677. e.packMethod = obj.packMethod;
  1678. e.tradeMethods = obj.tradeMethods;
  1679. }
  1680. }
  1681. let ids = formData.data.sampleProductList.map((x) => x.productId);
  1682. proxy
  1683. .post("/fileInfo/getList", {
  1684. businessIdList: ids,
  1685. })
  1686. .then((fileObj) => {
  1687. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1688. const e = formData.data.sampleProductList[i];
  1689. for (const key in fileObj) {
  1690. if (e.productId === key) {
  1691. e.fileList = fileObj[key] || [];
  1692. if (e.fileList && e.fileList.length > 0) {
  1693. e.fileUrl = e.fileList[0].fileUrl;
  1694. }
  1695. }
  1696. }
  1697. }
  1698. });
  1699. }
  1700. if (formData.data.countryId) {
  1701. getCityData(formData.data.countryId, "20");
  1702. }
  1703. if (formData.data.provinceId) {
  1704. getCityData(formData.data.provinceId, "30");
  1705. }
  1706. });
  1707. } else if (route.query && !route.query.processType) {
  1708. let businessId = route.query.businessId;
  1709. proxy.post("/sample/detail", { id: businessId }).then((res) => {
  1710. if (res && res.dataJson) {
  1711. res = { ...res, ...JSON.parse(res.dataJson) };
  1712. }
  1713. res.sampleShipmentList = res.sampleShipmentLists;
  1714. res.countryId = res.buyCountryId;
  1715. res.provinceId = res.buyProvinceId;
  1716. res.cityId = res.buyCityId;
  1717. if (!res.fileList) {
  1718. res.fileList = [];
  1719. }
  1720. if (!res.packageFileList) {
  1721. res.packageFileList = [];
  1722. }
  1723. for (const key in res) {
  1724. formData.data[key] = res[key];
  1725. }
  1726. formData.data.oldSampleId = formData.data.id;
  1727. delete formData.data.id;
  1728. proxy
  1729. .post("/fileInfo/getList", {
  1730. businessIdList: [businessId],
  1731. })
  1732. .then((fileObj) => {
  1733. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  1734. formData.data.fileList = fileObj[businessId]
  1735. .filter((x) => x.businessType === "1")
  1736. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1737. formData.data.packageFileList = fileObj[businessId]
  1738. .filter((x) => x.businessType === "2")
  1739. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1740. }
  1741. });
  1742. if (
  1743. formData.data.sampleProductList &&
  1744. formData.data.sampleProductList.length > 0
  1745. ) {
  1746. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1747. const e = formData.data.sampleProductList[i];
  1748. if (e.ehsdJson) {
  1749. let obj = JSON.parse(e.ehsdJson);
  1750. e.packMethod = obj.packMethod;
  1751. e.tradeMethods = obj.tradeMethods;
  1752. }
  1753. }
  1754. let ids = formData.data.sampleProductList.map((x) => x.productId);
  1755. proxy
  1756. .post("/fileInfo/getList", {
  1757. businessIdList: ids,
  1758. })
  1759. .then((fileObj) => {
  1760. for (let i = 0; i < formData.data.sampleProductList.length; i++) {
  1761. const e = formData.data.sampleProductList[i];
  1762. for (const key in fileObj) {
  1763. if (e.productId === key) {
  1764. e.fileList = fileObj[key] || [];
  1765. if (e.fileList && e.fileList.length > 0) {
  1766. e.fileUrl = e.fileList[0].fileUrl;
  1767. }
  1768. }
  1769. }
  1770. }
  1771. });
  1772. }
  1773. if (formData.data.countryId) {
  1774. getCityData(formData.data.countryId, "20");
  1775. }
  1776. if (formData.data.provinceId) {
  1777. getCityData(formData.data.provinceId, "30");
  1778. }
  1779. });
  1780. }
  1781. });
  1782. </script>
  1783. <style lang="scss" scoped>
  1784. ::v-deep(.el-input-number .el-input__inner) {
  1785. text-align: left;
  1786. }
  1787. .pic {
  1788. object-fit: contain;
  1789. width: 50px;
  1790. height: 50px;
  1791. cursor: pointer;
  1792. vertical-align: middle;
  1793. }
  1794. .shrinkPadding {
  1795. padding-right: 0 !important;
  1796. }
  1797. .hideCollapse {
  1798. margin-top: -62px;
  1799. border: 0 !important;
  1800. }
  1801. ::v-deep(.el-collapse-item__arrow) {
  1802. display: none !important;
  1803. }
  1804. ::v-deep(.el-collapse-item__wrap) {
  1805. border: 0 !important;
  1806. }
  1807. ::v-deep(.el-collapse-item__header) {
  1808. border: 0 !important;
  1809. }
  1810. </style>