diff --git a/pages/index/category/category.vue b/pages/index/category/category.vue
index cbc1d37..7ba2399 100644
--- a/pages/index/category/category.vue
+++ b/pages/index/category/category.vue
@@ -70,6 +70,7 @@
+
@@ -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);
- let category = res.data.data.category;
- let floor = res.data.data.floor;
- this.filter_list['floor'].list = floor;
- this.filter_list['class'].list = category;
+ 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);
- this.filter_list[this.filter_active].current = 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(){