Commit 28985070b0feb2be9a2dceaf11bd9b11efba7d3f
1 parent
e08efb78
tabBox切换每个tab进行查询判断是否有全部商品组件
Showing
1 changed file
with
10 additions
and
10 deletions
src/components/tabBox/tabBox.vue
| @@ -99,9 +99,13 @@ | @@ -99,9 +99,13 @@ | ||
| 99 | // 初始化的时选中关爱屋 | 99 | // 初始化的时选中关爱屋 |
| 100 | if(this.tabbar&&this.tabbar[0]&&this.tabbar[0].ads){ | 100 | if(this.tabbar&&this.tabbar[0]&&this.tabbar[0].ads){ |
| 101 | this.tabbaromponents = this.tabbar[0] | 101 | this.tabbaromponents = this.tabbar[0] |
| 102 | + for (let i = 0; i < this.tabbar[0].ads.length; i++) { | ||
| 103 | + if (this.tabbar[0].ads[i].style==15) { | ||
| 104 | + // 获取爱心屋全部商品数据 | ||
| 105 | + this.shopRecommendGoods(this.paging.commodity.page,this.tabbar[0].ads[i].shop_id) | ||
| 106 | + } | ||
| 107 | + } | ||
| 102 | } | 108 | } |
| 103 | - // 获取爱心屋全部商品数据 | ||
| 104 | - this.shopRecommendGoods(this.paging.commodity.page) | ||
| 105 | }, | 109 | }, |
| 106 | methods: { | 110 | methods: { |
| 107 | onChange(name, title) { | 111 | onChange(name, title) { |
| @@ -109,6 +113,8 @@ | @@ -109,6 +113,8 @@ | ||
| 109 | this.tabbaromponents = this.tabbar.find((item)=>{ | 113 | this.tabbaromponents = this.tabbar.find((item)=>{ |
| 110 | return item.title === title | 114 | return item.title === title |
| 111 | }); | 115 | }); |
| 116 | + // 获取爱心屋全部商品数据 | ||
| 117 | + this.shopRecommendGoods(this.paging.commodity.page,this.tabbaromponents.shop_id) | ||
| 112 | }, | 118 | }, |
| 113 | /** | 119 | /** |
| 114 | * 调用通用跳转 | 120 | * 调用通用跳转 |
| @@ -141,11 +147,7 @@ | @@ -141,11 +147,7 @@ | ||
| 141 | * 爱心屋项目全部商品 | 147 | * 爱心屋项目全部商品 |
| 142 | * @param {int} page [页码] | 148 | * @param {int} page [页码] |
| 143 | */ | 149 | */ |
| 144 | - shopRecommendGoods(page) { | ||
| 145 | - for (let i = 0; i < this.tabbar.length; i++) { | ||
| 146 | - // 判断必要参数 | ||
| 147 | - if (this.tabbar[i].ads[0].style==15) { | ||
| 148 | - | 150 | + shopRecommendGoods(page,shopId) { |
| 149 | // 加载中 | 151 | // 加载中 |
| 150 | this.$set(this.paging.commodity, "loading", true); | 152 | this.$set(this.paging.commodity, "loading", true); |
| 151 | 153 | ||
| @@ -154,13 +156,11 @@ | @@ -154,13 +156,11 @@ | ||
| 154 | 156 | ||
| 155 | // 请求接口 | 157 | // 请求接口 |
| 156 | this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", { | 158 | this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", { |
| 157 | - shopId: this.tabbar[i].shop_id, | 159 | + shopId: shopId, |
| 158 | page: page | 160 | page: page |
| 159 | }, this.shopRecommendGoodsCallback, { | 161 | }, this.shopRecommendGoodsCallback, { |
| 160 | method: "POST" | 162 | method: "POST" |
| 161 | }); | 163 | }); |
| 162 | - } | ||
| 163 | - } | ||
| 164 | }, | 164 | }, |
| 165 | 165 | ||
| 166 | /** | 166 | /** |