baseForm.vue 71 KB

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