...
|
...
|
@@ -4,5 +4,65 @@ Component({ |
|
|
type: Object,
|
|
|
value: {}
|
|
|
}
|
|
|
},
|
|
|
data: {
|
|
|
curSortType: 'def',
|
|
|
curSortField: '',
|
|
|
curGender: '',
|
|
|
showSubGender: false,
|
|
|
subFilterText: '筛选'
|
|
|
},
|
|
|
methods: {
|
|
|
sortChange: function ({target}) {
|
|
|
const sort = target.dataset.sort;
|
|
|
|
|
|
const setSort = field => {
|
|
|
if (sort === this.data.curSortType && sort !== 'price') {
|
|
|
return;
|
|
|
}
|
|
|
this.setData({
|
|
|
curSortType: sort,
|
|
|
curSortField: field,
|
|
|
showSubGender: false
|
|
|
});
|
|
|
this.triggerEvent('sortchange', {curSort: field, gender: this.data.curGender})
|
|
|
};
|
|
|
|
|
|
switch (sort) {
|
|
|
case 'def':
|
|
|
setSort('');
|
|
|
break;
|
|
|
case 'time':
|
|
|
setSort('s_t_desc');
|
|
|
break;
|
|
|
case 'popular':
|
|
|
setSort('s_n_asc');
|
|
|
break;
|
|
|
case 'price':
|
|
|
setSort(this.data.curSortField === 's_p_asc' ? 's_p_desc' : 's_p_asc');
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
},
|
|
|
subFilterGenderTap: function (e) {
|
|
|
this.setData({
|
|
|
showSubGender: !this.data.showSubGender
|
|
|
});
|
|
|
},
|
|
|
selectGenderTap: function (e) {
|
|
|
const gender = e.target.dataset.gender;
|
|
|
|
|
|
if (gender) {
|
|
|
this.setData({
|
|
|
curGender: gender,
|
|
|
showSubGender: false,
|
|
|
subFilterText: gender === '1,3' ? '男生' : '女生'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.triggerEvent('sortchange', {curSort: this.data.curSortField, gender})
|
|
|
}
|
|
|
}
|
|
|
}); |
...
|
...
|
|