cr hace 4 años
padre
commit
7c912d2529

+ 11 - 4
src/pages/manage/cashier/index.vue

@@ -963,10 +963,17 @@ export default {
963 963
         selectPrice() {
964 964
             let num = 0;
965 965
             for (let item of this.selectList) {
966
-                if (item._sku) {
967
-                    num += (item._sku.price / 100) * item.select_num;
968
-                } else {
969
-                    num += (item.price / 100) * item.select_num;
966
+                // 是否为称重
967
+                if(item.isWeightGood){
968
+                    let n = (item.price / 100) * item.select_num;
969
+                    n = Number(n.toFixed(2));
970
+                    num+=n;
971
+                }else{
972
+                    if (item._sku) {
973
+                        num += (item._sku.price / 100) * item.select_num;
974
+                    } else {
975
+                        num += (item.price / 100) * item.select_num;
976
+                    }
970 977
                 }
971 978
             }
972 979
             num = num.toFixed(2);

+ 19 - 7
src/pages/manage/cashier/settlement.vue

@@ -431,7 +431,9 @@ export default {
431 431
                     productId: item.id,
432 432
                     // skuId:item.id,
433 433
                     skuId: item._sku ? item._sku.skuId : "",
434
-                    count: item.isWeightGood?parseInt(item.select_num*1000):item.select_num,
434
+                    count: item.isWeightGood
435
+                        ? parseInt(item.select_num * 1000)
436
+                        : item.select_num,
435 437
                     remark: "",
436 438
                 });
437 439
             }
@@ -512,7 +514,10 @@ export default {
512 514
                 scanType: "barCode",
513 515
                 success(res) {
514 516
                     console.log("扫码", res);
515
-                    if (res.scanType === "CODE_128" || res.scanType === "QR_CODE") {
517
+                    if (
518
+                        res.scanType === "CODE_128" ||
519
+                        res.scanType === "QR_CODE"
520
+                    ) {
516 521
                         uni.showLoading({
517 522
                             title: "支付中...",
518 523
                             mask: true,
@@ -602,11 +607,18 @@ export default {
602 607
         // 总金额
603 608
         totalPrice() {
604 609
             let n = 0;
605
-            for (let item of this.goods) {
606
-                if (item._sku) {
607
-                    n += (item._sku.price / 100) * item.select_num;
608
-                } else {
609
-                    n += (item.price / 100) * item.select_num;
610
+            // 是否为称重
611
+            if (item.isWeightGood) {
612
+                let m = (item.price / 100) * item.select_num;
613
+                m = Number(n.toFixed(2));
614
+                n += m;
615
+            } else {
616
+                for (let item of this.goods) {
617
+                    if (item._sku) {
618
+                        n += (item._sku.price / 100) * item.select_num;
619
+                    } else {
620
+                        n += (item.price / 100) * item.select_num;
621
+                    }
610 622
                 }
611 623
             }
612 624
             n = n.toFixed(2);

+ 12 - 12
src/pages/manage/cashier/weighModal.vue

@@ -96,10 +96,10 @@ export default {
96 96
         },
97 97
 
98 98
         getData() {
99
-            var ret = testModule.open({
100
-                name: "unimp",
101
-                age: 1,
102
-            });
99
+            // var ret = testModule.open({
100
+            //     name: "unimp",
101
+            //     age: 1,
102
+            // });
103 103
             setInterval(() => {
104 104
                 this.getWeight();
105 105
                 // this.getPrice();
@@ -108,14 +108,14 @@ export default {
108 108
         },
109 109
 
110 110
         getWeight() {
111
-            var ret = testModule.getWeight({
112
-                name: "unimp",
113
-                age: 1,
114
-            });
115
-            if (!ret) {
116
-                this.fn.showToast("获取weight错误");
117
-            }
118
-            // let ret = { code: "1.340" };
111
+            // var ret = testModule.getWeight({
112
+            //     name: "unimp",
113
+            //     age: 1,
114
+            // });
115
+            // if (!ret) {
116
+            //     this.fn.showToast("获取weight错误");
117
+            // }
118
+            let ret = { code: "1.340" };
119 119
             this.weighData.weight = ret.code;
120 120
 
121 121
             let num = Number(ret.code);