baseForm.vue 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144
  1. <template>
  2. <el-form
  3. :model="ruleForm"
  4. status-icon
  5. :rules="rulesThis"
  6. ref="ruleForm"
  7. :size="'mini'"
  8. v-loading="loading"
  9. label-width="90px"
  10. >
  11. <el-row class="ddiv">
  12. <el-col :span="1" class="dtitle">
  13. <ul style="padding: 140px 0 0 0">
  14. <li>基</li>
  15. <li>础</li>
  16. <li>信</li>
  17. <li>息</li>
  18. </ul>
  19. </el-col>
  20. <el-col :span="23" class="dmain">
  21. <el-row>
  22. <el-col :span="12">
  23. <el-form-item label="商品分类" prop="cat_id">
  24. <search-sort
  25. :value="ruleForm.cat_id"
  26. :placeholder="'商品分类'"
  27. :disabled="
  28. type === 'view' || type === 'editBase' || type === 'editCoin'
  29. "
  30. :size="'mini'"
  31. :names="cat_id_name"
  32. :isDetail="type !== 'add'"
  33. @searchChange="goods_class_change"
  34. />
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="12">
  38. <el-form-item label="商品名称" prop="good_name">
  39. <el-input
  40. placeholder="商品名称"
  41. maxlength="100"
  42. :disabled="type === 'view' || type === 'editCoin'"
  43. v-model="ruleForm.good_name"
  44. ></el-input>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="12">
  48. <el-form-item label="业务公司" prop="company_id">
  49. <search-work-company
  50. :value="ruleForm.company_id"
  51. :placeholder="'业务公司'"
  52. :disabled="
  53. type === 'view' || type === 'editBase' || type === 'editCoin'
  54. "
  55. :size="'mini'"
  56. :isDetail="type !== 'add'"
  57. @searchChange="company_idsearchChange"
  58. />
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="12">
  62. <el-form-item label="供应商" prop="supplierNo">
  63. <search-supplier
  64. :value="ruleForm.supplierNo"
  65. :placeholder="'供应商'"
  66. :disabled="type === 'view' || type === 'editCoin'"
  67. :size="'mini'"
  68. :names="supplierName"
  69. :isDetail="type !== 'add'"
  70. @searchChange="supplierNosearchChange"
  71. />
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="8">
  75. <el-form-item label="商品品牌" prop="brandid">
  76. <search-brand
  77. :value="ruleForm.brandid"
  78. :disabled="type === 'view' || type === 'editCoin'"
  79. :size="'mini'"
  80. :isDetail="type !== 'add'"
  81. :names="brand_name"
  82. :placeholder="'商品品牌'"
  83. @searchChange="brandidsearchChange"
  84. />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="8">
  88. <el-form-item label="销售权限" prop="is_auth">
  89. <el-select
  90. v-model="ruleForm.is_auth"
  91. filterable
  92. clearable
  93. :disabled="type === 'view' || type === 'editCoin'"
  94. style="width: 100%"
  95. placeholder="销售权限"
  96. >
  97. <el-option
  98. v-for="group in options3"
  99. :key="group.id"
  100. :label="group.name"
  101. :value="group.id"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="4">
  107. <el-form-item label="单位" prop="unit" label-width="60px">
  108. <search-unit
  109. :value="ruleForm.unit"
  110. :disabled="type === 'view' || type === 'editCoin'"
  111. :size="'mini'"
  112. :isDetail="type !== 'add'"
  113. :names="unit_name"
  114. :placeholder="'单位'"
  115. @searchChange="unitsearchChange"
  116. />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="4">
  120. <el-form-item label="税点" prop="tax" label-width="60px">
  121. <search-tax
  122. :value="ruleForm.tax"
  123. :disabled="
  124. type === 'view' || type === 'editBase' || type === 'editCoin'
  125. "
  126. :size="'mini'"
  127. :isDetail="type !== 'add'"
  128. :placeholder="'税点'"
  129. @searchChange="taxsearchChange"
  130. />
  131. </el-form-item>
  132. </el-col>
  133. <el-col :span="8">
  134. <el-form-item label="专属类型" prop="is_exclusive">
  135. <search-exclusive
  136. :disabled="type === 'view' || type === 'editCoin'"
  137. style="width: 100%"
  138. :isDetail="type !== 'add'"
  139. :size="'mini'"
  140. placeholder="专属类型"
  141. :value="ruleForm.is_exclusive"
  142. @selectChange="exclusiveSearchChange"
  143. />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="8">
  147. <el-form-item label="商品总重量" prop="weight" label-width="95px">
  148. <digital-input
  149. :values="ruleForm.weight"
  150. :name="'ruleForm.weight'"
  151. :placeholder="'商品总重量'"
  152. :min="0"
  153. :disabled="type === 'view' || type === 'editCoin'"
  154. :max="100000000000"
  155. :position="'right'"
  156. :precision="3"
  157. :size="'mini'"
  158. :controls="false"
  159. :append="'g'"
  160. @reschange="number_change($event, 'weight')"
  161. />
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="8">
  165. <el-form-item label="是否库存品" prop="is_stock" label-width="95px">
  166. <el-select
  167. v-model="ruleForm.is_stock"
  168. filterable
  169. clearable
  170. :disabled="
  171. type === 'view' || type === 'editBase' || type === 'editCoin'
  172. "
  173. style="width: 100%"
  174. placeholder="是否库存品"
  175. >
  176. <el-option
  177. v-for="group in options4"
  178. :key="group.id"
  179. :label="group.name"
  180. :value="group.id"
  181. />
  182. </el-select>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="24" v-show="is_noble">
  186. <el-row>
  187. <el-col :span="8">
  188. <el-form-item
  189. label="贵金属重量"
  190. prop="noble_weight"
  191. label-width="95px"
  192. >
  193. <digital-input
  194. :values="ruleForm.noble_weight"
  195. :placeholder="'贵金属重量'"
  196. :name="'ruleForm.noble_weight'"
  197. :min="0"
  198. :disabled="
  199. type === 'view' ||
  200. type === 'editBase' ||
  201. type === 'editCoin'
  202. "
  203. :max="100000000000"
  204. :position="'right'"
  205. :precision="3"
  206. :size="'mini'"
  207. :controls="false"
  208. :append="'g'"
  209. @reschange="number_change($event, 'noble_weight')"
  210. />
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="8">
  214. <el-form-item
  215. label="贵金属种类"
  216. prop="noble_metal"
  217. label-width="95px"
  218. >
  219. <search-metal-kind
  220. :value="ruleForm.noble_metal"
  221. :disabled="
  222. type === 'view' ||
  223. type === 'editBase' ||
  224. type === 'editCoin'
  225. "
  226. :size="'mini'"
  227. :isDetail="type !== 'add'"
  228. :placeholder="'贵金属种类'"
  229. @searchChange="noble_metalsearchChange"
  230. />
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="8">
  234. <el-form-item
  235. label="启用实时金价"
  236. prop="is_gold_price"
  237. label-width="110px"
  238. >
  239. <el-select
  240. v-model="ruleForm.is_gold_price"
  241. filterable
  242. clearable
  243. :disabled="
  244. type === 'view' ||
  245. type === 'editBase' ||
  246. type === 'editCoin'
  247. "
  248. style="width: 100%"
  249. placeholder="启用实时金价"
  250. >
  251. <el-option
  252. v-for="group in options5"
  253. :key="group.id"
  254. :label="group.name"
  255. :value="group.id"
  256. />
  257. </el-select>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="6">
  261. <el-form-item label="有无工差" prop="is_diff">
  262. <el-select
  263. v-model="ruleForm.is_diff"
  264. filterable
  265. clearable
  266. :disabled="
  267. type === 'view' ||
  268. type === 'editBase' ||
  269. type === 'editCoin'
  270. "
  271. style="width: 100%"
  272. placeholder="有无工差"
  273. >
  274. <el-option
  275. v-for="group in options8"
  276. :key="group.id"
  277. :label="group.name"
  278. :value="group.id"
  279. />
  280. </el-select>
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="10">
  284. <el-form-item label="配置要求" prop="config" label-width="85px">
  285. <el-select
  286. v-model="ruleForm.config"
  287. multiple
  288. :disabled="type === 'view'"
  289. style="width: 100%"
  290. placeholder="配置要求"
  291. >
  292. <el-option
  293. v-for="(item, index) in options9"
  294. :key="item + index"
  295. :label="item"
  296. :value="item"
  297. >
  298. </el-option>
  299. </el-select>
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="8">
  303. <el-form-item
  304. label="其他配置要求"
  305. prop="other_config"
  306. label-width="110px"
  307. >
  308. <el-input
  309. placeholder="其他配置要求"
  310. maxlength="100"
  311. :disabled="type === 'view'"
  312. v-model="ruleForm.other_config"
  313. >
  314. </el-input>
  315. </el-form-item>
  316. </el-col>
  317. </el-row>
  318. </el-col>
  319. <el-col :span="8">
  320. <el-form-item label="售后说明" prop="after_sales">
  321. <el-input
  322. type="textarea"
  323. :rows="4"
  324. :disabled="type === 'view' || type === 'editCoin'"
  325. placeholder="售后说明"
  326. v-model="ruleForm.after_sales"
  327. >
  328. </el-input>
  329. </el-form-item>
  330. </el-col>
  331. <el-col :span="8">
  332. <el-form-item label="商品备注" prop="good_remark">
  333. <el-input
  334. type="textarea"
  335. :rows="4"
  336. :disabled="type === 'view' || type === 'editCoin'"
  337. placeholder="商品备注"
  338. v-model="ruleForm.good_remark"
  339. >
  340. </el-input>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="8">
  344. <el-form-item label="工艺说明" prop="craft_desc">
  345. <el-input
  346. type="textarea"
  347. :disabled="type === 'view' || type === 'editCoin'"
  348. :rows="4"
  349. placeholder="工艺说明"
  350. v-model="ruleForm.craft_desc"
  351. >
  352. </el-input>
  353. </el-form-item>
  354. </el-col>
  355. <el-col :span="8">
  356. <el-form-item label="是否定制" prop="good_type">
  357. <el-select
  358. v-model="ruleForm.good_type"
  359. filterable
  360. :disabled="
  361. type === 'view' || type === 'editBase' || type === 'editCoin'
  362. "
  363. clearable
  364. style="width: 100%"
  365. placeholder="是否定制"
  366. @change="good_type_change"
  367. >
  368. <el-option
  369. v-for="group in options1"
  370. :key="group.id"
  371. :label="group.name"
  372. :value="group.id"
  373. />
  374. </el-select>
  375. </el-form-item>
  376. </el-col>
  377. <el-col :span="8" v-show="ruleForm.good_type === '1'">
  378. <el-form-item label="定制起订量" prop="moq" label-width="95px">
  379. <digital-input
  380. :values="ruleForm.moq"
  381. :placeholder="'定制起订量'"
  382. :name="'ruleForm.moq'"
  383. :min="0"
  384. :disabled="type === 'view' || type === 'editBase'"
  385. :max="100000000000"
  386. :position="'right'"
  387. :precision="0"
  388. :size="'mini'"
  389. :controls="false"
  390. :append="''"
  391. @reschange="number_change($event, 'moq')"
  392. />
  393. </el-form-item>
  394. </el-col>
  395. <el-col :span="8" v-show="ruleForm.good_type === '1'">
  396. <el-form-item label="定制工期" prop="customized">
  397. <digital-input
  398. :values="ruleForm.customized"
  399. :placeholder="'定制工期'"
  400. :name="'ruleForm.customized'"
  401. :min="0"
  402. :disabled="type === 'view' || type === 'editBase'"
  403. :max="100000000000"
  404. :position="'right'"
  405. :precision="0"
  406. :size="'mini'"
  407. :controls="false"
  408. :append="'天'"
  409. @reschange="number_change($event, 'customized')"
  410. />
  411. </el-form-item>
  412. </el-col>
  413. </el-row>
  414. </el-col>
  415. </el-row>
  416. <el-row class="ddiv">
  417. <el-col :span="1" class="dtitle">
  418. <ul>
  419. <li>规</li>
  420. <li>格</li>
  421. <li>信</li>
  422. <li>息</li>
  423. </ul>
  424. </el-col>
  425. <el-col :span="23" class="dmain" style="padding: 20px 0 20px 18px">
  426. <el-table
  427. :data="spec_tableData"
  428. :size="'mini'"
  429. border
  430. style="width: 100%"
  431. >
  432. <el-table-column prop="spec_value" label="规格类型" />
  433. <el-table-column prop="spec_value_value" label="规格值" />
  434. <el-table-column
  435. fixed="right"
  436. v-if="type === 'add' || type === 'editBase' || type === 'edit'"
  437. >
  438. <template slot="header" slot-scope="scope">
  439. <span>操作</span>
  440. <el-tooltip
  441. class="item"
  442. effect="dark"
  443. content="添加规格类型"
  444. placement="top"
  445. >
  446. <i
  447. class="el-icon-circle-plus-outline fr"
  448. style="font-size: 18px; margin-top: 2px"
  449. @click="openEdit('-1', {})"
  450. />
  451. </el-tooltip>
  452. </template>
  453. <template slot-scope="scope">
  454. <el-tooltip effect="dark" content="修改" placement="top">
  455. <i
  456. class="el-icon-edit tb-icon"
  457. @click="openEdit(scope.$index, scope.row)"
  458. ></i>
  459. </el-tooltip>
  460. <el-tooltip
  461. v-if="!scope.row.isMust"
  462. effect="dark"
  463. content="删除"
  464. placement="top"
  465. >
  466. <i
  467. class="el-icon-delete tb-icon"
  468. @click="openDelete(scope.$index)"
  469. ></i>
  470. </el-tooltip>
  471. </template>
  472. </el-table-column>
  473. </el-table>
  474. <!-- 弹窗 新增/修改 -->
  475. <base-form-add-edit
  476. :index="modelIndex"
  477. :show-model="showModel"
  478. :sitem="sitem"
  479. @refresh="refreshEdit"
  480. @cancel="showModel = false"
  481. />
  482. </el-col>
  483. </el-row>
  484. <el-row class="ddiv">
  485. <el-col :span="1" class="dtitle">
  486. <ul>
  487. <li>包</li>
  488. <li>装</li>
  489. <li>信</li>
  490. <li>息</li>
  491. </ul></el-col
  492. >
  493. <el-col :span="23" class="dmain">
  494. <el-row>
  495. <el-col :span="6">
  496. <el-form-item label="包装方式" prop="packing_way">
  497. <el-input
  498. placeholder="包装方式"
  499. :disabled="type === 'view' || type === 'editCoin'"
  500. v-model="ruleForm.packing_way"
  501. maxlength="250"
  502. />
  503. </el-form-item>
  504. </el-col>
  505. <el-col :span="6">
  506. <el-form-item label="装箱规格" prop="packing_spec">
  507. <el-input
  508. placeholder="装箱规格"
  509. :disabled="type === 'view' || type === 'editCoin'"
  510. v-model="ruleForm.packing_spec"
  511. maxlength="250"
  512. />
  513. </el-form-item>
  514. </el-col>
  515. <el-col :span="6">
  516. <el-form-item label="装箱重量" prop="packing_weight">
  517. <digital-input
  518. :values="ruleForm.packing_weight"
  519. :placeholder="'装箱重量'"
  520. :min="0"
  521. :name="'ruleForm.packing_weight'"
  522. :disabled="type === 'view' || type === 'editCoin'"
  523. :max="100000000000"
  524. :position="'right'"
  525. :precision="3"
  526. :size="'mini'"
  527. :controls="false"
  528. :append="'g'"
  529. @reschange="number_change($event, 'packing_weight')"
  530. />
  531. </el-form-item>
  532. </el-col>
  533. <el-col :span="6">
  534. <el-form-item label="装箱尺寸" prop="packing_size">
  535. <el-input
  536. placeholder="装箱尺寸"
  537. :disabled="type === 'view' || type === 'editCoin'"
  538. v-model="ruleForm.packing_size"
  539. maxlength="250"
  540. />
  541. </el-form-item>
  542. </el-col>
  543. <el-col :span="6">
  544. <el-form-item label="商品尺寸" prop="good_size">
  545. <el-input
  546. placeholder="商品尺寸"
  547. :disabled="type === 'view' || type === 'editCoin'"
  548. v-model="ruleForm.good_size"
  549. maxlength="250"
  550. />
  551. </el-form-item>
  552. </el-col>
  553. <el-col :span="6">
  554. <el-form-item label="商品条形码" prop="good_bar">
  555. <el-input
  556. placeholder="商品条形码"
  557. :disabled="type === 'view' || type === 'editCoin'"
  558. v-model="ruleForm.good_bar"
  559. type="number"
  560. :min="0"
  561. :max="9999999999999"
  562. :step="0"
  563. />
  564. </el-form-item>
  565. </el-col>
  566. <el-col :span="12">
  567. <el-form-item label="包装清单" prop="packing_list">
  568. <el-input
  569. placeholder="包装清单"
  570. :disabled="type === 'view' || type === 'editCoin'"
  571. v-model="ruleForm.packing_list"
  572. maxlength="250"
  573. />
  574. </el-form-item>
  575. </el-col>
  576. </el-row>
  577. </el-col>
  578. </el-row>
  579. <el-row class="ddiv">
  580. <el-col :span="1" class="dtitle">
  581. <ul>
  582. <li>发</li>
  583. <li>货</li>
  584. <li>信</li>
  585. <li>息</li>
  586. </ul></el-col
  587. >
  588. <el-col :span="23" class="dmain">
  589. <el-row>
  590. <el-col :span="6">
  591. <el-form-item label="供货区域" prop="supply_area">
  592. <el-select
  593. v-model="ruleForm.supply_area"
  594. filterable
  595. clearable
  596. :disabled="type === 'view' || type === 'editCoin'"
  597. style="width: 100%"
  598. placeholder="供货区域"
  599. >
  600. <el-option
  601. v-for="group in options6"
  602. :key="group.id"
  603. :label="group.name"
  604. :value="group.id"
  605. />
  606. </el-select>
  607. </el-form-item>
  608. </el-col>
  609. <el-col :span="6">
  610. <el-form-item label="物流时间" prop="delivery_day">
  611. <digital-input
  612. :values="ruleForm.delivery_day"
  613. :placeholder="'物流时间'"
  614. :min="0"
  615. :name="'ruleForm.delivery_day'"
  616. :disabled="type === 'view' || type === 'editCoin'"
  617. :max="100000000000"
  618. :position="'right'"
  619. :precision="0"
  620. :size="'mini'"
  621. :controls="false"
  622. :append="'天'"
  623. @reschange="number_change($event, 'delivery_day')"
  624. />
  625. </el-form-item>
  626. </el-col>
  627. <el-col :span="6">
  628. <el-form-item label="供货周期" prop="lead_time">
  629. <digital-input
  630. :values="ruleForm.lead_time"
  631. :placeholder="'物流时间'"
  632. :min="0"
  633. :name="'ruleForm.lead_time'"
  634. :disabled="type === 'view' || type === 'editCoin'"
  635. :max="100000000000"
  636. :position="'right'"
  637. :precision="0"
  638. :size="'mini'"
  639. :controls="false"
  640. :append="'天'"
  641. @reschange="number_change($event, 'lead_time')"
  642. />
  643. </el-form-item>
  644. </el-col>
  645. <el-col :span="6">
  646. <el-form-item label="调样周期" prop="sample_day">
  647. <digital-input
  648. :values="ruleForm.sample_day"
  649. :placeholder="'调样周期'"
  650. :min="0"
  651. :name="'ruleForm.sample_day'"
  652. :disabled="type === 'view' || type === 'editCoin'"
  653. :max="100000000000"
  654. :position="'right'"
  655. :precision="0"
  656. :size="'mini'"
  657. :controls="false"
  658. :append="'天'"
  659. @reschange="number_change($event, 'sample_day')"
  660. />
  661. </el-form-item>
  662. </el-col>
  663. <el-col :span="12">
  664. <el-form-item label="发货地" prop="delivery_place">
  665. <select-area
  666. :placeholder="'发货地'"
  667. :value="ruleForm.delivery_place"
  668. :is-detail="id !== 'add'"
  669. :disabled="type === 'view' || type === 'editCoin'"
  670. :size="'mini'"
  671. @selectChange="selectAreaChange($event, 'delivery_place')"
  672. />
  673. </el-form-item>
  674. </el-col>
  675. <el-col :span="12">
  676. <el-form-item label="产地" prop="origin_place">
  677. <select-area
  678. :placeholder="'产地'"
  679. :value="ruleForm.origin_place"
  680. :size="'mini'"
  681. :is-detail="id !== 'add'"
  682. :disabled="type === 'view' || type === 'editCoin'"
  683. @selectChange="selectAreaChange($event, 'origin_place')"
  684. />
  685. </el-form-item>
  686. </el-col>
  687. </el-row>
  688. </el-col>
  689. </el-row>
  690. <el-row class="ddiv">
  691. <el-col :span="1" class="dtitle">
  692. <ul>
  693. <li>图</li>
  694. <li>片</li>
  695. <li>信</li>
  696. <li>息</li>
  697. </ul></el-col
  698. >
  699. <el-col :span="23" class="dmain">
  700. <el-row style="padding: 0 0 20px 0">
  701. <el-col :span="6">
  702. <el-form-item
  703. label="商品缩略"
  704. prop="good_thumb_img"
  705. class="activity-upload my-label-top"
  706. >
  707. <div class="btnupload" style="position: relative">
  708. <img
  709. v-if="ruleForm.good_thumb_img"
  710. :src="ruleForm.good_thumb_img"
  711. class="avatar"
  712. />
  713. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  714. <file-upload
  715. class="Upload"
  716. :disabled="type === 'view' || type === 'editCoin'"
  717. :accept="'.jpg,.png,.jpeg'"
  718. :multiple="true"
  719. :uploadcondition="beforeAvatarUpload"
  720. @UploadErrorEvent="UploadErrorEvent($event, 'good_thumb_img')"
  721. @UploadSuccessEvent="
  722. UploadSuccessEvent($event, 'good_thumb_img')
  723. "
  724. ></file-upload>
  725. </div>
  726. <div class="txt-tips fl">
  727. <p>尺寸比例:</p>
  728. <p>1:1</p>
  729. </div>
  730. </el-form-item>
  731. <div style="font-size: 12px; color: #606266">
  732. <span style="padding: 0 0 0 20px">图片大小:小于1M</span>
  733. <span style="padding: 0 0 0 20px">图片类型.jpg/png/jpeg</span>
  734. </div>
  735. </el-col>
  736. <el-col :span="9">
  737. <el-form-item label="商品主图" prop="good_img">
  738. <div class="good_info_img_div">
  739. <ul v-if="ruleForm.good_img" class="clear">
  740. <li
  741. class="img-show-li"
  742. v-viewer
  743. v-for="(img, iindex) in ruleForm.good_img"
  744. :key="img + iindex"
  745. >
  746. <div class="img-show-li-div">
  747. <img :src="img" class="img-show" alt="" />
  748. <i
  749. v-if="type == 'add' || type === 'editBase'"
  750. class="el-icon-close"
  751. @click="closeImg(iindex, 'good_img')"
  752. ></i>
  753. </div>
  754. </li>
  755. <li
  756. class="img-show-li"
  757. v-if="
  758. ruleForm.good_img.length < 10 &&
  759. (type == 'add' || type === 'editBase')
  760. "
  761. >
  762. <div class="activity-upload">
  763. <div class="btnupload" style="position: relative">
  764. <i class="el-icon-plus avatar-uploader-icon"></i>
  765. <file-upload
  766. class="Upload"
  767. :disabled="type === 'view' || type === 'editCoin'"
  768. :accept="'.jpg,.png,.jpeg'"
  769. :multiple="true"
  770. :uploadcondition="beforeAvatarUpload"
  771. @UploadErrorEvent="
  772. UploadErrorEvent($event, 'good_img')
  773. "
  774. @UploadSuccessEvent="
  775. UploadSuccessEvent($event, 'good_img')
  776. "
  777. ></file-upload>
  778. </div>
  779. </div>
  780. </li>
  781. </ul>
  782. </div>
  783. </el-form-item>
  784. </el-col>
  785. <el-col :span="9">
  786. <el-form-item label="详情介绍" prop="good_info_img">
  787. <div class="good_info_img_div">
  788. <ul v-if="ruleForm.good_info_img" class="clear">
  789. <li
  790. class="img-show-li"
  791. v-viewer
  792. v-for="(img, iindex) in ruleForm.good_info_img"
  793. :key="img + iindex"
  794. >
  795. <div class="img-show-li-div">
  796. <img :src="img" class="img-show" alt="" />
  797. <i
  798. v-if="type == 'add' || type === 'editBase'"
  799. class="el-icon-close"
  800. @click="closeImg(iindex, 'good_info_img')"
  801. ></i>
  802. </div>
  803. </li>
  804. <li
  805. class="img-show-li"
  806. v-if="
  807. ruleForm.good_info_img.length < 10 &&
  808. (type == 'add' || type === 'editBase')
  809. "
  810. >
  811. <div class="activity-upload">
  812. <div class="btnupload" style="position: relative">
  813. <i class="el-icon-plus avatar-uploader-icon"></i>
  814. <file-upload
  815. class="Upload"
  816. :disabled="type === 'view' || type === 'editCoin'"
  817. :accept="'.jpg,.png,.jpeg'"
  818. :multiple="true"
  819. :uploadcondition="beforeAvatarUpload"
  820. @UploadErrorEvent="
  821. UploadErrorEvent($event, 'good_info_img')
  822. "
  823. @UploadSuccessEvent="
  824. UploadSuccessEvent($event, 'good_info_img')
  825. "
  826. ></file-upload>
  827. </div>
  828. </div>
  829. </li>
  830. </ul>
  831. </div>
  832. </el-form-item>
  833. </el-col>
  834. </el-row>
  835. </el-col>
  836. </el-row>
  837. <el-row class="ddiv">
  838. <el-col :span="1" class="dtitle">
  839. <ul style="padding: 30px 0 0 0">
  840. <li>固</li>
  841. <li>定</li>
  842. <li>成</li>
  843. <li>本</li>
  844. </ul></el-col
  845. >
  846. <el-col :span="23" class="dmain">
  847. <el-row>
  848. <el-col :span="6">
  849. <el-form-item label="证书费" prop="cert_fee" label-width="75px">
  850. <digital-input
  851. :values="ruleForm.cert_fee"
  852. :placeholder="'证书费'"
  853. :min="0"
  854. :name="'ruleForm.cert_fee'"
  855. :disabled="type === 'view' || type === 'editBase'"
  856. :max="100000000000"
  857. :position="'right'"
  858. :precision="2"
  859. :size="'mini'"
  860. :controls="false"
  861. :append="'元'"
  862. @reschange="number_change($event, 'cert_fee')"
  863. />
  864. </el-form-item>
  865. </el-col>
  866. <el-col :span="6">
  867. <el-form-item label="包装费" prop="packing_fee" label-width="75px">
  868. <digital-input
  869. :values="ruleForm.packing_fee"
  870. :placeholder="'包装费'"
  871. :min="0"
  872. :name="'ruleForm.packing_fee'"
  873. :disabled="type === 'view' || type === 'editBase'"
  874. :max="100000000000"
  875. :position="'right'"
  876. :precision="2"
  877. :size="'mini'"
  878. :controls="false"
  879. :append="'元'"
  880. @reschange="number_change($event, 'packing_fee')"
  881. />
  882. </el-form-item>
  883. </el-col>
  884. <el-col :span="6">
  885. <el-form-item label="工艺费" prop="cost_fee" label-width="75px">
  886. <digital-input
  887. :values="ruleForm.cost_fee"
  888. :placeholder="'工艺费'"
  889. :min="0"
  890. :name="'ruleForm.cost_fee'"
  891. :disabled="type === 'view' || type === 'editBase'"
  892. :max="100000000000"
  893. :position="'right'"
  894. :precision="2"
  895. :size="'mini'"
  896. :controls="false"
  897. :append="'元'"
  898. @reschange="number_change($event, 'cost_fee')"
  899. />
  900. </el-form-item>
  901. </el-col>
  902. <el-col :span="6">
  903. <el-form-item label="加标费" prop="mark_fee" label-width="75px">
  904. <digital-input
  905. :values="ruleForm.mark_fee"
  906. :placeholder="'加标费'"
  907. :min="0"
  908. :name="'ruleForm.mark_fee'"
  909. :disabled="type === 'view' || type === 'editBase'"
  910. :max="100000000000"
  911. :position="'right'"
  912. :precision="2"
  913. :size="'mini'"
  914. :controls="false"
  915. :append="'元'"
  916. @reschange="number_change($event, 'mark_fee')"
  917. />
  918. </el-form-item>
  919. </el-col>
  920. <el-col :span="6">
  921. <el-form-item label="打样费" prop="demo_fee" label-width="75px">
  922. <digital-input
  923. :values="ruleForm.demo_fee"
  924. :placeholder="'打样费'"
  925. :min="0"
  926. :name="'ruleForm.demo_fee'"
  927. :disabled="type === 'view' || type === 'editBase'"
  928. :max="100000000000"
  929. :position="'right'"
  930. :precision="2"
  931. :size="'mini'"
  932. :controls="false"
  933. :append="'元'"
  934. @reschange="number_change($event, 'demo_fee')"
  935. />
  936. </el-form-item>
  937. </el-col>
  938. <el-col :span="6">
  939. <el-form-item label="开模费" prop="open_fee" label-width="75px">
  940. <digital-input
  941. :values="ruleForm.open_fee"
  942. :placeholder="'开模费'"
  943. :min="0"
  944. :name="'ruleForm.open_fee'"
  945. :disabled="type === 'view' || type === 'editBase'"
  946. :max="100000000000"
  947. :position="'right'"
  948. :precision="2"
  949. :size="'mini'"
  950. :controls="false"
  951. :append="'元/件'"
  952. @reschange="number_change($event, 'open_fee')"
  953. />
  954. </el-form-item>
  955. </el-col>
  956. <el-col :span="6">
  957. <el-form-item label="调样费" prop="sample_fee" label-width="75px">
  958. <digital-input
  959. :values="ruleForm.sample_fee"
  960. :placeholder="'调样费'"
  961. :min="0"
  962. :name="'ruleForm.sample_fee'"
  963. :disabled="type === 'view' || type === 'editBase'"
  964. :max="100000000000"
  965. :position="'right'"
  966. :precision="2"
  967. :size="'mini'"
  968. :controls="false"
  969. :append="'元'"
  970. @reschange="number_change($event, 'sample_fee')"
  971. />
  972. </el-form-item>
  973. </el-col>
  974. <el-col :span="6">
  975. <el-form-item label="市场价" prop="market_price" label-width="75px">
  976. <digital-input
  977. :values="ruleForm.market_price"
  978. :placeholder="'市场价'"
  979. :min="0"
  980. :name="'ruleForm.market_price'"
  981. :disabled="type === 'view' || type === 'editBase'"
  982. :max="100000000000"
  983. :position="'right'"
  984. :precision="2"
  985. :size="'mini'"
  986. :controls="false"
  987. :append="'元'"
  988. @reschange="number_change($event, 'market_price')"
  989. />
  990. </el-form-item>
  991. </el-col>
  992. <el-col :span="6">
  993. <el-form-item label="裸价" prop="nake_price" label-width="75px">
  994. <digital-input
  995. :values="ruleForm.nake_price"
  996. :placeholder="'裸价'"
  997. :min="0"
  998. :name="'ruleForm.nake_price'"
  999. :disabled="type === 'view' || type === 'editBase'"
  1000. :max="100000000000"
  1001. :position="'right'"
  1002. :precision="2"
  1003. :size="'mini'"
  1004. :controls="false"
  1005. :append="'元'"
  1006. @reschange="number_change($event, 'nake_price')"
  1007. />
  1008. </el-form-item>
  1009. </el-col>
  1010. <el-col :span="8" v-show="is_noble">
  1011. <el-form-item
  1012. label="供应商采购金价"
  1013. prop="cgd_gold_price"
  1014. label-width="130px"
  1015. >
  1016. <digital-input
  1017. :values="ruleForm.cgd_gold_price"
  1018. :placeholder="'供应商采购金价'"
  1019. :min="0"
  1020. :name="'ruleForm.cgd_gold_price'"
  1021. :disabled="type === 'view' || type === 'editBase'"
  1022. :max="100000000000"
  1023. :position="'right'"
  1024. :precision="2"
  1025. :size="'mini'"
  1026. :controls="false"
  1027. :append="'元/g'"
  1028. @reschange="number_change($event, 'cgd_gold_price')"
  1029. />
  1030. </el-form-item>
  1031. </el-col>
  1032. </el-row>
  1033. </el-col>
  1034. </el-row>
  1035. <el-row class="ddiv">
  1036. <el-col :span="1" class="dtitle">
  1037. <ul>
  1038. <li>阶</li>
  1039. <li>梯</li>
  1040. <li>成</li>
  1041. <li>本</li>
  1042. </ul></el-col
  1043. >
  1044. <el-col :span="23" class="dmain">
  1045. <el-row>
  1046. <el-col :span="6">
  1047. <el-form-item label="启用阶梯" prop="is_step">
  1048. <el-select
  1049. v-model="ruleForm.is_step"
  1050. filterable
  1051. :disabled="type === 'view' || type === 'editBase'"
  1052. style="width: 100%"
  1053. placeholder="启用阶梯"
  1054. @change="is_step_change"
  1055. >
  1056. <el-option
  1057. v-for="group in options5"
  1058. :key="group.id"
  1059. :label="group.name"
  1060. :value="group.id"
  1061. />
  1062. </el-select>
  1063. </el-form-item>
  1064. </el-col>
  1065. <el-col :span="24" style="padding-left: 18px">
  1066. <el-table
  1067. :data="ladder_tableData"
  1068. :size="'mini'"
  1069. border
  1070. stripe
  1071. style="width: 100%; margin: 0 0 20px 0"
  1072. >
  1073. <el-table-column prop="min_num" label="起订量(>=)" />
  1074. <el-table-column prop="nake_fee" label="成本合计" />
  1075. <el-table-column prop="cost_fee" label="工艺费" />
  1076. <el-table-column prop="delivery_fee" label="物流费" />
  1077. <el-table-column
  1078. fixed="right"
  1079. v-if="type === 'add' || type === 'editCoin' || type === 'edit'"
  1080. >
  1081. <template slot="header" slot-scope="scope">
  1082. <span>操作</span>
  1083. <el-tooltip effect="dark" content="添加阶梯" placement="top">
  1084. <i
  1085. class="el-icon-circle-plus-outline tb-icon fr"
  1086. @click="openCostEdit(-1, {})"
  1087. ></i>
  1088. </el-tooltip>
  1089. </template>
  1090. <template slot-scope="scope">
  1091. <el-tooltip effect="dark" content="修改" placement="top">
  1092. <i
  1093. class="el-icon-edit tb-icon"
  1094. @click="openCostEdit(scope.$index, scope.row)"
  1095. ></i>
  1096. </el-tooltip>
  1097. <el-tooltip effect="dark" content="删除" placement="top">
  1098. <i
  1099. class="el-icon-delete tb-icon"
  1100. @click="openCostEditDelete(scope.$index)"
  1101. ></i>
  1102. </el-tooltip>
  1103. </template>
  1104. </el-table-column>
  1105. </el-table>
  1106. </el-col>
  1107. </el-row>
  1108. <!-- 弹窗 新增/修改 -->
  1109. <cost-form-add-edit
  1110. :index="costmodelIndex"
  1111. :show-model="costshowModel"
  1112. :sitem="costsitem"
  1113. @refresh="costrefreshEdit"
  1114. @cancel="costshowModel = false"
  1115. />
  1116. </el-col>
  1117. <el-col
  1118. :span="24"
  1119. v-if="
  1120. type === 'editBase' ||
  1121. type === 'add' ||
  1122. type === 'editCoin' ||
  1123. type === 'edit'
  1124. "
  1125. style="
  1126. text-align: right;
  1127. padding: 15px 0 15px 0;
  1128. border-top: 1px solid #dcdfe6;
  1129. "
  1130. >
  1131. <el-button :size="'mini'" type="primary" @click="submitForm"
  1132. >保 存
  1133. </el-button>
  1134. </el-col></el-row
  1135. >
  1136. </el-form>
  1137. </template>
  1138. <script>
  1139. import asyncRequest from "@/apis/service/goodStore/goodsCost";
  1140. import resToken from "@/mixins/resToken";
  1141. import { mapGetters } from "vuex";
  1142. import baseFormAddEdit from "./baseFormAddEdit";
  1143. import costFormAddEdit from "./costFormAddEdit";
  1144. import {
  1145. options1,
  1146. options2,
  1147. options3,
  1148. options4,
  1149. options5,
  1150. options6,
  1151. options7,
  1152. options8,
  1153. options9,
  1154. rules,
  1155. } from "../columns";
  1156. export default {
  1157. name: "goodsCostAdd",
  1158. mixins: [resToken],
  1159. props: ["showModel", "id", "type", "sitem"],
  1160. components: {
  1161. baseFormAddEdit,
  1162. costFormAddEdit,
  1163. },
  1164. computed: {
  1165. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  1166. powers() {
  1167. let tran =
  1168. this.$store.getters.btnList.find(
  1169. (item) => item.menu_route == "goodsCostAdd"
  1170. ) || {};
  1171. if (tran && tran.action && tran.action.length > 0) {
  1172. return tran.action;
  1173. } else {
  1174. return [];
  1175. }
  1176. },
  1177. },
  1178. watch: {
  1179. newTime: function (val) {
  1180. if (val) {
  1181. this.initForm();
  1182. }
  1183. },
  1184. },
  1185. data() {
  1186. return {
  1187. spec_tableData: [],
  1188. cat_id_name: "",
  1189. brand_name: "",
  1190. unit_name: "",
  1191. costshowModel: false,
  1192. costmodelIndex: "",
  1193. costsitem: {},
  1194. showModel: false,
  1195. modelIndex: "",
  1196. is_noble: false,
  1197. size: "small",
  1198. status: "",
  1199. rulesThis: this.rules,
  1200. activeName: "1",
  1201. loading: true,
  1202. supplierName: "",
  1203. options1: options1,
  1204. options2: options2,
  1205. options3: options3,
  1206. options4: options4,
  1207. options5: options5,
  1208. options6: options6,
  1209. options7: options7,
  1210. options8: options8,
  1211. options9: options9,
  1212. ruleForm: {},
  1213. spec_tableData: [],
  1214. old_spec_tableData: [],
  1215. ladder_tableData: [],
  1216. old_ladder_tableData: [],
  1217. rules: rules,
  1218. };
  1219. },
  1220. mounted() {
  1221. this.initForm();
  1222. },
  1223. methods: {
  1224. async initForm() {
  1225. this.loading = true;
  1226. this.resetFormData();
  1227. this.rulesThis = this.rules;
  1228. await this.resetForm();
  1229. this.sch_is_noble();
  1230. this.good_type_change();
  1231. this.loading = false;
  1232. },
  1233. number_change(e, key) {
  1234. this.ruleForm[key] = e + "" || "0";
  1235. this.$refs.ruleForm.validateField(key);
  1236. },
  1237. openEdit(index, sitem) {
  1238. this.modelIndex = index;
  1239. this.sitem = sitem;
  1240. this.showModel = true;
  1241. },
  1242. openCostEdit(index, sitem) {
  1243. const { is_step } = this.ruleForm;
  1244. if (index === -1 && is_step === "0" && this.ladder_tableData.length > 0) {
  1245. this.$message.warning("不启用阶梯成本,只能录入一条阶梯成本信息!");
  1246. return;
  1247. }
  1248. this.costmodelIndex = index;
  1249. this.costsitem = sitem;
  1250. this.costshowModel = true;
  1251. },
  1252. openDelete(index) {
  1253. this.spec_tableData.splice(index, 1);
  1254. },
  1255. openCostEditDelete(index) {
  1256. this.ladder_tableData.splice(index, 1);
  1257. },
  1258. is_step_change() {
  1259. const { is_step } = this.ruleForm;
  1260. if (is_step === "0") {
  1261. let res = [];
  1262. let list =
  1263. this.ladder_tableData.length === 0
  1264. ? []
  1265. : JSON.parse(JSON.stringify(this.ladder_tableData));
  1266. if (list.length > 0) {
  1267. res.push(list[0]);
  1268. }
  1269. this.ladder_tableData = res;
  1270. }
  1271. },
  1272. async submitForm() {
  1273. this.sch_is_noble();
  1274. this.good_type_change();
  1275. await this.$refs.ruleForm.validate(async (valid) => {
  1276. if (valid) {
  1277. this.loading = true;
  1278. if (this.spec_tableData.length === 0) {
  1279. this.$message.warning("请录入商品规格信息!");
  1280. this.loading = false;
  1281. return;
  1282. }
  1283. let isMust = true;
  1284. this.spec_tableData.forEach((e) => {
  1285. if (e.isMust && !e.spec_value_id) {
  1286. isMust = false;
  1287. }
  1288. });
  1289. if (!isMust) {
  1290. this.$message.warning("分类绑定的规格必须填写规格值!");
  1291. this.loading = false;
  1292. return;
  1293. }
  1294. if (this.ladder_tableData.length === 0) {
  1295. this.$message.warning("请录入阶梯成本!");
  1296. this.loading = false;
  1297. return;
  1298. }
  1299. const { noble_weight, weight, good_type, moq, is_step } =
  1300. this.ruleForm;
  1301. if (is_step === "0" && this.ladder_tableData.length > 1) {
  1302. this.$message.warning("不启用阶梯成本,只能录入一条阶梯成本信息!");
  1303. this.loading = false;
  1304. return;
  1305. }
  1306. if (this.is_noble) {
  1307. if (noble_weight * 1000 > weight * 1000) {
  1308. this.$message.warning("贵金属总重量不能大于商品总重量!");
  1309. this.loading = false;
  1310. return;
  1311. }
  1312. }
  1313. // if (good_type === "1") {
  1314. // let set_num = moq * 1;
  1315. // let isok = true;
  1316. // this.ladder_tableData.forEach((e) => {
  1317. // if (e.min_num * 1 < set_num) {
  1318. // isok = false;
  1319. // }
  1320. // });
  1321. // if (!isok) {
  1322. // this.$message.warning("阶梯成本的起订量不能小于定制起订量!");
  1323. // this.loading = false;
  1324. // return;
  1325. // }
  1326. // }
  1327. let model = JSON.parse(JSON.stringify(this.ruleForm));
  1328. model.cat_id = model.cat_id.toString();
  1329. model.brandid = model.brandid.toString();
  1330. model.supplierNo = model.supplierNo.toString();
  1331. model.delivery_place = model.delivery_place.toString();
  1332. model.origin_place = model.origin_place.toString();
  1333. model.good_info_img = model.good_info_img.toString();
  1334. model.good_img = model.good_img.toString();
  1335. model.unit = model.unit.toString();
  1336. model.speclist = JSON.parse(JSON.stringify(this.setResData(1)));
  1337. model.good_ladder = JSON.parse(JSON.stringify(this.setResData(2)));
  1338. model.config = model.config.toString();
  1339. model.is_exclusive =
  1340. model.is_exclusive.length > 0
  1341. ? model.is_exclusive[model.is_exclusive.length - 1]
  1342. : "";
  1343. let res = {};
  1344. delete model["id"];
  1345. if (this.type === "add") {
  1346. delete model["spuCode"];
  1347. res = await asyncRequest.add(model);
  1348. } else if (this.type === "editBase") {
  1349. let item1 = this.setModel(model, "1");
  1350. res = await asyncRequest.update(item1);
  1351. } else if (this.type === "editCoin") {
  1352. let item2 = this.setModel(model, "2");
  1353. res = await asyncRequest.updateP(item2);
  1354. } else {
  1355. model.companyNo = model.company_id;
  1356. delete model["company_id"];
  1357. res = await asyncRequest.edit_update(model);
  1358. }
  1359. console.log(res);
  1360. this.loading = false;
  1361. if (res && res.code === 0) {
  1362. const { spuCode } = res.data;
  1363. const title =
  1364. this.type === "add"
  1365. ? "新建成功!"
  1366. : this.type === "editBase"
  1367. ? "基础信息修改成功!"
  1368. : this.type === "editCoin"
  1369. ? "成本信息修改成功!"
  1370. : "商品信息修改成功";
  1371. this.$notify.success({
  1372. title: title,
  1373. message: "",
  1374. });
  1375. this.showModelThis = false;
  1376. // 刷新
  1377. this.$emit("refresh", { spuCode: spuCode });
  1378. }
  1379. } else {
  1380. console.log(valid);
  1381. console.log("error submit!!");
  1382. return false;
  1383. }
  1384. });
  1385. },
  1386. //获取规格值
  1387. setResData(type) {
  1388. let list = JSON.parse(
  1389. JSON.stringify(type === 1 ? this.spec_tableData : this.ladder_tableData)
  1390. );
  1391. let oldlist = JSON.parse(
  1392. JSON.stringify(
  1393. type === 1 ? this.old_spec_tableData : this.old_ladder_tableData
  1394. )
  1395. );
  1396. let hasIDlist = [];
  1397. list.forEach((a) => {
  1398. if (a.id !== "") {
  1399. hasIDlist.push(a);
  1400. }
  1401. });
  1402. let newList = [];
  1403. let resList = [];
  1404. oldlist.forEach((a, ai) => {
  1405. let item = null;
  1406. let index = hasIDlist.findIndex((b) => a.id === b.id);
  1407. if (index === -1) {
  1408. item = JSON.parse(JSON.stringify(a));
  1409. item.is_del = "1";
  1410. } else {
  1411. item = JSON.parse(JSON.stringify(hasIDlist[index]));
  1412. }
  1413. newList.push(item);
  1414. });
  1415. list.forEach((b) => {
  1416. if (b.id === "") {
  1417. b.is_del = "0";
  1418. newList.push(b);
  1419. }
  1420. });
  1421. if (type === 1) {
  1422. newList.forEach((a) => {
  1423. let m = {
  1424. id: a.id,
  1425. spec_id: a.spec_id,
  1426. spec_value_id: a.spec_value_id,
  1427. is_del: a.is_del || "0",
  1428. };
  1429. resList.push(m);
  1430. });
  1431. } else {
  1432. newList.forEach((a) => {
  1433. let m = {
  1434. id: a.id,
  1435. min_num: a.min_num,
  1436. nake_fee: a.nake_fee,
  1437. cost_fee: a.cost_fee,
  1438. delivery_fee: a.delivery_fee,
  1439. is_del: a.is_del || "0",
  1440. };
  1441. resList.push(m);
  1442. });
  1443. }
  1444. return resList;
  1445. },
  1446. setladder() {
  1447. let list = JSON.parse(JSON.stringify(this.ladder_tableData));
  1448. let oldlist = JSON.parse(JSON.stringify(this.old_ladder_tableData));
  1449. let hasIDlist = [];
  1450. list.forEach((a) => {
  1451. if (a.id !== "") {
  1452. hasIDlist.push(a);
  1453. }
  1454. });
  1455. let newList = [];
  1456. let resList = [];
  1457. oldlist.forEach((a, ai) => {
  1458. let item = null;
  1459. let index = hasIDlist.findIndex((b) => a.id === b.id);
  1460. if (index === -1) {
  1461. item = JSON.parse(JSON.stringify(a));
  1462. item.is_del = "1";
  1463. } else {
  1464. item = JSON.parse(JSON.stringify(b));
  1465. }
  1466. newList.push(item);
  1467. });
  1468. list.forEach((b) => {
  1469. if (b.id === "") {
  1470. b.is_del = "0";
  1471. newList.push(b);
  1472. }
  1473. });
  1474. newList.forEach((a) => {
  1475. let m = {
  1476. id: a.id,
  1477. min_num: a.min_num,
  1478. spec_value_id: a.spec_value_id,
  1479. is_del: a.is_del || "0",
  1480. };
  1481. resList.push(m);
  1482. });
  1483. return resList;
  1484. },
  1485. //规格编辑修改
  1486. refreshEdit(e) {
  1487. let item = JSON.parse(JSON.stringify(e));
  1488. const {
  1489. index,
  1490. id,
  1491. spec_id,
  1492. isMust,
  1493. spec_value,
  1494. spec_value_id,
  1495. spec_value_value,
  1496. } = item;
  1497. let ffindex = -1;
  1498. this.spec_tableData.forEach((i, findex) => {
  1499. if (i.spec_id === spec_id) {
  1500. ffindex = findex;
  1501. this.spec_tableData[findex].id = id;
  1502. this.spec_tableData[findex].spec_id = spec_id;
  1503. this.spec_tableData[findex].isMust = isMust;
  1504. this.spec_tableData[findex].spec_value = spec_value;
  1505. this.spec_tableData[findex].spec_value_id = spec_value_id;
  1506. this.spec_tableData[findex].spec_value_value = spec_value_value;
  1507. }
  1508. });
  1509. if (ffindex === -1) {
  1510. this.spec_tableData.push(item);
  1511. }
  1512. this.showModel = false;
  1513. },
  1514. //阶梯成本修改
  1515. costrefreshEdit(e) {
  1516. let item = JSON.parse(JSON.stringify(e));
  1517. const { index, id, cost_fee, delivery_fee, min_num, nake_fee } = item;
  1518. let ffindex = -1;
  1519. this.ladder_tableData.forEach((i, findex) => {
  1520. if (findex === parseInt(index + "")) {
  1521. ffindex = findex;
  1522. this.ladder_tableData[findex].id = id;
  1523. this.ladder_tableData[findex].cost_fee = cost_fee;
  1524. this.ladder_tableData[findex].delivery_fee = delivery_fee;
  1525. this.ladder_tableData[findex].min_num = min_num;
  1526. this.ladder_tableData[findex].nake_fee = nake_fee;
  1527. }
  1528. });
  1529. if (ffindex === -1) {
  1530. this.ladder_tableData.push(item);
  1531. }
  1532. this.showModel = false;
  1533. },
  1534. dataSort(key) {
  1535. return function (a, b) {
  1536. let value1 = a[key];
  1537. let value2 = b[key];
  1538. return value1 - value2;
  1539. };
  1540. },
  1541. resetFormData() {
  1542. this.spec_tableData = [];
  1543. this.old_spec_tableData = [];
  1544. this.ladder_tableData = [];
  1545. this.old_ladder_tableData = [];
  1546. this.cat_id_name = "";
  1547. this.is_noble = false;
  1548. this.status = "";
  1549. this.brand_name = "";
  1550. this.unit_name = "";
  1551. this.supplierName = "";
  1552. this.ruleForm = {
  1553. id: "",
  1554. spuCode: "",
  1555. cat_id: [],
  1556. brandid: [],
  1557. noble_weight: "0",
  1558. weight: "",
  1559. good_type: "0",
  1560. is_stock: "0",
  1561. supplierNo: [],
  1562. company_id: "",
  1563. is_auth: "",
  1564. tax: "",
  1565. good_name: "",
  1566. unit: [],
  1567. is_exclusive: [],
  1568. noble_metal: "",
  1569. is_gold_price: "",
  1570. moq: "0",
  1571. customized: "0",
  1572. after_sales: "",
  1573. craft_desc: "",
  1574. good_remark: "",
  1575. //包装发货/图片
  1576. packing_list: "",
  1577. packing_way: "",
  1578. packing_spec: "",
  1579. packing_weight: "",
  1580. packing_size: "",
  1581. good_size: "",
  1582. good_bar: "",
  1583. supply_area: "",
  1584. delivery_place: [],
  1585. origin_place: [],
  1586. delivery_day: "0",
  1587. lead_time: "0",
  1588. sample_day: "0",
  1589. good_thumb_img: "",
  1590. good_img: [],
  1591. good_info_img: [],
  1592. //固定阶梯成本
  1593. cert_fee: "0",
  1594. packing_fee: "0",
  1595. cost_fee: "0",
  1596. mark_fee: "0",
  1597. demo_fee: "0",
  1598. open_fee: "0",
  1599. sample_fee: "0",
  1600. market_price: "0",
  1601. nake_price: "0",
  1602. cgd_gold_price: "0",
  1603. is_step: "0",
  1604. is_diff: "",
  1605. config: [],
  1606. other_config: "",
  1607. };
  1608. },
  1609. async resetForm() {
  1610. // 重置
  1611. await this.$nextTick(async () => {
  1612. if (this.$refs.ruleForm) {
  1613. this.$refs.ruleForm.resetFields();
  1614. this.$refs.ruleForm.clearValidate();
  1615. this.spec_tableData = [];
  1616. this.old_spec_tableData = [];
  1617. this.ladder_tableData = [];
  1618. this.old_ladder_tableData = [];
  1619. const {
  1620. id,
  1621. spuCode, //string 商品spuCode
  1622. // good_code, //string 无
  1623. good_name, //string 商品名称
  1624. // cat_id, //string 分类id
  1625. cat_info, //array 分类
  1626. brand_id, //string 品牌id
  1627. unit,
  1628. supplierName,
  1629. companyNo, // string 企业公司id
  1630. good_unit, // string 商品单位
  1631. good_type, //string 是否定制 1是0否
  1632. moq, //string 起订量
  1633. is_exclusive, // string 是否是专属
  1634. customized, // string 定制工期
  1635. tax, //string 税率
  1636. supplierNo, // string 供应商
  1637. is_auth, //string 是否有销售权限0 否1 是
  1638. auth_img, // string 无
  1639. exclusive,
  1640. is_stock, //
  1641. after_sales, // string 售后说明
  1642. craft_desc, // string 工艺说明
  1643. good_remark, // string 商品备注
  1644. weight, // string 重量
  1645. packing_way, // string 包装方式
  1646. packing_size, // string 包装尺寸
  1647. good_size, //商品尺寸
  1648. packing_spec, // string 包装规格
  1649. packing_list, // string 包装清单
  1650. packing_weight, // string 装箱重量
  1651. good_bar, // string 条形码
  1652. supply_area, // string 供货区域 1 全国2 除偏远地区
  1653. delivery_place, // string 发货地区
  1654. origin_place, // string 产地
  1655. delivery_day, // string 物流天数
  1656. lead_time, // string 供货周期
  1657. sample_day, //string 调样周期
  1658. sample_fee, // string 调样费有
  1659. good_img, // string 商品图片
  1660. good_thumb_img, // string 商品说略图
  1661. good_info_img, // string 商品详情图
  1662. cert_fee, // string 证书费
  1663. packing_fee, // string 打包费
  1664. cost_fee, // string 工艺费
  1665. mark_fee, // string 加标费
  1666. demo_fee, // string 打样费
  1667. open_fee, // string 开模费
  1668. noble_metal, // string 金属类别
  1669. noble_weight, // string 金属重量
  1670. is_gold_price, // string 是否使用实时金价
  1671. market_price, // string 市场价
  1672. nake_price, // string 成本裸价
  1673. cgd_gold_price, // string 供应商采购金价
  1674. is_step, // string 是否使用阶梯价
  1675. // is_online, // string 是否上线
  1676. status, // string 状态
  1677. nakelist, //階梯成本
  1678. speclist, //商品规格
  1679. brand_name,
  1680. config,
  1681. is_diff,
  1682. other_config,
  1683. } = this.sitem;
  1684. let cat_id_name = "";
  1685. let cat_id = [];
  1686. (cat_info || []).forEach((ai, i) => {
  1687. cat_id_name += i === 0 ? ai.name : `_${ai.name}`;
  1688. cat_id.push(ai.id);
  1689. });
  1690. this.cat_id_name = cat_id_name;
  1691. let isok = false;
  1692. if (cat_id.length > 0) {
  1693. cat_id.forEach((i) => {
  1694. if (i === "6") {
  1695. isok = true;
  1696. }
  1697. });
  1698. }
  1699. let exclusiveList = [];
  1700. if (exclusive && exclusive.length > 0) {
  1701. exclusive.forEach((a, ai) => {
  1702. exclusiveList.push(a.id);
  1703. });
  1704. }
  1705. this.is_noble = isok;
  1706. let spec_list1 =
  1707. speclist && speclist.length > 0
  1708. ? JSON.parse(JSON.stringify(speclist))
  1709. : [];
  1710. spec_list1.forEach((a) => {
  1711. let model = {
  1712. id: a.id,
  1713. is_del: a.is_del,
  1714. spec_id: a.spec_id,
  1715. spec_value: a.spec_name,
  1716. spec_value_value: a.spec_value,
  1717. spec_value_id: a.spec_value_id,
  1718. spuCode: a.spuCode,
  1719. };
  1720. this.spec_tableData.push(model);
  1721. });
  1722. this.old_spec_tableData = JSON.parse(
  1723. JSON.stringify(this.spec_tableData)
  1724. );
  1725. let list2 =
  1726. nakelist && nakelist.length > 0
  1727. ? JSON.parse(JSON.stringify(nakelist))
  1728. : [];
  1729. this.ladder_tableData = list2;
  1730. this.old_ladder_tableData = JSON.parse(
  1731. JSON.stringify(this.ladder_tableData)
  1732. );
  1733. this.status = status;
  1734. this.brand_name = brand_name;
  1735. this.unit_name = unit;
  1736. this.supplierName = supplierName || "";
  1737. this.ruleForm = {
  1738. id: id || "",
  1739. spuCode: spuCode || "",
  1740. cat_id:
  1741. cat_id && cat_id.length > 0 ? [cat_id[cat_id.length - 1]] : [],
  1742. brandid: brand_id ? [brand_id] : [],
  1743. noble_weight: noble_weight || "",
  1744. weight: weight || "",
  1745. good_type: good_type || "0",
  1746. is_stock: is_stock || "0",
  1747. supplierNo: supplierNo ? [supplierNo] : [],
  1748. company_id: companyNo || "",
  1749. is_auth: is_auth || "",
  1750. tax: tax ? tax + "%" : "",
  1751. good_name: good_name || "",
  1752. unit: good_unit ? [good_unit] : [],
  1753. is_exclusive: exclusiveList || [],
  1754. noble_metal: noble_metal || "",
  1755. is_gold_price: is_gold_price || "",
  1756. moq: moq || "0",
  1757. customized: customized || "0",
  1758. after_sales: after_sales || "",
  1759. craft_desc: craft_desc || "",
  1760. good_remark: good_remark || "",
  1761. //包装发货/图片
  1762. packing_list: packing_list || "",
  1763. packing_way: packing_way || "",
  1764. packing_spec: packing_spec || "",
  1765. packing_weight: packing_weight || "",
  1766. packing_size: packing_size || "",
  1767. good_size: good_size || "",
  1768. good_bar: good_bar || "",
  1769. supply_area: supply_area || "",
  1770. delivery_place: delivery_place
  1771. ? (delivery_place || "").split(",")
  1772. : [],
  1773. origin_place: origin_place ? (origin_place || "").split(",") : [],
  1774. delivery_day: delivery_day || "",
  1775. lead_time: lead_time || "",
  1776. sample_day: sample_day || "",
  1777. good_thumb_img: good_thumb_img || "",
  1778. good_img: good_img ? (good_img || "").split(",") : [],
  1779. good_info_img: good_info_img
  1780. ? (good_info_img || "").split(",")
  1781. : [],
  1782. //固定阶梯成本
  1783. cert_fee: cert_fee || "",
  1784. packing_fee: packing_fee || "",
  1785. cost_fee: cost_fee || "",
  1786. mark_fee: mark_fee || "",
  1787. demo_fee: demo_fee || "",
  1788. open_fee: open_fee || "",
  1789. sample_fee: sample_fee || "",
  1790. market_price: market_price || "",
  1791. nake_price: nake_price || "",
  1792. cgd_gold_price: cgd_gold_price || "",
  1793. is_step: is_step || "0",
  1794. is_diff: is_diff || "",
  1795. config: config ? config.split(",") : [],
  1796. other_config: other_config || "",
  1797. };
  1798. }
  1799. await this.set_must_spec();
  1800. });
  1801. },
  1802. sch_is_noble() {
  1803. let list = [
  1804. "noble_weight",
  1805. "noble_metal",
  1806. "is_gold_price",
  1807. "is_diff",
  1808. "config",
  1809. "other_config",
  1810. 'cgd_gold_price'
  1811. ];
  1812. for (let i = 0; i < list.length; i++) {
  1813. this.rulesThis[list[i]][0].required = this.is_noble;
  1814. console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
  1815. this.$refs.ruleForm.validateField(list[i]);
  1816. }
  1817. },
  1818. setModel(model, type) {
  1819. let item = null;
  1820. if (type === 1) {
  1821. item = JSON.parse(JSON.stringify(model));
  1822. delete item["cert_fee"];
  1823. delete item["packing_fee"];
  1824. delete item["cost_fee"];
  1825. delete item["mark_fee"];
  1826. delete item["demo_fee"];
  1827. delete item["open_fee"];
  1828. delete item["noble_metal"];
  1829. delete item["noble_weight"];
  1830. delete item["is_gold_price"];
  1831. delete item["market_price"];
  1832. delete item["nake_price"];
  1833. delete item["cgd_gold_price"];
  1834. delete item["is_step"];
  1835. delete item["good_ladder"];
  1836. } else {
  1837. const {
  1838. cert_fee,
  1839. packing_fee,
  1840. cost_fee,
  1841. mark_fee,
  1842. demo_fee,
  1843. open_fee,
  1844. noble_metal,
  1845. noble_weight,
  1846. is_gold_price,
  1847. market_price,
  1848. nake_price,
  1849. cgd_gold_price,
  1850. is_step,
  1851. good_ladder,
  1852. spuCode,
  1853. } = model;
  1854. item = {
  1855. cert_fee: cert_fee || "",
  1856. packing_fee: packing_fee || "",
  1857. cost_fee: cost_fee || "",
  1858. mark_fee: mark_fee || "",
  1859. demo_fee: demo_fee || "",
  1860. open_fee: open_fee || "",
  1861. noble_metal: noble_metal || "",
  1862. noble_weight: noble_weight || "",
  1863. is_gold_price: is_gold_price || "",
  1864. market_price: market_price || "",
  1865. nake_price: nake_price || "",
  1866. cgd_gold_price: cgd_gold_price || "",
  1867. is_step: is_step || "",
  1868. good_ladder: good_ladder || [],
  1869. spuCode: spuCode || "",
  1870. };
  1871. }
  1872. return model;
  1873. },
  1874. //商品分类选择
  1875. async goods_class_change(e) {
  1876. const { code, pid, id, label, cat_desc } = e;
  1877. this.ruleForm.cat_id = id ? [id] : [];
  1878. this.$refs.ruleForm.validateField("cat_id");
  1879. this.ruleForm.after_sales = cat_desc || "";
  1880. this.$refs.ruleForm.validateField("after_sales");
  1881. this.is_noble = pid === "6";
  1882. this.sch_is_noble();
  1883. await this.set_must_spec();
  1884. },
  1885. async set_must_spec() {
  1886. const { cat_id } = this.ruleForm;
  1887. let id = cat_id.length == 1 ? cat_id[0] : "";
  1888. let list1 =
  1889. this.spec_tableData && this.spec_tableData.length > 0
  1890. ? JSON.parse(JSON.stringify(this.spec_tableData))
  1891. : [];
  1892. let list2 = [];
  1893. if (id) {
  1894. const { code, message, data } = await asyncRequest.catinfo({ id: id });
  1895. if (code === 0) {
  1896. const { spec } = data;
  1897. if (spec && spec.length > 0) {
  1898. if (list1 && list1.length > 0) {
  1899. list1.forEach((c) => {
  1900. c.isMust = false;
  1901. });
  1902. spec.forEach((a, ai) => {
  1903. let findex = list1.findIndex((b) => b.spec_id === a.id);
  1904. if (findex !== -1) {
  1905. list1[findex].isMust = true;
  1906. } else {
  1907. list1.push({
  1908. id: "",
  1909. index: "1",
  1910. spec_id: a.id,
  1911. spec_value: a.spec_name,
  1912. isMust: true,
  1913. spec_value_value: "",
  1914. spec_value_id: "",
  1915. });
  1916. }
  1917. });
  1918. } else {
  1919. spec.forEach((a, ai) => {
  1920. let model = {
  1921. id: "",
  1922. index: "1",
  1923. spec_id: a.id,
  1924. spec_value: a.spec_name,
  1925. isMust: true,
  1926. spec_value_value: "",
  1927. spec_value_id: "",
  1928. };
  1929. list1.push(model);
  1930. });
  1931. }
  1932. }
  1933. list1.map((e, ei) => {
  1934. e.index = ei + "";
  1935. return e;
  1936. });
  1937. this.spec_tableData =
  1938. list1 && list1.length > 0 ? JSON.parse(JSON.stringify(list1)) : [];
  1939. } else if (code >= 100 && code <= 104) {
  1940. await this.logout();
  1941. } else {
  1942. this.$message.warning(message);
  1943. }
  1944. } else {
  1945. list1.forEach((e) => {
  1946. if (!e.isMust) {
  1947. list2.push(e);
  1948. }
  1949. });
  1950. }
  1951. },
  1952. //商品品牌选择
  1953. brandidsearchChange(e) {
  1954. const { id, code, label } = e;
  1955. if (id) {
  1956. this.ruleForm.brandid = [id];
  1957. } else {
  1958. this.ruleForm.brandid = [];
  1959. }
  1960. this.$refs.ruleForm.validateField("brandid");
  1961. },
  1962. //供应商选择
  1963. supplierNosearchChange(e) {
  1964. console.log(e);
  1965. const { id, code, label } = e;
  1966. if (id) {
  1967. this.ruleForm.supplierNo = [code];
  1968. } else {
  1969. this.ruleForm.supplierNo = [];
  1970. }
  1971. this.$refs.ruleForm.validateField("supplierNo");
  1972. },
  1973. //业务企业选择
  1974. company_idsearchChange(e) {
  1975. const { id, code, label } = e;
  1976. if (id) {
  1977. this.ruleForm.company_id = code;
  1978. } else {
  1979. this.ruleForm.company_id = "";
  1980. }
  1981. this.$refs.ruleForm.validateField("company_id");
  1982. },
  1983. //税点选择
  1984. taxsearchChange(e) {
  1985. this.ruleForm.tax = e;
  1986. this.$refs.ruleForm.validateField("tax");
  1987. },
  1988. //专属类型选择
  1989. exclusiveSearchChange(e) {
  1990. this.ruleForm.is_exclusive = e;
  1991. this.$refs.ruleForm.validateField("is_exclusive");
  1992. },
  1993. //单位选择
  1994. unitsearchChange(e) {
  1995. const { id, code, label } = e;
  1996. if (id) {
  1997. this.ruleForm.unit = [code];
  1998. } else {
  1999. this.ruleForm.unit = [];
  2000. }
  2001. this.$refs.ruleForm.validateField("unit");
  2002. },
  2003. //贵金属种类选择
  2004. noble_metalsearchChange(e) {
  2005. console.log(e);
  2006. const { id, code, label } = e;
  2007. if (id) {
  2008. this.ruleForm.noble_metal = id;
  2009. } else {
  2010. this.ruleForm.noble_metal = "";
  2011. }
  2012. this.$refs.ruleForm.validateField("noble_metal");
  2013. },
  2014. //省市区
  2015. selectAreaChange(e, key) {
  2016. this.ruleForm[key] = e;
  2017. this.$refs.ruleForm.validateField(key);
  2018. },
  2019. closeImg(index, key) {
  2020. this.ruleForm[key].splice(index, 1);
  2021. this.$refs.ruleForm.validateField(key);
  2022. },
  2023. //图片上传成功
  2024. async UploadSuccessEvent(data, key) {
  2025. const { url } = data;
  2026. if (url === "noToken") {
  2027. await this.logout();
  2028. } else {
  2029. if (key === "good_thumb_img") {
  2030. this.ruleForm[key] = url;
  2031. } else {
  2032. this.ruleForm[key].push(url);
  2033. }
  2034. this.$refs.ruleForm.validateField(key);
  2035. this.$message.success("图片上传成功!");
  2036. }
  2037. },
  2038. good_type_change() {
  2039. let list = ["moq", "customized"];
  2040. for (let i = 0; i < list.length; i++) {
  2041. this.rulesThis[list[i]][0].required = this.ruleForm.good_type === "1";
  2042. console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
  2043. this.$refs.ruleForm.validateField(list[i]);
  2044. }
  2045. },
  2046. imgUploadError(res, key) {
  2047. if (res !== "break") {
  2048. this.$message.error("图片上传失败!");
  2049. this.$refs.ruleForm.validateField(key);
  2050. }
  2051. },
  2052. //判断图片规格
  2053. beforeAvatarUpload(file) {
  2054. let isJPG = false;
  2055. if (
  2056. file.type === "image/jpg" ||
  2057. file.type === "image/png" ||
  2058. file.type === "image/jpeg"
  2059. ) {
  2060. isJPG = true;
  2061. }
  2062. const isLt2M = file.size / 1024 / 1024 < 1;
  2063. if (!isJPG) {
  2064. this.$message.error("图片格式不正确!");
  2065. }
  2066. if (!isLt2M) {
  2067. this.$message.error("图片大小不能超过 1MB!");
  2068. }
  2069. return isJPG && isLt2M;
  2070. },
  2071. },
  2072. };
  2073. </script>
  2074. <style lang="scss" scoped>
  2075. .goodsCostDetail {
  2076. // position: relative;
  2077. .good_info_img_div {
  2078. ul {
  2079. width: 100%;
  2080. li {
  2081. float: left;
  2082. width: 55px;
  2083. height: 55px;
  2084. padding: 0 5px 0 0;
  2085. .img-show-li-div {
  2086. width: 50px;
  2087. height: 50px;
  2088. border: 1px solid #dfe4ed;
  2089. background: #dfe4ed;
  2090. position: relative;
  2091. img.img-show {
  2092. width: 100%;
  2093. height: 100%;
  2094. position: relative;
  2095. display: inline-block;
  2096. }
  2097. i.el-icon-close {
  2098. position: absolute;
  2099. z-index: 2;
  2100. top: 0;
  2101. right: 0;
  2102. color: #dfe4ed;
  2103. }
  2104. &:hover {
  2105. i.el-icon-close {
  2106. cursor: pointer;
  2107. color: #63cbe7;
  2108. }
  2109. }
  2110. }
  2111. }
  2112. }
  2113. }
  2114. .goodsCostAdd-title {
  2115. border-top: 1px solid #ebeef5;
  2116. span {
  2117. height: 50px;
  2118. line-height: 50px;
  2119. font-family: "微软雅黑", sans-serif;
  2120. font-weight: 400;
  2121. font-style: normal;
  2122. font-size: 16fpx;
  2123. text-align: left;
  2124. }
  2125. }
  2126. }
  2127. </style>