add-good-form.vue 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. <template>
  2. <div class="page" :class="{ 'page--iphoneX': iphoneX }">
  3. <!-- 基本信息 -->
  4. <div class="form-card">
  5. <div class="head">
  6. <div class="tit">基本信息</div>
  7. <div class="switch"></div>
  8. </div>
  9. <section class="form-item">
  10. <div class="label">
  11. <span class="required">*</span>
  12. 店铺:
  13. </div>
  14. <div class="box">
  15. <!-- <picker
  16. :mode="'selector'"
  17. :range="storeList"
  18. :range-key="'name'"
  19. @change="pickerStoreChange"
  20. > -->
  21. <input
  22. type="text"
  23. v-model="baseInfo._storeName"
  24. :disabled="true"
  25. placeholder="请选择"
  26. />
  27. <!-- </picker> -->
  28. </div>
  29. </section>
  30. <section class="form-item">
  31. <div class="label">
  32. <span class="required">*</span>
  33. 商品条码:
  34. </div>
  35. <div class="box">
  36. <input
  37. type="text"
  38. v-model="baseInfo.barCode"
  39. @confirm="getBarCodeGood"
  40. />
  41. </div>
  42. <div class="tool code-tool">
  43. <span class="generate" @click="createBarcode()">生成</span>
  44. <my-image
  45. class="scan-img"
  46. @click="scan"
  47. src="/static/icon/scan.png"
  48. ></my-image>
  49. </div>
  50. </section>
  51. <section class="form-item">
  52. <div class="label">
  53. <span class="required">*</span>
  54. 商品标题:
  55. </div>
  56. <div class="box">
  57. <input type="text" v-model="baseInfo.name" />
  58. </div>
  59. </section>
  60. <section class="form-item">
  61. <div class="label">
  62. <span class="required hide">*</span>
  63. 初始销量:
  64. </div>
  65. <div class="box">
  66. <input type="number" v-model="baseInfo.initialSale" />
  67. </div>
  68. </section>
  69. <section class="form-item">
  70. <div class="label">
  71. <span class="required">*</span>
  72. 分类:
  73. </div>
  74. <div class="box">
  75. <div
  76. class="type-tip"
  77. v-if="cateList.length === 0"
  78. @touchstart.stop
  79. >
  80. 加载中...
  81. </div>
  82. <div
  83. class="type-item"
  84. v-for="(item, index) of typeList"
  85. :key="index"
  86. >
  87. <picker
  88. :mode="'multiSelector'"
  89. :range="cateList"
  90. :range-key="'name'"
  91. @columnchange="typeColumnchange"
  92. @change="pickerTypeChange($event, index)"
  93. >
  94. <input
  95. type="text"
  96. :disabled="true"
  97. :value="item.name"
  98. placeholder="请选择"
  99. />
  100. </picker>
  101. <span class="remove-text" @click="typeRemove(index,item)"
  102. >删除</span
  103. >
  104. </div>
  105. <div class="add-type" @click="addType">增加分类</div>
  106. </div>
  107. </section>
  108. </div>
  109. <!-- 规格 -->
  110. <div class="form-card sepc-card">
  111. <div class="head">
  112. <div class="tit">规格</div>
  113. <div class="switch"></div>
  114. </div>
  115. <section class="form-item">
  116. <div class="label">
  117. <span class="required">*</span>
  118. 规格数目:
  119. </div>
  120. <div class="box">
  121. <ul class="spec-list">
  122. <li
  123. :class="{ on: specIndex === 0 }"
  124. @click="specClick(0)"
  125. >
  126. 单品
  127. </li>
  128. <li
  129. :class="{ on: specIndex === 1 }"
  130. @click="specClick(1)"
  131. >
  132. 一种
  133. </li>
  134. <li
  135. :class="{ on: specIndex === 2 }"
  136. @click="specClick(2)"
  137. >
  138. 两种
  139. </li>
  140. <li
  141. :class="{ on: specIndex === 3 }"
  142. @click="specClick(3)"
  143. >
  144. 三种
  145. </li>
  146. </ul>
  147. </div>
  148. </section>
  149. <section
  150. class="form-item"
  151. v-if="specIndex === 1 || specIndex === 2 || specIndex === 3"
  152. >
  153. <div class="label">
  154. <span class="required">*</span>
  155. 规格一:
  156. </div>
  157. <div class="box">
  158. <div class="spec-view" @click="specEdit(1)">
  159. <span class="text" :class="{ dis: !specData1 }">{{
  160. specData1 | arrView
  161. }}</span>
  162. <my-image
  163. class="spec-link"
  164. src="/static/common/arrows_left.png"
  165. ></my-image>
  166. </div>
  167. </div>
  168. </section>
  169. <section
  170. class="form-item"
  171. v-if="specIndex === 2 || specIndex === 3"
  172. >
  173. <div class="label">
  174. <span class="required">*</span>
  175. 规格二:
  176. </div>
  177. <div class="box">
  178. <div class="spec-view" @click="specEdit(2)">
  179. <span class="text" :class="{ dis: !specData2 }">{{
  180. specData2 | arrView
  181. }}</span>
  182. <my-image
  183. class="spec-link"
  184. src="/static/common/arrows_left.png"
  185. ></my-image>
  186. </div>
  187. </div>
  188. </section>
  189. <section class="form-item" v-if="specIndex === 3">
  190. <div class="label">
  191. <span class="required">*</span>
  192. 规格三:
  193. </div>
  194. <div class="box">
  195. <div class="spec-view" @click="specEdit(3)">
  196. <span class="text" :class="{ dis: !specData3 }">{{
  197. specData3 | arrView
  198. }}</span>
  199. <my-image
  200. class="spec-link"
  201. src="/static/common/arrows_left.png"
  202. ></my-image>
  203. </div>
  204. </div>
  205. </section>
  206. <!-- 单品 -->
  207. <black v-if="specIndex === 0">
  208. <section class="form-item">
  209. <div class="label">
  210. <span class="required">*</span>
  211. 价格:
  212. </div>
  213. <div class="box">
  214. <input type="digit" v-model="baseInfo.price" />
  215. </div>
  216. <div class="tool">
  217. <span class="">元</span>
  218. </div>
  219. </section>
  220. <section class="form-item">
  221. <div class="label">
  222. <span class="required hide">*</span>
  223. 进货价:
  224. </div>
  225. <div class="box">
  226. <input type="digit" v-model="baseInfo.supplyPrice" />
  227. </div>
  228. <div class="tool">
  229. <span class="">元</span>
  230. </div>
  231. </section>
  232. <section class="form-item">
  233. <div class="label">
  234. <span class="required hide">*</span>
  235. 成本:
  236. </div>
  237. <div class="box">
  238. <input type="digit" v-model="baseInfo.cost" />
  239. </div>
  240. <div class="tool">
  241. <span class="">元</span>
  242. </div>
  243. </section>
  244. <section class="form-item">
  245. <div class="label">
  246. <span class="required hide">*</span>
  247. 划线价:
  248. </div>
  249. <div class="box">
  250. <input type="digit" v-model="baseInfo.tagPrice" />
  251. </div>
  252. <div class="tool">
  253. <span class="">元</span>
  254. </div>
  255. </section>
  256. <section class="form-item">
  257. <div class="label">
  258. <span class="required">*</span>
  259. 重量:
  260. </div>
  261. <div class="box">
  262. <input type="number" v-model="baseInfo.weight" />
  263. </div>
  264. <div class="tool">
  265. <span class="">克</span>
  266. </div>
  267. </section>
  268. <section class="form-item">
  269. <div class="label">
  270. <span class="required">*</span>
  271. 库存:
  272. </div>
  273. <div class="box">
  274. <input type="number" v-model="baseInfo.stock" />
  275. </div>
  276. </section>
  277. <section class="form-item">
  278. <div class="label">
  279. <span class="required">*</span>
  280. sku编码:
  281. </div>
  282. <div class="box">
  283. <input type="digit" v-model="baseInfo.skuCode" />
  284. </div>
  285. <div class="tool code-tool">
  286. <span class="generate" @click="generateCode('skuCode')"
  287. >生成</span
  288. >
  289. </div>
  290. </section>
  291. </black>
  292. <black v-if="specIndex !== 0">
  293. <section
  294. class="spec-item"
  295. v-for="item of skuTableData"
  296. :key="item.key"
  297. >
  298. <div class="spec-head" @click="specForm(item)">
  299. <span class="name">组合一:{{ item.key }}</span>
  300. <my-image
  301. class="img"
  302. src="/static/common/arrows_left.png"
  303. ></my-image>
  304. </div>
  305. <div class="con">
  306. <div class="con-item">
  307. 价格<span class="required">*</span>:{{
  308. item.price
  309. }}
  310. </div>
  311. <div class="con-item">
  312. 库存<span class="required">*</span>:{{
  313. item.stock
  314. }}
  315. </div>
  316. </div>
  317. </section>
  318. </black>
  319. </div>
  320. <!-- 图片 -->
  321. <div class="form-card img-card">
  322. <section class="form-img-item">
  323. <div class="tit"><span class="required">*</span>封面图</div>
  324. <div class="list">
  325. <easy-upload
  326. :types="'image'"
  327. :value="mainImage"
  328. :uploadCount="1"
  329. :openCilp="true"
  330. @change="minImgChange"
  331. ></easy-upload>
  332. </div>
  333. </section>
  334. <section class="form-img-item">
  335. <div class="tit"><span class="required">*</span>主图</div>
  336. <div class="list">
  337. <easy-upload
  338. :types="'image'"
  339. :value="productForm.images"
  340. :uploadCount="100"
  341. @change="imagesChange"
  342. ></easy-upload>
  343. </div>
  344. </section>
  345. <section class="form-img-item">
  346. <div class="tit">
  347. <span class="required hide">*</span>详情图
  348. </div>
  349. <div class="list">
  350. <easy-upload
  351. :types="'image'"
  352. :value="productForm.detailImages"
  353. :uploadCount="100"
  354. @change="detailImagesChange"
  355. ></easy-upload>
  356. </div>
  357. </section>
  358. <section class="form-img-item">
  359. <div class="tit">
  360. <span class="required hide">*</span>视频<span class="gray-text">(视频文件最大不超过100M)</span>
  361. </div>
  362. <div class="list">
  363. <easy-upload
  364. :types="'video'"
  365. v-model="video"
  366. :upload_max="100"
  367. :uploadCount="1"
  368. @change="videoChange"
  369. ></easy-upload>
  370. </div>
  371. </section>
  372. </div>
  373. <!-- 其他 -->
  374. <div class="form-card">
  375. <div class="head">
  376. <div class="tit">其他信息</div>
  377. <div class="switch">
  378. <switch :checked="showOther" @change="otherChange"></switch>
  379. </div>
  380. </div>
  381. <block v-if="showOther">
  382. <section class="form-item">
  383. <div class="label">
  384. <span class="required">*</span>
  385. 商品编码:
  386. </div>
  387. <div class="box">
  388. <input type="text" v-model="baseInfo.code" />
  389. </div>
  390. <div class="tool code-tool">
  391. <span class="generate" @click="generateCode('code')"
  392. >生成</span
  393. >
  394. </div>
  395. </section>
  396. <section class="form-item">
  397. <div class="label">
  398. <span class="required">*</span>
  399. 模板详情:
  400. </div>
  401. <div class="box">
  402. <radio-group @change="tempChange">
  403. <label>
  404. <radio
  405. :value="true"
  406. :checked="productForm.useTemplate === true"
  407. />
  408. <text>是</text>
  409. </label>
  410. <label>
  411. <radio
  412. :value="false"
  413. :checked="productForm.useTemplate === false"
  414. />
  415. <text>否</text>
  416. </label>
  417. </radio-group>
  418. </div>
  419. </section>
  420. <section class="form-item">
  421. <div class="label">
  422. <span class="required hide">*</span>
  423. 商品描述:
  424. </div>
  425. <div class="box">
  426. <textarea
  427. v-model="baseInfo.description"
  428. :maxlength="1048"
  429. :auto-height="true"
  430. ></textarea>
  431. </div>
  432. </section>
  433. <section class="form-item">
  434. <div class="label">
  435. <span class="required">*</span>
  436. 出售方式:
  437. </div>
  438. <div class="box">
  439. <picker
  440. :mode="'selector'"
  441. :range="sellType"
  442. :range-key="'key'"
  443. @change="pickerStatusChange"
  444. >
  445. <input
  446. type="text"
  447. :disabled="true"
  448. v-model="baseInfo._statusName"
  449. placeholder="请选择"
  450. />
  451. </picker>
  452. </div>
  453. </section>
  454. <section class="form-item">
  455. <div class="label">
  456. <span class="required hide">*</span>
  457. 限购数:
  458. </div>
  459. <div class="box">
  460. <input
  461. type="number"
  462. v-model="baseInfo.maxBuyableCount"
  463. />
  464. </div>
  465. </section>
  466. <!-- <section class="form-item">
  467. <div class="label">
  468. <span class="required">*</span>
  469. 供应商:
  470. </div>
  471. <div class="box">
  472. <picker :mode="'selector'" :range="supplierList">
  473. <input
  474. type="text"
  475. :disabled="true"
  476. placeholder="请选择"
  477. />
  478. </picker>
  479. </div>
  480. </section> -->
  481. </block>
  482. </div>
  483. <div class="btns">
  484. <button type="button" class="btn" @click="save('back')">
  485. 保存返回
  486. </button>
  487. <button type="button" class="btn" @click="save('next')">
  488. 保存继续
  489. </button>
  490. </div>
  491. <div class="spec-set-modal"></div>
  492. </div>
  493. </template>
  494. <script>
  495. import MyImage from "../../components/image/index";
  496. import easyUpload from "../../components/easy-upload/easy-upload";
  497. import EasyUpload from '../../components/easy-upload/easy-upload.vue';
  498. export default {
  499. name: "",
  500. components: { MyImage, EasyUpload },
  501. filters: {
  502. arrView(val) {
  503. let str = "";
  504. if (val) {
  505. str += val.name + ": ";
  506. for (let item of val.list) {
  507. str += item + ",";
  508. }
  509. str = str.replace(/,$/, "");
  510. }
  511. return str;
  512. },
  513. },
  514. // 数据
  515. data() {
  516. return {
  517. sellType: [
  518. { key: "立即出售", value: 1 },
  519. { key: "放入仓库", value: 0 },
  520. ], // 出售方式
  521. supplierList: ["测试供应商"], // 供应商
  522. storeList: [], // 店铺列表
  523. cateList: [], // 分类列表
  524. showOther: false, // 显示其他
  525. barCodeData: {}, // 条码扫描数据
  526. // 选中的分类列表 {id,name}
  527. typeList: [{}],
  528. // 基本信息表, _为前端临时用
  529. baseInfo: {
  530. storeId: "", // 店铺id
  531. _storeName: "", // 店铺名 前台显示用
  532. barCode: "", // 条码
  533. name: "", // 标题
  534. code: "", // 编码
  535. description: "", // 描述
  536. productTypeIds: [], // 分类
  537. price: 0, // 价格
  538. supplyPrice: 0, // 进货价
  539. cost: 0, // 成本
  540. tagPrice: 0, //划线价,单位为分
  541. weight: 0, //商品重量,单位为g
  542. stock: 0, // 库存
  543. skuCode: "", // sku编码
  544. initialSale: 0, // 初始销量
  545. status: 1, // 出售方式 0-放入仓库(即没有上架),1-立即出售(即上架)
  546. _statusName: "立即出售",
  547. maxBuyableCount: 0, // 限购数
  548. mainImage: "", // 封面图 300 *300
  549. },
  550. productForm: {
  551. useTemplate: true, // 是否使用模板
  552. images: [], // 主图
  553. detailImages: [], // 详情图
  554. video:''
  555. },
  556. mainImage: [],
  557. video:[],
  558. // 规格
  559. specIndex: 0,
  560. specData1: null, // {name,list,columnName}
  561. specData2: null, // {name,list,columnName}
  562. specData3: null, // {name,list,columnName}
  563. curSpecIndex: 0, // 当前编辑specData
  564. skuTableData: [], // sku表格数据 详情见initSkuTable
  565. skuAttrs: {}, // sku后台保存用
  566. submitLoading:false,
  567. };
  568. },
  569. onLoad() {
  570. this.reset();
  571. // this.getStore();
  572. if (this.user.storeId) {
  573. this.baseInfo.storeId = this.user.storeId;
  574. this.baseInfo._storeName = this.user.storeName;
  575. }
  576. this.getClassify(this.baseInfo.storeId);
  577. },
  578. async onShow() {
  579. // 规格设置
  580. console.log("specData", this.$store.state.common.specData);
  581. if (this.$store.state.common.specData) {
  582. switch (this.curSpecIndex) {
  583. case 1:
  584. this.specData1 = this.$store.state.common.specData;
  585. break;
  586. case 2:
  587. this.specData2 = this.$store.state.common.specData;
  588. break;
  589. case 3:
  590. this.specData3 = this.$store.state.common.specData;
  591. break;
  592. }
  593. this.$store.commit("common/update", {
  594. specData: null,
  595. });
  596. this.initSkuTable();
  597. }
  598. // sku值
  599. console.log("skuItem", this.$store.state.common.skuItem);
  600. if (this.$store.state.common.skuItem) {
  601. let d = this.$store.state.common.skuItem;
  602. let arr = [];
  603. for (let item of this.skuTableData) {
  604. if (item.key === d.key) {
  605. arr.push(d);
  606. } else {
  607. arr.push(item);
  608. }
  609. }
  610. this.$store.commit("common/update", {
  611. skuItem: null,
  612. });
  613. this.skuTableData = arr;
  614. }
  615. },
  616. // 函数
  617. methods: {
  618. // 获取店铺
  619. getStore() {
  620. this.api.get("/Store/GetShopList").then((res) => {
  621. this.storeList = res.data;
  622. });
  623. },
  624. // 获取分类
  625. getClassify(storeId) {
  626. this.api
  627. .get("/Product/GetProductType", {
  628. storeId,
  629. })
  630. .then((res) => {
  631. let arr = [res.data];
  632. if (res.data[0].children) {
  633. arr.push(res.data[0].children);
  634. } else {
  635. arr.push([]);
  636. }
  637. this.cateList = arr;
  638. });
  639. },
  640. // 条码回车
  641. barCodeKeyup() {
  642. let self = this;
  643. if (self.baseInfo.barCode) {
  644. self.getBarCodeGood();
  645. }
  646. },
  647. // 条码扫描
  648. scan() {
  649. let self = this;
  650. wx.scanCode({
  651. scanType: "barCode",
  652. success(res) {
  653. console.log("扫码", res);
  654. if (res.scanType === "EAN_13") {
  655. let code = res.result;
  656. self.baseInfo.barCode = code;
  657. self.baseInfo.code = code;
  658. self.baseInfo.skuCode = code;
  659. uni.showLoading({
  660. title: "识别条码中...",
  661. });
  662. self.getBarCodeGood();
  663. } else {
  664. self.fn.showToast("扫码失败,不是有效条码,请重新扫描");
  665. }
  666. },
  667. fail(res) {
  668. self.fn.showToast("扫码失败");
  669. console.log("扫码失败:", res);
  670. },
  671. });
  672. },
  673. // 获取条码商品
  674. getBarCodeGood() {
  675. let self = this;
  676. this.api
  677. .get(
  678. "/Product/GetProductByBarcode",
  679. {
  680. barcode: self.baseInfo.barCode,
  681. },
  682. { pass: true }
  683. )
  684. .then((res) => {
  685. uni.hideLoading();
  686. if (res.code === "200203") {
  687. // 标准库存在
  688. self.barCodeData = res.data;
  689. self.pullBarCodeData();
  690. } else if (res.code === "200202") {
  691. // 其他门店存在
  692. self.barCodeData = res.data;
  693. self.fn
  694. .showModal({
  695. content: "该条码在其他门店存在数据,是否复制",
  696. })
  697. .then((res) => {
  698. if (res.confirm) {
  699. self.pullBarCodeData();
  700. }
  701. });
  702. } else if (res.code === "200201") {
  703. // 当前门店存在
  704. self.barCodeData = res.data;
  705. self.fn
  706. .showModal({
  707. content:
  708. "该条码在当前门店存在已有数据,是否去编辑",
  709. })
  710. .then((res) => {
  711. if (res.confirm) {
  712. self.router.replace({
  713. path: "/pages/manage/edit-good-form",
  714. query: {
  715. id: self.barCodeData.baseInfo.id,
  716. },
  717. });
  718. }
  719. });
  720. } else {
  721. self.fn.showToast("当前条码无已有商品数据");
  722. }
  723. });
  724. },
  725. // 赋值条码数据
  726. pullBarCodeData() {
  727. let data = this.barCodeData;
  728. this.baseInfo = {
  729. ...data.baseInfo,
  730. };
  731. if (data.baseInfo.mainImage) {
  732. this.mainImage = [data.baseInfo.mainImage];
  733. } else {
  734. this.mainImage = [];
  735. }
  736. if (data.video) {
  737. this.video = [data.video];
  738. } else {
  739. this.video = [];
  740. }
  741. this.productForm.useTemplate = data.useTemplate;
  742. this.productForm.images = data.images;
  743. this.productForm.detailImages = data.detailImages;
  744. // 店铺不变
  745. if (this.user.storeId) {
  746. this.baseInfo.storeId = this.user.storeId;
  747. this.baseInfo._storeName = this.user.storeName;
  748. }
  749. // 状态
  750. this.baseInfo.status = 1;
  751. this.baseInfo._statusName = "立即出售";
  752. // 价格处理
  753. this.baseInfo.price = this.baseInfo.price / 100;
  754. this.baseInfo.supplyPrice = this.baseInfo.supplyPrice / 100;
  755. this.baseInfo.cost = this.baseInfo.cost / 100;
  756. this.baseInfo.tagPrice = this.baseInfo.tagPrice / 100;
  757. //编码 sku吗 等于条码
  758. if (!this.baseInfo.code) {
  759. this.baseInfo.code = this.baseInfo.barCode;
  760. }
  761. if (!this.baseInfo.skuCode) {
  762. this.baseInfo.skuCode = this.baseInfo.barCode;
  763. }
  764. // 多规格还原
  765. this.specClick(0);
  766. this.specData1 = null;
  767. this.specData2 = null;
  768. this.specData3 = null;
  769. this.curSpecIndex = 0;
  770. this.skuTableData = [];
  771. this.skuAttrs = {};
  772. console.log(this.baseInfo);
  773. this.$forceUpdate();
  774. },
  775. // 生成编码
  776. generateCode(name) {
  777. // 后台编码生成方式
  778. const timestamp = Date.parse(new Date());
  779. this.baseInfo[name] = timestamp;
  780. },
  781. //随机生成13位条形码
  782. createBarcode() {
  783. const timestamp = Date.parse(new Date());
  784. this.baseInfo.barCode = timestamp;
  785. if (!this.baseInfo.code) {
  786. this.baseInfo.code = timestamp;
  787. }
  788. if (!this.baseInfo.skuCode) {
  789. this.baseInfo.skuCode = timestamp;
  790. }
  791. },
  792. // 其他面板切换
  793. otherChange(e) {
  794. this.showOther = !this.showOther;
  795. },
  796. // 模板详情切换
  797. tempChange(e) {
  798. let val = e.target.value;
  799. if (val === "true") {
  800. this.productForm.useTemplate = true;
  801. } else {
  802. this.productForm.useTemplate = false;
  803. }
  804. },
  805. // 主图
  806. minImgChange(e) {
  807. this.baseInfo.mainImage = e[0] || "";
  808. },
  809. // 视频
  810. videoChange(e) {
  811. this.productForm.video = e[0] || "";
  812. },
  813. // 封面图
  814. imagesChange(e) {
  815. this.productForm.images = e;
  816. },
  817. // 详情图
  818. detailImagesChange(e) {
  819. this.productForm.detailImages = e;
  820. },
  821. // picker变化
  822. // 店铺
  823. pickerStoreChange(e) {
  824. let index = e.target.value;
  825. let val = this.storeList[index];
  826. this.baseInfo.storeId = val.id;
  827. this.baseInfo._storeName = val.name;
  828. this.typeList = [{}];
  829. this.cateList = [];
  830. this.getClassify(val.id);
  831. },
  832. // 分类
  833. addType() {
  834. this.typeList.push({});
  835. },
  836. typeRemove(i) {
  837. this.typeList.splice(i, 1);
  838. this.typeList = [...this.typeList];
  839. let ids = [];
  840. for(let item of this.baseInfo.productTypeIds){
  841. if(item !== val.id){
  842. ids.push(item);
  843. }
  844. }
  845. this.baseInfo.productTypeIds = ids;
  846. },
  847. pickerTypeChange(e, typeListIndex) {
  848. let index1 = e.detail.value[0] || 0;
  849. let index2 = e.detail.value[1] || 0;
  850. let name = this.cateList[0][index1].name;
  851. let id = this.cateList[0][index1].id;
  852. if (this.cateList[1].length) {
  853. name += "/" + this.cateList[1][index2].name;
  854. id = this.cateList[1][index2].id;
  855. }
  856. this.typeList[typeListIndex].name = name;
  857. this.typeList[typeListIndex].id = id;
  858. this.typeList = [...this.typeList];
  859. let ids = [];
  860. for (let item of this.typeList) {
  861. if (item.id) {
  862. ids.push(item.id);
  863. }
  864. }
  865. this.baseInfo.productTypeIds = ids;
  866. this.cateList[1] = this.cateList[0][0].children || [];
  867. },
  868. typeColumnchange(e) {
  869. let column = e.detail.column;
  870. let index = e.detail.value;
  871. if (column === 0) {
  872. let val = this.cateList[0][index];
  873. if (val.children) {
  874. this.cateList[1] = val.children;
  875. } else {
  876. this.cateList[1] = [];
  877. }
  878. this.$forceUpdate();
  879. }
  880. },
  881. // 出售方式
  882. pickerStatusChange(e) {
  883. let index = e.target.value;
  884. let val = this.sellType[index];
  885. this.baseInfo.status = val.value;
  886. this.baseInfo._statusName = val.key;
  887. },
  888. // 保存
  889. save(type) {
  890. if(this.submitLoading){
  891. return;
  892. }
  893. let requiredFile1 = [
  894. {
  895. key: "storeId",
  896. msg: "请选择店铺",
  897. },
  898. {
  899. key: "name",
  900. msg: "请输入商品标题",
  901. },
  902. {
  903. key: "code",
  904. msg: "请输入商品编码",
  905. },
  906. {
  907. key: "productTypeIds",
  908. type: "array",
  909. msg: "请选择分类",
  910. },
  911. {
  912. key: "mainImage",
  913. msg: "请上传封面图",
  914. },
  915. ];
  916. let requiredSku = [
  917. {
  918. key: "price",
  919. msg: "请输入价格",
  920. },
  921. {
  922. key: "weight",
  923. type: "number",
  924. msg: "请输入重量",
  925. },
  926. {
  927. key: "stock",
  928. type: "number",
  929. msg: "请输入库存",
  930. },
  931. {
  932. key: "skuCode",
  933. msg: "请输入sku编码",
  934. },
  935. ];
  936. let requiredFile2 = [
  937. {
  938. key: "images",
  939. type: "array",
  940. msg: "请上传主图",
  941. },
  942. // {
  943. // key: "detailImages",
  944. // type: "array",
  945. // msg: "请上传详情图",
  946. // }
  947. ];
  948. for (let item of requiredFile1) {
  949. if (item.type === "array") {
  950. if (this.baseInfo[item.key].length === 0) {
  951. return this.fn.showToast(item.msg);
  952. }
  953. } else if (item.type === "number") {
  954. if (!this.baseInfo[item.key]) {
  955. if (String(this.baseInfo[item.key]) !== "0") {
  956. return this.fn.showToast(item.msg);
  957. }
  958. }
  959. } else {
  960. if (!this.baseInfo[item.key]) {
  961. return this.fn.showToast(item.msg);
  962. }
  963. }
  964. }
  965. for (let item of requiredFile2) {
  966. if (item.type === "array") {
  967. if (this.productForm[item.key].length === 0) {
  968. return this.fn.showToast(item.msg);
  969. }
  970. } else if (item.type === "number") {
  971. if (!this.productForm[item.key]) {
  972. if (String(this.productForm[item.key]) !== "0") {
  973. return this.fn.showToast(item.msg);
  974. }
  975. }
  976. } else {
  977. if (!this.productForm[item.key]) {
  978. return this.fn.showToast(item.msg);
  979. }
  980. }
  981. }
  982. // 规格判断
  983. let skuInfo = "";
  984. if (this.specIndex === 0) {
  985. for (let item of requiredSku) {
  986. if (item.type === "array") {
  987. if (this.baseInfo[item.key].length === 0) {
  988. return this.fn.showToast(item.msg);
  989. }
  990. } else if (item.type === "number") {
  991. if (!this.baseInfo[item.key]) {
  992. if (String(this.baseInfo[item.key]) !== "0") {
  993. return this.fn.showToast(item.msg);
  994. }
  995. }
  996. } else {
  997. if (!this.baseInfo[item.key]) {
  998. return this.fn.showToast(item.msg);
  999. }
  1000. }
  1001. }
  1002. } else {
  1003. if (this.skuTableData.length === 0) {
  1004. return this.fn.showToast("请先选择规格");
  1005. }
  1006. // 价格转换
  1007. let arr = JSON.parse(JSON.stringify(this.skuTableData));
  1008. for (let item of arr) {
  1009. item.price = parseInt(Number(item.price) * 100);
  1010. item.supplyPrice = parseInt(Number(item.supplyPrice) * 100);
  1011. item.cost = parseInt(Number(item.cost) * 100);
  1012. item.tagPrice = parseInt(Number(item.tagPrice) * 100);
  1013. }
  1014. skuInfo = JSON.stringify({
  1015. skuAttrs: this.skuAttrs,
  1016. skus: arr,
  1017. });
  1018. }
  1019. let sendData = {
  1020. baseInfo: {
  1021. ...this.baseInfo,
  1022. },
  1023. ...this.productForm,
  1024. hotSaleRecommendIds: [],
  1025. businessRecommendIds: [],
  1026. participated: false,
  1027. participatedBox:false,
  1028. skuInfo: skuInfo,
  1029. };
  1030. if(sendData.baseInfo.weight){
  1031. sendData.baseInfo.weight = Number(sendData.baseInfo.weight);
  1032. }
  1033. if(sendData.baseInfo.stock){
  1034. sendData.baseInfo.stock = Number(sendData.baseInfo.stock);
  1035. }
  1036. if(sendData.baseInfo.initialSale){
  1037. sendData.baseInfo.initialSale = Number(sendData.baseInfo.initialSale);
  1038. }
  1039. //规格判断
  1040. if (this.specIndex === 0) {
  1041. sendData.baseInfo.price = parseInt(
  1042. Number(sendData.baseInfo.price) * 100
  1043. );
  1044. sendData.baseInfo.supplyPrice = parseInt(
  1045. Number(sendData.baseInfo.supplyPrice) * 100
  1046. );
  1047. sendData.baseInfo.cost = parseInt(
  1048. Number(sendData.baseInfo.cost) * 100
  1049. );
  1050. sendData.baseInfo.tagPrice = parseInt(
  1051. Number(sendData.baseInfo.tagPrice) * 100
  1052. );
  1053. }
  1054. this.submitLoading = true;
  1055. this.api.post("/product/SaveEdit", sendData,{pass:true}).then((res) => {
  1056. this.submitLoading = false;
  1057. if (res.success) {
  1058. if (type === "next") {
  1059. this.fn.showToast("保存成功");
  1060. this.reset();
  1061. } else {
  1062. this.fn.showToast("保存成功");
  1063. this.router.back();
  1064. }
  1065. } else {
  1066. this.fn.showModal({
  1067. content: res.message,
  1068. showCancel: false,
  1069. });
  1070. }
  1071. });
  1072. },
  1073. // 重置
  1074. reset() {
  1075. this.typeList = [{}];
  1076. this.baseInfo = {
  1077. storeId: "", // 店铺id
  1078. _storeName: "", // 店铺名 前台显示用
  1079. barCode: "", // 条码
  1080. name: "", // 标题
  1081. code: "", // 编码
  1082. description: "", // 描述
  1083. productTypeIds: [], // 分类
  1084. price: 0, // 价格
  1085. supplyPrice: 0, // 进货价
  1086. cost: 0, // 成本
  1087. tagPrice: 0, //划线价,单位为分
  1088. weight: 0, //商品重量,单位为g
  1089. stock: 0, // 库存
  1090. skuCode: "", // sku编码
  1091. initialSale: 0, // 初始销量
  1092. status: 1, // 出售方式 0-放入仓库(即没有上架),1-立即出售(即上架)
  1093. _statusName: "立即出售",
  1094. maxBuyableCount: 0, // 限购数
  1095. mainImage: "", // 主图 300 *300
  1096. };
  1097. this.productForm = {
  1098. useTemplate: true, // 是否使用模板
  1099. images: [], // 封面图
  1100. detailImages: [], // 详情图
  1101. video:''
  1102. };
  1103. this.video = [];
  1104. this.mainImage = [];
  1105. if (this.user.storeId) {
  1106. this.baseInfo.storeId = this.user.storeId;
  1107. this.baseInfo._storeName = this.user.storeName;
  1108. }
  1109. this.specIndex = 0;
  1110. this.specData1 = null;
  1111. this.specData2 = null;
  1112. this.specData3 = null;
  1113. this.curSpecIndex = 0;
  1114. this.skuTableData = [];
  1115. this.skuAttrs = {};
  1116. uni.pageScrollTo({
  1117. scrollTop: 0,
  1118. });
  1119. this.$forceUpdate();
  1120. },
  1121. // 规格点击
  1122. specClick(index) {
  1123. this.specIndex = index;
  1124. switch (index) {
  1125. case 0:
  1126. this.specData1 = null;
  1127. this.specData2 = null;
  1128. this.specData3 = null;
  1129. this.skuTableData = [];
  1130. this.skuAttrs = {};
  1131. this.curSpecIndex = 0;
  1132. break;
  1133. case 1:
  1134. this.specData2 = null;
  1135. this.specData3 = null;
  1136. break;
  1137. case 2:
  1138. this.specData3 = null;
  1139. break;
  1140. }
  1141. if (index !== 0) {
  1142. this.baseInfo.price = 0;
  1143. this.baseInfo.supplyPrice = 0;
  1144. this.baseInfo.cost = 0;
  1145. this.baseInfo.tagPrice = 0;
  1146. this.baseInfo.weight = 0;
  1147. this.baseInfo.stock = 0;
  1148. this.baseInfo.skuCode = "";
  1149. }
  1150. },
  1151. // 规格设置
  1152. specEdit(index) {
  1153. switch (index) {
  1154. case 1:
  1155. this.$store.commit("common/update", {
  1156. specData: this.specData1,
  1157. });
  1158. break;
  1159. case 2:
  1160. this.$store.commit("common/update", {
  1161. specData: this.specData2,
  1162. });
  1163. break;
  1164. case 3:
  1165. this.$store.commit("common/update", {
  1166. specData: this.specData3,
  1167. });
  1168. break;
  1169. }
  1170. this.curSpecIndex = index;
  1171. this.router.push("/pages/manage/spec-edit");
  1172. },
  1173. // 规格表单
  1174. specForm(item) {
  1175. console.log(item);
  1176. this.$store.commit("common/update", {
  1177. skuItem: item,
  1178. });
  1179. this.router.push("/pages/manage/spec-item-form");
  1180. },
  1181. // 生成skuTable
  1182. initSkuTable() {
  1183. let arr = [];
  1184. let skuAttrs = {};
  1185. if (this.specData1) {
  1186. for (let item of this.specData1.list) {
  1187. if (this.specData2) {
  1188. for (let item2 of this.specData2.list) {
  1189. if (this.specData3) {
  1190. for (let item3 of this.specData3.list) {
  1191. let tabItem = this.initSkuItem({
  1192. key: item + "-" + item2 + "-" + item3,
  1193. [this.specData1.columnName]: item,
  1194. [this.specData2.columnName]: item2,
  1195. [this.specData3.columnName]: item3,
  1196. });
  1197. skuAttrs[
  1198. this.specData1.columnName
  1199. ] = this.specData1.name;
  1200. skuAttrs[
  1201. this.specData2.columnName
  1202. ] = this.specData2.name;
  1203. skuAttrs[
  1204. this.specData3.columnName
  1205. ] = this.specData3.name;
  1206. arr.push(tabItem);
  1207. }
  1208. } else {
  1209. let tabItem = this.initSkuItem({
  1210. key: item + "-" + item2,
  1211. [this.specData1.columnName]: item,
  1212. [this.specData2.columnName]: item2,
  1213. });
  1214. skuAttrs[
  1215. this.specData1.columnName
  1216. ] = this.specData1.name;
  1217. skuAttrs[
  1218. this.specData2.columnName
  1219. ] = this.specData2.name;
  1220. arr.push(tabItem);
  1221. }
  1222. }
  1223. } else {
  1224. let tabItem = this.initSkuItem({
  1225. key: item,
  1226. [this.specData1.columnName]: item,
  1227. });
  1228. skuAttrs[
  1229. this.specData1.columnName
  1230. ] = this.specData1.name;
  1231. arr.push(tabItem);
  1232. }
  1233. }
  1234. }
  1235. let arr2 = [];
  1236. for (let item of arr) {
  1237. let f = false;
  1238. for (let skuItem of this.skuTableData) {
  1239. if (item.key === skuItem.key) {
  1240. arr2.push(skuItem);
  1241. f = true;
  1242. }
  1243. }
  1244. if (!f) {
  1245. arr2.push(item);
  1246. }
  1247. }
  1248. this.skuTableData = arr2;
  1249. this.skuAttrs = skuAttrs;
  1250. },
  1251. // 生成sku某一项
  1252. initSkuItem(obj = {}) {
  1253. //
  1254. //this.fn.guid()
  1255. return {
  1256. code: String(Date.now()), // 编码
  1257. cost: 0, // 成本
  1258. img:
  1259. "https://oss.ixiaokejia.com/images/common/20201021094129.png", // sku图
  1260. key: "", //关键字
  1261. order: 0, // 顺序
  1262. price: 0,
  1263. skuId: "",
  1264. stock: 0, // 库存
  1265. supplyPrice: 0, // 进货价
  1266. tagPrice: 0, // 标签价
  1267. weight: 0, // 重量
  1268. ...obj,
  1269. };
  1270. },
  1271. },
  1272. // 数据计算
  1273. computed: {
  1274. user() {
  1275. return this.$store.state.user.user;
  1276. },
  1277. },
  1278. // 数据监听
  1279. watch: {},
  1280. };
  1281. </script>
  1282. <style lang="scss" scoped>
  1283. .page {
  1284. padding-bottom: px(180);
  1285. }
  1286. .form-card {
  1287. background-color: #fff;
  1288. padding: 0 px(30);
  1289. & ~ .form-card {
  1290. margin-top: px(25);
  1291. }
  1292. .head {
  1293. display: flex;
  1294. align-items: center;
  1295. justify-content: space-between;
  1296. height: px(140);
  1297. background-color: #fbfbfb;
  1298. border-bottom: 1px solid #f1f1f1;
  1299. border-top: 1px solid #f1f1f1;
  1300. font-size: px(48);
  1301. }
  1302. }
  1303. .required {
  1304. color: #f00;
  1305. font-size: px(44);
  1306. &.hide {
  1307. visibility: hidden;
  1308. }
  1309. }
  1310. .form-item {
  1311. display: flex;
  1312. min-height: px(140);
  1313. padding: px(30) 0;
  1314. box-sizing: border-box;
  1315. align-items: center;
  1316. font-size: px(44);
  1317. & ~ .form-item {
  1318. border-top: 1px solid #f1f1f1;
  1319. }
  1320. .label {
  1321. width: px(240);
  1322. flex-shrink: 0;
  1323. color: #999;
  1324. margin-right: px(10);
  1325. }
  1326. .box {
  1327. width: 100%;
  1328. position: relative;
  1329. input {
  1330. width: 100%;
  1331. }
  1332. }
  1333. .tool {
  1334. flex-shrink: 0;
  1335. color: #999;
  1336. margin-left: px(10);
  1337. }
  1338. textarea,
  1339. input {
  1340. max-width: 100%;
  1341. width: 100%;
  1342. }
  1343. }
  1344. .code-tool {
  1345. display: flex;
  1346. justify-content: flex-start;
  1347. align-items: center;
  1348. .scan-img {
  1349. flex-shrink: 0;
  1350. width: px(80);
  1351. height: px(80);
  1352. /deep/ img {
  1353. width: px(80);
  1354. height: px(80);
  1355. }
  1356. }
  1357. .generate {
  1358. color: #0097d1;
  1359. margin-right: px(30);
  1360. flex-shrink: 0;
  1361. }
  1362. }
  1363. radio-group {
  1364. label ~ label {
  1365. margin-left: px(40);
  1366. }
  1367. }
  1368. .img-card {
  1369. padding-top: px(30);
  1370. padding-bottom: px(30);
  1371. }
  1372. .form-img-item {
  1373. .tit {
  1374. padding: px(30);
  1375. font-size: px(44);
  1376. }
  1377. }
  1378. .btns {
  1379. display: flex;
  1380. justify-content: space-between;
  1381. align-items: center;
  1382. position: fixed;
  1383. bottom: 0;
  1384. left: 0;
  1385. right: 0;
  1386. z-index: 100;
  1387. }
  1388. button::after {
  1389. border: none;
  1390. display: none;
  1391. }
  1392. button::before {
  1393. border: none;
  1394. display: none;
  1395. }
  1396. .page--iphoneX {
  1397. .btns {
  1398. padding-bottom: px(30);
  1399. background-color: rgb(0, 188, 38);
  1400. }
  1401. }
  1402. .btn {
  1403. background-color: rgb(0, 188, 38);
  1404. color: #fff;
  1405. border-radius: 0;
  1406. font-size: px(50);
  1407. border: none;
  1408. width: 50%;
  1409. & ~ .btn {
  1410. border-left: 1px solid #999;
  1411. }
  1412. }
  1413. .add-type {
  1414. width: 100%;
  1415. font-size: px(40);
  1416. color: #0097d1;
  1417. padding: px(20) 0;
  1418. }
  1419. .type-item {
  1420. padding: px(20) 0;
  1421. display: flex;
  1422. justify-content: space-between;
  1423. align-items: center;
  1424. border-bottom: 1px solid #f1f1f1;
  1425. .remove-text {
  1426. color: red;
  1427. flex-shrink: 0;
  1428. margin-left: px(10);
  1429. padding-left: px(30);
  1430. }
  1431. }
  1432. .type-tip {
  1433. position: absolute;
  1434. top: 0;
  1435. left: 0;
  1436. width: 100%;
  1437. height: 100%;
  1438. z-index: 100;
  1439. background-color: rgba(0, 0, 0, 0.3);
  1440. color: #fff;
  1441. font-size: px(44);
  1442. display: flex;
  1443. justify-content: center;
  1444. align-items: center;
  1445. pointer-events: none;
  1446. }
  1447. .min-radio {
  1448. transform: scale(0.8);
  1449. }
  1450. .spec-list {
  1451. width: 100%;
  1452. display: flex;
  1453. justify-content: space-between;
  1454. align-items: center;
  1455. li {
  1456. width: 25%;
  1457. font-size: px(40);
  1458. height: px(100);
  1459. border: 1px solid #f1f1f1;
  1460. display: flex;
  1461. align-items: center;
  1462. justify-content: center;
  1463. color: #999;
  1464. & ~ li {
  1465. // border-left: none;
  1466. }
  1467. &.on {
  1468. color: rgb(0, 188, 38);
  1469. border-color: rgb(0, 188, 38);
  1470. }
  1471. }
  1472. }
  1473. .spec-view {
  1474. display: flex;
  1475. justify-content: flex-end;
  1476. align-items: center;
  1477. .text {
  1478. font-size: px(40);
  1479. &.dis {
  1480. color: #999;
  1481. }
  1482. }
  1483. .spec-link {
  1484. width: px(50);
  1485. height: px(50);
  1486. margin-left: px(20);
  1487. transform: rotate(180deg);
  1488. /deep/ img {
  1489. width: px(50);
  1490. height: px(50);
  1491. }
  1492. }
  1493. }
  1494. .spec-item {
  1495. border: 1px solid #f1f1f1;
  1496. margin-top: px(30);
  1497. .spec-head {
  1498. display: flex;
  1499. justify-content: space-between;
  1500. align-items: center;
  1501. background-color: #f9f9f9;
  1502. border-bottom: 1px solid #f1f1f1;
  1503. padding: px(0) px(30);
  1504. height: px(120);
  1505. line-height: px(100);
  1506. font-size: px(44);
  1507. .img {
  1508. width: px(40);
  1509. height: px(40);
  1510. transform: rotate(180deg);
  1511. /deep/ img {
  1512. width: px(40);
  1513. height: px(40);
  1514. }
  1515. }
  1516. }
  1517. .con {
  1518. display: flex;
  1519. justify-content: space-between;
  1520. align-items: center;
  1521. padding: px(30) px(30);
  1522. }
  1523. .con-item {
  1524. width: 50%;
  1525. font-size: px(44);
  1526. color: #333;
  1527. }
  1528. }
  1529. .sepc-card {
  1530. padding-bottom: px(30);
  1531. }
  1532. .gray-text{
  1533. color: #999;
  1534. display: inline-block;
  1535. margin-left: px(10);
  1536. }
  1537. </style>