...
|
...
|
@@ -2,6 +2,8 @@ import $ from 'yoho-jquery'; |
|
|
import qs from 'yoho-qs';
|
|
|
import Page from 'yoho-page';
|
|
|
import tip from 'plugin/tip';
|
|
|
import cookie from 'yoho-cookie';
|
|
|
import cookieOption from './cookie-option';
|
|
|
|
|
|
class SelectCouponController extends Page {
|
|
|
constructor(params) {
|
...
|
...
|
@@ -13,6 +15,7 @@ class SelectCouponController extends Page { |
|
|
this.useCouponCodeUrl = params.useCouponCodeUrl;
|
|
|
this.selectCouponCodes = [];
|
|
|
this.isBuyNowPage = params.isBuyNowPage || false;
|
|
|
this.closeCouponRuleTipbyUser = cookie.get('close_coupon_rule_tip_by_user') || 'N';
|
|
|
|
|
|
if (this.orderInfo('coupon_code')) {
|
|
|
this.selectCouponCodes = this.orderInfo('coupon_code').split(',');
|
...
|
...
|
@@ -65,7 +68,9 @@ class SelectCouponController extends Page { |
|
|
unusableCouponList: resultHtml.find('.unusable'),
|
|
|
useNowBtn: resultHtml.find('#useNowBtn'),
|
|
|
exchangeCouponBtn: resultHtml.find('#exchangeCouponBtn'),
|
|
|
couponCodeInput: resultHtml.find('input[name=couponCodeInput]')
|
|
|
couponCodeInput: resultHtml.find('input[name=couponCodeInput]'),
|
|
|
exchangeBox: resultHtml.find('.exchange-box'),
|
|
|
useNowBox: resultHtml.find('#useNowBox')
|
|
|
};
|
|
|
|
|
|
this.view.filterBtn.on('click', this.tabChange.bind(this));
|
...
|
...
|
@@ -74,6 +79,10 @@ class SelectCouponController extends Page { |
|
|
this.view.useNowBtn.on('click', this.useCoupon.bind(this));
|
|
|
this.view.exchangeCouponBtn.on('click', this.exchangeCoupon.bind(this));
|
|
|
this.view.couponCodeInput.on('input', this.changeExchangeBtnStatus.bind(this));
|
|
|
|
|
|
if (this.closeCouponRuleTipbyUser === 'Y') {
|
|
|
this.view.tipBox.addClass('hide');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -135,6 +144,8 @@ class SelectCouponController extends Page { |
|
|
tabChange(event) {
|
|
|
let itemClicked = $(event.currentTarget);
|
|
|
|
|
|
console.log(this.view.useNowBox);
|
|
|
|
|
|
if (itemClicked.hasClass('active')) {
|
|
|
itemClicked.removeClass('active');
|
|
|
} else {
|
...
|
...
|
@@ -145,9 +156,23 @@ class SelectCouponController extends Page { |
|
|
if (itemClicked.hasClass('valid')) {
|
|
|
this.view.unusableCouponList.addClass('hide');
|
|
|
this.view.usableCouponList.removeClass('hide');
|
|
|
this.view.exchangeBox.removeClass('hide');
|
|
|
this.view.useNowBox.removeClass('hide');
|
|
|
} else {
|
|
|
this.view.usableCouponList.addClass('hide');
|
|
|
this.view.unusableCouponList.removeClass('hide');
|
|
|
this.view.exchangeBox.addClass('hide');
|
|
|
this.view.useNowBox.addClass('hide');
|
|
|
}
|
|
|
|
|
|
if (this.closeCouponRuleTipbyUser === 'Y') {
|
|
|
this.view.tipBox.addClass('hide');
|
|
|
} else {
|
|
|
if (itemClicked.data('num') === 0) {
|
|
|
this.view.tipBox.addClass('hide');
|
|
|
} else {
|
|
|
this.view.tipBox.removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -176,6 +201,8 @@ class SelectCouponController extends Page { |
|
|
* 关闭提示框
|
|
|
*/
|
|
|
closeTip() {
|
|
|
this.closeCouponRuleTipbyUser = 'Y';
|
|
|
cookie.set('close_coupon_rule_tip_by_user', 'Y', cookieOption);
|
|
|
this.view.tipBox.hide();
|
|
|
}
|
|
|
}
|
...
|
...
|
|