Browse Source

优惠券

zhengjinyi 3 years ago
parent
commit
841ed585a5

+ 2 - 1
src/main/resources/static/js/shopping/cart.js

@@ -79,7 +79,7 @@ var shoppingCart = new Vue({
                     _self.totalCount = data.totalCount;
                     _self.totalCount = data.totalCount;
                     _self.totalPrice = data.totalPrice;
                     _self.totalPrice = data.totalPrice;
                     _self.promotionsList = data.promotions;
                     _self.promotionsList = data.promotions;
-                    _self.totalCouponList = data.couponList
+                    _self.totalCouponList = data.couponList;
                     // 默认全选
                     // 默认全选
                     _self.listData.forEach(function(supplier){
                     _self.listData.forEach(function(supplier){
                         supplier.checked = true;
                         supplier.checked = true;
@@ -352,6 +352,7 @@ var shoppingCart = new Vue({
             });
             });
         },
         },
         updateCart: function(cart){
         updateCart: function(cart){
+            var _self = this;
             ShoppingApi.ShoppingCartUpdate({userID:_self.userId,productID: cart.productId,productCount: cart.number},function(response){
             ShoppingApi.ShoppingCartUpdate({userID:_self.userId,productID: cart.productId,productCount: cart.number},function(response){
                 if(response.code === 0){
                 if(response.code === 0){
                     console.log('更新购物车商品数量成功');
                     console.log('更新购物车商品数量成功');

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

@@ -135,7 +135,7 @@ var shoppingConfirm = new Vue({
                     var data = response.data;
                     var data = response.data;
                     _self.listData = data.list;
                     _self.listData = data.list;
                     _self.totalPrice =  data.totalPrice;
                     _self.totalPrice =  data.totalPrice;
-                    _self.totalDiscountAmount = _self.reducedPrice = data.reducedPrice;
+                    _self.reducedPrice = data.reducedPrice;
                     _self.totalCount =  data.totalCount;
                     _self.totalCount =  data.totalCount;
                     _self.kindCount = data.kindCount;
                     _self.kindCount = data.kindCount;
                     _self.balance.userMoney = data.userMoney;
                     _self.balance.userMoney = data.userMoney;
@@ -144,10 +144,15 @@ var shoppingConfirm = new Vue({
                     _self.getAddressList(_self.userId,20);
                     _self.getAddressList(_self.userId,20);
                     if( data.couponList &&  data.couponList.length>0){
                     if( data.couponList &&  data.couponList.length>0){
                         _self.isCouponShow = true;
                         _self.isCouponShow = true;
+                        _self.couponAmount = data.couponList[0].couponAmount;
+                        _self.clubCouponId = data.couponList[0].clubCouponId;
                         data.couponList.forEach((el) => {
                         data.couponList.forEach((el) => {
                             _self.couponList.push(Object.assign(el,{ischecked:false}))
                             _self.couponList.push(Object.assign(el,{ischecked:false}))
                         })
                         })
+                        _self.couponList[0].ischecked = true;
+                        _self.payInfo.orderShouldPayFee = data.totalPrice - _self.couponAmount;
                     }
                     }
+                    _self.totalDiscountAmount =  _self.reducedPrice + _self.couponAmount;
                     if(data.invoice){
                     if(data.invoice){
                         data.invoice.type = 0;
                         data.invoice.type = 0;
                         _self.invoice =  data.invoice;
                         _self.invoice =  data.invoice;

+ 1 - 1
src/main/resources/templates/shopping/cart.html

@@ -203,7 +203,7 @@
             <div class="right">
             <div class="right">
                 <a class="submit" href="javascript:void(0);" @click="submitCart()" onclick="_czc.push(['_trackEvent','购物车去结算','点击','去结算','','Um_Event_CartConfirmOrder'])">去结算</a>
                 <a class="submit" href="javascript:void(0);" @click="submitCart()" onclick="_czc.push(['_trackEvent','购物车去结算','点击','去结算','','Um_Event_CartConfirmOrder'])">去结算</a>
                 <div  :class="isDiscount ?'item priceTotal':'item'">
                 <div  :class="isDiscount ?'item priceTotal':'item'">
-                    <p class="priceTotal-t">合计:<em>¥{{ totalPrice | NumFormat }}</em></p>
+                    <p class="priceTotal-t">合计:<em>¥{{ totalPrice - couponPrice  | NumFormat }}</em></p>
                     <p class="priceTotal-b" v-if="isDiscount"><em>共减¥{{ totalDiscountAmount | NumFormat }}</em></p>
                     <p class="priceTotal-b" v-if="isDiscount"><em>共减¥{{ totalDiscountAmount | NumFormat }}</em></p>
                 </div>
                 </div>
             </div>
             </div>