Contract.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  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" filterable 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 #commodity>
  118. <div style="width: 100%">
  119. <el-button @click="openProduct = true">添加商品</el-button>
  120. <el-table :data="formData.data.contractProductList" style="width: 100%; margin-top: 16px">
  121. <el-table-column label="商品图片" width="80">
  122. <template #default="{ row }">
  123. <div v-if="row.productId">
  124. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  125. </div>
  126. <div v-else></div>
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="code" label="商品编码" width="120" />
  130. <el-table-column prop="name" label="商品中文名" width="160" />
  131. <el-table-column label="商品英文名" min-width="200">
  132. <template #default="{ row, $index }">
  133. <div style="width: 100%">
  134. <el-form-item :prop="'contractProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
  135. <el-input v-model="row.productName" placeholder="请输入商品英文名" />
  136. </el-form-item>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="规格型号" width="180">
  141. <template #default="{ row, $index }">
  142. <div style="width: 100%">
  143. <el-form-item :prop="'contractProductList.' + $index + '.productModel'" :inline-message="true">
  144. <el-input v-model="row.productModel" placeholder="请输入规格型号" />
  145. </el-form-item>
  146. </div>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="unit" label="单位" width="100" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
  150. <el-table-column label="数量" width="150">
  151. <template #default="{ row, $index }">
  152. <div style="width: 100%">
  153. <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
  154. <el-input-number
  155. onmousewheel="return false;"
  156. v-model="row.quantity"
  157. placeholder="请输入数量"
  158. style="width: 100%"
  159. :precision="0"
  160. :controls="false"
  161. :min="0"
  162. @change="calculationAmount()" />
  163. </el-form-item>
  164. </div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column label="单价" width="160">
  168. <template #default="{ row, $index }">
  169. <div style="width: 100%">
  170. <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
  171. <el-input-number
  172. onmousewheel="return false;"
  173. v-model="row.price"
  174. placeholder="请输入单价"
  175. style="width: 100%"
  176. :precision="2"
  177. :controls="false"
  178. :min="0"
  179. @change="calculationAmount()" />
  180. </el-form-item>
  181. </div>
  182. </template>
  183. </el-table-column>
  184. <el-table-column prop="amount" label="金额" width="100" />
  185. <el-table-column align="center" label="操作" width="120" fixed="right">
  186. <template #default="{ row, $index }">
  187. <el-button type="primary" link @click="handleHandover(row, $index)">交接单</el-button>
  188. <el-button type="primary" link @click="handleRemove($index, row)">删除</el-button>
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. </div>
  193. </template>
  194. <template #otherCharge>
  195. <div style="width: 100%">
  196. <el-button type="primary" @click="clickAdd()">添加行</el-button>
  197. <el-table :data="formData.data.contractProjectList" style="width: 100%; margin-top: 16px">
  198. <el-table-column label="收费项目" width="220">
  199. <template #default="{ row, $index }">
  200. <div style="width: 100%">
  201. <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
  202. <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
  203. </el-form-item>
  204. </div>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="金额" width="180">
  208. <template #default="{ row, $index }">
  209. <div style="width: 100%">
  210. <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
  211. <el-input-number
  212. onmousewheel="return false;"
  213. v-model="row.amount"
  214. placeholder="请输入金额"
  215. style="width: 100%"
  216. :precision="2"
  217. :controls="false"
  218. :min="0"
  219. @change="totalAmount()" />
  220. </el-form-item>
  221. </div>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="备注">
  225. <template #default="{ row, $index }">
  226. <div style="width: 100%">
  227. <el-form-item :prop="'contractProjectList.' + $index + '.remark'">
  228. <el-input v-model="row.remark" placeholder="请输入备注" />
  229. </el-form-item>
  230. </div>
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center" label="操作" width="80" fixed="right">
  234. <template #default="{ row, $index }">
  235. <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
  236. </template>
  237. </el-table-column>
  238. </el-table>
  239. </div>
  240. </template>
  241. <template #offerMoney>
  242. <div style="width: 100%">
  243. <el-row style="margin-top: 20px; width: 100%">
  244. <el-col :span="4">
  245. <el-form-item label="币种" prop="currency">
  246. <el-select v-model="formData.data.currency" placeholder="请选择币种" style="width: 100%">
  247. <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value" />
  248. </el-select>
  249. </el-form-item>
  250. </el-col>
  251. <el-col :span="6">
  252. <el-form-item label="合同总金额" prop="amount">
  253. <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
  254. </el-form-item>
  255. </el-col>
  256. <!-- <el-col :span="4">
  257. <el-form-item label="报价有效期 (天)" prop="effective">
  258. <el-input-number onmousewheel="return false;"
  259. v-model="formData.data.effective"
  260. placeholder="请输入有效期"
  261. style="width: 100%"
  262. :precision="0"
  263. :controls="false"
  264. :min="0"
  265. />
  266. </el-form-item>
  267. </el-col> -->
  268. </el-row>
  269. <el-row style="margin-top: 20px; width: 100%">
  270. <el-col :span="7">
  271. <el-form-item label="付款方式" prop="paymentMethod">
  272. <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
  273. <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
  274. </el-select>
  275. </el-form-item>
  276. </el-col>
  277. <el-col :span="7">
  278. <el-form-item label="预付比例 (%)" prop="advanceRatio">
  279. <el-input-number
  280. onmousewheel="return false;"
  281. v-model="formData.data.advanceRatio"
  282. placeholder="请输入预付比例"
  283. style="width: 100%"
  284. :precision="2"
  285. :controls="false"
  286. :min="0"
  287. :max="100" />
  288. </el-form-item>
  289. </el-col>
  290. <el-col :span="7">
  291. <el-form-item label="收款账号" prop="shroffAccountId">
  292. <el-select v-model="formData.data.shroffAccountId" placeholder="请选择收款账号" style="width: 100%" @change="changeShroffAccount">
  293. <el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value" />
  294. </el-select>
  295. </el-form-item>
  296. </el-col>
  297. <el-col :span="3">
  298. <el-form-item label=" ">
  299. <el-button type="primary" @click="changeActiveName" text>
  300. <span v-if="activeName == '1'">收起</span>
  301. <span v-else>展开</span>
  302. </el-button>
  303. </el-form-item>
  304. </el-col>
  305. </el-row>
  306. <div style="width: 100%; margin-top: 34px">
  307. <el-collapse v-model="activeName" class="hideCollapse" accordion>
  308. <el-collapse-item title="" name="1">
  309. <el-row style="width: 100%">
  310. <el-col :span="9">
  311. <el-form-item label="Beneficiary Name" prop="beneficiaryName">
  312. <el-input v-model="formData.data.beneficiaryName" placeholder="请输入Beneficiary Name" />
  313. </el-form-item>
  314. <div style="height: 20px"></div>
  315. <el-form-item label="Beneficiary Bank" prop="beneficiaryBank">
  316. <el-input v-model="formData.data.beneficiaryBank" placeholder="请输入Beneficiary Bank" />
  317. </el-form-item>
  318. <div style="height: 20px"></div>
  319. <el-form-item label="Beneficiary Bank Address" prop="beneficiaryBankAddress">
  320. <el-input v-model="formData.data.beneficiaryBankAddress" placeholder="请输入Beneficiary Bank Address" />
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="9">
  324. <el-form-item label="Beneficiary Account Number" prop="beneficiaryAccountNumber">
  325. <el-input v-model="formData.data.beneficiaryAccountNumber" placeholder="请输入Beneficiary Account Number" />
  326. </el-form-item>
  327. <div style="height: 20px"></div>
  328. <el-form-item label="Swift Code" prop="swiftCode">
  329. <el-input v-model="formData.data.swiftCode" placeholder="请输入Swift Code" />
  330. </el-form-item>
  331. <div style="height: 20px"></div>
  332. <el-form-item label="Beneficiary Address" prop="beneficiaryAddress">
  333. <el-input v-model="formData.data.beneficiaryAddress" placeholder="请输入Beneficiary Address" />
  334. </el-form-item>
  335. </el-col>
  336. </el-row>
  337. </el-collapse-item>
  338. </el-collapse>
  339. </div>
  340. </div>
  341. </template>
  342. <template #delivery>
  343. <div style="width: 100%">
  344. <el-row style="margin-top: 20px; width: 100%">
  345. <el-col :span="7">
  346. <el-form-item label="贸易方式" prop="tradeMethods">
  347. <el-select v-model="formData.data.tradeMethods" placeholder="请选择贸易方式" style="width: 100%">
  348. <el-option v-for="item in tradeMethods" :key="item.value" :label="item.label" :value="item.value" />
  349. </el-select>
  350. </el-form-item>
  351. </el-col>
  352. </el-row>
  353. <el-row style="margin-top: 20px; width: 100%">
  354. <el-col :span="7">
  355. <el-form-item label="运输方式" prop="transportMethod">
  356. <el-select v-model="formData.data.transportMethod" placeholder="请选择运输方式" style="width: 100%">
  357. <el-option v-for="item in shippingMethod" :key="item.value" :label="item.label" :value="item.value" />
  358. </el-select>
  359. </el-form-item>
  360. </el-col>
  361. <el-col :span="7">
  362. <el-form-item label="运输说明" prop="transportRemark">
  363. <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
  364. </el-form-item>
  365. </el-col>
  366. </el-row>
  367. <el-row style="margin-top: 20px; width: 100%">
  368. <el-col :span="14">
  369. <el-form-item label="付款条件" prop="remark">
  370. <el-input v-model="formData.data.remark" :rows="2" type="textarea" placeholder="请输入付款条件" />
  371. </el-form-item>
  372. </el-col>
  373. </el-row>
  374. <el-row style="margin-top: 20px; width: 100%">
  375. <el-col :span="7">
  376. <el-form-item label="交货期限 (天)" prop="deliveryTime">
  377. <!-- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" /> -->
  378. <el-input-number
  379. onmousewheel="return false;"
  380. v-model="formData.data.deliveryTime"
  381. placeholder="请输入交货期限"
  382. style="width: 100%"
  383. :precision="0"
  384. :controls="false"
  385. :min="0" />
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="7">
  389. <el-form-item label="质保期 (天)" prop="warranty">
  390. <el-input-number
  391. onmousewheel="return false;"
  392. v-model="formData.data.warranty"
  393. placeholder="请输入质保期"
  394. style="width: 100%"
  395. :precision="0"
  396. :controls="false"
  397. :min="0" />
  398. </el-form-item>
  399. </el-col>
  400. </el-row>
  401. </div>
  402. </template>
  403. <template #shipment>
  404. <div style="width: 100%">
  405. <el-table :data="formData.data.contractShipmentList" style="width: 100%; margin-top: 16px">
  406. <el-table-column prop="code" label="商品编码" width="120" />
  407. <el-table-column prop="productName" label="商品名称" />
  408. <el-table-column label="出货日期" width="220">
  409. <template #default="{ row, $index }">
  410. <div style="width: 100%">
  411. <el-form-item :prop="'contractShipmentList.' + $index + '.shipmentTime'" :rules="rules.shipmentTime" :inline-message="true">
  412. <el-date-picker v-model="row.shipmentTime" type="date" placeholder="请选择出货日期" value-format="YYYY-MM-DD" />
  413. </el-form-item>
  414. </div>
  415. </template>
  416. </el-table-column>
  417. <el-table-column label="数量" width="160">
  418. <template #default="{ row, $index }">
  419. <div style="width: 100%">
  420. <el-form-item :prop="'contractShipmentList.' + $index + '.quantity'" :inline-message="true">
  421. <el-input-number
  422. onmousewheel="return false;"
  423. v-model="row.quantity"
  424. placeholder="请输入数量"
  425. style="width: 100%"
  426. :precision="0"
  427. :controls="false"
  428. :min="0"
  429. @change="calculationAmount()" />
  430. </el-form-item>
  431. </div>
  432. </template>
  433. </el-table-column>
  434. <el-table-column align="center" label="操作" width="120" fixed="right">
  435. <template #default="{ row, $index }">
  436. <el-button type="primary" link @click="clickSplit(row)">拆分</el-button>
  437. <el-button type="primary" link @click="clickDelete($index)">删除</el-button>
  438. </template>
  439. </el-table-column>
  440. </el-table>
  441. </div>
  442. </template>
  443. </byForm>
  444. <el-dialog v-if="openProduct" v-model="openProduct" title="选择商品" width="70%" append-to-body>
  445. <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
  446. </el-dialog>
  447. <el-dialog title="交接单" v-if="openHandover" v-model="openHandover" width="800">
  448. <byForm :formConfig="formHandoverConfig" :formOption="formOption" v-model="productRow.data">
  449. <template #remark>
  450. <div style="width: 100%">
  451. <Editor :value="productRow.data.remark" @updateValue="updateContent" />
  452. </div>
  453. </template>
  454. <template #file>
  455. <div style="width: 100%">
  456. <el-upload
  457. v-model:fileList="fileList"
  458. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  459. :data="uploadData"
  460. multiple
  461. :before-upload="uploadFile"
  462. :on-success="handleSuccess"
  463. :on-preview="onPreviewFile">
  464. <el-button>选择</el-button>
  465. </el-upload>
  466. </div>
  467. </template>
  468. </byForm>
  469. <template #footer>
  470. <el-button @click="openHandover = false" size="large">取 消</el-button>
  471. <el-button type="primary" @click="submitHandoverForm()" size="large">确 定</el-button>
  472. </template>
  473. </el-dialog>
  474. </div>
  475. </template>
  476. <script setup>
  477. import byForm from "@/components/byForm/index";
  478. import SelectGoods from "@/components/product/SelectGoods";
  479. import { ElMessage } from "element-plus";
  480. import Editor from "@/components/Editor/index.vue";
  481. import selectCity from "@/components/selectCity/index.vue";
  482. import { useRoute } from "vue-router";
  483. const route = useRoute();
  484. // 接收父组件的传值
  485. const props = defineProps({
  486. queryData: String,
  487. });
  488. const { proxy } = getCurrentInstance();
  489. const contractType = ref([]);
  490. const accountCurrency = ref([]);
  491. const fundsPaymentMethod = ref([]);
  492. const tradeMethods = ref([]);
  493. const shippingMethod = ref([]);
  494. const templateList = ref([]);
  495. const corporationList = ref([]);
  496. const customerList = ref([]);
  497. const countryData = ref([]);
  498. const provinceData = ref([]);
  499. const cityData = ref([]);
  500. const customerUserList = ref([]);
  501. const accountList = ref([]);
  502. const productUnit = ref([]);
  503. const openProduct = ref(false);
  504. const activeName = ref("");
  505. const formData = reactive({
  506. data: {
  507. contractType: "1",
  508. amount: undefined,
  509. contractProductList: [],
  510. contractProjectList: [],
  511. contractShipmentList: [],
  512. },
  513. });
  514. const submit = ref(null);
  515. const judgeStatus = () => {
  516. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  517. let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
  518. if (data && data.length > 0) {
  519. return true;
  520. }
  521. }
  522. return false;
  523. };
  524. const formOption = reactive({
  525. inline: true,
  526. labelWidth: 100,
  527. itemWidth: 100,
  528. rules: [],
  529. disabled: false,
  530. });
  531. const formConfig = computed(() => {
  532. return [
  533. {
  534. type: "title",
  535. title: "合同模板",
  536. label: "",
  537. },
  538. {
  539. type: "select",
  540. label: "合同类型",
  541. prop: "contractType",
  542. data: contractType.value,
  543. itemWidth: 25,
  544. },
  545. {
  546. type: "select",
  547. label: "选择合同模板",
  548. prop: "contractTemplateId",
  549. data: templateList.value,
  550. fn: (val) => {
  551. changeTemplate(val);
  552. },
  553. itemWidth: 26,
  554. },
  555. {
  556. type: "slot",
  557. slotName: "seller",
  558. label: "卖方信息",
  559. itemWidth: 50,
  560. },
  561. {
  562. type: "slot",
  563. slotName: "buyer",
  564. label: "买方信息",
  565. itemWidth: 50,
  566. },
  567. {
  568. type: "slot",
  569. slotName: "commodity",
  570. label: "商品信息",
  571. },
  572. {
  573. type: "slot",
  574. slotName: "otherCharge",
  575. label: "其他收费项目",
  576. },
  577. {
  578. type: "slot",
  579. slotName: "offerMoney",
  580. label: "收款信息",
  581. },
  582. {
  583. type: "slot",
  584. slotName: "delivery",
  585. label: "交付信息",
  586. },
  587. {
  588. type: "slot",
  589. slotName: "shipment",
  590. label: "出货计划",
  591. },
  592. ];
  593. });
  594. const rules = ref({
  595. contractType: [{ required: true, message: "请选择合同类型", trigger: "change" }],
  596. contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
  597. buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
  598. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  599. sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  600. buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  601. buyContactName: [{ required: true, message: "请输入联系人", trigger: ["change", "blur"] }],
  602. buyContactNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  603. productName: [{ required: true, message: "请输入商品英文名", trigger: "blur" }],
  604. productModel: [{ required: true, message: "请输入规格型号", trigger: "blur" }],
  605. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  606. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  607. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  608. payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
  609. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  610. effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
  611. deliveryTime: [{ required: true, message: "请选择交货期限", trigger: "blur" }],
  612. paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
  613. advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
  614. shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
  615. tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
  616. transportMethod: [{ required: true, message: "请选择运输方式", trigger: "change" }],
  617. transportRemark: [{ required: true, message: "请输入运输说明", trigger: "blur" }],
  618. remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
  619. });
  620. const getDict = () => {
  621. proxy.getDictOne(["account_currency", "funds_payment_method", "trade_mode", "shipping_method", "contract_type", "unit"]).then((res) => {
  622. accountCurrency.value = res["account_currency"].map((x) => ({
  623. label: x.dictValue,
  624. value: x.dictKey,
  625. }));
  626. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  627. label: x.dictValue,
  628. value: x.dictKey,
  629. }));
  630. tradeMethods.value = res["trade_mode"].map((x) => ({
  631. label: x.dictValue,
  632. value: x.dictKey,
  633. }));
  634. shippingMethod.value = res["shipping_method"].map((x) => ({
  635. label: x.dictValue,
  636. value: x.dictKey,
  637. }));
  638. contractType.value = res["contract_type"].map((x) => ({
  639. label: x.dictValue,
  640. value: x.dictKey,
  641. }));
  642. productUnit.value = res["unit"].map((x) => ({
  643. label: x.dictValue,
  644. value: x.dictKey,
  645. }));
  646. });
  647. proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  648. templateList.value = res.rows.map((item) => {
  649. return {
  650. ...item,
  651. label: item.templateName,
  652. value: item.id,
  653. };
  654. });
  655. });
  656. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  657. corporationList.value = res.rows.map((item) => {
  658. return {
  659. ...item,
  660. label: item.name,
  661. value: item.id,
  662. };
  663. });
  664. });
  665. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  666. customerList.value = res.rows.map((item) => {
  667. return {
  668. ...item,
  669. label: item.name,
  670. value: item.id,
  671. };
  672. });
  673. });
  674. proxy.post("/accountManagement/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  675. accountList.value = res.rows.map((item) => {
  676. return {
  677. ...item,
  678. label: item.alias,
  679. value: item.id,
  680. };
  681. });
  682. });
  683. };
  684. getDict();
  685. const changeTemplate = (val) => {
  686. formData.data.sellCorporationId = "";
  687. formData.data.sellContactName = "";
  688. formData.data.sellContactNumber = "";
  689. formData.data.sellCountryName = "";
  690. formData.data.sellProvinceName = "";
  691. formData.data.sellCityName = "";
  692. formData.data.sellAddress = "";
  693. if (val) {
  694. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  695. formData.data.sellCorporationId = res.corporationId;
  696. if (res.corporationId) {
  697. proxy.post("/corporation/detail", { id: res.corporationId }).then((detailCorporation) => {
  698. if (detailCorporation.countryEnStr) {
  699. formData.data.sellCountryName = detailCorporation.countryEnStr;
  700. }
  701. if (res.provinceEnStr) {
  702. formData.data.sellProvinceName = detailCorporation.provinceEnStr;
  703. }
  704. if (res.cityEnStr) {
  705. formData.data.sellCityName = detailCorporation.cityEnStr;
  706. }
  707. if (detailCorporation.countryEnStr) {
  708. formData.data.sellCountryName = detailCorporation.countryEnStr;
  709. } else {
  710. proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
  711. let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
  712. if (sellCountryData && sellCountryData.length > 0) {
  713. formData.data.sellCountryName = sellCountryData[0].chineseName;
  714. } else {
  715. formData.data.sellCountryName = "";
  716. }
  717. });
  718. }
  719. if (detailCorporation.provinceEnStr) {
  720. formData.data.sellProvinceName = detailCorporation.provinceEnStr;
  721. } else if (detailCorporation.countryId) {
  722. proxy
  723. .post("/customizeArea/list", {
  724. parentId: detailCorporation.countryId,
  725. })
  726. .then((resProvince) => {
  727. let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
  728. if (sellProvinceData && sellProvinceData.length > 0) {
  729. formData.data.sellProvinceName = sellProvinceData[0].name;
  730. } else {
  731. formData.data.sellProvinceName = "";
  732. }
  733. });
  734. } else {
  735. formData.data.sellProvinceName = "";
  736. }
  737. if (detailCorporation.cityEnStr) {
  738. formData.data.sellCityName = detailCorporation.cityEnStr;
  739. } else if (detailCorporation.provinceId) {
  740. proxy
  741. .post("/customizeArea/list", {
  742. parentId: detailCorporation.provinceId,
  743. })
  744. .then((resCity) => {
  745. let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
  746. if (sellCityData && sellCityData.length > 0) {
  747. formData.data.sellCityName = sellCityData[0].name;
  748. } else {
  749. formData.data.sellCityName = "";
  750. }
  751. });
  752. } else {
  753. formData.data.sellCityName = "";
  754. }
  755. if (detailCorporation.addressEn) {
  756. formData.data.sellAddress = detailCorporation.addressEn;
  757. } else {
  758. formData.data.sellAddress = detailCorporation.address;
  759. }
  760. if (detailCorporation.cityEnStr) {
  761. formData.data.sellCityName = detailCorporation.cityEnStr;
  762. }
  763. if (detailCorporation.addressEn) {
  764. formData.data.sellAddress = detailCorporation.addressEn;
  765. }
  766. // proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
  767. // let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
  768. // if (sellCountryData && sellCountryData.length > 0) {
  769. // formData.data.sellCountryName = sellCountryData[0].chineseName;
  770. // } else {
  771. // formData.data.sellCountryName = "";
  772. // }
  773. // });
  774. // if (detailCorporation.countryId) {
  775. // proxy
  776. // .post("/customizeArea/list", {
  777. // parentId: detailCorporation.countryId,
  778. // })
  779. // .then((resProvince) => {
  780. // let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
  781. // if (sellProvinceData && sellProvinceData.length > 0) {
  782. // formData.data.sellProvinceName = sellProvinceData[0].name;
  783. // } else {
  784. // formData.data.sellProvinceName = "";
  785. // }
  786. // });
  787. // } else {
  788. // formData.data.sellProvinceName = "";
  789. // }
  790. // if (detailCorporation.provinceId) {
  791. // proxy
  792. // .post("/customizeArea/list", {
  793. // parentId: detailCorporation.provinceId,
  794. // })
  795. // .then((resCity) => {
  796. // let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
  797. // if (sellCityData && sellCityData.length > 0) {
  798. // formData.data.sellCityName = sellCityData[0].name;
  799. // } else {
  800. // formData.data.sellCityName = "";
  801. // }
  802. // });
  803. // } else {
  804. // formData.data.sellCityName = "";
  805. // }
  806. // formData.data.sellAddress = detailCorporation.address;
  807. });
  808. }
  809. formData.data.sellContactName = res.contactName;
  810. formData.data.sellContactNumber = res.contactNumber;
  811. });
  812. }
  813. };
  814. const getCityData = (id, type, isChange) => {
  815. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  816. if (type === "20") {
  817. provinceData.value = res;
  818. if (isChange) {
  819. formData.data.provinceId = "";
  820. formData.data.provinceName = "";
  821. formData.data.cityId = "";
  822. formData.data.cityName = "";
  823. }
  824. } else if (type === "30") {
  825. cityData.value = res;
  826. if (isChange) {
  827. formData.data.cityId = "";
  828. formData.data.cityName = "";
  829. }
  830. } else {
  831. countryData.value = res;
  832. }
  833. });
  834. };
  835. getCityData("0");
  836. const changeCustomer = (val) => {
  837. formData.data.buyContactName = "";
  838. formData.data.buyContactNumber = "";
  839. if (val) {
  840. proxy.post("/customer/detail", { id: val }).then(
  841. (res) => {
  842. if (res.customerUserList && res.customerUserList.length > 0) {
  843. formData.data.buyContactName = res.customerUserList[0].name;
  844. if (res.customerUserList[0].contactJson) {
  845. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  846. if (contactJson && contactJson.length > 0) {
  847. formData.data.buyContactNumber = contactJson[0].contactNo;
  848. }
  849. }
  850. customerUserList.value = res.customerUserList.map((item) => {
  851. return {
  852. ...item,
  853. value: item.name,
  854. };
  855. });
  856. }
  857. formData.data.countryId = res.countryId;
  858. formData.data.provinceId = res.provinceId;
  859. formData.data.cityId = res.cityId;
  860. formData.data.buyPostalCode = res.zipCode;
  861. formData.data.buyAddress = res.address;
  862. getCityData(formData.data.countryId, "20");
  863. if (formData.data.provinceId) {
  864. getCityData(formData.data.provinceId, "30");
  865. }
  866. },
  867. (err) => {
  868. console.log(err);
  869. formData.data.countryId = "";
  870. formData.data.provinceId = "";
  871. formData.data.cityId = "";
  872. formData.data.buyPostalCode = "";
  873. formData.data.buyAddress = "";
  874. }
  875. );
  876. } else {
  877. formData.data.countryId = "";
  878. formData.data.provinceId = "";
  879. formData.data.cityId = "";
  880. formData.data.buyPostalCode = "";
  881. formData.data.buyAddress = "";
  882. }
  883. getDecisionAids();
  884. };
  885. let auxiliaryData = ref([
  886. {
  887. label: "最近合同",
  888. data: [],
  889. },
  890. {
  891. label: "产品价格",
  892. data: [],
  893. },
  894. ]);
  895. const emit = defineEmits(["auxiliaryChange"]);
  896. const getDecisionAids = () => {
  897. let data = {
  898. buyCorporationId: formData.data.buyCorporationId,
  899. productIdList: [],
  900. };
  901. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  902. data.productIdList = formData.data.contractProductList.map((item) => item.productId);
  903. }
  904. proxy.post("/contract/decisionAid", data).then((res) => {
  905. if (res.lastContractList && res.lastContractList.length > 0) {
  906. auxiliaryData.value[0].data = res.lastContractList.map((item) => {
  907. return [
  908. {
  909. label: "合同编号",
  910. value: item.code,
  911. style: {
  912. color: "#0084FF",
  913. },
  914. id: item.id,
  915. num: 1,
  916. // fn: () => {},
  917. },
  918. {
  919. label: "下单日期",
  920. value: item.createTime,
  921. id: item.id,
  922. num: 1,
  923. },
  924. {
  925. label: "合同金额",
  926. value: item.currency + item.amount,
  927. id: item.id,
  928. num: 1,
  929. },
  930. ];
  931. });
  932. } else {
  933. auxiliaryData.value[0].data = [];
  934. }
  935. if (res.productPriceList && res.productPriceList.length > 0) {
  936. auxiliaryData.value[1].data = res.productPriceList.map((item) => {
  937. return [
  938. {
  939. label: "产品名称",
  940. value: item.name,
  941. id: item.id,
  942. num: 1,
  943. },
  944. {
  945. label: "最近价格",
  946. value: item.lastPrice,
  947. id: item.id,
  948. num: 1,
  949. },
  950. {
  951. label: "历史最高",
  952. value: item.maxPrice,
  953. id: item.id,
  954. num: 1,
  955. },
  956. {
  957. label: "历史最低",
  958. value: item.minPrice,
  959. id: item.id,
  960. num: 1,
  961. },
  962. ];
  963. });
  964. } else {
  965. auxiliaryData.value[1].data = [];
  966. }
  967. emit("auxiliaryChange", auxiliaryData.value);
  968. });
  969. };
  970. const createFilter = (queryString) => {
  971. return (restaurant) => {
  972. return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
  973. };
  974. };
  975. const querySearchPerson = (queryString, callback) => {
  976. const results = queryString ? customerUserList.value.filter(createFilter(queryString)) : customerUserList.value;
  977. callback(results);
  978. };
  979. const handlePerson = (item) => {
  980. formData.data.buyContactNumber = item.phone;
  981. };
  982. const pushGoods = (goods) => {
  983. if (goods && goods.length > 0) {
  984. let afterFiltering = [];
  985. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  986. afterFiltering = goods.filter((item) => {
  987. let data = formData.data.contractProductList.filter((itemProduct) => itemProduct.productId === item.id);
  988. if (data && data.length > 0) {
  989. return false;
  990. }
  991. return true;
  992. });
  993. } else {
  994. afterFiltering = goods;
  995. }
  996. formData.data.contractProductList = formData.data.contractProductList.concat(
  997. afterFiltering.map((item) => {
  998. let fileUrl = "";
  999. if (item.fileList && item.fileList.length > 0) {
  1000. fileUrl = item.fileList[0].fileUrl;
  1001. }
  1002. let name = item.name;
  1003. if (item.standardJson) {
  1004. let standardJson = JSON.parse(item.standardJson);
  1005. if (standardJson && standardJson.englishName) {
  1006. name = standardJson.englishName;
  1007. }
  1008. }
  1009. return {
  1010. fileUrl: fileUrl,
  1011. code: item.code,
  1012. productId: item.id,
  1013. name: item.name,
  1014. productName: name,
  1015. productModel: item.spec,
  1016. unit: item.unit,
  1017. quantity: undefined,
  1018. price: undefined,
  1019. amount: "",
  1020. remark: "",
  1021. fileList: [],
  1022. };
  1023. })
  1024. );
  1025. formData.data.contractShipmentList = formData.data.contractShipmentList.concat(
  1026. afterFiltering.map((item) => {
  1027. let name = item.name;
  1028. if (item.standardJson) {
  1029. let standardJson = JSON.parse(item.standardJson);
  1030. if (standardJson && standardJson.englishName) {
  1031. name = standardJson.englishName;
  1032. }
  1033. }
  1034. return {
  1035. code: item.code,
  1036. productId: item.id,
  1037. productName: name,
  1038. shipmentTime: "",
  1039. quantity: undefined,
  1040. };
  1041. })
  1042. );
  1043. ElMessage({
  1044. message: "添加成功!",
  1045. type: "success",
  1046. });
  1047. openProduct.value = false;
  1048. getDecisionAids();
  1049. } else {
  1050. ElMessage("请选择至少一件商品");
  1051. }
  1052. };
  1053. const onPicture = (path) => {
  1054. window.open(path, "_blank");
  1055. };
  1056. const productRow = reactive({
  1057. data: {
  1058. productName: "",
  1059. productModel: "",
  1060. remark: "",
  1061. },
  1062. });
  1063. const productIndex = ref(0);
  1064. const openHandover = ref(false);
  1065. const fileList = ref([]);
  1066. const uploadData = ref({});
  1067. const formHandoverConfig = computed(() => {
  1068. return [
  1069. {
  1070. type: "title",
  1071. title: "产品信息",
  1072. label: "",
  1073. },
  1074. {
  1075. type: "input",
  1076. prop: "productName",
  1077. label: "产品名称",
  1078. itemType: "text",
  1079. disabled: true,
  1080. },
  1081. {
  1082. type: "input",
  1083. prop: "productModel",
  1084. label: "规格型号",
  1085. itemType: "text",
  1086. disabled: true,
  1087. },
  1088. {
  1089. type: "slot",
  1090. slotName: "remark",
  1091. label: "交接单",
  1092. },
  1093. {
  1094. type: "slot",
  1095. prop: "file",
  1096. slotName: "file",
  1097. label: "上传附件",
  1098. },
  1099. ];
  1100. });
  1101. const handleHandover = (row, index) => {
  1102. productRow.data = {
  1103. productName: row.productName,
  1104. productModel: row.productModel,
  1105. remark: row.remark,
  1106. };
  1107. if (row.fileList && row.fileList.length > 0) {
  1108. fileList.value = row.fileList.map((item) => {
  1109. return {
  1110. raw: item,
  1111. name: item.fileName,
  1112. url: item.fileUrl,
  1113. };
  1114. });
  1115. } else {
  1116. fileList.value = [];
  1117. }
  1118. productIndex.value = index;
  1119. openHandover.value = true;
  1120. };
  1121. const updateContent = (val) => {
  1122. productRow.data.remark = val;
  1123. };
  1124. const changeActiveName = () => {
  1125. if (activeName.value) {
  1126. activeName.value = "";
  1127. } else {
  1128. activeName.value = "1";
  1129. }
  1130. };
  1131. const uploadFile = async (file) => {
  1132. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1133. uploadData.value = res.uploadBody;
  1134. file.id = res.id;
  1135. file.fileName = res.fileName;
  1136. file.fileUrl = res.fileUrl;
  1137. file.uploadState = true;
  1138. return true;
  1139. };
  1140. const handleSuccess = (any, UploadFile) => {
  1141. UploadFile.raw.uploadState = false;
  1142. };
  1143. const onPreviewFile = (file) => {
  1144. window.open(file.raw.fileUrl, "_blank");
  1145. };
  1146. const submitHandoverForm = () => {
  1147. if (fileList.value && fileList.value.length > 0) {
  1148. for (let i = 0; i < fileList.value.length; i++) {
  1149. if (fileList.value[i].raw.uploadState) {
  1150. ElMessage("文件上传中,请稍后提交");
  1151. return;
  1152. }
  1153. }
  1154. formData.data.contractProductList[productIndex.value].fileList = fileList.value.map((item) => {
  1155. return {
  1156. id: item.raw.id,
  1157. fileName: item.raw.fileName,
  1158. fileUrl: item.raw.fileUrl,
  1159. uploadState: item.raw.uploadState,
  1160. };
  1161. });
  1162. } else {
  1163. formData.data.contractProductList[productIndex.value].fileList = [];
  1164. }
  1165. formData.data.contractProductList[productIndex.value].remark = productRow.data.remark;
  1166. openHandover.value = false;
  1167. };
  1168. const handleRemove = async (index, row) => {
  1169. formData.data.contractShipmentList = formData.data.contractShipmentList.filter((item) => item.productId !== row.productId);
  1170. await formData.data.contractProductList.splice(index, 1);
  1171. totalAmount();
  1172. getDecisionAids();
  1173. };
  1174. const calculationAmount = () => {
  1175. nextTick(() => {
  1176. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  1177. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1178. let money = 0;
  1179. if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
  1180. money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
  1181. }
  1182. formData.data.contractProductList[i].amount = money;
  1183. }
  1184. }
  1185. nextTick(() => {
  1186. totalAmount();
  1187. });
  1188. });
  1189. };
  1190. const totalAmount = () => {
  1191. let money = 0;
  1192. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  1193. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1194. if (formData.data.contractProductList[i].amount) {
  1195. money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
  1196. }
  1197. }
  1198. }
  1199. if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
  1200. for (let i = 0; i < formData.data.contractProjectList.length; i++) {
  1201. if (formData.data.contractProjectList[i].amount) {
  1202. money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
  1203. }
  1204. }
  1205. }
  1206. formData.data.amount = money;
  1207. };
  1208. const clickAdd = () => {
  1209. if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
  1210. formData.data.contractProjectList.push({
  1211. payName: "",
  1212. amount: undefined,
  1213. remark: "",
  1214. });
  1215. } else {
  1216. formData.data.contractProjectList = [{ payName: "", amount: undefined, remark: "" }];
  1217. }
  1218. };
  1219. const handleDelete = async (index) => {
  1220. await formData.data.contractProjectList.splice(index, 1);
  1221. totalAmount();
  1222. };
  1223. const querySearch = (queryString, callback) => {
  1224. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  1225. if (res.rows && res.rows.length > 0) {
  1226. res.rows = res.rows.map((item) => {
  1227. return {
  1228. ...item,
  1229. value: item.payName,
  1230. };
  1231. });
  1232. callback(res.rows);
  1233. } else {
  1234. callback([]);
  1235. }
  1236. });
  1237. };
  1238. const clickSplit = (item) => {
  1239. formData.data.contractShipmentList.push({
  1240. code: item.code,
  1241. productId: item.productId,
  1242. productName: item.productName,
  1243. shipmentTime: "",
  1244. quantity: undefined,
  1245. });
  1246. };
  1247. const clickDelete = (index) => {
  1248. formData.data.contractShipmentList.splice(index, 1);
  1249. };
  1250. const handleSubmit = async () => {
  1251. let status = await submit.value.handleSubmit(() => {});
  1252. if (status) {
  1253. if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
  1254. ElMessage("请添加至少一件商品");
  1255. return false;
  1256. }
  1257. if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
  1258. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1259. let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
  1260. if (data && data.length > 0) {
  1261. let quantity = 0;
  1262. for (let j = 0; j < data.length; j++) {
  1263. quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
  1264. }
  1265. if (quantity > formData.data.contractProductList[i].quantity) {
  1266. ElMessage("出货数量不能大于商品数量");
  1267. return false;
  1268. }
  1269. }
  1270. }
  1271. }
  1272. return true;
  1273. } else {
  1274. setTimeout(() => {
  1275. const errorDiv = document.getElementsByClassName("is-error");
  1276. errorDiv[0].scrollIntoView();
  1277. }, 0);
  1278. }
  1279. return false;
  1280. };
  1281. const getFormData = () => {
  1282. return formData.data;
  1283. };
  1284. // 向父组件暴露
  1285. defineExpose({
  1286. getFormData,
  1287. handleSubmit,
  1288. });
  1289. const changeShroffAccount = (val) => {
  1290. if (val) {
  1291. let data = accountList.value.filter((item) => item.value === val);
  1292. if (data && data.length > 0) {
  1293. formData.data.beneficiaryName = data[0].beneficiaryName;
  1294. formData.data.beneficiaryBank = data[0].beneficiaryBank;
  1295. formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
  1296. formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
  1297. formData.data.swiftCode = data[0].swiftCode;
  1298. formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
  1299. }
  1300. }
  1301. };
  1302. watch(
  1303. props.queryData,
  1304. () => {
  1305. formOption.disabled = judgeStatus();
  1306. if (props.queryData && (route.query.processType == 10 || route.query.processType == 20)) {
  1307. for (var text in props.queryData) {
  1308. formData.data[text] = props.queryData[text];
  1309. }
  1310. if (formData.data.countryId) {
  1311. getCityData(formData.data.countryId, "20");
  1312. }
  1313. if (formData.data.provinceId) {
  1314. getCityData(formData.data.provinceId, "30");
  1315. }
  1316. }
  1317. },
  1318. {
  1319. deep: true,
  1320. }
  1321. );
  1322. const acquireSelectList = () => {
  1323. let data = [];
  1324. if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
  1325. data = formData.data.contractProductList.map((item) => {
  1326. return {
  1327. id: item.productId,
  1328. name: item.name,
  1329. };
  1330. });
  1331. }
  1332. return data;
  1333. };
  1334. </script>
  1335. <style lang="scss" scoped>
  1336. ::v-deep(.el-input-number .el-input__inner) {
  1337. text-align: left;
  1338. }
  1339. .pic {
  1340. object-fit: contain;
  1341. width: 50px;
  1342. height: 50px;
  1343. cursor: pointer;
  1344. vertical-align: middle;
  1345. }
  1346. .shrinkPadding {
  1347. padding-right: 0 !important;
  1348. }
  1349. .hideCollapse {
  1350. margin-top: -62px;
  1351. border: 0 !important;
  1352. }
  1353. ::v-deep(.el-collapse-item__arrow) {
  1354. display: none !important;
  1355. }
  1356. ::v-deep(.el-collapse-item__wrap) {
  1357. border: 0 !important;
  1358. }
  1359. ::v-deep(.el-collapse-item__header) {
  1360. border: 0 !important;
  1361. }
  1362. </style>