Sample.vue 42 KB

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