Authored by 郭成尧

tab-change

... ... @@ -42,9 +42,10 @@ class CouponNew {
let page = req.body.page;
co(function* () {
let coupons = yield req.ctx(CouponNewModel).couponData({
let couponApi = yield req.ctx(CouponNewModel).couponGet({
uid, type, filter, page
});
let coupons = _.get(couponApi, 'data.couponList', []);
res.json(coupons);
})().catch(next);
... ...
{{#each .}}
<section class="coupon-section">
<section class="coupon-section" data-code="{{coupon_code}}" data-id="{{coupon_id}}">
<div class="coupon">
<div class="coupon-left">
<p class="value">¥
<span>{{couponValue}}</span>
<span>{{coupon_value_str}}</span>
</p>
<p class="threshold">{{shopLimit}}可用</p>
{{#if use_rule}}
<p class="threshold">{{use_rule}}</p>
{{/if}}
</div>
<div class="coupon-right">
<p class="title">
<span class="type-shop">[店铺券]</span> {{couponDetailInfomation}}</p>
<p class="time">{{couponValidity}}</p>
<span class="type-shop">[{{catalog_name}}]</span> {{coupon_name}}</p>
<p class="time">{{coupon_validity}}</p>
<p>
<span class="show-intro-btn">使用说明</span>
<span class="iconfont icon-down show-intro-btn show-intro-arrow"></span>
... ...
... ... @@ -18,11 +18,9 @@ class ConponController extends Page {
couponList: $('#couponList')
};
this.view.filterBtn.on('click', this.tapChange.bind(this));
this.view.filterBtn.on('click', this.tabChange.bind(this));
this.view.showFilterBtn.on('click', this.showFilter.bind(this));
this.view.filterItem.on('click', 'button', this.filterCoupons.bind(this));
// this.renderCoupons();
}
/**
... ... @@ -78,25 +76,25 @@ class ConponController extends Page {
/**
* tab 切换
*/
tapChange(event) {
tabChange(event) {
let itemClicked = $(event.currentTarget);
if (itemClicked.hasClass('no-used')) {
this.status = 0;
this.couponType = 'notuse';
} else if (itemClicked.hasClass('used')) {
this.status = 1;
this.couponType = 'use';
} else if (itemClicked.hasClass('invalid')) {
this.status = 2;
this.couponType = 'overtime';
}
this.renderCoupons();
if (itemClicked.hasClass('active')) {
itemClicked.removeClass('active');
} else {
this.view.filterBtn.removeClass('active');
itemClicked.addClass('active');
}
this.renderCoupons();
}
/**
... ...