Commit 28985070b0feb2be9a2dceaf11bd9b11efba7d3f

Authored by zhiyangdu
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 99 // 初始化的时选中关爱屋
100 100 if(this.tabbar&&this.tabbar[0]&&this.tabbar[0].ads){
101 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 110 methods: {
107 111 onChange(name, title) {
... ... @@ -109,6 +113,8 @@
109 113 this.tabbaromponents = this.tabbar.find((item)=>{
110 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 147 * 爱心屋项目全部商品
142 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 152 this.$set(this.paging.commodity, "loading", true);
151 153  
... ... @@ -154,13 +156,11 @@
154 156  
155 157 // 请求接口
156 158 this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", {
157   - shopId: this.tabbar[i].shop_id,
  159 + shopId: shopId,
158 160 page: page
159 161 }, this.shopRecommendGoodsCallback, {
160 162 method: "POST"
161 163 });
162   - }
163   - }
164 164 },
165 165  
166 166 /**
... ...