|
@@ -35,6 +35,7 @@
|
35
|
35
|
<input type="text" v-model="baseInfo.barCode" />
|
36
|
36
|
</div>
|
37
|
37
|
<div class="tool code-tool">
|
|
38
|
+ <span class="generate" @click="createBarcode()">生成</span>
|
38
|
39
|
<my-image
|
39
|
40
|
class="scan-img"
|
40
|
41
|
@click="scan"
|
|
@@ -347,7 +348,14 @@
|
347
|
348
|
</block>
|
348
|
349
|
</div>
|
349
|
350
|
|
350
|
|
- <button type="button" class="btn" @click="save">保存</button>
|
|
351
|
+ <div class="btns">
|
|
352
|
+ <button type="button" class="btn" @click="save('back')">
|
|
353
|
+ 保存返回
|
|
354
|
+ </button>
|
|
355
|
+ <button type="button" class="btn" @click="save('next')">
|
|
356
|
+ 保存继续
|
|
357
|
+ </button>
|
|
358
|
+ </div>
|
351
|
359
|
</div>
|
352
|
360
|
</template>
|
353
|
361
|
|
|
@@ -456,10 +464,41 @@ export default {
|
456
|
464
|
},
|
457
|
465
|
|
458
|
466
|
// 生成编码
|
459
|
|
- generateCode(file) {
|
|
467
|
+ generateCode(name) {
|
460
|
468
|
// 后台编码生成方式
|
461
|
469
|
const timestamp = Date.parse(new Date());
|
462
|
|
- this.baseInfo[file] = timestamp;
|
|
470
|
+ this.baseInfo[name] = timestamp;
|
|
471
|
+ },
|
|
472
|
+ //生成13位条形码功能函数
|
|
473
|
+ //获取校验位
|
|
474
|
+ CheckBarCode(s) {
|
|
475
|
+ let a = 0,
|
|
476
|
+ b = 0,
|
|
477
|
+ c = 0,
|
|
478
|
+ d = 0,
|
|
479
|
+ e = 0;
|
|
480
|
+ for (let i = 1; i <= 12; i++) {
|
|
481
|
+ let sc = parseInt(s[i - 1]);
|
|
482
|
+ if (i <= 12 && i % 2 == 0) {
|
|
483
|
+ a += sc;
|
|
484
|
+ } else if (i <= 11 && i % 2 == 1) {
|
|
485
|
+ b += sc;
|
|
486
|
+ }
|
|
487
|
+ }
|
|
488
|
+ c = a * 3;
|
|
489
|
+ d = b + c;
|
|
490
|
+ if (d % 10 == 0) e = d - d;
|
|
491
|
+ else e = d + (10 - (d % 10)) - d;
|
|
492
|
+ return e;
|
|
493
|
+ },
|
|
494
|
+ //随机生成13位条形码
|
|
495
|
+ createBarcode() {
|
|
496
|
+ let str = "69";
|
|
497
|
+ for (let i = 0; i < 10; i++) {
|
|
498
|
+ str += Math.floor(Math.random() * 10);
|
|
499
|
+ }
|
|
500
|
+ let checkcode = this.CheckBarCode(str);
|
|
501
|
+ this.baseInfo.barCode = str + checkcode;
|
463
|
502
|
},
|
464
|
503
|
|
465
|
504
|
// 其他面板切换
|
|
@@ -557,7 +596,7 @@ export default {
|
557
|
596
|
},
|
558
|
597
|
|
559
|
598
|
// 保存
|
560
|
|
- save() {
|
|
599
|
+ save(type) {
|
561
|
600
|
let requiredFile1 = [
|
562
|
601
|
{
|
563
|
602
|
key: "storeId",
|
|
@@ -637,19 +676,34 @@ export default {
|
637
|
676
|
let sendData = {
|
638
|
677
|
baseInfo: {
|
639
|
678
|
...this.baseInfo,
|
640
|
|
- companyId:'0520aa13-517d-4f69-88ef-c0b543372af7'
|
|
679
|
+ companyId: "0520aa13-517d-4f69-88ef-c0b543372af7",
|
641
|
680
|
},
|
642
|
681
|
...this.productForm,
|
643
|
|
- hotSaleRecommendIds:[],
|
644
|
|
- businessRecommendIds:[],
|
645
|
|
- participated:false,
|
646
|
|
- video:''
|
|
682
|
+ hotSaleRecommendIds: [],
|
|
683
|
+ businessRecommendIds: [],
|
|
684
|
+ participated: false,
|
|
685
|
+ video: "",
|
647
|
686
|
};
|
648
|
|
- sendData.baseInfo.price = Number(sendData.baseInfo.price)* 100;
|
649
|
|
- sendData.baseInfo.supplyPrice = Number(sendData.baseInfo.supplyPrice)* 100;
|
650
|
|
- sendData.baseInfo.cost = Number(sendData.baseInfo.cost)* 100;
|
651
|
|
- sendData.baseInfo.tagPrice = Number(sendData.baseInfo.tagPrice)* 100;
|
652
|
|
- this.api.post("/product/SaveEdit", sendData).then((res) => {});
|
|
687
|
+ sendData.baseInfo.price = Number(sendData.baseInfo.price) * 100;
|
|
688
|
+ sendData.baseInfo.supplyPrice =
|
|
689
|
+ Number(sendData.baseInfo.supplyPrice) * 100;
|
|
690
|
+ sendData.baseInfo.cost = Number(sendData.baseInfo.cost) * 100;
|
|
691
|
+ sendData.baseInfo.tagPrice =
|
|
692
|
+ Number(sendData.baseInfo.tagPrice) * 100;
|
|
693
|
+ this.api.post("/product/SaveEdit", sendData).then((res) => {
|
|
694
|
+ if(res.success){
|
|
695
|
+ if(type==='next'){
|
|
696
|
+
|
|
697
|
+ }else{
|
|
698
|
+ this.router.back();
|
|
699
|
+ }
|
|
700
|
+ }else{
|
|
701
|
+ this.fn.showModal({
|
|
702
|
+ content:res.message,
|
|
703
|
+ showCancel:false
|
|
704
|
+ })
|
|
705
|
+ }
|
|
706
|
+ });
|
653
|
707
|
},
|
654
|
708
|
},
|
655
|
709
|
|
|
@@ -756,12 +810,19 @@ radio-group {
|
756
|
810
|
.list {
|
757
|
811
|
}
|
758
|
812
|
}
|
759
|
|
-.btn {
|
|
813
|
+.btns {
|
760
|
814
|
margin-top: px(60);
|
|
815
|
+ display: flex;
|
|
816
|
+ justify-content: space-between;
|
|
817
|
+ align-items: center;
|
|
818
|
+}
|
|
819
|
+.btn {
|
761
|
820
|
background-color: rgb(0, 188, 38);
|
762
|
821
|
color: #fff;
|
763
|
822
|
border-radius: 0;
|
|
823
|
+ font-size: px(50);
|
764
|
824
|
border: none;
|
|
825
|
+ width: 50%;
|
765
|
826
|
}
|
766
|
827
|
.add-type {
|
767
|
828
|
width: 100%;
|