baseForm.vue 63 KB

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