Browse Source

购物车增加凑单促销叠化计算

zhengjinyi 3 năm trước cách đây
mục cha
commit
5f7d87ec81

+ 15 - 4
src/main/resources/static/js/shopping/cart.js

@@ -252,15 +252,26 @@ var shoppingCart = new Vue({
                 _self.promotionsList.forEach(function (promotions) {
                     // 凑单满减
                     if (promotions.mode * 1 === 2 && promotions.type * 1 === 2) {
-                        var total = 0;
+                        var collecTotal = 0;
+                        var collecDiscountNum = 0;
                         promotions.productList.forEach(function (product) {
                             if (_self.submitIds.includes(product.productId * 1)) {
                                 total += product.number * product.price;
                             }
                         });
-                        if (total >= promotions.touchPrice) {
-                            totalPrice -= promotions.reducedPrice;
-                            reducedPrice += promotions.reducedPrice;
+                        if(promotions.discount == 1){// 支持凑单满减促销叠加条件的执行
+                            collecDiscountNum += parseInt(collecTotal/promotions.touchPrice) // 凑单满减促销叠加次数 = 凑单商品合计价格/凑单满减促销价格
+                            console.log('凑单促销满减叠加通道叠加次数',`${collecDiscountNum}次`)
+                            if (collecTotal >= promotions.touchPrice) {
+                                totalPrice -= promotions.reducedPrice*collecDiscountNum
+                                reducedPrice += promotions.reducedPrice*collecDiscountNum
+                            }
+                        }else{
+                            console.log('凑单促销满减非叠加通道')
+                            if (collecTotal >= promotions.touchPrice) {
+                                totalPrice -= promotions.reducedPrice
+                                reducedPrice += promotions.reducedPrice
+                            }
                         }
                     }
                 });

+ 0 - 1
src/main/resources/static/js/shopping/confirm.js

@@ -824,7 +824,6 @@ var shoppingConfirm = new Vue({
             }else if(urlType === 3){// 组合商品立即购买
                 _self.supportParm.productInfo = CAIMEI.Storage.getItem("KEY_SUPPORE");
                 _self.OrderClubProductSupporting()
-                console.log('_self.supportParm.productInfo',_self.supportParm.productInfo)
             }
         }
     },