选中已使用的优惠劵,则剩余多少张优惠劵,不提示
Showing
4 changed files
with
24 additions
and
15 deletions
@@ -81,6 +81,7 @@ $couponList.on('touchstart', '.employ-main', function() { | @@ -81,6 +81,7 @@ $couponList.on('touchstart', '.employ-main', function() { | ||
81 | $('body').on('touchend', '.not-use', function() { | 81 | $('body').on('touchend', '.not-use', function() { |
82 | orderInfo('couponCode', null); | 82 | orderInfo('couponCode', null); |
83 | orderInfo('couponName', null); | 83 | orderInfo('couponName', null); |
84 | + location.href = '/cart/index/orderEnsure'; | ||
84 | }); | 85 | }); |
85 | 86 | ||
86 | 87 |
@@ -96,20 +96,22 @@ | @@ -96,20 +96,22 @@ | ||
96 | <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}"> | 96 | <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}"> |
97 | <span class="title">优惠券</span> | 97 | <span class="title">优惠券</span> |
98 | {{# coupon}} | 98 | {{# coupon}} |
99 | - <span class="coupon-count"> | ||
100 | - {{count}}张可用 | ||
101 | - </span> | ||
102 | - {{#if couponName}} | ||
103 | - <span class="used coupon-use" data-name="{{couponName}}"> | ||
104 | - {{couponName}} | ||
105 | - <i class="iconfont"></i> | ||
106 | - </span> | ||
107 | - {{^}} | ||
108 | - <span class="not-used coupon-use"> | ||
109 | - {{#if isLimit}}该商品不可使用优惠券{{else}}未使用{{/if}} | ||
110 | - <i class="iconfont"></i> | ||
111 | - </span> | ||
112 | - {{/if}} | 99 | + {{#if isCoupon}} |
100 | + <span class="coupon-count"> | ||
101 | + {{count}}张可用 | ||
102 | + </span> | ||
103 | + {{/if}} | ||
104 | + {{#if couponName}} | ||
105 | + <span class="used coupon-use" data-name="{{couponName}}"> | ||
106 | + {{couponName}} | ||
107 | + <i class="iconfont"></i> | ||
108 | + </span> | ||
109 | + {{^}} | ||
110 | + <span class="not-used coupon-use"> | ||
111 | + {{#if isLimit}}该商品不可使用优惠券{{else}}未使用{{/if}} | ||
112 | + <i class="iconfont"></i> | ||
113 | + </span> | ||
114 | + {{/if}} | ||
113 | {{/coupon}} | 115 | {{/coupon}} |
114 | </a> | 116 | </a> |
115 | </li> | 117 | </li> |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | </a> | 20 | </a> |
21 | \{{/ notAvailable}} | 21 | \{{/ notAvailable}} |
22 | \{{/coupons}} | 22 | \{{/coupons}} |
23 | -<a class="not-use" href="/cart/index/orderEnsure">不使用任何优惠券</a> | 23 | +<a class="not-use" href="javascript:void(0);">不使用任何优惠券</a> |
24 | </script> | 24 | </script> |
25 | <script id="tmpl-coupon-not-avaliable" type="text/tmpl"> | 25 | <script id="tmpl-coupon-not-avaliable" type="text/tmpl"> |
26 | \{{# notAvailableCoupons}} | 26 | \{{# notAvailableCoupons}} |
@@ -594,11 +594,17 @@ class CartModel | @@ -594,11 +594,17 @@ class CartModel | ||
594 | // 优惠券数据 | 594 | // 优惠券数据 |
595 | $coupons = array( | 595 | $coupons = array( |
596 | 'couponName' => '', | 596 | 'couponName' => '', |
597 | + 'isCoupon' => false, | ||
597 | 'count' => self::getValidCouponCount($uid) | 598 | 'count' => self::getValidCouponCount($uid) |
598 | ); | 599 | ); |
599 | if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) { | 600 | if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) { |
600 | $coupons['couponName'] = $orderInfo['couponName']; | 601 | $coupons['couponName'] = $orderInfo['couponName']; |
601 | } | 602 | } |
603 | + //选中已使用的优惠劵,则剩余多少张优惠劵,不提示 | ||
604 | + if (empty($coupons['couponName']) || $coupons['count'] === 0) { | ||
605 | + $coupons['isCoupon'] = true; | ||
606 | + } | ||
607 | + | ||
602 | $result['coupon'] = $coupons; | 608 | $result['coupon'] = $coupons; |
603 | } | 609 | } |
604 | while (false); | 610 | while (false); |
-
Please register or login to post a comment