Contract.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  1. <template>
  2. <div style="width: 100%; padding: 0px 15px">
  3. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  4. <template #seller>
  5. <div style="width: 100%">
  6. <el-form-item prop="sellCorporationId">
  7. <el-select v-model="formData.data.sellCorporationId" style="width: 100%" disabled>
  8. <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
  9. </el-select>
  10. </el-form-item>
  11. <el-row style="margin-top: 20px; width: 100%">
  12. <el-col :span="8">
  13. <el-form-item label="地址" prop="sellCountryName">
  14. <el-input v-model="formData.data.sellCountryName" placeholder="请输入国家" />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="8">
  18. <el-form-item label=" " prop="sellProvinceName">
  19. <el-input v-model="formData.data.sellProvinceName" placeholder="请输入省/州" />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label=" " prop="sellCityName">
  24. <el-input v-model="formData.data.sellCityName" placeholder="请输入城市" />
  25. </el-form-item>
  26. </el-col>
  27. </el-row>
  28. <el-row style="margin-top: 20px; width: 100%">
  29. <el-col :span="24">
  30. <el-form-item prop="sellAddress">
  31. <el-input v-model="formData.data.sellAddress" type="textarea"> </el-input>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <el-row style="margin-top: 20px; width: 100%">
  36. <el-col :span="8">
  37. <el-form-item label="联系人" prop="sellContactName">
  38. <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="16">
  42. <el-form-item label=" " prop="sellContactNumber">
  43. <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
  44. </el-form-item>
  45. </el-col>
  46. </el-row>
  47. </div>
  48. </template>
  49. <template #buyer>
  50. <div style="width: 100%">
  51. <div style="width: 100%">
  52. <el-form-item prop="buyCorporationId">
  53. <el-select v-model="formData.data.buyCorporationId" style="width: 100%" @change="changeCustomer">
  54. <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
  55. </el-select>
  56. </el-form-item>
  57. <el-row style="margin-top: 20px; width: 100%">
  58. <el-col :span="6">
  59. <el-form-item label="地址" prop="countryId">
  60. <el-select v-model="formData.data.countryId" placeholder="国家" filterable @change="(val) => getCityData(val, '20', true)">
  61. <el-option v-for="item in countryData" :label="item.chineseName" :value="item.id"> </el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item label=" " prop="provinceName">
  67. <selectCity
  68. placeholder="省/洲"
  69. @change="(val) => getCityData(val, '30', true)"
  70. addressId="provinceId"
  71. addressName="provinceName"
  72. v-model="formData.data"
  73. :data="provinceData">
  74. </selectCity>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="6">
  78. <el-form-item label=" " prop="cityName">
  79. <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"> </selectCity>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="6">
  83. <el-form-item label=" " prop="buyPostalCode">
  84. <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" />
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. <el-row style="margin-top: 20px; width: 100%">
  89. <el-col :span="24">
  90. <el-form-item prop="buyAddress">
  91. <el-input v-model="formData.data.buyAddress" type="textarea"> </el-input>
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row style="margin-top: 20px; width: 100%">
  96. <el-col :span="8">
  97. <el-form-item label="联系人" prop="buyContactName">
  98. <el-autocomplete
  99. v-model="formData.data.buyContactName"
  100. :fetch-suggestions="querySearchPerson"
  101. clearable
  102. class="inline-input w-50"
  103. placeholder="请输入联系人"
  104. @select="handlePerson">
  105. </el-autocomplete>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="16">
  109. <el-form-item label=" " prop="buyContactNumber">
  110. <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" />
  111. </el-form-item>
  112. </el-col>
  113. </el-row>
  114. </div>
  115. </div>
  116. </template>
  117. <template #payment>
  118. <div style="width: 100%">
  119. <el-row style="margin-top: 20px; width: 100%">
  120. <el-col :span="6">
  121. <el-form-item label="币种" prop="currency">
  122. <el-select v-model="formData.data.currency" placeholder="请选择币种" style="width: 100%">
  123. <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value" />
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="6">
  128. <el-form-item label="付款方式" prop="paymentMethod">
  129. <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
  130. <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="6">
  135. <el-form-item label="预付比例 (%)" prop="advanceRatio">
  136. <el-input-number
  137. onmousewheel="return false;"
  138. v-model="formData.data.advanceRatio"
  139. placeholder="请输入预付比例"
  140. style="width: 100%"
  141. :precision="2"
  142. :controls="false"
  143. :min="0"
  144. :max="100" />
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. <el-row style="margin-top: 20px; width: 100%">
  149. <el-col :span="18">
  150. <el-form-item label="付款条件" prop="remark">
  151. <el-input v-model="formData.data.remark" :rows="2" type="textarea" placeholder="请输入付款条件" />
  152. </el-form-item>
  153. </el-col>
  154. </el-row>
  155. <el-row style="margin-top: 20px; width: 100%">
  156. <el-col :span="9">
  157. <el-form-item label="收款账号" prop="shroffAccountId">
  158. <el-select v-model="formData.data.shroffAccountId" placeholder="请选择收款账号" style="width: 100%" @change="changeShroffAccount">
  159. <el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value" />
  160. </el-select>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="9">
  164. <el-form-item label=" ">
  165. <el-button type="primary" @click="changeActiveName" text>
  166. <span v-if="activeName == '1'">收起</span>
  167. <span v-else>展开</span>
  168. </el-button>
  169. </el-form-item>
  170. </el-col>
  171. </el-row>
  172. <div style="width: 100%; margin-top: 34px">
  173. <el-collapse v-model="activeName" class="hideCollapse" accordion>
  174. <el-collapse-item title="" name="1">
  175. <el-row style="width: 100%">
  176. <el-col :span="9">
  177. <el-form-item label="Beneficiary Name" prop="beneficiaryName">
  178. <el-input v-model="formData.data.beneficiaryName" placeholder="请输入Beneficiary Name" />
  179. </el-form-item>
  180. <div style="height: 20px"></div>
  181. <el-form-item label="Beneficiary Bank" prop="beneficiaryBank">
  182. <el-input v-model="formData.data.beneficiaryBank" placeholder="请输入Beneficiary Bank" />
  183. </el-form-item>
  184. <div style="height: 20px"></div>
  185. <el-form-item label="Beneficiary Bank Address" prop="beneficiaryBankAddress">
  186. <el-input v-model="formData.data.beneficiaryBankAddress" placeholder="请输入Beneficiary Bank Address" />
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="9">
  190. <el-form-item label="Beneficiary Account Number" prop="beneficiaryAccountNumber">
  191. <el-input v-model="formData.data.beneficiaryAccountNumber" placeholder="请输入Beneficiary Account Number" />
  192. </el-form-item>
  193. <div style="height: 20px"></div>
  194. <el-form-item label="Swift Code" prop="swiftCode">
  195. <el-input v-model="formData.data.swiftCode" placeholder="请输入Swift Code" />
  196. </el-form-item>
  197. <div style="height: 20px"></div>
  198. <el-form-item label="Beneficiary Address" prop="beneficiaryAddress">
  199. <el-input v-model="formData.data.beneficiaryAddress" placeholder="请输入Beneficiary Address" />
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. </el-collapse-item>
  204. </el-collapse>
  205. </div>
  206. </div>
  207. </template>
  208. <template #delivery>
  209. <div style="width: 100%">
  210. <el-row style="margin-top: 20px; width: 100%">
  211. <el-col :span="6">
  212. <el-form-item label="报价有效期 (天)" prop="effective">
  213. <el-input-number
  214. onmousewheel="return false;"
  215. v-model="formData.data.effective"
  216. placeholder="请输入有效期"
  217. style="width: 100%"
  218. :precision="0"
  219. :controls="false"
  220. :min="0" />
  221. </el-form-item>
  222. </el-col>
  223. <el-col :span="6">
  224. <el-form-item label="交货期限" prop="deliveryTime">
  225. <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" />
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="6">
  229. <el-form-item label="运输方式" prop="transportMethod">
  230. <el-select v-model="formData.data.transportMethod" placeholder="请选择运输方式" style="width: 100%">
  231. <el-option v-for="item in shippingMethod" :key="item.value" :label="item.label" :value="item.value" />
  232. </el-select>
  233. </el-form-item>
  234. </el-col>
  235. <el-col :span="6">
  236. <el-form-item label="运输说明" prop="transportRemark">
  237. <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
  238. </el-form-item>
  239. </el-col>
  240. </el-row>
  241. </div>
  242. </template>
  243. <template #commodity>
  244. <div style="width: 100%">
  245. <el-button type="primary" @click="openProductCompany = true" plain>标准产品库</el-button>
  246. <el-button type="primary" @click="clickCustomerProduct()" plain>客户产品库</el-button>
  247. <el-table :data="formData.data.contractProductList" style="width: 100%; margin-top: 16px">
  248. <el-table-column label="商品图片" width="80">
  249. <template #default="{ row }">
  250. <div v-if="row.fileUrl">
  251. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  252. </div>
  253. <div v-else></div>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="商品名称" min-width="180">
  257. <template #default="{ row, $index }">
  258. <div style="width: 100%">
  259. <el-form-item
  260. :prop="'contractProductList.' + $index + '.productName'"
  261. :rules="rules.productName"
  262. :inline-message="true"
  263. class="shrinkPadding">
  264. <el-input v-model="row.productName" placeholder="请输入商品名称" />
  265. </el-form-item>
  266. </div>
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="尺寸 cm*cm*cm" width="140">
  270. <template #default="{ row, $index }">
  271. <div style="width: 100%">
  272. <el-form-item
  273. :prop="'contractProductList.' + $index + '.productModel'"
  274. :rules="rules.productModel"
  275. :inline-message="true"
  276. class="shrinkPadding">
  277. <el-input v-model="row.productModel" placeholder="请输入" />
  278. </el-form-item>
  279. </div>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="数量" width="130">
  283. <template #default="{ row, $index }">
  284. <div style="width: 100%">
  285. <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" class="shrinkPadding">
  286. <el-input-number
  287. onmousewheel="return false;"
  288. v-model="row.quantity"
  289. placeholder="请输入"
  290. style="width: 100%"
  291. :precision="0"
  292. :controls="false"
  293. :min="0"
  294. @change="calculationAmount()" />
  295. </el-form-item>
  296. </div>
  297. </template>
  298. </el-table-column>
  299. <el-table-column label="单价" width="140">
  300. <template #default="{ row, $index }">
  301. <div style="width: 100%">
  302. <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true" class="shrinkPadding">
  303. <el-input-number
  304. onmousewheel="return false;"
  305. v-model="row.price"
  306. placeholder="请输入"
  307. style="width: 100%"
  308. :precision="2"
  309. :controls="false"
  310. :min="0"
  311. @change="calculationAmount()" />
  312. </el-form-item>
  313. </div>
  314. </template>
  315. </el-table-column>
  316. <el-table-column label="贸易方式" width="140">
  317. <template #default="{ row, $index }">
  318. <div style="width: 100%">
  319. <el-form-item
  320. :prop="'contractProductList.' + $index + '.tradeMethods'"
  321. :rules="rules.tradeMethods"
  322. :inline-message="true"
  323. class="shrinkPadding">
  324. <el-select v-model="row.tradeMethods" placeholder="请选择" style="width: 100%">
  325. <el-option v-for="item in tradeMethods" :key="item.value" :label="item.label" :value="item.value" />
  326. </el-select>
  327. </el-form-item>
  328. </div>
  329. </template>
  330. </el-table-column>
  331. <el-table-column label="包装方式" width="180">
  332. <template #default="{ row, $index }">
  333. <div style="width: 100%">
  334. <el-form-item :prop="'contractProductList.' + $index + '.packMethod'" :rules="rules.packMethod" :inline-message="true" class="shrinkPadding">
  335. <el-input v-model="row.packMethod" placeholder="请输入" />
  336. </el-form-item>
  337. </div>
  338. </template>
  339. </el-table-column>
  340. <el-table-column prop="amount" :label="'金额 ( ' + formData.data.currency + ' )'" width="130" />
  341. <el-table-column label="操作" width="60" align="center" fixed="right">
  342. <template #default="{ row, $index }">
  343. <el-button type="primary" link @click="handleRemove($index, row)">删除</el-button>
  344. </template>
  345. </el-table-column>
  346. </el-table>
  347. </div>
  348. </template>
  349. <template #file>
  350. <div style="width: 100%">
  351. <el-upload
  352. v-model:fileList="formData.data.fileList"
  353. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  354. :data="uploadData"
  355. multiple
  356. :before-upload="uploadFile"
  357. :on-success="handleSuccess"
  358. :on-preview="onPreviewFile">
  359. <el-button type="primary" plain>选择</el-button>
  360. </el-upload>
  361. </div>
  362. </template>
  363. <template #indication>
  364. <div style="width: 100%">
  365. <el-upload
  366. v-model:fileList="formData.data.packageFileList"
  367. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  368. :data="indicationUploadData"
  369. multiple
  370. :before-upload="indicationUploadFile"
  371. :on-success="handleSuccess"
  372. :on-preview="onPreviewFile">
  373. <el-button type="primary" plain>选择</el-button>
  374. </el-upload>
  375. </div>
  376. </template>
  377. <template #otherCharge>
  378. <div style="width: 100%">
  379. <el-button type="primary" @click="clickAdd()">添加行</el-button>
  380. <el-table :data="formData.data.contractProjectList" style="width: 100%; margin-top: 16px">
  381. <el-table-column label="收费项目" width="220">
  382. <template #default="{ row, $index }">
  383. <div style="width: 100%">
  384. <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
  385. <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
  386. </el-form-item>
  387. </div>
  388. </template>
  389. </el-table-column>
  390. <el-table-column label="备注">
  391. <template #default="{ row, $index }">
  392. <div style="width: 100%">
  393. <el-form-item :prop="'contractProjectList.' + $index + '.remark'">
  394. <el-input v-model="row.remark" placeholder="请输入备注" />
  395. </el-form-item>
  396. </div>
  397. </template>
  398. </el-table-column>
  399. <el-table-column :label="'金额 ( ' + formData.data.currency + ' )'" width="130">
  400. <template #default="{ row, $index }">
  401. <div style="width: 100%">
  402. <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true" class="shrinkPadding">
  403. <el-input-number
  404. onmousewheel="return false;"
  405. v-model="row.amount"
  406. placeholder="请输入金额"
  407. style="width: 100%"
  408. :precision="2"
  409. :controls="false"
  410. :min="0"
  411. @change="totalAmount()" />
  412. </el-form-item>
  413. </div>
  414. </template>
  415. </el-table-column>
  416. <el-table-column label="操作" width="60" align="center" fixed="right">
  417. <template #default="{ $index }">
  418. <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
  419. </template>
  420. </el-table-column>
  421. </el-table>
  422. </div>
  423. </template>
  424. <template #offerMoney>
  425. <div style="width: 100%; display: flex">
  426. <div style="width: calc(100% - 190px)"></div>
  427. <div style="width: 130px; padding: 0 12px">
  428. <el-form-item label="合同总金额" prop="amount" class="shrinkPadding">
  429. <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
  430. </el-form-item>
  431. </div>
  432. </div>
  433. </template>
  434. <template #shipment>
  435. <div style="width: 100%">
  436. <el-table :data="formData.data.contractShipmentList" style="width: 100%; margin-top: 16px">
  437. <el-table-column prop="code" label="商品编码" width="120" />
  438. <el-table-column prop="productName" label="商品名称" />
  439. <el-table-column label="出货日期" width="220">
  440. <template #default="{ row, $index }">
  441. <div style="width: 100%">
  442. <el-form-item :prop="'contractShipmentList.' + $index + '.shipmentTime'" :rules="rules.shipmentTime" :inline-message="true">
  443. <el-date-picker v-model="row.shipmentTime" type="date" placeholder="请选择出货日期" value-format="YYYY-MM-DD" />
  444. </el-form-item>
  445. </div>
  446. </template>
  447. </el-table-column>
  448. <el-table-column label="数量" width="160">
  449. <template #default="{ row, $index }">
  450. <div style="width: 100%">
  451. <el-form-item :prop="'contractShipmentList.' + $index + '.quantity'" :inline-message="true">
  452. <el-input-number
  453. onmousewheel="return false;"
  454. v-model="row.quantity"
  455. placeholder="请输入数量"
  456. style="width: 100%"
  457. :precision="0"
  458. :controls="false"
  459. :min="0"
  460. @change="calculationAmount()" />
  461. </el-form-item>
  462. </div>
  463. </template>
  464. </el-table-column>
  465. <el-table-column align="center" label="操作" width="120" fixed="right">
  466. <template #default="{ row, $index }">
  467. <el-button type="primary" link @click="clickSplit(row)">拆分</el-button>
  468. <el-button type="primary" link @click="clickDelete($index)">删除</el-button>
  469. </template>
  470. </el-table-column>
  471. </el-table>
  472. </div>
  473. </template>
  474. </byForm>
  475. <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="公司产品库" width="90%" append-to-body>
  476. <CompanyProduct :selectStatus="true" @selectProduct="selectProduct"></CompanyProduct>
  477. </el-dialog>
  478. <el-dialog v-if="openProductCustomer" v-model="openProductCustomer" title="客户产品库" width="90%" append-to-body>
  479. <CustomerProduct :selectStatus="true" :buyCorporationId="formData.data.buyCorporationId" @selectProduct="selectProduct"></CustomerProduct>
  480. </el-dialog>
  481. </div>
  482. </template>
  483. <script setup>
  484. import byForm from "@/components/byForm/index";
  485. import CompanyProduct from "@/views/EHSD/productLibrary/companyProduct/index";
  486. import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
  487. import { ElMessage } from "element-plus";
  488. import selectCity from "@/components/selectCity/index.vue";
  489. import { useRoute } from "vue-router";
  490. const route = useRoute();
  491. const { proxy } = getCurrentInstance();
  492. const innerMethod = ref([]);
  493. const outsideMethod = ref([]);
  494. const accountCurrency = ref([]);
  495. const fundsPaymentMethod = ref([]);
  496. const tradeMethods = ref([]);
  497. const shippingMethod = ref([]);
  498. const templateList = ref([]);
  499. const corporationList = ref([]);
  500. const customerList = ref([]);
  501. const accountList = ref([]);
  502. const countryData = ref([]);
  503. const provinceData = ref([]);
  504. const cityData = ref([]);
  505. const customerUserList = ref([]);
  506. const openProductCompany = ref(false);
  507. const openProductCustomer = ref(false);
  508. const activeName = ref("");
  509. const formData = reactive({
  510. data: {
  511. currency: "¥",
  512. amount: undefined,
  513. contractProductList: [],
  514. contractProjectList: [],
  515. fileList: [],
  516. packageFileList: [],
  517. contractShipmentList: [],
  518. },
  519. });
  520. const submit = ref(null);
  521. const judgeStatus = () => {
  522. if (route.query.processType == 20 || route.query.processType == 10) {
  523. return true;
  524. }
  525. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  526. let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
  527. if (data && data.length > 0) {
  528. return true;
  529. }
  530. }
  531. return false;
  532. };
  533. const formOption = reactive({
  534. inline: true,
  535. labelWidth: 100,
  536. itemWidth: 100,
  537. rules: [],
  538. disabled: false,
  539. });
  540. const uploadData = ref({});
  541. const indicationUploadData = ref({});
  542. const formConfig = computed(() => {
  543. return [
  544. {
  545. type: "title",
  546. title: "合同模板",
  547. label: "",
  548. },
  549. {
  550. type: "select",
  551. label: "选择合同模板",
  552. prop: "contractTemplateId",
  553. data: templateList.value,
  554. fn: (val) => {
  555. changeTemplate(val);
  556. },
  557. },
  558. {
  559. type: "slot",
  560. slotName: "seller",
  561. label: "卖方信息",
  562. itemWidth: 50,
  563. },
  564. {
  565. type: "slot",
  566. slotName: "buyer",
  567. label: "买方信息",
  568. itemWidth: 50,
  569. },
  570. {
  571. type: "slot",
  572. slotName: "payment",
  573. label: "付款信息",
  574. },
  575. {
  576. type: "slot",
  577. slotName: "delivery",
  578. label: "交付信息",
  579. },
  580. {
  581. type: "slot",
  582. slotName: "commodity",
  583. label: "商品信息",
  584. },
  585. {
  586. type: "slot",
  587. slotName: "file",
  588. label: "交接单",
  589. },
  590. {
  591. type: "slot",
  592. slotName: "indication",
  593. label: "包装指示",
  594. },
  595. {
  596. type: "slot",
  597. slotName: "otherCharge",
  598. label: "其他收费项目",
  599. },
  600. {
  601. type: "slot",
  602. slotName: "offerMoney",
  603. },
  604. {
  605. type: "slot",
  606. slotName: "shipment",
  607. label: "出货计划",
  608. },
  609. ];
  610. });
  611. const rules = ref({
  612. contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
  613. buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
  614. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  615. sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  616. buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  617. buyContactName: [{ required: true, message: "请输入联系人", trigger: ["change", "blur"] }],
  618. buyContactNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  619. productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
  620. productModel: [{ required: true, message: "请输入尺寸 cm*cm*cm", trigger: "blur" }],
  621. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  622. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  623. packMethod: [{ required: true, message: "请输入包装方式", trigger: "blur" }],
  624. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  625. payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
  626. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  627. effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
  628. deliveryTime: [{ required: true, message: "请选择交货期限", trigger: "change" }],
  629. paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
  630. advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
  631. shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
  632. tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
  633. transportMethod: [{ required: true, message: "请选择运输方式", trigger: "change" }],
  634. transportRemark: [{ required: true, message: "请输入运输说明", trigger: "blur" }],
  635. remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
  636. });
  637. const getDict = () => {
  638. proxy
  639. .getDictOne([
  640. "inner_packaging_method_ehsd",
  641. "outside_packaging_method_ehsd",
  642. "account_currency",
  643. "funds_payment_method",
  644. "trade_mode",
  645. "shipping_method",
  646. ])
  647. .then((res) => {
  648. innerMethod.value = res["inner_packaging_method_ehsd"].map((x) => ({
  649. label: x.dictValue,
  650. value: x.dictKey,
  651. }));
  652. outsideMethod.value = res["outside_packaging_method_ehsd"].map((x) => ({
  653. label: x.dictValue,
  654. value: x.dictKey,
  655. }));
  656. accountCurrency.value = res["account_currency"].map((x) => ({
  657. label: x.dictValue,
  658. value: x.dictKey,
  659. }));
  660. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  661. label: x.dictValue,
  662. value: x.dictKey,
  663. }));
  664. tradeMethods.value = res["trade_mode"].map((x) => ({
  665. label: x.dictValue,
  666. value: x.dictKey,
  667. }));
  668. shippingMethod.value = res["shipping_method"].map((x) => ({
  669. label: x.dictValue,
  670. value: x.dictKey,
  671. }));
  672. });
  673. proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  674. templateList.value = res.rows.map((item) => {
  675. return {
  676. ...item,
  677. label: item.templateName,
  678. value: item.id,
  679. };
  680. });
  681. });
  682. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  683. corporationList.value = res.rows.map((item) => {
  684. return {
  685. ...item,
  686. label: item.name,
  687. value: item.id,
  688. };
  689. });
  690. });
  691. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  692. customerList.value = res.rows.map((item) => {
  693. return {
  694. ...item,
  695. label: item.name,
  696. value: item.id,
  697. };
  698. });
  699. });
  700. proxy.post("/accountManagement/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  701. accountList.value = res.rows.map((item) => {
  702. return {
  703. ...item,
  704. label: item.alias,
  705. value: item.id,
  706. };
  707. });
  708. });
  709. };
  710. getDict();
  711. const changeTemplate = (val) => {
  712. formData.data.sellCorporationId = "";
  713. formData.data.sellContactName = "";
  714. formData.data.sellContactNumber = "";
  715. formData.data.sellCountryName = "";
  716. formData.data.sellProvinceName = "";
  717. formData.data.sellCityName = "";
  718. formData.data.sellAddress = "";
  719. if (val) {
  720. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  721. formData.data.sellCorporationId = res.corporationId;
  722. if (res.corporationId) {
  723. proxy.post("/corporation/detail", { id: res.corporationId }).then((detailCorporation) => {
  724. proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
  725. let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
  726. if (sellCountryData && sellCountryData.length > 0) {
  727. formData.data.sellCountryName = sellCountryData[0].chineseName;
  728. } else {
  729. formData.data.sellCountryName = "";
  730. }
  731. });
  732. if (detailCorporation.countryId) {
  733. proxy.post("/customizeArea/list", { parentId: detailCorporation.countryId }).then((resProvince) => {
  734. let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
  735. if (sellProvinceData && sellProvinceData.length > 0) {
  736. formData.data.sellProvinceName = sellProvinceData[0].name;
  737. } else {
  738. formData.data.sellProvinceName = "";
  739. }
  740. });
  741. } else {
  742. formData.data.sellProvinceName = "";
  743. }
  744. if (detailCorporation.provinceId) {
  745. proxy.post("/customizeArea/list", { parentId: detailCorporation.provinceId }).then((resCity) => {
  746. let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
  747. if (sellCityData && sellCityData.length > 0) {
  748. formData.data.sellCityName = sellCityData[0].name;
  749. } else {
  750. formData.data.sellCityName = "";
  751. }
  752. });
  753. } else {
  754. formData.data.sellCityName = "";
  755. }
  756. formData.data.sellAddress = detailCorporation.address;
  757. });
  758. }
  759. formData.data.sellContactName = res.contactName;
  760. formData.data.sellContactNumber = res.contactNumber;
  761. });
  762. }
  763. };
  764. const getCityData = (id, type, isChange) => {
  765. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  766. if (type === "20") {
  767. provinceData.value = res;
  768. if (isChange) {
  769. formData.data.provinceId = "";
  770. formData.data.provinceName = "";
  771. formData.data.cityId = "";
  772. formData.data.cityName = "";
  773. }
  774. } else if (type === "30") {
  775. cityData.value = res;
  776. if (isChange) {
  777. formData.data.cityId = "";
  778. formData.data.cityName = "";
  779. }
  780. } else {
  781. countryData.value = res;
  782. }
  783. });
  784. };
  785. getCityData("0");
  786. const changeCustomer = (val) => {
  787. formData.data.contractProductList = [];
  788. formData.data.customerName = "";
  789. formData.data.customerTel = "";
  790. if (val) {
  791. proxy.post("/customer/detail", { id: val }).then(
  792. (res) => {
  793. if (res.customerUserList && res.customerUserList.length > 0) {
  794. formData.data.buyContactName = res.customerUserList[0].name;
  795. if (res.customerUserList[0].contactJson) {
  796. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  797. if (contactJson && contactJson.length > 0) {
  798. formData.data.buyContactNumber = contactJson[0].contactNo;
  799. }
  800. }
  801. customerUserList.value = res.customerUserList.map((item) => {
  802. return {
  803. ...item,
  804. value: item.name,
  805. };
  806. });
  807. }
  808. formData.data.countryId = res.countryId;
  809. formData.data.provinceId = res.provinceId;
  810. formData.data.cityId = res.cityId;
  811. formData.data.buyPostalCode = res.zipCode;
  812. formData.data.buyAddress = res.address;
  813. getCityData(formData.data.countryId, "20");
  814. if (formData.data.provinceId) {
  815. getCityData(formData.data.provinceId, "30");
  816. }
  817. },
  818. (err) => {
  819. console.log(err);
  820. formData.data.countryId = "";
  821. formData.data.provinceId = "";
  822. formData.data.cityId = "";
  823. formData.data.buyPostalCode = "";
  824. formData.data.buyAddress = "";
  825. }
  826. );
  827. } else {
  828. formData.data.countryId = "";
  829. formData.data.provinceId = "";
  830. formData.data.cityId = "";
  831. formData.data.buyPostalCode = "";
  832. formData.data.buyAddress = "";
  833. }
  834. };
  835. const createFilter = (queryString) => {
  836. return (restaurant) => {
  837. return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
  838. };
  839. };
  840. const querySearchPerson = (queryString, callback) => {
  841. const results = queryString ? customerUserList.value.filter(createFilter(queryString)) : customerUserList.value;
  842. callback(results);
  843. };
  844. const handlePerson = (item) => {
  845. formData.data.customerTel = item.phone;
  846. };
  847. const selectProduct = (goods) => {
  848. if (goods && goods.id) {
  849. let data = formData.data.contractProductList.filter((item) => item.productId === goods.id);
  850. if (data && data.length > 0) {
  851. return ElMessage("该产品已添加");
  852. }
  853. let fileUrl = "";
  854. if (goods.fileList && goods.fileList.length > 0) {
  855. fileUrl = goods.fileList[0].fileUrl;
  856. }
  857. let packMethod = "";
  858. if (goods.innerPackMethod) {
  859. let innerPackMethod = goods.innerPackMethod.split(",");
  860. innerPackMethod.map((item) => {
  861. if (packMethod) {
  862. packMethod = packMethod + "," + proxy.dictValueLabel(item, innerMethod.value);
  863. } else {
  864. packMethod = proxy.dictValueLabel(item, innerMethod.value);
  865. }
  866. });
  867. }
  868. if (goods.outerPackMethod) {
  869. let outerPackMethod = goods.outerPackMethod.split(",");
  870. outerPackMethod.map((item) => {
  871. if (packMethod) {
  872. packMethod = packMethod + "," + proxy.dictValueLabel(item, outsideMethod.value);
  873. } else {
  874. packMethod = proxy.dictValueLabel(item, outsideMethod.value);
  875. }
  876. });
  877. }
  878. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  879. formData.data.contractProductList.push({
  880. fileUrl: fileUrl,
  881. productId: goods.id,
  882. productName: goods.name,
  883. productModel: goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
  884. quantity: undefined,
  885. price: undefined,
  886. amount: "",
  887. tradeMethods: "",
  888. packMethod: packMethod,
  889. });
  890. } else {
  891. formData.data.contractProductList = [
  892. {
  893. fileUrl: fileUrl,
  894. productId: goods.id,
  895. productName: goods.name,
  896. productModel: goods.productLong + "*" + goods.productWide + "*" + goods.productHigh,
  897. quantity: undefined,
  898. price: undefined,
  899. amount: "",
  900. tradeMethods: "",
  901. packMethod: packMethod,
  902. },
  903. ];
  904. }
  905. formData.data.contractShipmentList.push({
  906. code: goods.code,
  907. productId: goods.id,
  908. productName: goods.name,
  909. shipmentTime: "",
  910. quantity: undefined,
  911. });
  912. ElMessage({
  913. message: "添加成功!",
  914. type: "success",
  915. });
  916. } else {
  917. return ElMessage("选择错误");
  918. }
  919. };
  920. const onPicture = (path) => {
  921. window.open(path, "_blank");
  922. };
  923. const handleRemove = async (index, row) => {
  924. formData.data.contractShipmentList = formData.data.contractShipmentList.filter((item) => item.productId !== row.productId);
  925. await formData.data.contractProductList.splice(index, 1);
  926. totalAmount();
  927. };
  928. const calculationAmount = () => {
  929. nextTick(() => {
  930. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  931. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  932. let money = 0;
  933. if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
  934. money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
  935. }
  936. formData.data.contractProductList[i].amount = money;
  937. }
  938. }
  939. nextTick(() => {
  940. totalAmount();
  941. });
  942. });
  943. };
  944. const totalAmount = () => {
  945. let money = 0;
  946. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  947. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  948. if (formData.data.contractProductList[i].amount) {
  949. money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
  950. }
  951. }
  952. }
  953. if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
  954. for (let i = 0; i < formData.data.contractProjectList.length; i++) {
  955. if (formData.data.contractProjectList[i].amount) {
  956. money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
  957. }
  958. }
  959. }
  960. formData.data.amount = money;
  961. };
  962. const clickAdd = () => {
  963. if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
  964. formData.data.contractProjectList.push({
  965. payName: "",
  966. amount: undefined,
  967. remark: "",
  968. });
  969. } else {
  970. formData.data.contractProjectList = [{ payName: "", amount: undefined, remark: "" }];
  971. }
  972. };
  973. const handleDelete = async (index) => {
  974. await formData.data.contractProjectList.splice(index, 1);
  975. totalAmount();
  976. };
  977. const querySearch = (queryString, callback) => {
  978. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  979. if (res.rows && res.rows.length > 0) {
  980. res.rows = res.rows.map((item) => {
  981. return {
  982. ...item,
  983. value: item.payName,
  984. };
  985. });
  986. callback(res.rows);
  987. } else {
  988. callback([]);
  989. }
  990. });
  991. };
  992. const handleSubmit = async () => {
  993. let status = await submit.value.handleSubmit(() => {});
  994. if (status) {
  995. if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
  996. ElMessage("请添加至少一件商品");
  997. return false;
  998. }
  999. if (formData.data.fileList && formData.data.fileList.length > 0) {
  1000. for (let i = 0; i < formData.data.fileList.length; i++) {
  1001. if (formData.data.fileList[i].raw.uploadState) {
  1002. ElMessage("文件上传中,请稍后提交");
  1003. return false;
  1004. }
  1005. }
  1006. }
  1007. if (formData.data.packageFileList && formData.data.packageFileList.length > 0) {
  1008. for (let i = 0; i < formData.data.packageFileList.length; i++) {
  1009. if (formData.data.packageFileList[i].raw.uploadState) {
  1010. ElMessage("文件上传中,请稍后提交");
  1011. return false;
  1012. }
  1013. }
  1014. }
  1015. if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
  1016. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1017. let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
  1018. if (data && data.length > 0) {
  1019. let quantity = 0;
  1020. for (let j = 0; j < data.length; j++) {
  1021. quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
  1022. }
  1023. if (quantity > formData.data.contractProductList[i].quantity) {
  1024. ElMessage("出货数量不能大于商品数量");
  1025. return false;
  1026. }
  1027. }
  1028. }
  1029. }
  1030. return true;
  1031. } else {
  1032. setTimeout(() => {
  1033. const errorDiv = document.getElementsByClassName("is-error");
  1034. errorDiv[0].scrollIntoView();
  1035. }, 0);
  1036. }
  1037. return status;
  1038. };
  1039. // 接收父组件的传值
  1040. const props = defineProps({
  1041. queryData: Object,
  1042. });
  1043. const clickCustomerProduct = () => {
  1044. if (!formData.data.buyCorporationId) {
  1045. return ElMessage("请先选择客户");
  1046. }
  1047. openProductCustomer.value = true;
  1048. };
  1049. const getFormData = () => {
  1050. return proxy.deepClone(formData.data);
  1051. };
  1052. // 向父组件暴露
  1053. defineExpose({
  1054. getFormData,
  1055. handleSubmit,
  1056. });
  1057. const changeShroffAccount = (val) => {
  1058. if (val) {
  1059. let data = accountList.value.filter((item) => item.value === val);
  1060. if (data && data.length > 0) {
  1061. formData.data.beneficiaryName = data[0].beneficiaryName;
  1062. formData.data.beneficiaryBank = data[0].beneficiaryBank;
  1063. formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
  1064. formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
  1065. formData.data.swiftCode = data[0].swiftCode;
  1066. formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
  1067. }
  1068. }
  1069. };
  1070. const changeActiveName = () => {
  1071. if (activeName.value) {
  1072. activeName.value = "";
  1073. } else {
  1074. activeName.value = "1";
  1075. }
  1076. };
  1077. const uploadFile = async (file) => {
  1078. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1079. uploadData.value = res.uploadBody;
  1080. file.id = res.id;
  1081. file.fileName = res.fileName;
  1082. file.fileUrl = res.fileUrl;
  1083. file.uploadState = true;
  1084. return true;
  1085. };
  1086. const indicationUploadFile = async (file) => {
  1087. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1088. indicationUploadData.value = res.uploadBody;
  1089. file.id = res.id;
  1090. file.fileName = res.fileName;
  1091. file.fileUrl = res.fileUrl;
  1092. file.uploadState = true;
  1093. return true;
  1094. };
  1095. const handleSuccess = (any, UploadFile) => {
  1096. UploadFile.raw.uploadState = false;
  1097. };
  1098. const onPreviewFile = (file) => {
  1099. window.open(file.raw.fileUrl, "_blank");
  1100. };
  1101. const clickSplit = (item) => {
  1102. formData.data.contractShipmentList.push({
  1103. code: item.code,
  1104. productId: item.productId,
  1105. productName: item.productName,
  1106. shipmentTime: "",
  1107. quantity: undefined,
  1108. });
  1109. };
  1110. const clickDelete = (index) => {
  1111. formData.data.contractShipmentList.splice(index, 1);
  1112. };
  1113. watch(
  1114. props.queryData,
  1115. () => {
  1116. formOption.disabled = judgeStatus();
  1117. if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
  1118. for (var text in props.queryData) {
  1119. if (text === "fileList" || text === "packageFileList") {
  1120. if (props.queryData[text] && props.queryData[text].length > 0) {
  1121. formData.data[text] = props.queryData[text].map((item) => {
  1122. return {
  1123. raw: item,
  1124. name: item.fileName,
  1125. url: item.fileUrl,
  1126. };
  1127. });
  1128. }
  1129. } else {
  1130. formData.data[text] = props.queryData[text];
  1131. }
  1132. }
  1133. if (formData.data.countryId) {
  1134. getCityData(formData.data.countryId, "20");
  1135. }
  1136. if (formData.data.provinceId) {
  1137. getCityData(formData.data.provinceId, "30");
  1138. }
  1139. }
  1140. },
  1141. {
  1142. deep: true,
  1143. }
  1144. );
  1145. </script>
  1146. <style lang="scss" scoped>
  1147. ::v-deep(.el-input-number .el-input__inner) {
  1148. text-align: left;
  1149. }
  1150. .pic {
  1151. object-fit: contain;
  1152. width: 50px;
  1153. height: 50px;
  1154. cursor: pointer;
  1155. vertical-align: middle;
  1156. }
  1157. .shrinkPadding {
  1158. padding-right: 0 !important;
  1159. }
  1160. .hideCollapse {
  1161. margin-top: -62px;
  1162. border: 0 !important;
  1163. }
  1164. ::v-deep(.el-collapse-item__arrow) {
  1165. display: none !important;
  1166. }
  1167. ::v-deep(.el-collapse-item__wrap) {
  1168. border: 0 !important;
  1169. }
  1170. ::v-deep(.el-collapse-item__header) {
  1171. border: 0 !important;
  1172. }
  1173. </style>