Authored by 郝肖肖

选中已使用的优惠劵,则剩余多少张优惠劵,不提示

... ... @@ -81,6 +81,7 @@ $couponList.on('touchstart', '.employ-main', function() {
$('body').on('touchend', '.not-use', function() {
orderInfo('couponCode', null);
orderInfo('couponName', null);
location.href = '/cart/index/orderEnsure';
});
... ...
... ... @@ -96,9 +96,11 @@
<a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}">
<span class="title">优惠券</span>
{{# coupon}}
{{#if isCoupon}}
<span class="coupon-count">
{{count}}张可用
</span>
{{/if}}
{{#if couponName}}
<span class="used coupon-use" data-name="{{couponName}}">
{{couponName}}
... ...
... ... @@ -20,7 +20,7 @@
</a>
\{{/ notAvailable}}
\{{/coupons}}
<a class="not-use" href="/cart/index/orderEnsure">不使用任何优惠券</a>
<a class="not-use" href="javascript:void(0);">不使用任何优惠券</a>
</script>
<script id="tmpl-coupon-not-avaliable" type="text/tmpl">
\{{# notAvailableCoupons}}
... ...
... ... @@ -594,11 +594,17 @@ class CartModel
// 优惠券数据
$coupons = array(
'couponName' => '',
'isCoupon' => false,
'count' => self::getValidCouponCount($uid)
);
if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) {
$coupons['couponName'] = $orderInfo['couponName'];
}
//选中已使用的优惠劵,则剩余多少张优惠劵,不提示
if (empty($coupons['couponName']) || $coupons['count'] === 0) {
$coupons['isCoupon'] = true;
}
$result['coupon'] = $coupons;
}
while (false);
... ...