ContractChange.vue 61 KB

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