Authored by 郭成尧

tip-show-ctl

{{#result}}
<section>
<div class="filter-box">
<span class="filter-btn valid active">可用({{usableCouponNumStr}})</span>
<span class="filter-btn invalid">不可用({{unusableCouponNumStr}})</span>
<span class="filter-btn valid active" data-num="{{usableCouponNumStr}}">可用({{usableCouponNumStr}})</span>
<span class="filter-btn invalid" data-num="{{unusableCouponNumStr}}">不可用({{unusableCouponNumStr}})</span>
</div>
<div class="exchange-box">
<input type="text" name="couponCodeInput" placeholder="请输入优惠券码">
<button id="exchangeCouponBtn" class="exchange-coupon-btn">兑换</button>
</div>
{{#if showTips}}
<div class="tip-box">
<div class="tip-box{{#if noShowTips}} hide{{/if}}">
<div class="tips">
{{{headMsg}}}
</div>
... ... @@ -17,7 +16,6 @@
<span class="iconfont">&#xe623;</span>
</div>
</div>
{{/if}}
<div class="coupon-list usable">
{{#usableCouponsList}}
{{#each ./coupons}}
... ...
... ... @@ -13,6 +13,7 @@ class SelectCouponController extends Page {
this.useCouponCodeUrl = params.useCouponCodeUrl;
this.selectCouponCodes = [];
this.isBuyNowPage = params.isBuyNowPage || false;
this.closeTipbyUser = false;
if (this.orderInfo('coupon_code')) {
this.selectCouponCodes = this.orderInfo('coupon_code').split(',');
... ... @@ -152,6 +153,12 @@ class SelectCouponController extends Page {
this.view.unusableCouponList.removeClass('hide');
this.view.exchangeBox.addClass('hide');
}
if (itemClicked.data('num') === 0) {
this.view.tipBox.addClass('hide');
} else if (!this.closeTipbyUser) {
this.view.tipBox.removeClass('hide');
}
}
/**
... ... @@ -179,6 +186,7 @@ class SelectCouponController extends Page {
* 关闭提示框
*/
closeTip() {
this.closeTipbyUser = true;
this.view.tipBox.hide();
}
}
... ...
... ... @@ -387,7 +387,7 @@ const couponProcess = conponData => {
let headMsg = _.replace(_.get(conponData, 'usable_coupon_catalogs.head_msg', []), '\n', '<br>');
let usableCouponNumStr = '';
let unusableCouponNumStr = '';
let showTips = true;
let noShowTips = true;
_.forEach(unusableCouponsList, listItem => {
if (listItem.coupons && listItem.coupons.length) {
... ... @@ -409,8 +409,8 @@ const couponProcess = conponData => {
unusableCouponNumStr = unusableCouponNum + '';
}
if (!unusableCouponNum) {
showTips = false;
if (!usableCouponNum) {
noShowTips = true;
}
return {
... ... @@ -420,7 +420,7 @@ const couponProcess = conponData => {
unusableCouponsList,
couponPay,
headMsg,
showTips
noShowTips
};
};
... ...