ContractChange.vue 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925
  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.name"
  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.contractProductList"
  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
  467. prop="productCnName"
  468. label="商品中文名"
  469. min-width="130"
  470. />
  471. <el-table-column label="商品英文名" min-width="180">
  472. <template #default="{ row, $index }">
  473. <div style="width: 100%">
  474. <el-form-item
  475. :prop="'contractProductList.' + $index + '.productName'"
  476. :rules="rules.productName"
  477. :inline-message="true"
  478. class="shrinkPadding"
  479. >
  480. <el-input
  481. v-model="row.productName"
  482. placeholder="请输入商品名称"
  483. />
  484. </el-form-item>
  485. </div>
  486. </template>
  487. </el-table-column>
  488. <el-table-column label="尺寸 cm*cm*cm" width="140">
  489. <template #default="{ row, $index }">
  490. <div style="width: 100%">
  491. <el-form-item
  492. :prop="'contractProductList.' + $index + '.productModel'"
  493. :rules="rules.productModel"
  494. :inline-message="true"
  495. class="shrinkPadding"
  496. >
  497. <el-input v-model="row.productModel" placeholder="请输入" />
  498. </el-form-item>
  499. </div>
  500. </template>
  501. </el-table-column>
  502. <el-table-column label="数量" width="130">
  503. <template #default="{ row, $index }">
  504. <div style="width: 100%">
  505. <el-form-item
  506. :prop="'contractProductList.' + $index + '.quantity'"
  507. :rules="rules.quantity"
  508. :inline-message="true"
  509. class="shrinkPadding"
  510. >
  511. <el-input-number
  512. onmousewheel="return false;"
  513. v-model="row.quantity"
  514. placeholder="请输入"
  515. style="width: 100%"
  516. :precision="0"
  517. :controls="false"
  518. :min="0"
  519. @change="calculationAmount()"
  520. />
  521. </el-form-item>
  522. </div>
  523. </template>
  524. </el-table-column>
  525. <el-table-column label="单价" width="140">
  526. <template #default="{ row, $index }">
  527. <div style="width: 100%">
  528. <el-form-item
  529. :prop="'contractProductList.' + $index + '.price'"
  530. :rules="rules.price"
  531. :inline-message="true"
  532. class="shrinkPadding"
  533. >
  534. <el-input-number
  535. onmousewheel="return false;"
  536. v-model="row.price"
  537. placeholder="请输入"
  538. style="width: 100%"
  539. :precision="2"
  540. :controls="false"
  541. :min="0"
  542. @change="calculationAmount()"
  543. />
  544. </el-form-item>
  545. </div>
  546. </template>
  547. </el-table-column>
  548. <el-table-column label="贸易方式" width="140">
  549. <template #default="{ row, $index }">
  550. <div style="width: 100%">
  551. <el-form-item
  552. :prop="'contractProductList.' + $index + '.tradeMethods'"
  553. :rules="rules.tradeMethods"
  554. :inline-message="true"
  555. class="shrinkPadding"
  556. >
  557. <el-select
  558. v-model="row.tradeMethods"
  559. placeholder="请选择"
  560. style="width: 100%"
  561. >
  562. <el-option
  563. v-for="item in tradeMethods"
  564. :key="item.value"
  565. :label="item.label"
  566. :value="item.value"
  567. />
  568. </el-select>
  569. </el-form-item>
  570. </div>
  571. </template>
  572. </el-table-column>
  573. <el-table-column label="包装方式" width="180">
  574. <template #default="{ row, $index }">
  575. <div style="width: 100%">
  576. <el-form-item
  577. :prop="'contractProductList.' + $index + '.packMethod'"
  578. :rules="rules.packMethod"
  579. :inline-message="true"
  580. class="shrinkPadding"
  581. >
  582. <el-input v-model="row.packMethod" placeholder="请输入" />
  583. </el-form-item>
  584. </div>
  585. </template>
  586. </el-table-column>
  587. <el-table-column
  588. prop="amount"
  589. :label="'金额 ( ' + formData.data.currency + ' )'"
  590. width="130"
  591. />
  592. <el-table-column
  593. label="操作"
  594. width="60"
  595. align="center"
  596. fixed="right"
  597. >
  598. <template #default="{ row, $index }">
  599. <el-button
  600. type="primary"
  601. link
  602. @click="handleRemove($index, row)"
  603. >删除</el-button
  604. >
  605. </template>
  606. </el-table-column>
  607. </el-table>
  608. </div>
  609. </template>
  610. <template #file>
  611. <div style="width: 100%">
  612. <el-upload
  613. v-model:fileList="formData.data.fileList"
  614. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  615. :data="uploadData"
  616. multiple
  617. :before-upload="uploadFile"
  618. :on-success="handleSuccess"
  619. :on-preview="onPreviewFile"
  620. >
  621. <el-button type="primary" plain>选择</el-button>
  622. </el-upload>
  623. </div>
  624. </template>
  625. <template #indication>
  626. <div style="width: 100%">
  627. <el-upload
  628. v-model:fileList="formData.data.packageFileList"
  629. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  630. :data="indicationUploadData"
  631. multiple
  632. :before-upload="indicationUploadFile"
  633. :on-success="handleSuccess"
  634. :on-preview="onPreviewFile"
  635. >
  636. <el-button type="primary" plain>选择</el-button>
  637. </el-upload>
  638. </div>
  639. </template>
  640. <template #otherCharge>
  641. <div style="width: 100%">
  642. <el-button type="primary" @click="clickAdd()">添加行</el-button>
  643. <el-table
  644. :data="formData.data.contractProjectList"
  645. style="width: 100%; margin-top: 16px"
  646. >
  647. <el-table-column label="收费项目" width="220">
  648. <template #default="{ row, $index }">
  649. <div style="width: 100%">
  650. <el-form-item
  651. :prop="'contractProjectList.' + $index + '.payName'"
  652. :rules="rules.payName"
  653. :inline-message="true"
  654. >
  655. <el-autocomplete
  656. v-model="row.payName"
  657. :fetch-suggestions="querySearch"
  658. clearable
  659. class="inline-input w-50"
  660. placeholder="请输入收费项目"
  661. />
  662. </el-form-item>
  663. </div>
  664. </template>
  665. </el-table-column>
  666. <el-table-column label="备注">
  667. <template #default="{ row, $index }">
  668. <div style="width: 100%">
  669. <el-form-item
  670. :prop="'contractProjectList.' + $index + '.remark'"
  671. >
  672. <el-input v-model="row.remark" placeholder="请输入备注" />
  673. </el-form-item>
  674. </div>
  675. </template>
  676. </el-table-column>
  677. <el-table-column
  678. :label="'金额 ( ' + formData.data.currency + ' )'"
  679. width="130"
  680. >
  681. <template #default="{ row, $index }">
  682. <div style="width: 100%">
  683. <el-form-item
  684. :prop="'contractProjectList.' + $index + '.amount'"
  685. :rules="rules.amount"
  686. :inline-message="true"
  687. class="shrinkPadding"
  688. >
  689. <el-input-number
  690. onmousewheel="return false;"
  691. v-model="row.amount"
  692. placeholder="请输入金额"
  693. style="width: 100%"
  694. :precision="2"
  695. :controls="false"
  696. :min="0"
  697. @change="totalAmount()"
  698. />
  699. </el-form-item>
  700. </div>
  701. </template>
  702. </el-table-column>
  703. <el-table-column
  704. label="操作"
  705. width="60"
  706. align="center"
  707. fixed="right"
  708. >
  709. <template #default="{ $index }">
  710. <el-button type="primary" link @click="handleDelete($index)"
  711. >删除</el-button
  712. >
  713. </template>
  714. </el-table-column>
  715. </el-table>
  716. </div>
  717. </template>
  718. <template #offerMoney>
  719. <div style="width: 100%; display: flex">
  720. <div style="width: calc(100% - 190px)"></div>
  721. <div style="width: 130px; padding: 0 12px">
  722. <el-form-item
  723. label="合同总金额"
  724. prop="amount"
  725. class="shrinkPadding"
  726. >
  727. <el-input
  728. v-model="formData.data.amount"
  729. placeholder="合同总金额"
  730. disabled
  731. />
  732. </el-form-item>
  733. </div>
  734. </div>
  735. </template>
  736. <template #shipment>
  737. <div style="width: 100%">
  738. <el-table
  739. :data="formData.data.contractShipmentList"
  740. style="width: 100%; margin-top: 16px"
  741. >
  742. <el-table-column prop="productCode" label="商品编码" width="120" />
  743. <el-table-column prop="productName" label="商品名称" />
  744. <el-table-column label="出货日期" width="220">
  745. <template #default="{ row, $index }">
  746. <div style="width: 100%">
  747. <el-form-item
  748. :prop="'contractShipmentList.' + $index + '.shipmentTime'"
  749. :rules="rules.shipmentTime"
  750. :inline-message="true"
  751. >
  752. <el-date-picker
  753. v-model="row.shipmentTime"
  754. type="date"
  755. placeholder="请选择出货日期"
  756. value-format="YYYY-MM-DD"
  757. />
  758. </el-form-item>
  759. </div>
  760. </template>
  761. </el-table-column>
  762. <el-table-column label="数量" width="160">
  763. <template #default="{ row, $index }">
  764. <div style="width: 100%">
  765. <el-form-item
  766. :prop="'contractShipmentList.' + $index + '.quantity'"
  767. :inline-message="true"
  768. >
  769. <el-input-number
  770. onmousewheel="return false;"
  771. v-model="row.quantity"
  772. placeholder="请输入数量"
  773. style="width: 100%"
  774. :precision="0"
  775. :controls="false"
  776. :min="0"
  777. @change="calculationAmount()"
  778. />
  779. </el-form-item>
  780. </div>
  781. </template>
  782. </el-table-column>
  783. <el-table-column
  784. align="center"
  785. label="操作"
  786. width="120"
  787. fixed="right"
  788. >
  789. <template #default="{ row, $index }">
  790. <el-button type="primary" link @click="clickSplit(row)"
  791. >拆分</el-button
  792. >
  793. <el-button type="primary" link @click="clickDelete($index)"
  794. >删除</el-button
  795. >
  796. </template>
  797. </el-table-column>
  798. </el-table>
  799. </div>
  800. </template>
  801. </byForm>
  802. <el-dialog
  803. v-if="openProductCompany"
  804. v-model="openProductCompany"
  805. title="公司产品库"
  806. width="90%"
  807. append-to-body
  808. >
  809. <CompanyProduct
  810. :selectStatus="true"
  811. @selectProduct="selectProduct"
  812. ></CompanyProduct>
  813. </el-dialog>
  814. <el-dialog
  815. v-if="openProductCustomer"
  816. v-model="openProductCustomer"
  817. title="客户产品库"
  818. width="90%"
  819. append-to-body
  820. >
  821. <CustomerProduct
  822. :selectStatus="true"
  823. :buyCorporationId="formData.data.buyCorporationId"
  824. @selectProduct="selectProduct"
  825. ></CustomerProduct>
  826. </el-dialog>
  827. </div>
  828. </template>
  829. <script setup>
  830. import byForm from "@/components/byForm/index";
  831. import CompanyProduct from "@/views/EHSD/productLibrary/companyProduct/index";
  832. import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
  833. import { ElMessage } from "element-plus";
  834. import selectCity from "@/components/selectCity/index.vue";
  835. import { useRoute } from "vue-router";
  836. const route = useRoute();
  837. const { proxy } = getCurrentInstance();
  838. const innerMethod = ref([]);
  839. const outsideMethod = ref([]);
  840. const accountCurrency = ref([]);
  841. const fundsPaymentMethod = ref([]);
  842. const tradeMethods = ref([]);
  843. const shippingMethod = ref([]);
  844. const templateList = ref([]);
  845. const corporationList = ref([]);
  846. const customerList = ref([]);
  847. const accountList = ref([]);
  848. const countryData = ref([]);
  849. const provinceData = ref([]);
  850. const cityData = ref([]);
  851. const customerUserList = ref([]);
  852. const openProductCompany = ref(false);
  853. const openProductCustomer = ref(false);
  854. const activeName = ref("1");
  855. const formData = reactive({
  856. data: {
  857. currency: "",
  858. amount: undefined,
  859. contractProductList: [],
  860. contractProjectList: [],
  861. fileList: [],
  862. packageFileList: [],
  863. contractShipmentList: [],
  864. },
  865. });
  866. const submit = ref(null);
  867. const judgeStatus = () => {
  868. if (route.query.processType == 20 || route.query.processType == 10) {
  869. return true;
  870. }
  871. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  872. let data = props.queryData.recordList.filter(
  873. (item) => item.status === 2 && item.nodeType !== 1
  874. );
  875. if (data && data.length > 0) {
  876. return true;
  877. }
  878. }
  879. return false;
  880. };
  881. const formOption = reactive({
  882. inline: true,
  883. labelWidth: 100,
  884. itemWidth: 100,
  885. rules: [],
  886. disabled: false,
  887. });
  888. const uploadData = ref({});
  889. const indicationUploadData = ref({});
  890. const formConfig = computed(() => {
  891. return [
  892. {
  893. type: "title",
  894. title: "合同模板",
  895. label: "",
  896. },
  897. {
  898. type: "select",
  899. label: "选择合同模板",
  900. prop: "contractTemplateId",
  901. data: templateList.value,
  902. fn: (val) => {
  903. changeTemplate(val);
  904. },
  905. },
  906. {
  907. type: "slot",
  908. slotName: "seller",
  909. label: "卖方信息",
  910. itemWidth: 50,
  911. },
  912. {
  913. type: "slot",
  914. slotName: "buyer",
  915. label: "买方信息",
  916. itemWidth: 50,
  917. },
  918. {
  919. type: "slot",
  920. slotName: "payment",
  921. label: "付款信息",
  922. },
  923. {
  924. type: "slot",
  925. slotName: "delivery",
  926. label: "交付信息",
  927. },
  928. {
  929. type: "slot",
  930. slotName: "commodity",
  931. label: "商品信息",
  932. },
  933. {
  934. type: "slot",
  935. slotName: "file",
  936. label: "交接单",
  937. },
  938. {
  939. type: "slot",
  940. slotName: "indication",
  941. label: "包装指示",
  942. },
  943. {
  944. type: "slot",
  945. slotName: "otherCharge",
  946. label: "其他收费项目",
  947. },
  948. {
  949. type: "slot",
  950. slotName: "offerMoney",
  951. },
  952. {
  953. type: "slot",
  954. slotName: "shipment",
  955. label: "出货计划",
  956. },
  957. ];
  958. });
  959. const rules = ref({
  960. contractTemplateId: [
  961. { required: true, message: "请选择合同模板", trigger: "change" },
  962. ],
  963. buyCorporationId: [
  964. { required: true, message: "请选择公司", trigger: "change" },
  965. ],
  966. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  967. sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  968. buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  969. buyContactName: [
  970. { required: true, message: "请输入联系人", trigger: ["change", "blur"] },
  971. ],
  972. buyContactNumber: [
  973. { required: true, message: "请输入联系电话", trigger: "blur" },
  974. ],
  975. productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
  976. productModel: [
  977. { required: true, message: "请输入尺寸 cm*cm*cm", trigger: "blur" },
  978. ],
  979. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  980. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  981. // packMethod: [{ required: true, message: "请输入包装方式", trigger: "blur" }],
  982. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  983. payName: [
  984. { required: true, message: "请输入收费项目", trigger: ["change", "blur"] },
  985. ],
  986. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  987. effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
  988. deliveryTime: [
  989. { required: true, message: "请选择交货期限", trigger: "change" },
  990. ],
  991. paymentMethod: [
  992. { required: true, message: "请选择付款方式", trigger: "change" },
  993. ],
  994. advanceRatio: [
  995. { required: true, message: "请输入预付比例", trigger: "blur" },
  996. ],
  997. shroffAccountId: [
  998. { required: true, message: "请选择收款账号", trigger: "change" },
  999. ],
  1000. // tradeMethods: [
  1001. // { required: true, message: "请选择贸易方式", trigger: "change" },
  1002. // ],
  1003. transportMethod: [
  1004. { required: true, message: "请选择运输方式", trigger: "change" },
  1005. ],
  1006. transportRemark: [
  1007. { required: true, message: "请输入运输说明", trigger: "blur" },
  1008. ],
  1009. remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
  1010. rate: [{ required: true, message: "请输入汇率", trigger: "blur" }],
  1011. });
  1012. const getDict = () => {
  1013. proxy
  1014. .getDictOne([
  1015. "inner_packaging_method_ehsd",
  1016. "outside_packaging_method_ehsd",
  1017. "account_currency",
  1018. "funds_payment_method",
  1019. "trade_mode",
  1020. "shipping_method",
  1021. ])
  1022. .then((res) => {
  1023. innerMethod.value = res["inner_packaging_method_ehsd"].map((x) => ({
  1024. label: x.dictValue,
  1025. value: x.dictKey,
  1026. }));
  1027. outsideMethod.value = res["outside_packaging_method_ehsd"].map((x) => ({
  1028. label: x.dictValue,
  1029. value: x.dictKey,
  1030. }));
  1031. accountCurrency.value = res["account_currency"].map((x) => ({
  1032. label: x.dictValue,
  1033. value: x.dictKey,
  1034. }));
  1035. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  1036. label: x.dictValue,
  1037. value: x.dictKey,
  1038. }));
  1039. tradeMethods.value = res["trade_mode"].map((x) => ({
  1040. label: x.dictValue,
  1041. value: x.dictKey,
  1042. }));
  1043. shippingMethod.value = res["shipping_method"].map((x) => ({
  1044. label: x.dictValue,
  1045. value: x.dictKey,
  1046. }));
  1047. });
  1048. proxy
  1049. .post("/contractTemplate/page", { pageNum: 1, pageSize: 999 })
  1050. .then((res) => {
  1051. templateList.value = res.rows.map((item) => {
  1052. return {
  1053. ...item,
  1054. label: item.templateName,
  1055. value: item.id,
  1056. };
  1057. });
  1058. });
  1059. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1060. corporationList.value = res.rows.map((item) => {
  1061. return {
  1062. ...item,
  1063. label: item.name,
  1064. value: item.id,
  1065. };
  1066. });
  1067. });
  1068. proxy
  1069. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  1070. .then((res) => {
  1071. accountList.value = res.rows.map((item) => {
  1072. return {
  1073. ...item,
  1074. label: item.alias,
  1075. value: item.id,
  1076. };
  1077. });
  1078. });
  1079. };
  1080. getDict();
  1081. const changeTemplate = (val) => {
  1082. formData.data.sellCorporationId = "";
  1083. formData.data.sellContactName = "";
  1084. formData.data.sellContactNumber = "";
  1085. formData.data.sellCountryName = "";
  1086. formData.data.sellProvinceName = "";
  1087. formData.data.sellCityName = "";
  1088. formData.data.sellAddress = "";
  1089. if (val) {
  1090. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  1091. formData.data.sellCorporationId = res.corporationId;
  1092. if (res.corporationId) {
  1093. proxy
  1094. .post("/corporation/detail", { id: res.corporationId })
  1095. .then((detailCorporation) => {
  1096. proxy
  1097. .post("/customizeArea/list", { parentId: "0" })
  1098. .then((resCountry) => {
  1099. let sellCountryData = resCountry.filter(
  1100. (item) => item.id === detailCorporation.countryId
  1101. );
  1102. if (sellCountryData && sellCountryData.length > 0) {
  1103. formData.data.sellCountryName =
  1104. sellCountryData[0].chineseName;
  1105. } else {
  1106. formData.data.sellCountryName = "";
  1107. }
  1108. });
  1109. if (detailCorporation.countryId) {
  1110. proxy
  1111. .post("/customizeArea/list", {
  1112. parentId: detailCorporation.countryId,
  1113. })
  1114. .then((resProvince) => {
  1115. let sellProvinceData = resProvince.filter(
  1116. (item) => item.id === detailCorporation.provinceId
  1117. );
  1118. if (sellProvinceData && sellProvinceData.length > 0) {
  1119. formData.data.sellProvinceName = sellProvinceData[0].name;
  1120. } else {
  1121. formData.data.sellProvinceName = "";
  1122. }
  1123. });
  1124. } else {
  1125. formData.data.sellProvinceName = "";
  1126. }
  1127. if (detailCorporation.provinceId) {
  1128. proxy
  1129. .post("/customizeArea/list", {
  1130. parentId: detailCorporation.provinceId,
  1131. })
  1132. .then((resCity) => {
  1133. let sellCityData = resCity.filter(
  1134. (item) => item.id === detailCorporation.cityId
  1135. );
  1136. if (sellCityData && sellCityData.length > 0) {
  1137. formData.data.sellCityName = sellCityData[0].name;
  1138. } else {
  1139. formData.data.sellCityName = "";
  1140. }
  1141. });
  1142. } else {
  1143. formData.data.sellCityName = "";
  1144. }
  1145. formData.data.sellAddress = detailCorporation.address;
  1146. });
  1147. }
  1148. formData.data.sellContactName = res.contactName;
  1149. formData.data.sellContactNumber = res.contactNumber;
  1150. });
  1151. }
  1152. };
  1153. const getCityData = (id, type, isChange) => {
  1154. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1155. if (type === "20") {
  1156. provinceData.value = res;
  1157. if (isChange) {
  1158. formData.data.provinceId = "";
  1159. formData.data.provinceName = "";
  1160. formData.data.cityId = "";
  1161. formData.data.cityName = "";
  1162. }
  1163. } else if (type === "30") {
  1164. cityData.value = res;
  1165. if (isChange) {
  1166. formData.data.cityId = "";
  1167. formData.data.cityName = "";
  1168. }
  1169. } else {
  1170. countryData.value = res;
  1171. }
  1172. });
  1173. };
  1174. getCityData("0");
  1175. let auxiliaryData = ref([
  1176. {
  1177. label: "最近合同",
  1178. data: [],
  1179. },
  1180. {
  1181. label: "产品价格",
  1182. data: [],
  1183. },
  1184. ]);
  1185. const emit = defineEmits(["auxiliaryChange"]);
  1186. const getDecisionAids = () => {
  1187. let data = {
  1188. buyCorporationId: formData.data.buyCorporationId,
  1189. productIdList: [],
  1190. };
  1191. if (
  1192. formData.data.contractProductList &&
  1193. formData.data.contractProductList.length > 0
  1194. ) {
  1195. data.productIdList = formData.data.contractProductList.map(
  1196. (item) => item.productId
  1197. );
  1198. }
  1199. proxy.post("/contract/decisionAid", data).then((res) => {
  1200. if (res.lastContractList && res.lastContractList.length > 0) {
  1201. auxiliaryData.value[0].data = res.lastContractList.map((item) => {
  1202. return [
  1203. {
  1204. label: "合同编号",
  1205. value: item.code,
  1206. style: {
  1207. color: "#0084FF",
  1208. },
  1209. id: item.id,
  1210. num: 1,
  1211. // fn: () => {},
  1212. },
  1213. {
  1214. label: "下单日期",
  1215. value: item.createTime,
  1216. id: item.id,
  1217. num: 1,
  1218. },
  1219. {
  1220. label: "合同金额",
  1221. value: item.currency + item.amount,
  1222. id: item.id,
  1223. num: 1,
  1224. },
  1225. ];
  1226. });
  1227. } else {
  1228. auxiliaryData.value[0].data = [];
  1229. }
  1230. if (res.productPriceList && res.productPriceList.length > 0) {
  1231. auxiliaryData.value[1].data = res.productPriceList.map((item) => {
  1232. return [
  1233. {
  1234. label: "产品名称",
  1235. value: item.name,
  1236. id: item.id,
  1237. num: 1,
  1238. },
  1239. {
  1240. label: "最近价格",
  1241. value: item.lastPrice,
  1242. id: item.id,
  1243. num: 1,
  1244. },
  1245. {
  1246. label: "历史最高",
  1247. value: item.maxPrice,
  1248. id: item.id,
  1249. num: 1,
  1250. },
  1251. {
  1252. label: "历史最低",
  1253. value: item.minPrice,
  1254. id: item.id,
  1255. num: 1,
  1256. },
  1257. ];
  1258. });
  1259. } else {
  1260. auxiliaryData.value[1].data = [];
  1261. }
  1262. emit("auxiliaryChange", auxiliaryData.value);
  1263. });
  1264. };
  1265. const changeCustomer = (val) => {
  1266. formData.data.contractProductList = [];
  1267. formData.data.customerName = "";
  1268. formData.data.customerTel = "";
  1269. if (val) {
  1270. proxy.post("/customer/detail", { id: val }).then(
  1271. (res) => {
  1272. formData.data.buyCorporationName = res.name;
  1273. if (res.customerUserList && res.customerUserList.length > 0) {
  1274. formData.data.buyContactName = res.customerUserList[0].name;
  1275. if (res.customerUserList[0].contactJson) {
  1276. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  1277. if (contactJson && contactJson.length > 0) {
  1278. formData.data.buyContactNumber = contactJson[0].contactNo;
  1279. }
  1280. }
  1281. customerUserList.value = res.customerUserList.map((item) => {
  1282. return {
  1283. ...item,
  1284. value: item.name,
  1285. };
  1286. });
  1287. }
  1288. formData.data.countryId = res.countryId;
  1289. formData.data.provinceId = res.provinceId;
  1290. formData.data.cityId = res.cityId;
  1291. formData.data.buyPostalCode = res.zipCode;
  1292. formData.data.buyAddress = res.address;
  1293. getCityData(formData.data.countryId, "20");
  1294. if (formData.data.provinceId) {
  1295. getCityData(formData.data.provinceId, "30");
  1296. }
  1297. },
  1298. (err) => {
  1299. console.log(err);
  1300. formData.data.countryId = "";
  1301. formData.data.provinceId = "";
  1302. formData.data.cityId = "";
  1303. formData.data.buyPostalCode = "";
  1304. formData.data.buyAddress = "";
  1305. }
  1306. );
  1307. } else {
  1308. formData.data.countryId = "";
  1309. formData.data.provinceId = "";
  1310. formData.data.cityId = "";
  1311. formData.data.buyPostalCode = "";
  1312. formData.data.buyAddress = "";
  1313. }
  1314. getDecisionAids();
  1315. };
  1316. const createFilter = (queryString) => {
  1317. return (restaurant) => {
  1318. return (
  1319. restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
  1320. );
  1321. };
  1322. };
  1323. const querySearchPerson = (queryString, callback) => {
  1324. const results = queryString
  1325. ? customerUserList.value.filter(createFilter(queryString))
  1326. : customerUserList.value;
  1327. callback(results);
  1328. };
  1329. const handlePerson = (item) => {
  1330. formData.data.customerTel = item.phone;
  1331. };
  1332. const selectProduct = (goods) => {
  1333. if (goods && goods.id) {
  1334. let data = formData.data.contractProductList.filter(
  1335. (item) => item.productId === goods.id
  1336. );
  1337. if (data && data.length > 0) {
  1338. return ElMessage("该产品已添加");
  1339. }
  1340. let fileUrl = "";
  1341. if (goods.fileList && goods.fileList.length > 0) {
  1342. fileUrl = goods.fileList[0].fileUrl;
  1343. }
  1344. let packMethod = "";
  1345. if (goods.innerPackMethod) {
  1346. let innerPackMethod = goods.innerPackMethod.split(",");
  1347. innerPackMethod.map((item) => {
  1348. if (packMethod) {
  1349. packMethod =
  1350. packMethod + "," + proxy.dictValueLabel(item, innerMethod.value);
  1351. } else {
  1352. packMethod = proxy.dictValueLabel(item, innerMethod.value);
  1353. }
  1354. });
  1355. }
  1356. if (goods.outerPackMethod) {
  1357. let outerPackMethod = goods.outerPackMethod.split(",");
  1358. outerPackMethod.map((item) => {
  1359. if (packMethod) {
  1360. packMethod =
  1361. packMethod + "," + proxy.dictValueLabel(item, outsideMethod.value);
  1362. } else {
  1363. packMethod = proxy.dictValueLabel(item, outsideMethod.value);
  1364. }
  1365. });
  1366. }
  1367. if (
  1368. formData.data.contractProductList &&
  1369. formData.data.contractProductList.length > 0
  1370. ) {
  1371. formData.data.contractProductList.push({
  1372. fileUrl: fileUrl,
  1373. productId: goods.id,
  1374. productCnName: goods.nameEnglish,
  1375. productName: goods.name,
  1376. productModel:
  1377. goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
  1378. quantity: undefined,
  1379. price: undefined,
  1380. amount: "",
  1381. tradeMethods: "",
  1382. packMethod: packMethod,
  1383. });
  1384. } else {
  1385. formData.data.contractProductList = [
  1386. {
  1387. fileUrl: fileUrl,
  1388. productId: goods.id,
  1389. productCnName: goods.nameEnglish,
  1390. productName: goods.name,
  1391. productModel:
  1392. goods.productLong +
  1393. "*" +
  1394. goods.productWide +
  1395. "*" +
  1396. goods.productHigh,
  1397. quantity: undefined,
  1398. price: undefined,
  1399. amount: "",
  1400. tradeMethods: "",
  1401. packMethod: packMethod,
  1402. },
  1403. ];
  1404. }
  1405. formData.data.contractShipmentList.push({
  1406. productCode: goods.code,
  1407. productId: goods.id,
  1408. productName: goods.name,
  1409. shipmentTime: "",
  1410. quantity: undefined,
  1411. });
  1412. ElMessage({
  1413. message: "添加成功!",
  1414. type: "success",
  1415. });
  1416. } else {
  1417. return ElMessage("选择错误");
  1418. }
  1419. getDecisionAids();
  1420. };
  1421. const onPicture = (path) => {
  1422. window.open(path, "_blank");
  1423. };
  1424. const handleRemove = async (index, row) => {
  1425. formData.data.contractShipmentList =
  1426. formData.data.contractShipmentList.filter(
  1427. (item) => item.productId !== row.productId
  1428. );
  1429. await formData.data.contractProductList.splice(index, 1);
  1430. totalAmount();
  1431. };
  1432. const calculationAmount = () => {
  1433. nextTick(() => {
  1434. if (
  1435. formData.data.contractProductList &&
  1436. formData.data.contractProductList.length > 0
  1437. ) {
  1438. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1439. let money = 0;
  1440. if (
  1441. formData.data.contractProductList[i].quantity &&
  1442. formData.data.contractProductList[i].price
  1443. ) {
  1444. money = parseFloat(
  1445. Number(formData.data.contractProductList[i].quantity) *
  1446. Number(formData.data.contractProductList[i].price)
  1447. ).toFixed(2);
  1448. }
  1449. formData.data.contractProductList[i].amount = money;
  1450. }
  1451. }
  1452. nextTick(() => {
  1453. totalAmount();
  1454. });
  1455. });
  1456. };
  1457. const totalAmount = () => {
  1458. let money = 0;
  1459. if (
  1460. formData.data.contractProductList &&
  1461. formData.data.contractProductList.length > 0
  1462. ) {
  1463. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1464. if (formData.data.contractProductList[i].amount) {
  1465. money = parseFloat(
  1466. Number(money) + Number(formData.data.contractProductList[i].amount)
  1467. ).toFixed(2);
  1468. }
  1469. }
  1470. }
  1471. if (
  1472. formData.data.contractProjectList &&
  1473. formData.data.contractProjectList.length > 0
  1474. ) {
  1475. for (let i = 0; i < formData.data.contractProjectList.length; i++) {
  1476. if (formData.data.contractProjectList[i].amount) {
  1477. money = parseFloat(
  1478. Number(money) + Number(formData.data.contractProjectList[i].amount)
  1479. ).toFixed(2);
  1480. }
  1481. }
  1482. }
  1483. formData.data.amount = money;
  1484. };
  1485. const clickAdd = () => {
  1486. if (
  1487. formData.data.contractProjectList &&
  1488. formData.data.contractProjectList.length > 0
  1489. ) {
  1490. formData.data.contractProjectList.push({
  1491. payName: "",
  1492. amount: undefined,
  1493. remark: "",
  1494. });
  1495. } else {
  1496. formData.data.contractProjectList = [
  1497. { payName: "", amount: undefined, remark: "" },
  1498. ];
  1499. }
  1500. };
  1501. const handleDelete = async (index) => {
  1502. await formData.data.contractProjectList.splice(index, 1);
  1503. totalAmount();
  1504. getDecisionAids();
  1505. };
  1506. const querySearch = (queryString, callback) => {
  1507. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  1508. if (res.rows && res.rows.length > 0) {
  1509. res.rows = res.rows.map((item) => {
  1510. return {
  1511. ...item,
  1512. value: item.payName,
  1513. };
  1514. });
  1515. callback(res.rows);
  1516. } else {
  1517. callback([]);
  1518. }
  1519. });
  1520. };
  1521. const handleSubmit = async () => {
  1522. let status = await submit.value.handleSubmit(() => {});
  1523. if (status) {
  1524. if (
  1525. !(
  1526. formData.data.contractProductList &&
  1527. formData.data.contractProductList.length > 0
  1528. )
  1529. ) {
  1530. ElMessage("请添加至少一件商品");
  1531. return false;
  1532. }
  1533. if (formData.data.fileList && formData.data.fileList.length > 0) {
  1534. for (let i = 0; i < formData.data.fileList.length; i++) {
  1535. if (formData.data.fileList[i].raw.uploadState) {
  1536. ElMessage("文件上传中,请稍后提交");
  1537. return false;
  1538. }
  1539. }
  1540. }
  1541. if (
  1542. formData.data.packageFileList &&
  1543. formData.data.packageFileList.length > 0
  1544. ) {
  1545. for (let i = 0; i < formData.data.packageFileList.length; i++) {
  1546. if (formData.data.packageFileList[i].raw.uploadState) {
  1547. ElMessage("文件上传中,请稍后提交");
  1548. return false;
  1549. }
  1550. }
  1551. }
  1552. if (
  1553. formData.data.contractShipmentList &&
  1554. formData.data.contractShipmentList.length > 0
  1555. ) {
  1556. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1557. let data = formData.data.contractShipmentList.filter(
  1558. (item) =>
  1559. item.productId === formData.data.contractProductList[i].productId
  1560. );
  1561. if (data && data.length > 0) {
  1562. let quantity = 0;
  1563. for (let j = 0; j < data.length; j++) {
  1564. quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
  1565. }
  1566. if (quantity > formData.data.contractProductList[i].quantity) {
  1567. ElMessage("出货数量不能大于商品数量");
  1568. return false;
  1569. }
  1570. }
  1571. }
  1572. }
  1573. return true;
  1574. } else {
  1575. setTimeout(() => {
  1576. const errorDiv = document.getElementsByClassName("is-error");
  1577. errorDiv[0].scrollIntoView();
  1578. }, 0);
  1579. }
  1580. return status;
  1581. };
  1582. // 接收父组件的传值
  1583. const props = defineProps({
  1584. queryData: Object,
  1585. });
  1586. const clickCustomerProduct = () => {
  1587. if (!formData.data.buyCorporationId) {
  1588. return ElMessage("请先选择客户");
  1589. }
  1590. openProductCustomer.value = true;
  1591. };
  1592. const loadingSearch = ref(false);
  1593. const remoteMethod = (keyword) => {
  1594. if (keyword && typeof keyword === "string") {
  1595. loadingSearch.value = true;
  1596. proxy.post("/customer/selPage", { keyword }).then((res) => {
  1597. customerList.value = res.rows.map((x) => ({
  1598. ...x,
  1599. label: x.name,
  1600. value: x.id,
  1601. }));
  1602. loadingSearch.value = false;
  1603. });
  1604. }
  1605. return;
  1606. };
  1607. const getFormData = () => {
  1608. return proxy.deepClone(formData.data);
  1609. };
  1610. // 向父组件暴露
  1611. defineExpose({
  1612. getFormData,
  1613. handleSubmit,
  1614. });
  1615. const changeShroffAccount = (val) => {
  1616. if (val) {
  1617. let data = accountList.value.filter((item) => item.value === val);
  1618. if (data && data.length > 0) {
  1619. formData.data.beneficiaryName = data[0].beneficiaryName;
  1620. formData.data.beneficiaryBank = data[0].beneficiaryBank;
  1621. formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
  1622. formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
  1623. formData.data.swiftCode = data[0].swiftCode;
  1624. formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
  1625. }
  1626. }
  1627. };
  1628. const changeActiveName = () => {
  1629. if (activeName.value) {
  1630. activeName.value = "";
  1631. } else {
  1632. activeName.value = "1";
  1633. }
  1634. };
  1635. const uploadFile = async (file) => {
  1636. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1637. uploadData.value = res.uploadBody;
  1638. file.id = res.id;
  1639. file.fileName = res.fileName;
  1640. file.fileUrl = res.fileUrl;
  1641. file.uploadState = true;
  1642. return true;
  1643. };
  1644. const indicationUploadFile = async (file) => {
  1645. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1646. indicationUploadData.value = res.uploadBody;
  1647. file.id = res.id;
  1648. file.fileName = res.fileName;
  1649. file.fileUrl = res.fileUrl;
  1650. file.uploadState = true;
  1651. return true;
  1652. };
  1653. const handleSuccess = (any, UploadFile) => {
  1654. UploadFile.raw.uploadState = false;
  1655. };
  1656. const onPreviewFile = (file) => {
  1657. window.open(file.raw.fileUrl, "_blank");
  1658. };
  1659. const clickSplit = (item) => {
  1660. formData.data.contractShipmentList.push({
  1661. productCode: item.code,
  1662. productId: item.productId,
  1663. productName: item.productName,
  1664. shipmentTime: "",
  1665. quantity: undefined,
  1666. });
  1667. };
  1668. const clickDelete = (index) => {
  1669. formData.data.contractShipmentList.splice(index, 1);
  1670. };
  1671. watch(
  1672. props.queryData,
  1673. () => {
  1674. formOption.disabled = judgeStatus();
  1675. return;
  1676. if (
  1677. props.queryData &&
  1678. ["10", "20", "30"].includes(route.query.processType)
  1679. ) {
  1680. for (var text in props.queryData) {
  1681. if (text === "fileList" || text === "packageFileList") {
  1682. if (props.queryData[text] && props.queryData[text].length > 0) {
  1683. formData.data[text] = props.queryData[text].map((item) => {
  1684. return {
  1685. raw: item,
  1686. name: item.fileName,
  1687. url: item.fileUrl,
  1688. };
  1689. });
  1690. }
  1691. } else {
  1692. formData.data[text] = props.queryData[text];
  1693. }
  1694. }
  1695. if (formData.data.countryId) {
  1696. getCityData(formData.data.countryId, "20");
  1697. }
  1698. if (formData.data.provinceId) {
  1699. getCityData(formData.data.provinceId, "30");
  1700. }
  1701. getDecisionAids();
  1702. }
  1703. },
  1704. {
  1705. deep: true,
  1706. }
  1707. );
  1708. onMounted(() => {
  1709. formOption.disabled = judgeStatus();
  1710. console.log(route.query, "qqda");
  1711. if (route.query && route.query.businessId && route.query.processType) {
  1712. let businessId = route.query.businessId;
  1713. proxy.post("/contract/detail", { id: businessId }).then((res) => {
  1714. if (!res.fileList) {
  1715. res.fileList = [];
  1716. }
  1717. if (!res.packageFileList) {
  1718. res.packageFileList = [];
  1719. }
  1720. res.countryId = res.buyCountryId;
  1721. res.provinceId = res.buyProvinceId;
  1722. res.cityId = res.buyCityId;
  1723. for (const key in res) {
  1724. formData.data[key] = res[key];
  1725. }
  1726. proxy
  1727. .post("/fileInfo/getList", {
  1728. businessIdList: [businessId],
  1729. })
  1730. .then((fileObj) => {
  1731. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  1732. formData.data.fileList = fileObj[businessId]
  1733. .filter((x) => x.businessType === "1")
  1734. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1735. formData.data.packageFileList = fileObj[businessId]
  1736. .filter((x) => x.businessType === "2")
  1737. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1738. }
  1739. });
  1740. if (
  1741. formData.data.contractProductList &&
  1742. formData.data.contractProductList.length > 0
  1743. ) {
  1744. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1745. const e = formData.data.contractProductList[i];
  1746. if (e.ehsdJson) {
  1747. let obj = JSON.parse(e.ehsdJson);
  1748. e.packMethod = obj.packMethod;
  1749. e.tradeMethods = obj.tradeMethods;
  1750. }
  1751. }
  1752. let ids = formData.data.contractProductList.map((x) => x.productId);
  1753. proxy
  1754. .post("/fileInfo/getList", {
  1755. businessIdList: ids,
  1756. })
  1757. .then((fileObj) => {
  1758. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1759. const e = formData.data.contractProductList[i];
  1760. for (const key in fileObj) {
  1761. if (e.productId === key) {
  1762. e.fileList = fileObj[key] || [];
  1763. if (e.fileList && e.fileList.length > 0) {
  1764. e.fileUrl = e.fileList[0].fileUrl;
  1765. }
  1766. }
  1767. }
  1768. }
  1769. });
  1770. }
  1771. if (formData.data.countryId) {
  1772. getCityData(formData.data.countryId, "20");
  1773. }
  1774. if (formData.data.provinceId) {
  1775. getCityData(formData.data.provinceId, "30");
  1776. }
  1777. });
  1778. } else if (
  1779. route.query &&
  1780. route.query.businessId &&
  1781. !route.query.processType
  1782. ) {
  1783. let businessId = route.query.businessId;
  1784. proxy.post("/contract/detail", { id: businessId }).then((res) => {
  1785. if (res && res.buyCorporationName) {
  1786. proxy
  1787. .post("/customer/selPage", { keyword: res.buyCorporationName })
  1788. .then((res) => {
  1789. customerList.value = res.rows.map((x) => ({
  1790. ...x,
  1791. label: x.name,
  1792. value: x.id,
  1793. }));
  1794. });
  1795. }
  1796. if (!res.fileList) {
  1797. res.fileList = [];
  1798. }
  1799. if (!res.packageFileList) {
  1800. res.packageFileList = [];
  1801. }
  1802. res.countryId = res.buyCountryId;
  1803. res.provinceId = res.buyProvinceId;
  1804. res.cityId = res.buyCityId;
  1805. for (const key in res) {
  1806. formData.data[key] = res[key];
  1807. }
  1808. formData.data.oldContractId = formData.data.id;
  1809. delete formData.data.id;
  1810. delete formData.data.code;
  1811. proxy
  1812. .post("/fileInfo/getList", {
  1813. businessIdList: [businessId],
  1814. })
  1815. .then((fileObj) => {
  1816. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  1817. formData.data.fileList = fileObj[businessId]
  1818. .filter((x) => x.businessType === "1")
  1819. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1820. formData.data.packageFileList = fileObj[businessId]
  1821. .filter((x) => x.businessType === "2")
  1822. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1823. }
  1824. });
  1825. if (
  1826. formData.data.contractProductList &&
  1827. formData.data.contractProductList.length > 0
  1828. ) {
  1829. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1830. const e = formData.data.contractProductList[i];
  1831. if (e.ehsdJson) {
  1832. let obj = JSON.parse(e.ehsdJson);
  1833. e.packMethod = obj.packMethod;
  1834. e.tradeMethods = obj.tradeMethods;
  1835. }
  1836. }
  1837. let ids = formData.data.contractProductList.map((x) => x.productId);
  1838. proxy
  1839. .post("/fileInfo/getList", {
  1840. businessIdList: ids,
  1841. })
  1842. .then((fileObj) => {
  1843. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1844. const e = formData.data.contractProductList[i];
  1845. for (const key in fileObj) {
  1846. if (e.productId === key) {
  1847. e.fileList = fileObj[key] || [];
  1848. if (e.fileList && e.fileList.length > 0) {
  1849. e.fileUrl = e.fileList[0].fileUrl;
  1850. }
  1851. }
  1852. }
  1853. }
  1854. });
  1855. }
  1856. // if (
  1857. // formData.data.contractProjectList &&
  1858. // formData.data.contractProjectList.length > 0
  1859. // ) {
  1860. // formData.data.contractProjectList =
  1861. // formData.data.contractProjectList.map((x) => {
  1862. // delete x.id;
  1863. // return x;
  1864. // });
  1865. // }
  1866. // if (
  1867. // formData.data.contractShipmentList &&
  1868. // formData.data.contractShipmentList.length > 0
  1869. // ) {
  1870. // formData.data.contractShipmentList =
  1871. // formData.data.contractShipmentList.map((x) => {
  1872. // delete x.id;
  1873. // return x;
  1874. // });
  1875. // }
  1876. if (formData.data.countryId) {
  1877. getCityData(formData.data.countryId, "20");
  1878. }
  1879. if (formData.data.provinceId) {
  1880. getCityData(formData.data.provinceId, "30");
  1881. }
  1882. });
  1883. }
  1884. });
  1885. </script>
  1886. <style lang="scss" scoped>
  1887. ::v-deep(.el-input-number .el-input__inner) {
  1888. text-align: left;
  1889. }
  1890. .pic {
  1891. object-fit: contain;
  1892. width: 50px;
  1893. height: 50px;
  1894. cursor: pointer;
  1895. vertical-align: middle;
  1896. }
  1897. .shrinkPadding {
  1898. padding-right: 0 !important;
  1899. }
  1900. .hideCollapse {
  1901. margin-top: -62px;
  1902. border: 0 !important;
  1903. }
  1904. ::v-deep(.el-collapse-item__arrow) {
  1905. display: none !important;
  1906. }
  1907. ::v-deep(.el-collapse-item__wrap) {
  1908. border: 0 !important;
  1909. }
  1910. ::v-deep(.el-collapse-item__header) {
  1911. border: 0 !important;
  1912. }
  1913. </style>