Contract.vue 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826
  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("");
  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.post("/customer/selPage", { pageNum: 1, pageSize: 50 }).then((res) => {
  1014. customerList.value = res.rows.map((x) => ({
  1015. ...x,
  1016. label: x.name,
  1017. value: x.id,
  1018. }));
  1019. });
  1020. proxy
  1021. .getDictOne([
  1022. "inner_packaging_method_ehsd",
  1023. "outside_packaging_method_ehsd",
  1024. "account_currency",
  1025. "funds_payment_method",
  1026. "trade_mode",
  1027. "shipping_method",
  1028. ])
  1029. .then((res) => {
  1030. innerMethod.value = res["inner_packaging_method_ehsd"].map((x) => ({
  1031. label: x.dictValue,
  1032. value: x.dictKey,
  1033. }));
  1034. outsideMethod.value = res["outside_packaging_method_ehsd"].map((x) => ({
  1035. label: x.dictValue,
  1036. value: x.dictKey,
  1037. }));
  1038. accountCurrency.value = res["account_currency"].map((x) => ({
  1039. label: x.dictValue,
  1040. value: x.dictKey,
  1041. }));
  1042. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  1043. label: x.dictValue,
  1044. value: x.dictKey,
  1045. }));
  1046. tradeMethods.value = res["trade_mode"].map((x) => ({
  1047. label: x.dictValue,
  1048. value: x.dictKey,
  1049. }));
  1050. shippingMethod.value = res["shipping_method"].map((x) => ({
  1051. label: x.dictValue,
  1052. value: x.dictKey,
  1053. }));
  1054. });
  1055. proxy
  1056. .post("/contractTemplate/page", { pageNum: 1, pageSize: 999 })
  1057. .then((res) => {
  1058. templateList.value = res.rows.map((item) => {
  1059. return {
  1060. ...item,
  1061. label: item.templateName,
  1062. value: item.id,
  1063. };
  1064. });
  1065. });
  1066. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1067. corporationList.value = res.rows.map((item) => {
  1068. return {
  1069. ...item,
  1070. label: item.name,
  1071. value: item.id,
  1072. };
  1073. });
  1074. });
  1075. proxy
  1076. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  1077. .then((res) => {
  1078. accountList.value = res.rows.map((item) => {
  1079. return {
  1080. ...item,
  1081. label: item.alias,
  1082. value: item.id,
  1083. };
  1084. });
  1085. });
  1086. };
  1087. getDict();
  1088. const changeTemplate = (val) => {
  1089. formData.data.sellCorporationId = "";
  1090. formData.data.sellContactName = "";
  1091. formData.data.sellContactNumber = "";
  1092. formData.data.sellCountryName = "";
  1093. formData.data.sellProvinceName = "";
  1094. formData.data.sellCityName = "";
  1095. formData.data.sellAddress = "";
  1096. if (val) {
  1097. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  1098. formData.data.sellCorporationId = res.corporationId;
  1099. if (res.corporationId) {
  1100. proxy
  1101. .post("/corporation/detail", { id: res.corporationId })
  1102. .then((detailCorporation) => {
  1103. proxy
  1104. .post("/customizeArea/list", { parentId: "0" })
  1105. .then((resCountry) => {
  1106. let sellCountryData = resCountry.filter(
  1107. (item) => item.id === detailCorporation.countryId
  1108. );
  1109. if (sellCountryData && sellCountryData.length > 0) {
  1110. formData.data.sellCountryName =
  1111. sellCountryData[0].chineseName;
  1112. } else {
  1113. formData.data.sellCountryName = "";
  1114. }
  1115. });
  1116. if (detailCorporation.countryId) {
  1117. proxy
  1118. .post("/customizeArea/list", {
  1119. parentId: detailCorporation.countryId,
  1120. })
  1121. .then((resProvince) => {
  1122. let sellProvinceData = resProvince.filter(
  1123. (item) => item.id === detailCorporation.provinceId
  1124. );
  1125. if (sellProvinceData && sellProvinceData.length > 0) {
  1126. formData.data.sellProvinceName = sellProvinceData[0].name;
  1127. } else {
  1128. formData.data.sellProvinceName = "";
  1129. }
  1130. });
  1131. } else {
  1132. formData.data.sellProvinceName = "";
  1133. }
  1134. if (detailCorporation.provinceId) {
  1135. proxy
  1136. .post("/customizeArea/list", {
  1137. parentId: detailCorporation.provinceId,
  1138. })
  1139. .then((resCity) => {
  1140. let sellCityData = resCity.filter(
  1141. (item) => item.id === detailCorporation.cityId
  1142. );
  1143. if (sellCityData && sellCityData.length > 0) {
  1144. formData.data.sellCityName = sellCityData[0].name;
  1145. } else {
  1146. formData.data.sellCityName = "";
  1147. }
  1148. });
  1149. } else {
  1150. formData.data.sellCityName = "";
  1151. }
  1152. formData.data.sellAddress = detailCorporation.address;
  1153. });
  1154. }
  1155. formData.data.sellContactName = res.contactName;
  1156. formData.data.sellContactNumber = res.contactNumber;
  1157. });
  1158. }
  1159. };
  1160. const getCityData = (id, type, isChange) => {
  1161. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1162. if (type === "20") {
  1163. provinceData.value = res;
  1164. if (isChange) {
  1165. formData.data.provinceId = "";
  1166. formData.data.provinceName = "";
  1167. formData.data.cityId = "";
  1168. formData.data.cityName = "";
  1169. }
  1170. } else if (type === "30") {
  1171. cityData.value = res;
  1172. if (isChange) {
  1173. formData.data.cityId = "";
  1174. formData.data.cityName = "";
  1175. }
  1176. } else {
  1177. countryData.value = res;
  1178. }
  1179. });
  1180. };
  1181. getCityData("0");
  1182. let auxiliaryData = ref([
  1183. {
  1184. label: "最近合同",
  1185. data: [],
  1186. },
  1187. {
  1188. label: "产品价格",
  1189. data: [],
  1190. },
  1191. ]);
  1192. const emit = defineEmits(["auxiliaryChange"]);
  1193. const getDecisionAids = () => {
  1194. let data = {
  1195. buyCorporationId: formData.data.buyCorporationId,
  1196. productIdList: [],
  1197. };
  1198. if (
  1199. formData.data.contractProductList &&
  1200. formData.data.contractProductList.length > 0
  1201. ) {
  1202. data.productIdList = formData.data.contractProductList.map(
  1203. (item) => item.productId
  1204. );
  1205. }
  1206. proxy.post("/contract/decisionAid", data).then((res) => {
  1207. if (res.lastContractList && res.lastContractList.length > 0) {
  1208. auxiliaryData.value[0].data = res.lastContractList.map((item) => {
  1209. return [
  1210. {
  1211. label: "合同编号",
  1212. value: item.code,
  1213. style: {
  1214. color: "#0084FF",
  1215. },
  1216. id: item.id,
  1217. num: 1,
  1218. // fn: () => {},
  1219. },
  1220. {
  1221. label: "下单日期",
  1222. value: item.createTime,
  1223. id: item.id,
  1224. num: 1,
  1225. },
  1226. {
  1227. label: "合同金额",
  1228. value: item.currency + item.amount,
  1229. id: item.id,
  1230. num: 1,
  1231. },
  1232. ];
  1233. });
  1234. } else {
  1235. auxiliaryData.value[0].data = [];
  1236. }
  1237. if (res.productPriceList && res.productPriceList.length > 0) {
  1238. auxiliaryData.value[1].data = res.productPriceList.map((item) => {
  1239. return [
  1240. {
  1241. label: "产品名称",
  1242. value: item.name,
  1243. id: item.id,
  1244. num: 1,
  1245. },
  1246. {
  1247. label: "最近价格",
  1248. value: item.lastPrice,
  1249. id: item.id,
  1250. num: 1,
  1251. },
  1252. {
  1253. label: "历史最高",
  1254. value: item.maxPrice,
  1255. id: item.id,
  1256. num: 1,
  1257. },
  1258. {
  1259. label: "历史最低",
  1260. value: item.minPrice,
  1261. id: item.id,
  1262. num: 1,
  1263. },
  1264. ];
  1265. });
  1266. } else {
  1267. auxiliaryData.value[1].data = [];
  1268. }
  1269. emit("auxiliaryChange", auxiliaryData.value);
  1270. });
  1271. };
  1272. const changeCustomer = (val) => {
  1273. formData.data.contractProductList = [];
  1274. formData.data.customerName = "";
  1275. formData.data.customerTel = "";
  1276. if (val) {
  1277. proxy.post("/customer/detail", { id: val }).then(
  1278. (res) => {
  1279. formData.data.buyCorporationName = res.name;
  1280. if (res.customerUserList && res.customerUserList.length > 0) {
  1281. formData.data.buyContactName = res.customerUserList[0].name;
  1282. if (res.customerUserList[0].contactJson) {
  1283. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  1284. if (contactJson && contactJson.length > 0) {
  1285. formData.data.buyContactNumber = contactJson[0].contactNo;
  1286. }
  1287. }
  1288. customerUserList.value = res.customerUserList.map((item) => {
  1289. return {
  1290. ...item,
  1291. value: item.name,
  1292. };
  1293. });
  1294. }
  1295. formData.data.countryId = res.countryId;
  1296. formData.data.provinceId = res.provinceId;
  1297. formData.data.cityId = res.cityId;
  1298. formData.data.buyPostalCode = res.zipCode;
  1299. formData.data.buyAddress = res.address;
  1300. getCityData(formData.data.countryId, "20");
  1301. if (formData.data.provinceId) {
  1302. getCityData(formData.data.provinceId, "30");
  1303. }
  1304. },
  1305. (err) => {
  1306. console.log(err);
  1307. formData.data.countryId = "";
  1308. formData.data.provinceId = "";
  1309. formData.data.cityId = "";
  1310. formData.data.buyPostalCode = "";
  1311. formData.data.buyAddress = "";
  1312. }
  1313. );
  1314. } else {
  1315. formData.data.countryId = "";
  1316. formData.data.provinceId = "";
  1317. formData.data.cityId = "";
  1318. formData.data.buyPostalCode = "";
  1319. formData.data.buyAddress = "";
  1320. }
  1321. getDecisionAids();
  1322. };
  1323. const createFilter = (queryString) => {
  1324. return (restaurant) => {
  1325. return (
  1326. restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
  1327. );
  1328. };
  1329. };
  1330. const querySearchPerson = (queryString, callback) => {
  1331. const results = queryString
  1332. ? customerUserList.value.filter(createFilter(queryString))
  1333. : customerUserList.value;
  1334. callback(results);
  1335. };
  1336. const handlePerson = (item) => {
  1337. formData.data.customerTel = item.phone;
  1338. };
  1339. const selectProduct = (goods) => {
  1340. if (goods && goods.id) {
  1341. let data = formData.data.contractProductList.filter(
  1342. (item) => item.productId === goods.id
  1343. );
  1344. if (data && data.length > 0) {
  1345. return ElMessage("该产品已添加");
  1346. }
  1347. let fileUrl = "";
  1348. if (goods.fileList && goods.fileList.length > 0) {
  1349. fileUrl = goods.fileList[0].fileUrl;
  1350. }
  1351. let packMethod = "";
  1352. if (goods.innerPackMethod) {
  1353. let innerPackMethod = goods.innerPackMethod.split(",");
  1354. innerPackMethod.map((item) => {
  1355. if (packMethod) {
  1356. packMethod =
  1357. packMethod + "," + proxy.dictValueLabel(item, innerMethod.value);
  1358. } else {
  1359. packMethod = proxy.dictValueLabel(item, innerMethod.value);
  1360. }
  1361. });
  1362. }
  1363. if (goods.outerPackMethod) {
  1364. let outerPackMethod = goods.outerPackMethod.split(",");
  1365. outerPackMethod.map((item) => {
  1366. if (packMethod) {
  1367. packMethod =
  1368. packMethod + "," + proxy.dictValueLabel(item, outsideMethod.value);
  1369. } else {
  1370. packMethod = proxy.dictValueLabel(item, outsideMethod.value);
  1371. }
  1372. });
  1373. }
  1374. if (
  1375. formData.data.contractProductList &&
  1376. formData.data.contractProductList.length > 0
  1377. ) {
  1378. formData.data.contractProductList.push({
  1379. fileUrl: fileUrl,
  1380. productId: goods.id,
  1381. productCnName: goods.nameEnglish,
  1382. productName: goods.name,
  1383. productModel:
  1384. goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
  1385. quantity: undefined,
  1386. price: undefined,
  1387. amount: "",
  1388. tradeMethods: "",
  1389. packMethod: packMethod,
  1390. });
  1391. } else {
  1392. formData.data.contractProductList = [
  1393. {
  1394. fileUrl: fileUrl,
  1395. productId: goods.id,
  1396. productName: goods.name,
  1397. productModel:
  1398. goods.productLong +
  1399. "*" +
  1400. goods.productWide +
  1401. "*" +
  1402. goods.productHigh,
  1403. quantity: undefined,
  1404. price: undefined,
  1405. amount: "",
  1406. tradeMethods: "",
  1407. packMethod: packMethod,
  1408. },
  1409. ];
  1410. }
  1411. formData.data.contractShipmentList.push({
  1412. productCode: goods.code,
  1413. productId: goods.id,
  1414. productName: goods.name,
  1415. shipmentTime: "",
  1416. quantity: undefined,
  1417. });
  1418. ElMessage({
  1419. message: "添加成功!",
  1420. type: "success",
  1421. });
  1422. } else {
  1423. return ElMessage("选择错误");
  1424. }
  1425. getDecisionAids();
  1426. };
  1427. const onPicture = (path) => {
  1428. window.open(path, "_blank");
  1429. };
  1430. const handleRemove = async (index, row) => {
  1431. formData.data.contractShipmentList =
  1432. formData.data.contractShipmentList.filter(
  1433. (item) => item.productId !== row.productId
  1434. );
  1435. await formData.data.contractProductList.splice(index, 1);
  1436. totalAmount();
  1437. };
  1438. const calculationAmount = () => {
  1439. nextTick(() => {
  1440. if (
  1441. formData.data.contractProductList &&
  1442. formData.data.contractProductList.length > 0
  1443. ) {
  1444. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1445. let money = 0;
  1446. if (
  1447. formData.data.contractProductList[i].quantity &&
  1448. formData.data.contractProductList[i].price
  1449. ) {
  1450. money = parseFloat(
  1451. Number(formData.data.contractProductList[i].quantity) *
  1452. Number(formData.data.contractProductList[i].price)
  1453. ).toFixed(2);
  1454. }
  1455. formData.data.contractProductList[i].amount = money;
  1456. }
  1457. }
  1458. nextTick(() => {
  1459. totalAmount();
  1460. });
  1461. });
  1462. };
  1463. const totalAmount = () => {
  1464. let money = 0;
  1465. if (
  1466. formData.data.contractProductList &&
  1467. formData.data.contractProductList.length > 0
  1468. ) {
  1469. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1470. if (formData.data.contractProductList[i].amount) {
  1471. money = parseFloat(
  1472. Number(money) + Number(formData.data.contractProductList[i].amount)
  1473. ).toFixed(2);
  1474. }
  1475. }
  1476. }
  1477. if (
  1478. formData.data.contractProjectList &&
  1479. formData.data.contractProjectList.length > 0
  1480. ) {
  1481. for (let i = 0; i < formData.data.contractProjectList.length; i++) {
  1482. if (formData.data.contractProjectList[i].amount) {
  1483. money = parseFloat(
  1484. Number(money) + Number(formData.data.contractProjectList[i].amount)
  1485. ).toFixed(2);
  1486. }
  1487. }
  1488. }
  1489. formData.data.amount = money;
  1490. };
  1491. const clickAdd = () => {
  1492. if (
  1493. formData.data.contractProjectList &&
  1494. formData.data.contractProjectList.length > 0
  1495. ) {
  1496. formData.data.contractProjectList.push({
  1497. payName: "",
  1498. amount: undefined,
  1499. remark: "",
  1500. });
  1501. } else {
  1502. formData.data.contractProjectList = [
  1503. { payName: "", amount: undefined, remark: "" },
  1504. ];
  1505. }
  1506. };
  1507. const handleDelete = async (index) => {
  1508. await formData.data.contractProjectList.splice(index, 1);
  1509. totalAmount();
  1510. getDecisionAids();
  1511. };
  1512. const querySearch = (queryString, callback) => {
  1513. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  1514. if (res.rows && res.rows.length > 0) {
  1515. res.rows = res.rows.map((item) => {
  1516. return {
  1517. ...item,
  1518. value: item.payName,
  1519. };
  1520. });
  1521. callback(res.rows);
  1522. } else {
  1523. callback([]);
  1524. }
  1525. });
  1526. };
  1527. const handleSubmit = async () => {
  1528. let status = await submit.value.handleSubmit(() => {});
  1529. if (status) {
  1530. if (
  1531. !(
  1532. formData.data.contractProductList &&
  1533. formData.data.contractProductList.length > 0
  1534. )
  1535. ) {
  1536. ElMessage("请添加至少一件商品");
  1537. return false;
  1538. }
  1539. if (formData.data.fileList && formData.data.fileList.length > 0) {
  1540. for (let i = 0; i < formData.data.fileList.length; i++) {
  1541. if (formData.data.fileList[i].raw.uploadState) {
  1542. ElMessage("文件上传中,请稍后提交");
  1543. return false;
  1544. }
  1545. }
  1546. }
  1547. if (
  1548. formData.data.packageFileList &&
  1549. formData.data.packageFileList.length > 0
  1550. ) {
  1551. for (let i = 0; i < formData.data.packageFileList.length; i++) {
  1552. if (formData.data.packageFileList[i].raw.uploadState) {
  1553. ElMessage("文件上传中,请稍后提交");
  1554. return false;
  1555. }
  1556. }
  1557. }
  1558. if (
  1559. formData.data.contractShipmentList &&
  1560. formData.data.contractShipmentList.length > 0
  1561. ) {
  1562. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1563. let data = formData.data.contractShipmentList.filter(
  1564. (item) =>
  1565. item.productId === formData.data.contractProductList[i].productId
  1566. );
  1567. if (data && data.length > 0) {
  1568. let quantity = 0;
  1569. for (let j = 0; j < data.length; j++) {
  1570. quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
  1571. }
  1572. if (quantity > formData.data.contractProductList[i].quantity) {
  1573. ElMessage("出货数量不能大于商品数量");
  1574. return false;
  1575. }
  1576. }
  1577. }
  1578. }
  1579. return true;
  1580. } else {
  1581. setTimeout(() => {
  1582. const errorDiv = document.getElementsByClassName("is-error");
  1583. errorDiv[0].scrollIntoView();
  1584. }, 0);
  1585. }
  1586. return status;
  1587. };
  1588. // 接收父组件的传值
  1589. const props = defineProps({
  1590. queryData: Object,
  1591. });
  1592. const clickCustomerProduct = () => {
  1593. if (!formData.data.buyCorporationId) {
  1594. return ElMessage("请先选择客户");
  1595. }
  1596. openProductCustomer.value = true;
  1597. };
  1598. const loadingSearch = ref(false);
  1599. const remoteMethod = (keyword) => {
  1600. if (keyword && typeof keyword === "string") {
  1601. loadingSearch.value = true;
  1602. proxy.post("/customer/selPage", { keyword }).then((res) => {
  1603. customerList.value = res.rows.map((x) => ({
  1604. ...x,
  1605. label: x.name,
  1606. value: x.id,
  1607. }));
  1608. loadingSearch.value = false;
  1609. });
  1610. }
  1611. return;
  1612. };
  1613. const getFormData = () => {
  1614. return proxy.deepClone(formData.data);
  1615. };
  1616. // 向父组件暴露
  1617. defineExpose({
  1618. getFormData,
  1619. handleSubmit,
  1620. });
  1621. const changeShroffAccount = (val) => {
  1622. if (val) {
  1623. let data = accountList.value.filter((item) => item.value === val);
  1624. if (data && data.length > 0) {
  1625. formData.data.beneficiaryName = data[0].beneficiaryName;
  1626. formData.data.beneficiaryBank = data[0].beneficiaryBank;
  1627. formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
  1628. formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
  1629. formData.data.swiftCode = data[0].swiftCode;
  1630. formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
  1631. }
  1632. }
  1633. };
  1634. const changeActiveName = () => {
  1635. if (activeName.value) {
  1636. activeName.value = "";
  1637. } else {
  1638. activeName.value = "1";
  1639. }
  1640. };
  1641. const uploadFile = async (file) => {
  1642. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1643. uploadData.value = res.uploadBody;
  1644. file.id = res.id;
  1645. file.fileName = res.fileName;
  1646. file.fileUrl = res.fileUrl;
  1647. file.uploadState = true;
  1648. return true;
  1649. };
  1650. const indicationUploadFile = async (file) => {
  1651. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1652. indicationUploadData.value = res.uploadBody;
  1653. file.id = res.id;
  1654. file.fileName = res.fileName;
  1655. file.fileUrl = res.fileUrl;
  1656. file.uploadState = true;
  1657. return true;
  1658. };
  1659. const handleSuccess = (any, UploadFile) => {
  1660. UploadFile.raw.uploadState = false;
  1661. };
  1662. const onPreviewFile = (file) => {
  1663. window.open(file.raw.fileUrl, "_blank");
  1664. };
  1665. const clickSplit = (item) => {
  1666. formData.data.contractShipmentList.push({
  1667. productCode: item.code,
  1668. productId: item.productId,
  1669. productName: item.productName,
  1670. shipmentTime: "",
  1671. quantity: undefined,
  1672. });
  1673. };
  1674. const clickDelete = (index) => {
  1675. formData.data.contractShipmentList.splice(index, 1);
  1676. };
  1677. watch(
  1678. props.queryData,
  1679. () => {
  1680. formOption.disabled = judgeStatus();
  1681. return;
  1682. if (
  1683. props.queryData &&
  1684. ["10", "20", "30"].includes(route.query.processType)
  1685. ) {
  1686. for (var text in props.queryData) {
  1687. if (text === "fileList" || text === "packageFileList") {
  1688. if (props.queryData[text] && props.queryData[text].length > 0) {
  1689. formData.data[text] = props.queryData[text].map((item) => {
  1690. return {
  1691. raw: item,
  1692. name: item.fileName,
  1693. url: item.fileUrl,
  1694. };
  1695. });
  1696. }
  1697. } else {
  1698. formData.data[text] = props.queryData[text];
  1699. }
  1700. }
  1701. if (formData.data.countryId) {
  1702. getCityData(formData.data.countryId, "20");
  1703. }
  1704. if (formData.data.provinceId) {
  1705. getCityData(formData.data.provinceId, "30");
  1706. }
  1707. getDecisionAids();
  1708. }
  1709. },
  1710. {
  1711. deep: true,
  1712. }
  1713. );
  1714. onMounted(() => {
  1715. formOption.disabled = judgeStatus();
  1716. if (route.query && route.query.businessId && route.query.processType) {
  1717. let businessId = route.query.businessId;
  1718. proxy.post("/contract/detail", { id: businessId }).then((res) => {
  1719. if (!res.fileList) {
  1720. res.fileList = [];
  1721. }
  1722. if (!res.packageFileList) {
  1723. res.packageFileList = [];
  1724. }
  1725. res.countryId = res.buyCountryId;
  1726. res.provinceId = res.buyProvinceId;
  1727. res.cityId = res.buyCityId;
  1728. for (const key in res) {
  1729. formData.data[key] = res[key];
  1730. }
  1731. proxy
  1732. .post("/fileInfo/getList", {
  1733. businessIdList: [businessId],
  1734. })
  1735. .then((fileObj) => {
  1736. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  1737. formData.data.fileList = fileObj[businessId]
  1738. .filter((x) => x.businessType === "1")
  1739. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1740. formData.data.packageFileList = fileObj[businessId]
  1741. .filter((x) => x.businessType === "2")
  1742. .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
  1743. }
  1744. });
  1745. if (
  1746. formData.data.contractProductList &&
  1747. formData.data.contractProductList.length > 0
  1748. ) {
  1749. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1750. const e = formData.data.contractProductList[i];
  1751. if (e.ehsdJson) {
  1752. let obj = JSON.parse(e.ehsdJson);
  1753. e.packMethod = obj.packMethod;
  1754. e.tradeMethods = obj.tradeMethods;
  1755. }
  1756. }
  1757. let ids = formData.data.contractProductList.map((x) => x.productId);
  1758. proxy
  1759. .post("/fileInfo/getList", {
  1760. businessIdList: ids,
  1761. })
  1762. .then((fileObj) => {
  1763. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1764. const e = formData.data.contractProductList[i];
  1765. for (const key in fileObj) {
  1766. if (e.productId === key) {
  1767. e.fileList = fileObj[key] || [];
  1768. if (e.fileList && e.fileList.length > 0) {
  1769. e.fileUrl = e.fileList[0].fileUrl;
  1770. }
  1771. }
  1772. }
  1773. }
  1774. });
  1775. }
  1776. if (formData.data.countryId) {
  1777. getCityData(formData.data.countryId, "20");
  1778. }
  1779. if (formData.data.provinceId) {
  1780. getCityData(formData.data.provinceId, "30");
  1781. }
  1782. getDecisionAids();
  1783. });
  1784. }
  1785. });
  1786. </script>
  1787. <style lang="scss" scoped>
  1788. ::v-deep(.el-input-number .el-input__inner) {
  1789. text-align: left;
  1790. }
  1791. .pic {
  1792. object-fit: contain;
  1793. width: 50px;
  1794. height: 50px;
  1795. cursor: pointer;
  1796. vertical-align: middle;
  1797. }
  1798. .shrinkPadding {
  1799. padding-right: 0 !important;
  1800. }
  1801. .hideCollapse {
  1802. margin-top: -62px;
  1803. border: 0 !important;
  1804. }
  1805. ::v-deep(.el-collapse-item__arrow) {
  1806. display: none !important;
  1807. }
  1808. ::v-deep(.el-collapse-item__wrap) {
  1809. border: 0 !important;
  1810. }
  1811. ::v-deep(.el-collapse-item__header) {
  1812. border: 0 !important;
  1813. }
  1814. </style>