Commit a4cc62a7c3e83ce4f9d24a9eaac16bdaf01bfbe9
Merge branch 'dev' into 'test'
Dev See merge request !101
Showing
2 changed files
with
42 additions
and
17 deletions
components/diy_goodsGroup/diy_goodsGroup.js
| @@ -120,7 +120,17 @@ Component({ | @@ -120,7 +120,17 @@ Component({ | ||
| 120 | } else if (prom_type == 6) { | 120 | } else if (prom_type == 6) { |
| 121 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | 121 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; |
| 122 | } | 122 | } |
| 123 | - return app.request.promiseGet(url, {}) | 123 | + if(url==""){ |
| 124 | + th.data.requestData.push(item); | ||
| 125 | + th.setData({ goods_array: th.data.requestData, }); | ||
| 126 | + if (th.data.firist_type_curr == th.data.firist_type_data.length) { | ||
| 127 | + th.setData({ goods_btn: [] }); | ||
| 128 | + } | ||
| 129 | + }else{ | ||
| 130 | + return app.request.promiseGet(url, {}) | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + | ||
| 124 | }).then(res => { | 134 | }).then(res => { |
| 125 | index++; | 135 | index++; |
| 126 | var prom = res.data.data; | 136 | var prom = res.data.data; |
| @@ -185,18 +195,27 @@ Component({ | @@ -185,18 +195,27 @@ Component({ | ||
| 185 | } else if (prom_type == 6) { | 195 | } else if (prom_type == 6) { |
| 186 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | 196 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; |
| 187 | } | 197 | } |
| 188 | - | ||
| 189 | - app.request.promiseGet(url, {}).then(res => { | ||
| 190 | - var prom = res.data.data; | ||
| 191 | - if (prom != null) { | ||
| 192 | - item.shop_price = res.data.data.price; | ||
| 193 | - } | 198 | + if(url!="") { |
| 199 | + app.request.promiseGet(url, {}).then(res => { | ||
| 200 | + var prom = res.data.data; | ||
| 201 | + if (prom != null) { | ||
| 202 | + item.shop_price = res.data.data.price; | ||
| 203 | + } | ||
| 204 | + th.data.requestData.push(item); | ||
| 205 | + th.setData({ | ||
| 206 | + goods_array: th.data.requestData, | ||
| 207 | + page: th.data.currentPage - 1, | ||
| 208 | + }); | ||
| 209 | + }) | ||
| 210 | + }else{ | ||
| 194 | th.data.requestData.push(item); | 211 | th.data.requestData.push(item); |
| 195 | th.setData({ | 212 | th.setData({ |
| 196 | goods_array: th.data.requestData, | 213 | goods_array: th.data.requestData, |
| 197 | page: th.data.currentPage - 1, | 214 | page: th.data.currentPage - 1, |
| 198 | }); | 215 | }); |
| 199 | - }) | 216 | + } |
| 217 | + | ||
| 218 | + | ||
| 200 | }) | 219 | }) |
| 201 | 220 | ||
| 202 | }) | 221 | }) |
| @@ -247,17 +266,25 @@ Component({ | @@ -247,17 +266,25 @@ Component({ | ||
| 247 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | 266 | url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; |
| 248 | } | 267 | } |
| 249 | 268 | ||
| 250 | - app.request.promiseGet(url, {}).then(res => { | ||
| 251 | - var prom = res.data.data; | ||
| 252 | - if (prom != null) { | ||
| 253 | - item.shop_price = res.data.data.price; | ||
| 254 | - } | 269 | + if(url!=null){ |
| 270 | + app.request.promiseGet(url, {}).then(res => { | ||
| 271 | + var prom = res.data.data; | ||
| 272 | + if (prom != null) { | ||
| 273 | + item.shop_price = res.data.data.price; | ||
| 274 | + } | ||
| 275 | + th.data.requestData.push(item); | ||
| 276 | + th.setData({ | ||
| 277 | + goods_array: th.data.requestData, | ||
| 278 | + page: th.data.currentPage - 1, | ||
| 279 | + }); | ||
| 280 | + }) | ||
| 281 | + }else{ | ||
| 255 | th.data.requestData.push(item); | 282 | th.data.requestData.push(item); |
| 256 | th.setData({ | 283 | th.setData({ |
| 257 | goods_array: th.data.requestData, | 284 | goods_array: th.data.requestData, |
| 258 | page: th.data.currentPage - 1, | 285 | page: th.data.currentPage - 1, |
| 259 | }); | 286 | }); |
| 260 | - }) | 287 | + } |
| 261 | }) | 288 | }) |
| 262 | 289 | ||
| 263 | }) | 290 | }) |
pages/index/index/index.js
| @@ -332,10 +332,8 @@ Page({ | @@ -332,10 +332,8 @@ Page({ | ||
| 332 | }, | 332 | }, |
| 333 | //---加载更多是靠这个函数---- | 333 | //---加载更多是靠这个函数---- |
| 334 | onReachBottom: function () { | 334 | onReachBottom: function () { |
| 335 | - | ||
| 336 | var goods_list = this.selectComponent("#goods_list"); //组件的id | 335 | var goods_list = this.selectComponent("#goods_list"); //组件的id |
| 337 | - goods_list.get_list(); | ||
| 338 | - | 336 | + if(goods_list) goods_list.get_list(); |
| 339 | }, | 337 | }, |
| 340 | 338 | ||
| 341 | 339 |