|
@@ -28,25 +28,24 @@
|
28
|
28
|
</section>
|
29
|
29
|
<section class="form-item">
|
30
|
30
|
<div class="label">
|
31
|
|
- <span class="required hide">*</span>
|
|
31
|
+ <span class="required">*</span>
|
32
|
32
|
商品条码:
|
33
|
33
|
</div>
|
34
|
34
|
<div class="box">
|
35
|
35
|
<input
|
36
|
36
|
type="text"
|
37
|
|
- class="dis"
|
38
|
|
- :disabled="true"
|
39
|
37
|
v-model="baseInfo.barCode"
|
|
38
|
+ @confirm="getBarCodeGood"
|
40
|
39
|
/>
|
41
|
40
|
</div>
|
42
|
|
- <!-- <div class="tool code-tool">
|
|
41
|
+ <div class="tool code-tool">
|
43
|
42
|
<span class="generate" @click="createBarcode()">生成</span>
|
44
|
43
|
<my-image
|
45
|
44
|
class="scan-img"
|
46
|
45
|
@click="scan"
|
47
|
46
|
src="/static/icon/scan.png"
|
48
|
47
|
></my-image>
|
49
|
|
- </div> -->
|
|
48
|
+ </div>
|
50
|
49
|
</section>
|
51
|
50
|
|
52
|
51
|
<section class="form-item">
|
|
@@ -149,107 +148,109 @@
|
149
|
148
|
|
150
|
149
|
<section class="form-item">
|
151
|
150
|
<div class="label">
|
152
|
|
- <span class="required hide">*</span>
|
153
|
|
- 进货价:
|
|
151
|
+ <span class="required">*</span>
|
|
152
|
+ 重量:
|
154
|
153
|
</div>
|
155
|
154
|
<div class="box">
|
156
|
|
- <input type="digit" v-model="baseInfo.supplyPrice" />
|
|
155
|
+ <input type="digit" v-model="baseInfo.weight" />
|
157
|
156
|
</div>
|
158
|
157
|
<div class="tool">
|
159
|
|
- <span class="">元</span>
|
|
158
|
+ <span class="">克</span>
|
160
|
159
|
</div>
|
161
|
160
|
</section>
|
162
|
161
|
|
163
|
162
|
<section class="form-item">
|
164
|
163
|
<div class="label">
|
165
|
|
- <span class="required hide">*</span>
|
166
|
|
- 成本:
|
|
164
|
+ <span class="required">*</span>
|
|
165
|
+ 库存:
|
167
|
166
|
</div>
|
168
|
167
|
<div class="box">
|
169
|
|
- <input type="digit" v-model="baseInfo.cost" />
|
170
|
|
- </div>
|
171
|
|
- <div class="tool">
|
172
|
|
- <span class="">元</span>
|
|
168
|
+ <input type="digit" v-model="baseInfo.stock" />
|
173
|
169
|
</div>
|
174
|
170
|
</section>
|
175
|
171
|
|
176
|
172
|
<section class="form-item">
|
177
|
173
|
<div class="label">
|
178
|
|
- <span class="required hide">*</span>
|
179
|
|
- 划线价:
|
|
174
|
+ <span class="required">*</span>
|
|
175
|
+ sku编码:
|
180
|
176
|
</div>
|
181
|
177
|
<div class="box">
|
182
|
|
- <input type="digit" v-model="baseInfo.tagPrice" />
|
|
178
|
+ <input type="digit" v-model="baseInfo.skuCode" />
|
183
|
179
|
</div>
|
184
|
|
- <div class="tool">
|
185
|
|
- <span class="">元</span>
|
|
180
|
+ <div class="tool code-tool">
|
|
181
|
+ <span class="generate" @click="generateCode('skuCode')"
|
|
182
|
+ >生成</span
|
|
183
|
+ >
|
186
|
184
|
</div>
|
187
|
185
|
</section>
|
188
|
186
|
|
189
|
187
|
<section class="form-item">
|
190
|
188
|
<div class="label">
|
191
|
|
- <span class="required">*</span>
|
192
|
|
- 重量:
|
|
189
|
+ <span class="required hide">*</span>
|
|
190
|
+ 进货价:
|
193
|
191
|
</div>
|
194
|
192
|
<div class="box">
|
195
|
|
- <input type="digit" v-model="baseInfo.weight" />
|
|
193
|
+ <input type="digit" v-model="baseInfo.supplyPrice" />
|
196
|
194
|
</div>
|
197
|
195
|
<div class="tool">
|
198
|
|
- <span class="">克</span>
|
|
196
|
+ <span class="">元</span>
|
199
|
197
|
</div>
|
200
|
198
|
</section>
|
201
|
199
|
|
202
|
200
|
<section class="form-item">
|
203
|
201
|
<div class="label">
|
204
|
|
- <span class="required">*</span>
|
205
|
|
- 库存:
|
|
202
|
+ <span class="required hide">*</span>
|
|
203
|
+ 成本:
|
206
|
204
|
</div>
|
207
|
205
|
<div class="box">
|
208
|
|
- <input type="digit" v-model="baseInfo.stock" />
|
|
206
|
+ <input type="digit" v-model="baseInfo.cost" />
|
|
207
|
+ </div>
|
|
208
|
+ <div class="tool">
|
|
209
|
+ <span class="">元</span>
|
209
|
210
|
</div>
|
210
|
211
|
</section>
|
211
|
212
|
|
212
|
213
|
<section class="form-item">
|
213
|
214
|
<div class="label">
|
214
|
|
- <span class="required">*</span>
|
215
|
|
- sku编码:
|
|
215
|
+ <span class="required hide">*</span>
|
|
216
|
+ 划线价:
|
216
|
217
|
</div>
|
217
|
218
|
<div class="box">
|
218
|
|
- <input type="digit" v-model="baseInfo.skuCode" />
|
|
219
|
+ <input type="digit" v-model="baseInfo.tagPrice" />
|
219
|
220
|
</div>
|
220
|
|
- <div class="tool code-tool">
|
221
|
|
- <span class="generate" @click="generateCode('skuCode')"
|
222
|
|
- >生成</span
|
223
|
|
- >
|
|
221
|
+ <div class="tool">
|
|
222
|
+ <span class="">元</span>
|
224
|
223
|
</div>
|
225
|
224
|
</section>
|
226
|
225
|
</div>
|
227
|
226
|
|
228
|
227
|
<div class="form-card img-card">
|
229
|
228
|
<section class="form-img-item">
|
230
|
|
- <div class="tit"><span class="required">*</span>主图</div>
|
|
229
|
+ <div class="tit"><span class="required">*</span>封面图</div>
|
231
|
230
|
<div class="list">
|
232
|
231
|
<easy-upload
|
233
|
232
|
:types="'image'"
|
234
|
|
- v-model="mainImage"
|
235
|
|
- :uploadCount="1"
|
236
|
|
- @change="minImgChange"
|
|
233
|
+ v-model="productForm.images"
|
|
234
|
+ :uploadCount="100"
|
|
235
|
+ @change="imagesChange"
|
237
|
236
|
></easy-upload>
|
238
|
237
|
</div>
|
239
|
238
|
</section>
|
240
|
239
|
<section class="form-img-item">
|
241
|
|
- <div class="tit"><span class="required">*</span>封面图</div>
|
|
240
|
+ <div class="tit"><span class="required">*</span>主图</div>
|
242
|
241
|
<div class="list">
|
243
|
242
|
<easy-upload
|
244
|
243
|
:types="'image'"
|
245
|
|
- v-model="productForm.images"
|
246
|
|
- :uploadCount="100"
|
247
|
|
- @change="imagesChange"
|
|
244
|
+ v-model="mainImage"
|
|
245
|
+ :uploadCount="1"
|
|
246
|
+ @change="minImgChange"
|
248
|
247
|
></easy-upload>
|
249
|
248
|
</div>
|
250
|
249
|
</section>
|
251
|
250
|
<section class="form-img-item">
|
252
|
|
- <div class="tit"><span class="required">*</span>详情图</div>
|
|
251
|
+ <div class="tit">
|
|
252
|
+ <span class="required hide">*</span>详情图
|
|
253
|
+ </div>
|
253
|
254
|
<div class="list">
|
254
|
255
|
<easy-upload
|
255
|
256
|
:types="'image'"
|
|
@@ -461,6 +462,13 @@ export default {
|
461
|
462
|
this.productForm.useTemplate = this.oldData.useTemplate;
|
462
|
463
|
this.productForm.images = this.oldData.images;
|
463
|
464
|
this.productForm.detailImages = this.oldData.detailImages;
|
|
465
|
+
|
|
466
|
+ if(this.baseInfo.status ===0){
|
|
467
|
+ this.baseInfo._statusName = '放入仓库';
|
|
468
|
+ }else{
|
|
469
|
+ this.baseInfo._statusName = '立即出售';
|
|
470
|
+ }
|
|
471
|
+
|
464
|
472
|
this.$forceUpdate();
|
465
|
473
|
|
466
|
474
|
this.getStore();
|
|
@@ -468,6 +476,7 @@ export default {
|
468
|
476
|
});
|
469
|
477
|
},
|
470
|
478
|
|
|
479
|
+
|
471
|
480
|
// 获取分类
|
472
|
481
|
getClassify(storeId) {
|
473
|
482
|
this.api
|
|
@@ -486,6 +495,8 @@ export default {
|
486
|
495
|
});
|
487
|
496
|
},
|
488
|
497
|
|
|
498
|
+
|
|
499
|
+
|
489
|
500
|
// 初始已选分类
|
490
|
501
|
initCate(cateList) {
|
491
|
502
|
let cateIds = this.baseInfo.productTypeIds;
|
|
@@ -517,42 +528,158 @@ export default {
|
517
|
528
|
}
|
518
|
529
|
},
|
519
|
530
|
|
|
531
|
+
|
|
532
|
+ // 条码回车
|
|
533
|
+ barCodeKeyup() {
|
|
534
|
+ let self = this;
|
|
535
|
+ if (self.baseInfo.barCode) {
|
|
536
|
+ self.getBarCodeGood();
|
|
537
|
+ }
|
|
538
|
+ },
|
|
539
|
+
|
|
540
|
+ // 条码扫描
|
|
541
|
+ scan() {
|
|
542
|
+ let self = this;
|
|
543
|
+ wx.scanCode({
|
|
544
|
+ scanType: "barCode",
|
|
545
|
+ success(res) {
|
|
546
|
+ console.log("扫码", res);
|
|
547
|
+ let code = res.result;
|
|
548
|
+ self.baseInfo.barCode = code;
|
|
549
|
+ self.baseInfo.code = code;
|
|
550
|
+ self.baseInfo.skuCode = code;
|
|
551
|
+ uni.showLoading({
|
|
552
|
+ title: "识别条码中...",
|
|
553
|
+ });
|
|
554
|
+ self.getBarCodeGood();
|
|
555
|
+ },
|
|
556
|
+ fail(res) {
|
|
557
|
+ self.fn.showToast("扫码失败");
|
|
558
|
+ console.log("扫码失败:", res);
|
|
559
|
+ },
|
|
560
|
+ });
|
|
561
|
+ },
|
|
562
|
+
|
|
563
|
+ // 获取条码商品
|
|
564
|
+ getBarCodeGood() {
|
|
565
|
+ let self = this;
|
|
566
|
+ this.api
|
|
567
|
+ .get(
|
|
568
|
+ "/Product/GetProductByBarcode",
|
|
569
|
+ {
|
|
570
|
+ barcode: self.baseInfo.barCode,
|
|
571
|
+ },
|
|
572
|
+ { pass: true }
|
|
573
|
+ )
|
|
574
|
+ .then((res) => {
|
|
575
|
+ uni.hideLoading();
|
|
576
|
+ if (res.code === "200203") {
|
|
577
|
+ // 标准库存在
|
|
578
|
+ self.barCodeData = res.data;
|
|
579
|
+ self.pullBarCodeData();
|
|
580
|
+ // self.fn
|
|
581
|
+ // .showModal({
|
|
582
|
+ // content: "该条码存在标准库数据,是否复制",
|
|
583
|
+ // })
|
|
584
|
+ // .then((res) => {
|
|
585
|
+ // if (res.confirm) {
|
|
586
|
+ // self.pullBarCodeData();
|
|
587
|
+ // }
|
|
588
|
+ // });
|
|
589
|
+ self.pullBarCodeData();
|
|
590
|
+ } else if (res.code === "200202") {
|
|
591
|
+ // 其他门店存在
|
|
592
|
+ self.barCodeData = res.data;
|
|
593
|
+ self.fn
|
|
594
|
+ .showModal({
|
|
595
|
+ content: "该条码在其他门店存在数据,是否复制",
|
|
596
|
+ })
|
|
597
|
+ .then((res) => {
|
|
598
|
+ if (res.confirm) {
|
|
599
|
+ self.pullBarCodeData();
|
|
600
|
+ }
|
|
601
|
+ });
|
|
602
|
+ } else if (res.code === "200201") {
|
|
603
|
+ // 当前门店存在
|
|
604
|
+ self.barCodeData = res.data;
|
|
605
|
+ self.fn
|
|
606
|
+ .showModal({
|
|
607
|
+ content:
|
|
608
|
+ "该条码在当前门店存在已有数据,是否去编辑",
|
|
609
|
+ })
|
|
610
|
+ .then((res) => {
|
|
611
|
+ if (res.confirm) {
|
|
612
|
+ self.router.replace({
|
|
613
|
+ path: "/pages/manage/edit-good-form",
|
|
614
|
+ query: {
|
|
615
|
+ id: self.barCodeData.baseInfo.id,
|
|
616
|
+ },
|
|
617
|
+ });
|
|
618
|
+ }
|
|
619
|
+ });
|
|
620
|
+ } else {
|
|
621
|
+ self.fn.showToast("当前条码无已有商品数据");
|
|
622
|
+ }
|
|
623
|
+ });
|
|
624
|
+ },
|
|
625
|
+
|
|
626
|
+ // 赋值条码数据
|
|
627
|
+ pullBarCodeData() {
|
|
628
|
+ let data = this.barCodeData;
|
|
629
|
+ this.baseInfo = {
|
|
630
|
+ ...data.baseInfo,
|
|
631
|
+ };
|
|
632
|
+ this.mainImage = [data.baseInfo.mainImage];
|
|
633
|
+ this.productForm.useTemplate = data.useTemplate;
|
|
634
|
+ this.productForm.images = data.images;
|
|
635
|
+ this.productForm.detailImages = data.detailImages;
|
|
636
|
+
|
|
637
|
+ // 店铺不变
|
|
638
|
+ if (this.user.storeId) {
|
|
639
|
+ this.baseInfo.storeId = this.user.storeId;
|
|
640
|
+ this.baseInfo._storeName = this.user.storeName;
|
|
641
|
+ } else {
|
|
642
|
+ this.baseInfo.storeId = this.$store.state.common.manageShop.id;
|
|
643
|
+ this.baseInfo._storeName = this.$store.state.common.manageShop.name;
|
|
644
|
+ }
|
|
645
|
+
|
|
646
|
+ // 状态判断
|
|
647
|
+ if (this.baseInfo.status === 1) {
|
|
648
|
+ this.baseInfo._statusName = "立即出售";
|
|
649
|
+ } else if (this.baseInfo.status === 0) {
|
|
650
|
+ this.baseInfo._statusName = "放入仓库";
|
|
651
|
+ } else {
|
|
652
|
+ this.baseInfo.status = 1;
|
|
653
|
+ this.baseInfo._statusName = "立即出售";
|
|
654
|
+ }
|
|
655
|
+
|
|
656
|
+ // 价格处理
|
|
657
|
+ this.baseInfo.price = this.baseInfo.price / 100;
|
|
658
|
+ this.baseInfo.supplyPrice = this.baseInfo.supplyPrice / 100;
|
|
659
|
+ this.baseInfo.cost = this.baseInfo.cost / 100;
|
|
660
|
+ this.baseInfo.tagPrice = this.baseInfo.tagPrice / 100;
|
|
661
|
+
|
|
662
|
+ //编码 sku吗 等于条码
|
|
663
|
+ if (!this.baseInfo.code) {
|
|
664
|
+ this.baseInfo.code = this.baseInfo.barcode;
|
|
665
|
+ }
|
|
666
|
+ if (!this.baseInfo.skuCode) {
|
|
667
|
+ this.baseInfo.skuCode = this.baseInfo.barcode;
|
|
668
|
+ }
|
|
669
|
+
|
|
670
|
+ this.$forceUpdate();
|
|
671
|
+ },
|
|
672
|
+
|
520
|
673
|
// 生成编码
|
521
|
674
|
generateCode(name) {
|
522
|
675
|
// 后台编码生成方式
|
523
|
676
|
const timestamp = Date.parse(new Date());
|
524
|
677
|
this.baseInfo[name] = timestamp;
|
525
|
678
|
},
|
526
|
|
- //生成13位条形码功能函数
|
527
|
|
- //获取校验位
|
528
|
|
- CheckBarCode(s) {
|
529
|
|
- let a = 0,
|
530
|
|
- b = 0,
|
531
|
|
- c = 0,
|
532
|
|
- d = 0,
|
533
|
|
- e = 0;
|
534
|
|
- for (let i = 1; i <= 12; i++) {
|
535
|
|
- let sc = parseInt(s[i - 1]);
|
536
|
|
- if (i <= 12 && i % 2 == 0) {
|
537
|
|
- a += sc;
|
538
|
|
- } else if (i <= 11 && i % 2 == 1) {
|
539
|
|
- b += sc;
|
540
|
|
- }
|
541
|
|
- }
|
542
|
|
- c = a * 3;
|
543
|
|
- d = b + c;
|
544
|
|
- if (d % 10 == 0) e = d - d;
|
545
|
|
- else e = d + (10 - (d % 10)) - d;
|
546
|
|
- return e;
|
547
|
|
- },
|
548
|
679
|
//随机生成13位条形码
|
549
|
680
|
createBarcode() {
|
550
|
|
- let str = "69";
|
551
|
|
- for (let i = 0; i < 10; i++) {
|
552
|
|
- str += Math.floor(Math.random() * 10);
|
553
|
|
- }
|
554
|
|
- let checkcode = this.CheckBarCode(str);
|
555
|
|
- this.baseInfo.barCode = str + checkcode;
|
|
681
|
+ const timestamp = Date.parse(new Date());
|
|
682
|
+ this.baseInfo.barCode = timestamp;
|
556
|
683
|
},
|
557
|
684
|
|
558
|
685
|
// 其他面板切换
|
|
@@ -615,7 +742,6 @@ export default {
|
615
|
742
|
name += "/" + this.cateList[1][index2].name;
|
616
|
743
|
id = this.cateList[1][index2].id;
|
617
|
744
|
}
|
618
|
|
- console.log(name, id);
|
619
|
745
|
this.typeList[typeListIndex].name = name;
|
620
|
746
|
this.typeList[typeListIndex].id = id;
|
621
|
747
|
this.typeList = [...this.typeList];
|
|
@@ -814,7 +940,6 @@ export default {
|
814
|
940
|
.box {
|
815
|
941
|
width: 100%;
|
816
|
942
|
position: relative;
|
817
|
|
- height: 100%;
|
818
|
943
|
input {
|
819
|
944
|
width: 100%;
|
820
|
945
|
}
|
|
@@ -863,8 +988,6 @@ radio-group {
|
863
|
988
|
padding: px(30);
|
864
|
989
|
font-size: px(44);
|
865
|
990
|
}
|
866
|
|
- .list {
|
867
|
|
- }
|
868
|
991
|
}
|
869
|
992
|
.btns {
|
870
|
993
|
margin-top: px(60);
|
|
@@ -895,7 +1018,8 @@ radio-group {
|
895
|
1018
|
.remove-text {
|
896
|
1019
|
color: red;
|
897
|
1020
|
flex-shrink: 0;
|
898
|
|
- margin-left: px(20);
|
|
1021
|
+ margin-left: px(10);
|
|
1022
|
+ padding-left: px(30);
|
899
|
1023
|
}
|
900
|
1024
|
}
|
901
|
1025
|
.type-tip {
|
|
@@ -913,7 +1037,4 @@ radio-group {
|
913
|
1037
|
align-items: center;
|
914
|
1038
|
pointer-events: none;
|
915
|
1039
|
}
|
916
|
|
-// input.dis{
|
917
|
|
-// background-color: #f1f1f1;
|
918
|
|
-// }
|
919
|
1040
|
</style>
|