...
|
...
|
@@ -98,22 +98,22 @@ $notUseCoupon.on('click', function() { |
|
|
});
|
|
|
|
|
|
function getCouponHandle(allCoupons) {
|
|
|
let notAvailableCoupons,
|
|
|
coupons;
|
|
|
|
|
|
// 把可用和不可用的优惠券分离出来
|
|
|
notAvailableCoupons = allCoupons.notAvailableCoupons;
|
|
|
coupons = allCoupons.coupons;
|
|
|
let availableCoupons = allCoupons.availableCoupons;
|
|
|
let usableFreesCoupons = allCoupons.freesCoupons;
|
|
|
let notAvailableCoupons = allCoupons.notAvailableCoupons;
|
|
|
|
|
|
// 没有优惠券
|
|
|
if (!(notAvailableCoupons.length || coupons.length)) {
|
|
|
if (!(availableCoupons.length || usableFreesCoupons)) {
|
|
|
$('.coupon-wrap').html($('#tmpl-no-coupon').html());
|
|
|
fixedLayOut();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.each(availableCoupons, function(i, coupon) {
|
|
|
coupon.couponValue = Math.floor(coupon.couponValue);
|
|
|
});
|
|
|
|
|
|
$.each(coupons, function(i, coupon) {
|
|
|
$.each(usableFreesCoupons, function(i, coupon) {
|
|
|
coupon.couponValue = Math.floor(coupon.couponValue);
|
|
|
});
|
|
|
|
...
|
...
|
@@ -123,7 +123,8 @@ function getCouponHandle(allCoupons) { |
|
|
|
|
|
// 渲染可用的优惠券
|
|
|
$couponList.append(conponTmpl({
|
|
|
coupons: coupons
|
|
|
availableCoupons: availableCoupons,
|
|
|
usableFreesCoupons: usableFreesCoupons
|
|
|
})).find('.employ-main').on('touchstart', function() {
|
|
|
let couponCode = $(this).data('coupon-code');
|
|
|
|
...
|
...
|
|