Sample.vue 71 KB

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