Browse Source

完成品牌页面筛选功能

master
邓平艺 4 years ago
parent
commit
cce1119653
  1. 26
      pages/index/category/category.vue

26
pages/index/category/category.vue

@ -70,6 +70,7 @@
</view>
</view>
</view>
<lf-nocontent src="/static/images/empty.png" v-if="brand_list.length <= 0"></lf-nocontent>
</scroll-view>
<!-- 锚点定位 -->
<view class="fixed-point" v-if="point_list.length">
@ -148,7 +149,7 @@
},
onLoad(options) {
// https://ext.dcloud.net.cn/plugin?id=5031
this.getBrandList();
this.getBrandList({load: true});
if(this.$isRight(options)){
this.current = options.current || 1;
this.left_selectIndex = options.type || 0;
@ -167,15 +168,29 @@
// this.createAtoZ();
},
methods: {
getBrandList(){
getBrandList(options = {}){
let par = {};
if(options.filter){
let _floor = this.filter_list['floor'];
let _class = this.filter_list['class'];
if(_floor.current != null){
par.floor = _floor.list[_floor.current].name;
}
if(_class.current != null){
par.category_id = _class.current;
}
}
this.$http.get({
api: '/api/brand'
api: '/api/brand',
data: par
}).then(res => {
console.log("getBrandList", res);
if(options.load){
let category = res.data.data.category;
let floor = res.data.data.floor;
this.filter_list['floor'].list = floor;
this.filter_list['class'].list = category;
}
this.brand_list = res.data.data.list;
this.autoCreateAtoZ(res.data.data.list);
});
@ -193,8 +208,13 @@
//
selectFilter(item, index){
console.log(item, index);
if(this.filter_list[this.filter_active].current == index){
this.filter_list[this.filter_active].current = null;
}else{
this.filter_list[this.filter_active].current = index;
}
this.filter_active = '';
this.getBrandList({filter: true});
},
// A-Z
createAtoZ(){

Loading…
Cancel
Save