baseForm.vue 62 KB

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