Sample.vue 56 KB

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