Authored by 郭成尧

code-better

... ... @@ -109,7 +109,10 @@ class ConponController extends Page {
let currentTarget = $(evt.currentTarget);
let currentTargetData = currentTarget.data();
this.couponType = 'notuse';
this.page = 0;
this.couponFilter = currentTargetData.id;
this.view.filterItem.find('button').removeClass('active');
currentTarget.addClass('active');
this.view.filterItem.addClass('hide');
... ... @@ -169,31 +172,37 @@ class ConponController extends Page {
*/
tabChange(event) {
this.page = 0;
this.couponFilter = 0;
this.loadEnd = false;
let itemClicked = $(event.currentTarget);
// 筛选参数更改
if (itemClicked.hasClass('no-used')) {
this.couponType = 'notuse';
this.view.showFilterBtn.addClass('active');
} else if (itemClicked.hasClass('used')) {
this.couponType = 'use';
this.view.showFilterBtn.removeClass('icon-up').addClass('icon-down');
this.view.showFilterBtn.removeClass('active');
} else if (itemClicked.hasClass('invalid')) {
this.couponType = 'overtime';
}
// 筛选框控制按钮状态管理
if (itemClicked.hasClass('no-used')) {
this.view.showFilterBtn.addClass('active');
} else {
this.view.showFilterBtn.removeClass('icon-up').addClass('icon-down');
this.view.showFilterBtn.removeClass('active');
}
if (itemClicked.hasClass('active')) {
itemClicked.removeClass('active');
} else {
// 筛选项面板和筛选项状态重置
this.view.filterItem.addClass('hide');
this.view.filterItem.find('button').removeClass('active');
if (!itemClicked.hasClass('active')) {
this.view.filterBtn.removeClass('active');
itemClicked.addClass('active');
this.renderCoupons();
}
this.renderCoupons();
}
/**
... ...