Browse Source

优惠券

zhengjinyi 3 năm trước cách đây
mục cha
commit
5426fecff0
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/main/resources/static/js/shopping/cart.js

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

@@ -247,8 +247,8 @@ var shoppingCart = new Vue({
                     let eligibleCoupons = _self.calculationCoupon();
                     if(eligibleCoupons.length>0){
                         _self.eligibleCoupons.splice(0,_self.eligibleCoupons.length);
-                        _self.eligibleCoupons.push(eligibleCoupons[0])
-                        _self.couponPrice = _self.eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount)[0].couponAmount
+                        _self.eligibleCoupons = eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount)
+                        _self.couponPrice = this.eligibleCoupons[0].couponAmount
                     }else{
                         _self.couponPrice = 0
                     }