baseForm.vue 69 KB

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