info.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  1. <template>
  2. <div class="component-edit-indent-info">
  3. <el-dialog
  4. v-model="show"
  5. class="custom-edit-indent-info-dialog"
  6. :title="visible === 1 ? '录入报价信息' : '录入报价信息'"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. :before-close="close"
  10. width="1300px"
  11. >
  12. <div style="color: #ef4135">* 为了报价单的内容,请填写英文信息</div>
  13. <div class="form-table">
  14. <div class="flex items-stretch form-header">
  15. <div class="first-label"></div>
  16. <div class="second-label">操作</div>
  17. <div
  18. v-for="(item, index) in forms"
  19. :key="index"
  20. class="input-area flex justify-center items-center"
  21. >
  22. <el-button
  23. v-show="forms.length > 1"
  24. size="small"
  25. type="danger"
  26. link
  27. plain
  28. @click="deleteForm(index)"
  29. >
  30. {{ $t('btn_delete') }}
  31. </el-button>
  32. </div>
  33. </div>
  34. <div class="flex items-stretch">
  35. <div class="first-label flex justify-center items-center">
  36. {{ $t(prefix + 'label_supplier') }}
  37. </div>
  38. <div class="flex flex-col items-stretch">
  39. <div class="flex items-center">
  40. <div class="second-label required">
  41. {{ $t(prefix + 'label_company_name') }}
  42. </div>
  43. <el-form
  44. v-for="(item, index) in forms"
  45. :ref="($e) => getFormRef($e, `vendor_id_${index}`)"
  46. :key="index"
  47. :show-message="false"
  48. :model="item"
  49. >
  50. <div class="input-area">
  51. <el-form-item
  52. prop="vendor_id"
  53. :rules="{ required: true, validator: commonCheck }"
  54. >
  55. <div class="flex w-[100%] pr-3">
  56. <el-select
  57. v-model="item.vendor_id"
  58. :remote-method="($e: any) => queryVenderList($e, index)"
  59. filterable
  60. remote
  61. style="width: 100%"
  62. placeholder="请选择供应商"
  63. @change="($e) => changeVenderSelect($e, index)"
  64. >
  65. <!-- allow-create -->
  66. <el-option
  67. v-for="(option, subIndex) in vendorList[index]"
  68. :key="option.id || subIndex"
  69. :value="option.id"
  70. :label="option.name"
  71. ></el-option>
  72. </el-select>
  73. <el-button @click="copyValue(item.vendor_name, $event)">
  74. copy
  75. </el-button>
  76. </div>
  77. </el-form-item>
  78. <div
  79. v-if="index < forms.length - 1"
  80. class="btn-copy"
  81. @click.self="commonCopyFormItem(index, 'vendor_id')"
  82. >
  83. &gt;&gt;&gt;
  84. </div>
  85. </div>
  86. </el-form>
  87. </div>
  88. <div class="flex items-stretch">
  89. <div class="second-label">
  90. {{ $t(prefix + 'label_supplier_type') }}
  91. </div>
  92. <div
  93. v-for="(item, index) in forms"
  94. :key="index"
  95. class="input-area"
  96. >
  97. <el-input
  98. v-model="item.vendor_type"
  99. placeholder="请输入供应商类型"
  100. ></el-input>
  101. <div
  102. v-if="index < forms.length - 1"
  103. class="btn-copy"
  104. @click.self="commonCopyFormItem(index, 'vendor_type')"
  105. >
  106. &gt;&gt;&gt;
  107. </div>
  108. </div>
  109. </div>
  110. <div class="flex items-stretch">
  111. <div class="second-label">
  112. {{ $t(prefix + 'label_wangwang_year') }}
  113. </div>
  114. <div
  115. v-for="(item, index) in forms"
  116. :key="index"
  117. class="input-area"
  118. >
  119. <el-input
  120. v-model="item.vendor_wangwang_old"
  121. placeholder="请输入旺旺年份"
  122. ></el-input>
  123. <div
  124. v-if="index < forms.length - 1"
  125. class="btn-copy"
  126. @click.self="commonCopyFormItem(index, 'vendor_wangwang_old')"
  127. >
  128. &gt;&gt;&gt;
  129. </div>
  130. </div>
  131. </div>
  132. <div class="flex items-stretch">
  133. <div class="second-label">
  134. {{ $t(prefix + 'label_contact') }}
  135. </div>
  136. <div
  137. v-for="(item, index) in forms"
  138. :key="index"
  139. class="input-area"
  140. >
  141. <el-input
  142. v-model="item.vendor_contact"
  143. placeholder="请输入联系人"
  144. ></el-input>
  145. <div
  146. v-if="index < forms.length - 1"
  147. class="btn-copy"
  148. @click.self="commonCopyFormItem(index, 'vendor_contact')"
  149. >
  150. &gt;&gt;&gt;
  151. </div>
  152. </div>
  153. </div>
  154. <div class="flex items-stretch">
  155. <div class="second-label">
  156. {{ $t(prefix + 'label_phone') }}
  157. </div>
  158. <div
  159. v-for="(item, index) in forms"
  160. :key="index"
  161. class="input-area"
  162. >
  163. <el-input
  164. v-model="item.vendor_phone"
  165. placeholder="请输入电话"
  166. ></el-input>
  167. <div
  168. v-if="index < forms.length - 1"
  169. class="btn-copy"
  170. @click.self="commonCopyFormItem(index, 'vendor_phone')"
  171. >
  172. &gt;&gt;&gt;
  173. </div>
  174. </div>
  175. </div>
  176. <div class="flex items-stretch">
  177. <div class="second-label">
  178. {{ $t(prefix + 'label_cert') }}
  179. </div>
  180. <div
  181. v-for="(item, index) in forms"
  182. :key="index"
  183. class="input-area"
  184. >
  185. <el-input
  186. v-model="item.cert"
  187. placeholder="证书"
  188. ></el-input>
  189. <div
  190. v-if="index < forms.length - 1"
  191. class="btn-copy"
  192. @click.self="commonCopyFormItem(index, 'cert')"
  193. >
  194. &gt;&gt;&gt;
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="flex items-stretch">
  201. <div class="first-label flex justify-center items-center">
  202. {{ $t(prefix + 'label_product_info') }}
  203. </div>
  204. <div class="flex flex-col items-stretch">
  205. <div class="flex items-stretch">
  206. <div class="second-label required">
  207. {{ $t(prefix + 'label_product_name') }}
  208. </div>
  209. <el-form
  210. v-for="(item, index) in forms"
  211. :ref="($e) => getFormRef($e, `product_name_${index}`)"
  212. :key="index"
  213. :show-message="false"
  214. :model="item"
  215. >
  216. <div class="input-area">
  217. <el-form-item
  218. prop="product_name"
  219. :rules="{
  220. required: true,
  221. trigger: 'change',
  222. validator: commonCheck,
  223. }"
  224. >
  225. <el-input
  226. v-model="item.product_name"
  227. placeholder="请输入产品名称"
  228. @input="
  229. ($e) => inputFilter($e, forms[index], 'product_name')
  230. "
  231. ></el-input>
  232. </el-form-item>
  233. <div
  234. v-if="index < forms.length - 1"
  235. class="btn-copy"
  236. @click.self="commonCopyFormItem(index, 'product_name')"
  237. >
  238. &gt;&gt;&gt;
  239. </div>
  240. </div>
  241. </el-form>
  242. </div>
  243. <div class="flex items-stretch">
  244. <div class="second-label">
  245. {{ $t(prefix + 'label_product_url') }}
  246. </div>
  247. <div
  248. v-for="(item, index) in forms"
  249. :key="index"
  250. class="input-area"
  251. >
  252. <el-input
  253. v-model="item.product_url"
  254. placeholder="请输入产品链接"
  255. @input="($e) => inputFilter($e, forms[index], 'product_url')"
  256. ></el-input>
  257. <div
  258. v-if="index < forms.length - 1"
  259. class="btn-copy"
  260. @click.self="commonCopyFormItem(index, 'product_url')"
  261. >
  262. &gt;&gt;&gt;
  263. </div>
  264. </div>
  265. </div>
  266. <div class="flex items-stretch">
  267. <div class="second-label">
  268. {{ $t(prefix + 'label_product_image') }}
  269. </div>
  270. <div
  271. v-for="(item, index) in forms"
  272. :key="index"
  273. class="input-area"
  274. >
  275. <image-upload
  276. v-model:list="productImageList[index]"
  277. width="100px"
  278. height="100px"
  279. :disable-preview="true"
  280. ></image-upload>
  281. <div
  282. v-if="index < forms.length - 1"
  283. class="btn-copy"
  284. @click.self="commonCopyFormItem(index, 'productImageList')"
  285. >
  286. &gt;&gt;&gt;
  287. </div>
  288. </div>
  289. </div>
  290. <div class="flex items-stretch">
  291. <div class="second-label">
  292. {{ $t(prefix + 'label_size') }}
  293. </div>
  294. <div
  295. v-for="(item, index) in forms"
  296. :key="index"
  297. class="input-area"
  298. >
  299. <el-input
  300. v-model="item.product_size"
  301. placeholder="请输入尺寸"
  302. @input="($e) => inputFilter($e, forms[index], 'product_size')"
  303. ></el-input>
  304. <div
  305. v-if="index < forms.length - 1"
  306. class="btn-copy"
  307. @click.self="commonCopyFormItem(index, 'product_size')"
  308. >
  309. &gt;&gt;&gt;
  310. </div>
  311. </div>
  312. </div>
  313. <div class="flex items-stretch">
  314. <div class="second-label">
  315. {{ $t(prefix + 'label_product_hd') }}
  316. </div>
  317. <div
  318. v-for="(item, index) in forms"
  319. :key="index"
  320. class="input-area"
  321. >
  322. <el-input
  323. v-model="item.product_hd"
  324. placeholder="请输入厚度"
  325. @input="($e) => inputFilter($e, forms[index], 'product_hd')"
  326. ></el-input>
  327. <div
  328. v-if="index < forms.length - 1"
  329. class="btn-copy"
  330. @click.self="commonCopyFormItem(index, 'product_hd')"
  331. >
  332. &gt;&gt;&gt;
  333. </div>
  334. </div>
  335. </div>
  336. <div class="flex items-stretch">
  337. <div class="second-label">
  338. {{ $t(prefix + 'label_capacity') }}
  339. </div>
  340. <div
  341. v-for="(item, index) in forms"
  342. :key="index"
  343. class="input-area"
  344. >
  345. <el-input
  346. v-model="item.product_capacity"
  347. placeholder="请输入容量"
  348. @input="
  349. ($e) => inputFilter($e, forms[index], 'product_capacity')
  350. "
  351. ></el-input>
  352. <div
  353. v-if="index < forms.length - 1"
  354. class="btn-copy"
  355. @click.self="commonCopyFormItem(index, 'product_capacity')"
  356. >
  357. &gt;&gt;&gt;
  358. </div>
  359. </div>
  360. </div>
  361. <div class="flex items-stretch">
  362. <div class="second-label">
  363. {{ $t(prefix + 'label_material') }}
  364. </div>
  365. <div
  366. v-for="(item, index) in forms"
  367. :key="index"
  368. class="input-area"
  369. >
  370. <el-input
  371. v-model="item.product_material"
  372. placeholder="请输入材质"
  373. @input="
  374. ($e) => inputFilter($e, forms[index], 'product_material')
  375. "
  376. ></el-input>
  377. <div
  378. v-if="index < forms.length - 1"
  379. class="btn-copy"
  380. @click.self="commonCopyFormItem(index, 'product_material')"
  381. >
  382. &gt;&gt;&gt;
  383. </div>
  384. </div>
  385. </div>
  386. <div class="flex items-stretch">
  387. <div class="second-label">
  388. {{ $t(prefix + 'label_battery') }}
  389. </div>
  390. <div
  391. v-for="(item, index) in forms"
  392. :key="index"
  393. class="input-area"
  394. >
  395. <el-input
  396. v-model="item.product_battery"
  397. placeholder="是否带电池"
  398. @input="
  399. ($e) => inputFilter($e, forms[index], 'product_battery')
  400. "
  401. ></el-input>
  402. <div
  403. v-if="index < forms.length - 1"
  404. class="btn-copy"
  405. @click.self="commonCopyFormItem(index, 'product_battery')"
  406. >
  407. &gt;&gt;&gt;
  408. </div>
  409. </div>
  410. </div>
  411. <div class="flex items-stretch">
  412. <div class="second-label">
  413. {{ $t(prefix + 'label_print_require') }}
  414. </div>
  415. <div
  416. v-for="(item, index) in forms"
  417. :key="index"
  418. class="input-area"
  419. >
  420. <el-input
  421. v-model="item.product_require_print"
  422. placeholder="请输入要求"
  423. @input="
  424. ($e) =>
  425. inputFilter($e, forms[index], 'product_require_print')
  426. "
  427. ></el-input>
  428. <div
  429. v-if="index < forms.length - 1"
  430. class="btn-copy"
  431. @click.self="
  432. commonCopyFormItem(index, 'product_require_print')
  433. "
  434. >
  435. &gt;&gt;&gt;
  436. </div>
  437. </div>
  438. </div>
  439. <div class="flex items-stretch">
  440. <div class="second-label">
  441. {{ $t(prefix + 'label_color') }}
  442. </div>
  443. <div
  444. v-for="(item, index) in forms"
  445. :key="index"
  446. class="input-area"
  447. >
  448. <el-input
  449. v-model="item.product_color"
  450. placeholder="请输入颜色"
  451. @input="
  452. ($e) => inputFilter($e, forms[index], 'product_color')
  453. "
  454. ></el-input>
  455. <div
  456. v-if="index < forms.length - 1"
  457. class="btn-copy"
  458. @click.self="commonCopyFormItem(index, 'product_color')"
  459. >
  460. &gt;&gt;&gt;
  461. </div>
  462. </div>
  463. </div>
  464. <div class="flex items-stretch">
  465. <div class="second-label">
  466. {{ $t(prefix + 'label_color_require') }}
  467. </div>
  468. <div
  469. v-for="(item, index) in forms"
  470. :key="index"
  471. class="input-area"
  472. >
  473. <el-input
  474. v-model="item.product_require_color"
  475. placeholder="请输入颜色定制要求"
  476. @input="
  477. ($e) =>
  478. inputFilter($e, forms[index], 'product_require_color')
  479. "
  480. ></el-input>
  481. <div
  482. v-if="index < forms.length - 1"
  483. class="btn-copy"
  484. @click.self="
  485. commonCopyFormItem(index, 'product_require_color')
  486. "
  487. >
  488. &gt;&gt;&gt;
  489. </div>
  490. </div>
  491. </div>
  492. <div class="flex items-stretch">
  493. <div class="second-label">
  494. {{ $t(prefix + 'label_other') }}
  495. </div>
  496. <div
  497. v-for="(item, index) in forms"
  498. :key="index"
  499. class="input-area"
  500. >
  501. <el-input
  502. v-model="item.product_other"
  503. placeholder="其他信息"
  504. type="textarea"
  505. :rows="3"
  506. @input="
  507. ($e) => inputFilter($e, forms[index], 'product_other')
  508. "
  509. ></el-input>
  510. <div
  511. v-if="index < forms.length - 1"
  512. class="btn-copy"
  513. @click.self="commonCopyFormItem(index, 'product_other')"
  514. >
  515. &gt;&gt;&gt;
  516. </div>
  517. </div>
  518. </div>
  519. </div>
  520. </div>
  521. <div class="flex items-stretch">
  522. <div class="first-label flex justify-center items-center">
  523. {{ $t(prefix + 'label_factory_price') }}
  524. </div>
  525. <div class="flex flex-col items-stretch">
  526. <div class="flex items-stretch">
  527. <div class="second-label required">
  528. {{ $t(prefix + 'label_number_table') }}
  529. </div>
  530. <el-form
  531. v-for="(item, index) in forms"
  532. :ref="($e) => getFormRef($e, `number_${index}`)"
  533. :key="index"
  534. :show-message="false"
  535. :model="item"
  536. >
  537. <div class="input-area">
  538. <div class="sub-table">
  539. <div class="sub-table-head flex items-center">
  540. <div class="sub-table-number">数量</div>
  541. <div class="sub-table-price">单价(RMB)</div>
  542. <div class="sub-table-days">天数</div>
  543. </div>
  544. <div
  545. v-for="(i, subIndex) in item.number"
  546. :key="subIndex"
  547. class="sub-table-row flex items-center"
  548. >
  549. <div class="sub-table-number">
  550. <el-form-item
  551. :prop="'number.' + subIndex"
  552. :rules="{
  553. required: true,
  554. validator: commonCheck,
  555. }"
  556. >
  557. <el-input v-model="item.number[subIndex]"></el-input>
  558. </el-form-item>
  559. </div>
  560. <div class="sub-table-price">
  561. <el-form-item
  562. :prop="'price.' + subIndex"
  563. :rules="{
  564. required: true,
  565. validator: commonCheck,
  566. }"
  567. >
  568. <el-input v-model="item.price[subIndex]"></el-input>
  569. </el-form-item>
  570. </div>
  571. <div class="sub-table-days">
  572. <el-form-item
  573. :prop="'days.' + subIndex"
  574. :rules="{
  575. required: true,
  576. validator: commonCheck,
  577. }"
  578. >
  579. <el-input v-model="item.days[subIndex]"></el-input>
  580. </el-form-item>
  581. </div>
  582. <div class="sub-table-btn-delete">
  583. <div
  584. v-show="item.number.length > 1"
  585. @click="numberTableDeleteRow(index, subIndex)"
  586. >
  587. <el-icon size="18">
  588. <CircleCloseFilled></CircleCloseFilled>
  589. </el-icon>
  590. </div>
  591. </div>
  592. </div>
  593. </div>
  594. <div class="sub-table-btn-add">
  595. <el-button
  596. size="small"
  597. @click="numberTableAddRow(index)"
  598. >
  599. + 添加价格信息
  600. </el-button>
  601. </div>
  602. <div
  603. v-if="index < forms.length - 1"
  604. class="btn-copy"
  605. style="bottom: 4px; top: unset"
  606. @click.self="commonCopyFormItem(index, 'numberItem')"
  607. >
  608. &gt;&gt;&gt;
  609. </div>
  610. </div>
  611. </el-form>
  612. </div>
  613. <div class="flex items-stretch">
  614. <div class="second-label required">
  615. {{ $t(prefix + 'label_extra_fee') }}
  616. </div>
  617. <el-form
  618. v-for="(item, index) in forms"
  619. :ref="($e) => getFormRef($e, `cost_${index}`)"
  620. :key="index"
  621. :show-message="false"
  622. :model="item"
  623. >
  624. <div class="input-area">
  625. <div class="sub-table">
  626. <div class="sub-table-head flex items-center">
  627. <div class="sub-table-cost-name">项目</div>
  628. <div class="sub-table-cost-price">价格(RMB)</div>
  629. </div>
  630. <div
  631. v-for="(i, subIndex) in item.cost_name"
  632. :key="subIndex"
  633. class="sub-table-row flex items-center"
  634. >
  635. <div class="sub-table-cost-name">
  636. <el-form-item
  637. :prop="'cost_name.' + subIndex"
  638. :rules="{
  639. required: true,
  640. validator: commonCheck,
  641. }"
  642. >
  643. <el-select
  644. v-model="item.cost_name[subIndex]"
  645. size="small"
  646. >
  647. <el-option
  648. v-for="option in costOptions"
  649. :key="option.label"
  650. :label="option.label"
  651. :value="option.value"
  652. ></el-option>
  653. </el-select>
  654. </el-form-item>
  655. </div>
  656. <div class="sub-table-cost-price">
  657. <el-form-item
  658. :prop="'cost_price.' + subIndex"
  659. :rules="{
  660. required: true,
  661. validator: commonCheck,
  662. }"
  663. >
  664. <el-input
  665. v-model="item.cost_price[subIndex]"
  666. ></el-input>
  667. </el-form-item>
  668. </div>
  669. <div class="sub-table-btn-delete">
  670. <el-button
  671. :disabled="item.cost_name.length < 2"
  672. type="danger"
  673. size="small"
  674. plain
  675. @click="costTableDeleteRow(index, subIndex)"
  676. >
  677. {{ $t('btn_delete') }}
  678. </el-button>
  679. </div>
  680. </div>
  681. </div>
  682. <div class="sub-table-btn-add">
  683. <el-button
  684. size="small"
  685. @click="costTableAddRow(index)"
  686. >
  687. + 添加价格信息
  688. </el-button>
  689. </div>
  690. <div
  691. v-if="index < forms.length - 1"
  692. class="btn-copy"
  693. style="bottom: 4px; top: unset"
  694. @click.self="commonCopyFormItem(index, 'cost')"
  695. >
  696. &gt;&gt;&gt;
  697. </div>
  698. </div>
  699. </el-form>
  700. </div>
  701. </div>
  702. </div>
  703. <div class="flex items-stretch">
  704. <div class="first-label flex justify-center items-center">
  705. {{ $t(prefix + 'label_package_info') }}
  706. </div>
  707. <div class="flex flex-col items-stretch">
  708. <div class="flex items-stretch">
  709. <div class="second-label">
  710. {{ $t(prefix + 'label_package') }}
  711. </div>
  712. <div
  713. v-for="(item, index) in forms"
  714. :key="index"
  715. class="input-area"
  716. >
  717. <el-input
  718. v-model="item.package_info"
  719. placeholder="请输入产品包装信息"
  720. ></el-input>
  721. <div
  722. v-if="index < forms.length - 1"
  723. class="btn-copy"
  724. @click.self="commonCopyFormItem(index, 'package_info')"
  725. >
  726. &gt;&gt;&gt;
  727. </div>
  728. </div>
  729. </div>
  730. <div class="flex flex-col items-stretch">
  731. <div class="flex items-stretch">
  732. <div class="second-label required">
  733. {{ $t(prefix + 'label_gross_weight') }}(KG)
  734. </div>
  735. <el-form
  736. v-for="(item, index) in forms"
  737. :ref="($e) => getFormRef($e, `package_weight_${index}`)"
  738. :key="index"
  739. :show-message="false"
  740. :model="item"
  741. >
  742. <div class="input-area">
  743. <el-form-item
  744. prop="package_weight"
  745. :rules="{ required: true, validator: commonCheck }"
  746. >
  747. <el-input
  748. v-model="item.package_weight"
  749. placeholder="请输入每箱毛重"
  750. ></el-input>
  751. </el-form-item>
  752. <div
  753. v-if="index < forms.length - 1"
  754. class="btn-copy"
  755. @click.self="commonCopyFormItem(index, 'package_weight')"
  756. >
  757. &gt;&gt;&gt;
  758. </div>
  759. </div>
  760. </el-form>
  761. </div>
  762. <div class="flex items-stretch">
  763. <div class="second-label required">
  764. {{ $t(prefix + 'label_package_size') }}(CM)
  765. </div>
  766. <el-form
  767. v-for="(item, index) in forms"
  768. :ref="($e) => getFormRef($e, `package_size_${index}`)"
  769. :key="index"
  770. :show-message="false"
  771. :model="item"
  772. >
  773. <div class="input-area flex justify-center items-center">
  774. <el-form-item
  775. prop="package_size_length"
  776. :rules="{
  777. required: true,
  778. trigger: 'change',
  779. validator: commonCheck,
  780. }"
  781. >
  782. <el-input
  783. v-model="item.package_size_length"
  784. style="width: 74px"
  785. placeholder="长"
  786. ></el-input>
  787. </el-form-item>
  788. <el-icon size="18">
  789. <Close></Close>
  790. </el-icon>
  791. <el-form-item
  792. prop="package_size_width"
  793. :rules="{
  794. required: true,
  795. trigger: 'change',
  796. validator: commonCheck,
  797. }"
  798. >
  799. <el-input
  800. v-model="item.package_size_width"
  801. style="width: 74px"
  802. placeholder="宽"
  803. ></el-input>
  804. </el-form-item>
  805. <el-icon size="18">
  806. <Close></Close>
  807. </el-icon>
  808. <el-form-item
  809. prop="package_size_height"
  810. :rules="{
  811. required: true,
  812. trigger: 'change',
  813. validator: commonCheck,
  814. }"
  815. >
  816. <el-input
  817. v-model="item.package_size_height"
  818. style="width: 74px"
  819. placeholder="高"
  820. ></el-input>
  821. </el-form-item>
  822. <span>&nbsp;CM</span>
  823. <div
  824. v-if="index < forms.length - 1"
  825. class="btn-copy"
  826. @click.self="commonCopyFormItem(index, 'package_size')"
  827. >
  828. &gt;&gt;&gt;
  829. </div>
  830. </div>
  831. </el-form>
  832. </div>
  833. <div class="flex items-stretch">
  834. <div class="second-label required">
  835. {{ $t(prefix + 'label_pcs') }}(PCS)
  836. </div>
  837. <el-form
  838. v-for="(item, index) in forms"
  839. :ref="($e) => getFormRef($e, `in_package_${index}`)"
  840. :key="index"
  841. :show-message="false"
  842. :model="item"
  843. >
  844. <div class="input-area">
  845. <el-form-item
  846. prop="in_package"
  847. :rules="{
  848. required: true,
  849. trigger: 'change',
  850. validator: commonCheck,
  851. }"
  852. >
  853. <el-input
  854. v-model="item.in_package"
  855. placeholder="PCS"
  856. ></el-input>
  857. </el-form-item>
  858. <div
  859. v-if="index < forms.length - 1"
  860. class="btn-copy"
  861. @click.self="commonCopyFormItem(index, 'in_package')"
  862. >
  863. &gt;&gt;&gt;
  864. </div>
  865. </div>
  866. </el-form>
  867. </div>
  868. </div>
  869. </div>
  870. </div>
  871. <div class="flex items-stretch">
  872. <div class="first-label flex justify-center items-center">
  873. {{ $t(prefix + 'label_example') }}
  874. </div>
  875. <div class="flex flex-col items-stretch">
  876. <div class="flex items-stretch">
  877. <div class="second-label required">
  878. {{ $t(prefix + 'label_example_days') }}(Days)
  879. </div>
  880. <el-form
  881. v-for="(item, index) in forms"
  882. :ref="($e) => getFormRef($e, `demo_days_${index}`)"
  883. :key="index"
  884. :show-message="false"
  885. :model="item"
  886. >
  887. <div class="input-area">
  888. <el-form-item
  889. prop="demo_days"
  890. :rules="{
  891. required: true,
  892. trigger: 'change',
  893. validator: commonCheck,
  894. }"
  895. >
  896. <el-input
  897. v-model="item.demo_days"
  898. placeholder="天数"
  899. ></el-input>
  900. </el-form-item>
  901. <div
  902. v-if="index < forms.length - 1"
  903. class="btn-copy"
  904. @click.self="commonCopyFormItem(index, 'demo_days')"
  905. >
  906. &gt;&gt;&gt;
  907. </div>
  908. </div>
  909. </el-form>
  910. </div>
  911. <div class="flex items-stretch">
  912. <div class="second-label">
  913. {{ $t(prefix + 'label_example_cost') }}(¥)
  914. </div>
  915. <div
  916. v-for="(item, index) in forms"
  917. :key="index"
  918. class="input-area"
  919. >
  920. <el-input
  921. v-model="item.demo_cost"
  922. placeholder="请输入打样费用"
  923. ></el-input>
  924. <div
  925. v-if="index < forms.length - 1"
  926. class="btn-copy"
  927. @click.self="commonCopyFormItem(index, 'demo_cost')"
  928. >
  929. &gt;&gt;&gt;
  930. </div>
  931. </div>
  932. </div>
  933. <div class="flex items-stretch">
  934. <div class="second-label">
  935. {{ $t(prefix + 'label_can_refund') }}
  936. </div>
  937. <div
  938. v-for="(item, index) in forms"
  939. :key="index"
  940. class="input-area"
  941. >
  942. <el-input
  943. v-model="item.demo_return"
  944. placeholder="请输入退费信息"
  945. ></el-input>
  946. <div
  947. v-if="index < forms.length - 1"
  948. class="btn-copy"
  949. @click.self="commonCopyFormItem(index, 'demo_return')"
  950. >
  951. &gt;&gt;&gt;
  952. </div>
  953. </div>
  954. </div>
  955. </div>
  956. </div>
  957. <div class="flex items-stretch">
  958. <div class="first-label flex justify-center items-center"></div>
  959. <div class="flex flex-col items-stretch">
  960. <div class="flex items-stretch">
  961. <div class="second-label">
  962. {{ $t(prefix + 'label_comment') }}
  963. </div>
  964. <div
  965. v-for="(item, index) in forms"
  966. :key="index"
  967. class="input-area"
  968. >
  969. <el-input
  970. v-model="item.notes"
  971. placeholder="请输入内容"
  972. type="textarea"
  973. :rows="3"
  974. ></el-input>
  975. <div
  976. v-if="index < forms.length - 1"
  977. class="btn-copy"
  978. @click.self="commonCopyFormItem(index, 'notes')"
  979. >
  980. &gt;&gt;&gt;
  981. </div>
  982. </div>
  983. </div>
  984. </div>
  985. </div>
  986. </div>
  987. <div
  988. v-show="canAddForm"
  989. class="btn-add-indent-info flex justify-center flex-col items-center"
  990. @click="addFormColumn"
  991. >
  992. <el-icon
  993. size="42"
  994. class="el-icon-circle-plus-outline"
  995. >
  996. <CirclePlus></CirclePlus>
  997. </el-icon>
  998. <div>
  999. {{ $t(prefix + 'btn_add_info') }}
  1000. </div>
  1001. </div>
  1002. <template #footer>
  1003. <div class="flex justify-center items-center">
  1004. <!-- v-show="$showAuthBtn(429)" -->
  1005. <el-button
  1006. type="primary"
  1007. size="small"
  1008. @click="checkForm"
  1009. >
  1010. {{ $t('btn_save') }}
  1011. </el-button>
  1012. <el-button
  1013. type=""
  1014. size="small"
  1015. @click="close"
  1016. >
  1017. {{ $t('btn_close') }}
  1018. </el-button>
  1019. </div>
  1020. </template>
  1021. </el-dialog>
  1022. </div>
  1023. </template>
  1024. <script lang="ts" setup>
  1025. import { defineComponent, ref, watch, computed, nextTick, inject } from 'vue'
  1026. import {
  1027. ElButton,
  1028. ElForm,
  1029. ElFormItem,
  1030. ElInput,
  1031. ElSelect,
  1032. ElOption,
  1033. ElDialog,
  1034. ElNotification,
  1035. ElMessage,
  1036. ElIcon,
  1037. ElMessageBox,
  1038. } from 'element-plus'
  1039. import { CirclePlus, Close, CircleCloseFilled } from '@element-plus/icons-vue'
  1040. import debounce from 'lodash.debounce'
  1041. import cloneDeep from 'lodash.clonedeep'
  1042. import Clipboard from 'clipboard'
  1043. import { $t } from '@/i18n/index'
  1044. import imageUpload from '@/components/ImageUpload.vue'
  1045. // 用来对oss的图片、视频等媒体数据的url进行匹配替换
  1046. import { getVendorList, createQuote, deleteIndent } from '@/api/indent'
  1047. import userAPI from '@/api/user'
  1048. defineComponent({
  1049. name: 'EditInfo',
  1050. })
  1051. const $emit = defineEmits(['update:visible', 'create'])
  1052. const {
  1053. visible = 0,
  1054. alreadyHasIndentCount = 0,
  1055. parentId = 0,
  1056. dataForEdit = [],
  1057. defaultName = '',
  1058. defaultSku = {},
  1059. } = defineProps<{
  1060. visible: number
  1061. alreadyHasIndentCount?: number
  1062. parentId?: number | string
  1063. dataForEdit?: any[]
  1064. defaultName?: string
  1065. defaultSku?: { [x: string]: any }
  1066. }>()
  1067. const $mediaRegExp = inject('mediaRegExp') as RegExp
  1068. const prefix = 'order.indent_edit_info.'
  1069. const show = ref(false)
  1070. const costOptions = [
  1071. {
  1072. label: $t('text_please_select'),
  1073. value: '',
  1074. },
  1075. {
  1076. label: '样品费用',
  1077. value: '样品费用',
  1078. },
  1079. {
  1080. label: '印刷费用',
  1081. value: '印刷费用',
  1082. },
  1083. {
  1084. label: '模具费用',
  1085. value: '模具费用',
  1086. },
  1087. {
  1088. label: '制版费用',
  1089. value: '制版费用',
  1090. },
  1091. {
  1092. label: '染色费用',
  1093. value: '染色费用',
  1094. },
  1095. {
  1096. label: '其他费用',
  1097. value: '其他费用',
  1098. },
  1099. ]
  1100. const formDemo = {
  1101. // 供应商
  1102. vendor_name: '',
  1103. vendor_id: '',
  1104. vendor_type: '',
  1105. vendor_wangwang_old: '',
  1106. vendor_contact: '',
  1107. vendor_phone: '',
  1108. // 产品信息
  1109. product_name: '',
  1110. product_url: '',
  1111. product_image: '',
  1112. product_size: '',
  1113. product_hd: '',
  1114. product_capacity: '',
  1115. product_material: '',
  1116. product_battery: '',
  1117. product_require_print: '',
  1118. product_color: '',
  1119. product_require_color: '',
  1120. product_other: '',
  1121. // 出厂价
  1122. number: [''],
  1123. price: [''],
  1124. days: [''],
  1125. cost_name: ['制版费用'],
  1126. cost_price: ['0'],
  1127. // 包装信息
  1128. package_info: '',
  1129. package_size_length: '',
  1130. package_size_width: '',
  1131. package_size_height: '',
  1132. package_weight: '',
  1133. in_package: '', // 一箱个数
  1134. // 打样情况
  1135. demo_days: '',
  1136. demo_cost: '',
  1137. demo_return: '',
  1138. cert: '',
  1139. notes: '',
  1140. }
  1141. const forms = ref<any[]>([])
  1142. const canAddForm = computed(() => {
  1143. return 100 - alreadyHasIndentCount - forms.value.length > 0
  1144. })
  1145. const productImageList = ref([] as any[][])
  1146. const vendorList = ref([] as any[][])
  1147. const manualVendor = ref({} as any)
  1148. const commonCopyFormItem = function (index: number, key: string) {
  1149. if (['vendor_id', 'vendor_name', 'vendor_phone'].includes(key)) {
  1150. vendorList.value.splice(index + 1, 1, cloneDeep(vendorList.value[index]))
  1151. forms.value[index + 1].vendor_name = forms.value[index].vendor_name
  1152. forms.value[index + 1].vendor_phone = forms.value[index].vendor_phone
  1153. forms.value[index + 1].vendor_id = forms.value[index].vendor_id
  1154. } else if (key === 'productImageList') {
  1155. productImageList.value.splice(
  1156. index + 1,
  1157. 1,
  1158. cloneDeep(productImageList.value[index]),
  1159. )
  1160. } else if (key === 'cost') {
  1161. // 额外费用
  1162. forms.value[index + 1].cost_name = cloneDeep(forms.value[index].cost_name)
  1163. forms.value[index + 1].cost_price = cloneDeep(forms.value[index].cost_price)
  1164. } else if (key === 'numberItem') {
  1165. // 数量 单价
  1166. forms.value[index + 1].number = cloneDeep(forms.value[index].number)
  1167. forms.value[index + 1].price = cloneDeep(forms.value[index].price)
  1168. forms.value[index + 1].days = cloneDeep(forms.value[index].days)
  1169. } else if (key === 'package_size') {
  1170. // 外箱规格
  1171. forms.value[index + 1].package_size_length = cloneDeep(
  1172. forms.value[index].package_size_length,
  1173. )
  1174. forms.value[index + 1].package_size_width = cloneDeep(
  1175. forms.value[index].package_size_width,
  1176. )
  1177. forms.value[index + 1].package_size_height = cloneDeep(
  1178. forms.value[index].package_size_height,
  1179. )
  1180. } else {
  1181. forms.value[index + 1][key] = forms.value[index][key]
  1182. }
  1183. }
  1184. const costTableDeleteRow = function (index: number, subIndex: number) {
  1185. forms.value[index].cost_name.splice(subIndex, 1)
  1186. forms.value[index].cost_price.splice(subIndex, 1)
  1187. }
  1188. const costTableAddRow = function (index: number) {
  1189. forms.value[index].cost_name.push('制版费用')
  1190. forms.value[index].cost_price.push('0')
  1191. }
  1192. const numberTableDeleteRow = function (index: number, subIndex: number) {
  1193. forms.value[index].number.splice(subIndex, 1)
  1194. forms.value[index].price.splice(subIndex, 1)
  1195. forms.value[index].days.splice(subIndex, 1)
  1196. }
  1197. const numberTableAddRow = function (index: number) {
  1198. forms.value[index].number.push('')
  1199. forms.value[index].price.push('')
  1200. forms.value[index].days.push('')
  1201. }
  1202. // 20250630.在编辑询价界面进来也要显示所有报价信息, 即除了新建报价时(询价为空), 其实时候都需要遍历数据展示已有报价.
  1203. const initData = function (d: any, index: number) {
  1204. // 查询供应商候选列表, 不然下拉框无数据匹配, 下拉框界面上会显示成供应商的id
  1205. queryVenderList(d.vendor_name || '', index)
  1206. const temp = cloneDeep(d)
  1207. productImageList.value.push([])
  1208. if (Array.isArray(temp.product_image) && temp.product_image.length) {
  1209. nextTick(() => {
  1210. productImageList.value.splice(
  1211. index,
  1212. 1,
  1213. temp.product_image.map((img: string) => {
  1214. return {
  1215. url: $mediaRegExp.test(img)
  1216. ? img
  1217. : import.meta.env.VITE_APP_OSS_PREFIX + img,
  1218. }
  1219. }),
  1220. )
  1221. })
  1222. }
  1223. if (temp.cost_list && temp.cost_list.length > 2) {
  1224. const t = JSON.parse(temp.cost_list)
  1225. temp.cost_name = []
  1226. temp.cost_price = []
  1227. t.forEach((item: any) => {
  1228. temp.cost_name.push(item.cost_name)
  1229. temp.cost_price.push(item.cost_price)
  1230. })
  1231. } else {
  1232. // 如果cost_list字符串长度小于2, 说明该数组为空, 删除temp的对应字段, 避免覆盖掉formDemo的克隆值.
  1233. delete temp.cost_name
  1234. delete temp.cost_price
  1235. }
  1236. if (temp.price_list && temp.price_list.length > 2) {
  1237. const t = JSON.parse(temp.price_list)
  1238. temp.number = []
  1239. temp.price = []
  1240. temp.days = []
  1241. t.forEach((item: any) => {
  1242. temp.number.push(item.number)
  1243. temp.price.push(item.price)
  1244. temp.days.push(item.days)
  1245. })
  1246. } else {
  1247. // 如果 price_list 字符串长度小于2, 说明该数组为空, 删除temp的对应字段, 避免覆盖掉formDemo的克隆值.
  1248. delete temp.cost_name
  1249. delete temp.cost_price
  1250. }
  1251. temp.entity_id = temp.id
  1252. // 删除无用字段避免接口报错
  1253. delete temp.id
  1254. // delete temp.parent_id
  1255. delete temp.create_time
  1256. delete temp.update_time
  1257. delete temp.creator
  1258. delete temp.admin_id
  1259. forms.value.push(Object.assign({}, cloneDeep(formDemo), temp))
  1260. }
  1261. const deleteForm = function (index: number) {
  1262. let deleteItem = forms.value.splice(index, 1)
  1263. productImageList.value.splice(index, 1)
  1264. vendorList.value.splice(index, 1)
  1265. console.log(deleteItem, 'deleteItem')
  1266. if (!['0', 0].includes(parentId)) {
  1267. deleteIndent({
  1268. indent_ids: [],
  1269. quote_ids: deleteItem.map((i) => `${parentId}_${i.entity_id}`),
  1270. }).then((response: any) => {
  1271. if (response.code === 1) {
  1272. ElNotification({
  1273. title: '删除成功',
  1274. message: '删除成功',
  1275. duration: 3000,
  1276. })
  1277. }
  1278. })
  1279. }
  1280. }
  1281. const addFormColumn = function () {
  1282. if (canAddForm.value) {
  1283. forms.value.push(
  1284. Object.assign(cloneDeep(formDemo), {
  1285. parent_id: parentId,
  1286. product_name: visible === 1 ? defaultName : '',
  1287. in_package: visible === 1 ? defaultSku.Carton_Qty || '' : '',
  1288. package_weight: visible === 1 ? defaultSku.Carton_Weight_Kg || '' : '',
  1289. package_size_length: visible === 1 ? defaultSku.Length || '' : '',
  1290. package_size_width: visible === 1 ? defaultSku.Width || '' : '',
  1291. package_size_height:
  1292. visible === 1 ? defaultSku.Thickness_Height || '' : '',
  1293. }),
  1294. )
  1295. productImageList.value.push([])
  1296. vendorList.value.push([])
  1297. }
  1298. }
  1299. watch(
  1300. () => visible,
  1301. () => {
  1302. forms.value = []
  1303. productImageList.value = []
  1304. vendorList.value = []
  1305. if (visible > 1) {
  1306. dataForEdit.forEach((i, index) => {
  1307. vendorList.value.push([])
  1308. initData(i, index)
  1309. })
  1310. } else if (visible > 0) {
  1311. addFormColumn()
  1312. }
  1313. show.value = visible > 0
  1314. },
  1315. )
  1316. const queryVenderList = function (keyword: string, index: number) {
  1317. let keywords = keyword.trim()
  1318. if (!keywords.length) return
  1319. getVendorList({ keywords }).then((response: any) => {
  1320. const defaultCreateOption = {
  1321. name: keywords,
  1322. id: keywords,
  1323. }
  1324. if (Array.isArray(response.result)) {
  1325. const tempStr = keywords.replace(/\S_-/g, '').toLowerCase()
  1326. const tempList = response.result.map((i: any) =>
  1327. i.name.replace(/\S_-/g, '').toLowerCase(),
  1328. )
  1329. let result = []
  1330. if (response.result.length) {
  1331. if (tempList.includes(tempStr)) {
  1332. result = response.result
  1333. } else {
  1334. // 结果里面没找到输入的搜索字符串, 就把它加入到结果里面当成‘新增的’
  1335. result = [cloneDeep(defaultCreateOption)].concat(response.result)
  1336. }
  1337. } else if (keywords.length) {
  1338. result = [cloneDeep(defaultCreateOption)]
  1339. }
  1340. if (manualVendor.value.id) {
  1341. vendorList.value.splice(index, 1, [manualVendor.value].concat(result))
  1342. } else {
  1343. vendorList.value.splice(index, 1, result)
  1344. }
  1345. }
  1346. })
  1347. }
  1348. const changeVenderSelect = function (value: string | number, index: number) {
  1349. if (value) {
  1350. const temp = vendorList.value[index].filter((i) => i.id === value)
  1351. if (temp.length) {
  1352. forms.value[index].vendor_name = temp[0].name
  1353. forms.value[index].vendor_phone = temp[0].phone || temp[0].Phone || ''
  1354. forms.value[index].vendor_contact = temp[0].Primary_Contact_name || ''
  1355. manualVendor.value = {
  1356. name: '',
  1357. id: '',
  1358. }
  1359. } else {
  1360. // vendor_name === vendor_id 为新增
  1361. forms.value[index].vendor_name = value || ''
  1362. forms.value[index].vendor_phone = ''
  1363. forms.value[index].vendor_type = ''
  1364. forms.value[index].vendor_contact = ''
  1365. manualVendor.value = {
  1366. name: value || '',
  1367. id: value || '',
  1368. }
  1369. }
  1370. }
  1371. }
  1372. const auditUser = ref('')
  1373. const getCurrentAuditUser = () => {
  1374. userAPI.getAuditUser().then((res: any) => {
  1375. // console.log(res, 'res')
  1376. if (
  1377. res.code === 1 &&
  1378. Array.isArray(res.result.data) &&
  1379. res.result.data.length
  1380. ) {
  1381. const temp = res.result.data.filter((i: any) => i.type === 1)
  1382. // console.log(temp, 'temp')
  1383. if (temp.length) auditUser.value = temp[0].email
  1384. }
  1385. })
  1386. }
  1387. getCurrentAuditUser()
  1388. const createQuoteFunc = function () {
  1389. const params = {
  1390. file: '', // 疑似永远为空
  1391. } as any
  1392. if (parentId) {
  1393. params.parent_id = parentId
  1394. }
  1395. let notiList: string[] = []
  1396. let temp = cloneDeep(forms.value)
  1397. temp = temp.map((item, index) => {
  1398. const result = { ...item }
  1399. result.price_list = []
  1400. result.number.forEach((v: any, i: number) => {
  1401. result.price_list.push({
  1402. number: `${result.number[i]}`,
  1403. price: `${result.price[i]}`,
  1404. days: `${result.days[i]}`,
  1405. })
  1406. })
  1407. result.cost_list = []
  1408. result.cost_name.forEach((v: any, i: number) => {
  1409. result.cost_list.push({
  1410. cost_name: `${result.cost_name[i]}`,
  1411. cost_price: `${result.cost_price[i]}`,
  1412. })
  1413. })
  1414. result.product_image = productImageList.value[index]
  1415. .map((i) => {
  1416. return i.url.replace($mediaRegExp, '/')
  1417. })
  1418. .join(',')
  1419. // if (result.vendor_id && result.vendor_name === result.vendor_id) {
  1420. // notiList.push(result.vendor_name)
  1421. // }
  1422. return result
  1423. })
  1424. // 组装接口数据
  1425. Object.assign(params, { lists: temp })
  1426. // if (notiList.length) {
  1427. // ElMessageBox.alert(
  1428. // '您正在提交系统外供应商 ' +
  1429. // notiList.map((i) => `[${i}]`).join(', ') +
  1430. // '<br>本次操作已触发审核流程,审核人将会尽快处理,如有问题请联系:' +
  1431. // `<a href="mailto:${auditUser.value}">${auditUser.value}</a>`,
  1432. // '提示',
  1433. // {
  1434. // dangerouslyUseHTMLString: true,
  1435. // },
  1436. // )
  1437. // }
  1438. createQuote(params).then((response: any) => {
  1439. if (response.code !== 1) return
  1440. ElNotification({
  1441. title: '成功',
  1442. message: '提交成功',
  1443. type: 'success',
  1444. duration: 3000,
  1445. })
  1446. $emit('create', response.result)
  1447. close()
  1448. })
  1449. }
  1450. const inputFilter = (value: string, target: any, key: string) => {
  1451. target[key] = value
  1452. .split('')
  1453. .filter((i) => i.charCodeAt(0) > 0 && i.charCodeAt(0) < 255)
  1454. .join('')
  1455. }
  1456. // 用来动态绑定ref, 便于调用表单验证
  1457. const formRef = ref({} as any)
  1458. const getFormRef = (el: any, key: string) => {
  1459. formRef.value[`${key}`] = el
  1460. }
  1461. const checkForm = function () {
  1462. const key = [
  1463. 'vendor_id',
  1464. 'product_name',
  1465. 'number',
  1466. 'cost',
  1467. 'package_weight',
  1468. 'package_size',
  1469. 'in_package',
  1470. 'demo_days',
  1471. ]
  1472. let length = forms.value.length
  1473. const target = [] as any[]
  1474. do {
  1475. key.forEach((i) => {
  1476. target.push(`${i}_${length - 1}`)
  1477. })
  1478. length--
  1479. } while (length >= 1)
  1480. // 表单校验结果
  1481. let result = true
  1482. const promisePool: any[] = []
  1483. target.forEach((i: string) => {
  1484. const r: any = formRef.value[`${i}`]
  1485. if (typeof r.validate === 'function') {
  1486. r.clearValidate()
  1487. const p = new Promise((resolve) => {
  1488. r.validate((valid: boolean) => {
  1489. if (!valid) {
  1490. messageError('请检查表单必填项')
  1491. resolve(false)
  1492. } else {
  1493. resolve(true)
  1494. }
  1495. })
  1496. })
  1497. promisePool.push(p)
  1498. } else {
  1499. result = false
  1500. }
  1501. })
  1502. if (!result) {
  1503. // 一般不会到这里
  1504. messageError('表单异常. 请刷新页面再试或者全屏截图联系管理员')
  1505. return
  1506. }
  1507. Promise.all(promisePool).then((res) => {
  1508. const valid = res.every((a) => a === true)
  1509. if (valid) {
  1510. createQuoteFunc()
  1511. }
  1512. })
  1513. }
  1514. const messageError = debounce(function (info) {
  1515. ElMessage.error(info)
  1516. }, 100)
  1517. const commonCheck = (rule: any, value: any, cb: any) => {
  1518. if (typeof value === 'number') {
  1519. if (value >= 0) {
  1520. cb()
  1521. } else {
  1522. cb(new Error('数字校验出错'))
  1523. }
  1524. return
  1525. }
  1526. if (value && value.trim().length) {
  1527. cb()
  1528. } else {
  1529. cb(new Error('字符串校验出错'))
  1530. }
  1531. }
  1532. const close = (done = {} as any) => {
  1533. $emit('update:visible', 0)
  1534. if (typeof done === 'function') done()
  1535. }
  1536. const copyValue = (str: any, event: any) => {
  1537. console.log(str, 'str')
  1538. const clipboard = new Clipboard(event.target, {
  1539. text: () => str,
  1540. })
  1541. clipboard.on('success', () => {
  1542. ElMessage.success('复制成功!')
  1543. clipboard.destroy()
  1544. })
  1545. clipboard.on('error', () => {
  1546. ElMessage.error('复制失败,请手动复制')
  1547. clipboard.destroy()
  1548. })
  1549. // 触发实际复制
  1550. event.target.click()
  1551. }
  1552. </script>
  1553. <style lang="scss">
  1554. .component-edit-indent-info {
  1555. .custom-edit-indent-info-dialog {
  1556. margin-top: 0 !important;
  1557. margin-bottom: 0 !important;
  1558. height: 100vh;
  1559. .el-dialog__body {
  1560. max-height: 87vh;
  1561. overflow-y: scroll;
  1562. overflow-x: auto;
  1563. padding-top: 8px;
  1564. }
  1565. .el-dialog__header {
  1566. border-bottom: 1px solid #dcdfe6;
  1567. }
  1568. .el-dialog__footer {
  1569. padding-bottom: 10px;
  1570. }
  1571. }
  1572. }
  1573. </style>
  1574. <style lang="scss" scoped>
  1575. div {
  1576. box-sizing: border-box;
  1577. }
  1578. .form-table {
  1579. margin: 24px 0;
  1580. & > div {
  1581. &::after {
  1582. // 占位符. 让表格右侧在横向滚动的时候能再滚动20px
  1583. content: '.';
  1584. width: 20px;
  1585. padding-left: 20px;
  1586. height: 1px;
  1587. background-color: transparent;
  1588. color: transparent;
  1589. }
  1590. }
  1591. }
  1592. .first-label {
  1593. text-align: center;
  1594. width: 120px;
  1595. min-width: 120px;
  1596. border: 1px solid #dcdfe6;
  1597. border-top: none;
  1598. border-right: none;
  1599. }
  1600. .second-label {
  1601. width: 170px;
  1602. min-width: 170px;
  1603. line-height: 55px;
  1604. min-height: 55px;
  1605. text-align: left;
  1606. padding: 0 10px;
  1607. border: 1px solid #dcdfe6;
  1608. border-top: none;
  1609. &.required {
  1610. color: #ef4135;
  1611. &::before {
  1612. content: '*';
  1613. display: inline-block;
  1614. color: #ef4135;
  1615. font-size: 14px;
  1616. width: 8px;
  1617. height: 8px;
  1618. }
  1619. }
  1620. }
  1621. .input-area {
  1622. position: relative;
  1623. border: 1px solid #dcdfe6;
  1624. border-left: none;
  1625. border-top: none;
  1626. min-height: 55px;
  1627. height: 100%;
  1628. padding: 7px 8px;
  1629. width: 300px;
  1630. min-width: 300px;
  1631. &:hover .btn-copy {
  1632. display: block;
  1633. }
  1634. .btn-copy {
  1635. display: none;
  1636. cursor: pointer;
  1637. background-color: #fff;
  1638. line-height: 26px;
  1639. padding: 0 4px;
  1640. position: absolute;
  1641. z-index: 2;
  1642. top: calc((100% - 26px) / 2);
  1643. right: -16px;
  1644. }
  1645. .el-form-item {
  1646. margin-bottom: 0;
  1647. }
  1648. .sub-table {
  1649. border: 1px solid #dcdfe6;
  1650. border-left: none;
  1651. }
  1652. .sub-table-head {
  1653. text-align: center;
  1654. line-height: 24px;
  1655. height: 24px;
  1656. background-color: #efefef;
  1657. }
  1658. .sub-table-row {
  1659. border-top: 1px solid #dcdfe6;
  1660. }
  1661. .sub-table-head,
  1662. .sub-table-row {
  1663. position: relative;
  1664. & > div {
  1665. border-left: 1px solid #dcdfe6;
  1666. padding: 2px 4px;
  1667. }
  1668. &:hover .sub-table-btn-delete {
  1669. border-left: 0;
  1670. padding: 0;
  1671. display: block;
  1672. }
  1673. }
  1674. .sub-table-price {
  1675. width: 120px;
  1676. }
  1677. .sub-table-days {
  1678. width: 90px;
  1679. }
  1680. .sub-table-number {
  1681. width: 90px;
  1682. }
  1683. .sub-table-cost-name {
  1684. width: 140px;
  1685. }
  1686. .sub-table-cost-price {
  1687. width: 140px;
  1688. }
  1689. .sub-table-btn-delete {
  1690. display: none;
  1691. line-height: 1;
  1692. font-size: 20px;
  1693. color: #ef4135;
  1694. position: absolute;
  1695. right: -6px;
  1696. top: 0;
  1697. z-index: 2;
  1698. }
  1699. .sub-table-btn-add {
  1700. margin: 12px 0 8px;
  1701. }
  1702. }
  1703. .form-header {
  1704. .first-label,
  1705. .input-area,
  1706. .second-label {
  1707. border-top: 1px solid #dcdfe6;
  1708. min-height: auto;
  1709. height: 40px;
  1710. line-height: 40px;
  1711. }
  1712. .el-button {
  1713. color: #ef4135;
  1714. }
  1715. }
  1716. .btn-add-indent-info {
  1717. background-color: #fff;
  1718. z-index: 2;
  1719. width: 74px;
  1720. height: 84px;
  1721. border: 1px solid #009688;
  1722. position: absolute;
  1723. right: 40px;
  1724. bottom: 40px;
  1725. color: #666;
  1726. font-size: 14px;
  1727. cursor: pointer;
  1728. .el-icon-circle-plus-outline {
  1729. color: #009688;
  1730. }
  1731. &:hover {
  1732. color: #333;
  1733. font-weight: 500;
  1734. border-color: #00bb88;
  1735. .el-icon-circle-plus-outline {
  1736. color: #00bb88;
  1737. }
  1738. }
  1739. }
  1740. </style>