Contract.vue 63 KB

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