选中已使用的优惠劵,则剩余多少张优惠劵,不提示
Showing
4 changed files
with
10 additions
and
1 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,9 +96,11 @@ | @@ -96,9 +96,11 @@ | ||
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 | + {{#if isCoupon}} | ||
99 | <span class="coupon-count"> | 100 | <span class="coupon-count"> |
100 | {{count}}张可用 | 101 | {{count}}张可用 |
101 | </span> | 102 | </span> |
103 | + {{/if}} | ||
102 | {{#if couponName}} | 104 | {{#if couponName}} |
103 | <span class="used coupon-use" data-name="{{couponName}}"> | 105 | <span class="used coupon-use" data-name="{{couponName}}"> |
104 | {{couponName}} | 106 | {{couponName}} |
@@ -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