Commit 2da3540f34aa76098d57b59a4b0bb2024cc5c804
1 parent
876c529e
分类的跳转的实现
Showing
1 changed file
with
36 additions
and
4 deletions
pages/goods/categoryList/categoryList.js
@@ -271,16 +271,16 @@ Page({ | @@ -271,16 +271,16 @@ Page({ | ||
271 | var t_type=that.data.type; | 271 | var t_type=that.data.type; |
272 | //----求传参过来的控制----- | 272 | //----求传参过来的控制----- |
273 | if (t_type == 1 && that.data.is_show_gb ) { | 273 | if (t_type == 1 && that.data.is_show_gb ) { |
274 | - that.setData({ currentTab: 1 }); | 274 | + that.setData({ currentTab: 1,select_classify_on:223 }); |
275 | that.get_nation(); | 275 | that.get_nation(); |
276 | } else if (t_type == 2 && that.data.is_show_pp ) { | 276 | } else if (t_type == 2 && that.data.is_show_pp ) { |
277 | - that.setData({ currentTab: 2 }); | 277 | + that.setData({ currentTab: 2,select_classify_on:220}); |
278 | that.get_brand(); | 278 | that.get_brand(); |
279 | } else if (t_type == 3 && that.data.is_show_xm ) { | 279 | } else if (t_type == 3 && that.data.is_show_xm ) { |
280 | - that.setData({ currentTab: 3 }); | 280 | + that.setData({ currentTab: 3,select_classify_on:221 }); |
281 | that.getServiceCategory(); | 281 | that.getServiceCategory(); |
282 | } else if (that.data.is_show_pl) { | 282 | } else if (that.data.is_show_pl) { |
283 | - that.setData({ currentTab: 0 }); | 283 | + that.setData({ currentTab: 0,select_classify_on:0 }); |
284 | } | 284 | } |
285 | // 获取默认选中的第一个 | 285 | // 获取默认选中的第一个 |
286 | if(that.data.is_show_gb && that.data.select_classify_on == 223){ | 286 | if(that.data.is_show_gb && that.data.select_classify_on == 223){ |
@@ -372,6 +372,38 @@ Page({ | @@ -372,6 +372,38 @@ Page({ | ||
372 | } | 372 | } |
373 | //console.log(arr) | 373 | //console.log(arr) |
374 | t.setData({one_level_classify:arr}); | 374 | t.setData({one_level_classify:arr}); |
375 | + if(t.data.select_classify_on==0){ | ||
376 | + var item=arr[0]; | ||
377 | + | ||
378 | + var name = item.items.name; | ||
379 | + var cid = item.items.cid; | ||
380 | + var arr = item.array; | ||
381 | + | ||
382 | + | ||
383 | + if (arr.length == 0) { | ||
384 | + t.setData({ | ||
385 | + select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, | ||
386 | + goodslist: null, is_level_three: 0 | ||
387 | + }); | ||
388 | + return false; | ||
389 | + } | ||
390 | + if (arr.length != 0) { | ||
391 | + var is_lev_thr = 0 | ||
392 | + for (var i = 0; i < arr.length; i++) { | ||
393 | + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } | ||
394 | + } | ||
395 | + t.setData({ is_level_three: is_lev_thr }); | ||
396 | + | ||
397 | + if (this.data.is_level_three != 1) { | ||
398 | + t.setData({ index: 0, classify_name: name, goodslist: arr }); | ||
399 | + } else { | ||
400 | + t.setData({ index: 0, goodslist: arr }); | ||
401 | + } | ||
402 | + } | ||
403 | + | ||
404 | + t.style(t.data.stylePage, cid) | ||
405 | + | ||
406 | + } | ||
375 | 407 | ||
376 | } | 408 | } |
377 | } | 409 | } |