Commit bcbb9f206019e187f9cd869610cb50c6e75829a6
1 parent
1af16978
分类一级无子级的情况修复
Showing
3 changed files
with
217 additions
and
230 deletions
pages/goods/categoryList/categoryList.js
| @@ -28,7 +28,6 @@ Page({ | @@ -28,7 +28,6 @@ Page({ | ||
| 28 | is_country:1, | 28 | is_country:1, | 
| 29 | //品牌的控制属性 | 29 | //品牌的控制属性 | 
| 30 | is_brand:1, | 30 | is_brand:1, | 
| 31 | - | ||
| 32 | //选择分类的控制属性 | 31 | //选择分类的控制属性 | 
| 33 | select_classify_on:223, | 32 | select_classify_on:223, | 
| 34 | index:223, | 33 | index:223, | 
| @@ -40,6 +39,7 @@ Page({ | @@ -40,6 +39,7 @@ Page({ | ||
| 40 | cat_id:0, | 39 | cat_id:0, | 
| 41 | pl_timer: null,//只有品类的定时器 | 40 | pl_timer: null,//只有品类的定时器 | 
| 42 | is_pl_time:0, | 41 | is_pl_time:0, | 
| 42 | + | ||
| 43 | }, | 43 | }, | 
| 44 | onLoad: function(tt) { | 44 | onLoad: function(tt) { | 
| 45 | const res = wx.getSystemInfoSync(), | 45 | const res = wx.getSystemInfoSync(), | 
| @@ -74,19 +74,16 @@ Page({ | @@ -74,19 +74,16 @@ Page({ | ||
| 74 | lettersPosition: temp | 74 | lettersPosition: temp | 
| 75 | }); | 75 | }); | 
| 76 | 76 | ||
| 77 | - if (this.data.is_used_share==0){ | ||
| 78 | - | 77 | + if (this.data.is_used_share==0){ | 
| 79 | this.get_nation(); | 78 | this.get_nation(); | 
| 80 | } | 79 | } | 
| 81 | 80 | ||
| 82 | - | ||
| 83 | }, | 81 | }, | 
| 84 | 82 | ||
| 85 | onShow:function(){ | 83 | onShow:function(){ | 
| 86 | var that=this; | 84 | var that=this; | 
| 87 | - this.requestFirstCategoris(); | 85 | + //this.requestFirstCategoris(); | 
| 88 | if(getApp().globalData.user_id) getApp().requestCardNum(); | 86 | if(getApp().globalData.user_id) getApp().requestCardNum(); | 
| 89 | - | ||
| 90 | getApp().getConfig2(function (e) { | 87 | getApp().getConfig2(function (e) { | 
| 91 | 88 | ||
| 92 | var data=e; | 89 | var data=e; | 
| @@ -98,37 +95,46 @@ Page({ | @@ -98,37 +95,46 @@ Page({ | ||
| 98 | if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); } | 95 | if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); } | 
| 99 | if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); } | 96 | if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); } | 
| 100 | that.setData({ store_config: e,is_do:1 }); | 97 | that.setData({ store_config: e,is_do:1 }); | 
| 101 | - if ( that.data.is_show_gb != 1 && that.data.is_show_pp != 1){ | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - that.data.pl_timer = setInterval(function () { | ||
| 105 | 98 | ||
| 99 | + //---有勾品类--- | ||
| 100 | + if (that.data.is_show_pl){ | ||
| 106 | that.requestFirstCategoris(); | 101 | that.requestFirstCategoris(); | 
| 107 | - console.log("8888888888888888888", that.data.one_level_classify.length); | ||
| 108 | - if (that.data.one_level_classify.length>0){ | ||
| 109 | - console.log("7777777777777777777777", that.data.one_level_classify); | ||
| 110 | - //清除定时器 | ||
| 111 | - clearInterval(that.data.pl_timer); | ||
| 112 | - } | ||
| 113 | - },1000); | ||
| 114 | - | ||
| 115 | - console.log(that.data.one_level_classify); | ||
| 116 | - that.setData({ select_classify_on: 0, index: 0, goodslist: one_level_classify[0]}); | ||
| 117 | - | ||
| 118 | - } else if (that.data.is_show_gb != 1 ){ | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - that.setData({ select_classify_on: 220, classify_name: "品牌" }); | ||
| 122 | } | 102 | } | 
| 103 | + if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl){ | ||
| 104 | + that.data.pl_timer = setInterval(function () { | ||
| 105 | + if (that.data.one_level_classify.length>0){ | ||
| 106 | + var item=that.data.one_level_classify[0],arr=item.array; | ||
| 107 | + //----如果有下级的时候----- | ||
| 108 | + if(item.array && item.array.length>0){ | ||
| 109 | + var is_lev_thr=0 | ||
| 110 | + for(var i=0;i<arr.length;i++){ | ||
| 111 | + if (arr[i].arrays.length>0) {is_lev_thr=1;break; } | ||
| 112 | + } | ||
| 113 | + that.setData({ is_level_three: is_lev_thr }); | ||
| 114 | + if (is_lev_thr!=1) { | ||
| 115 | + that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, goodslist: item.array }); | ||
| 116 | + } else { | ||
| 117 | + that.setData({ select_classify_on: 0, index: 0, goodslist: arr }); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + else{ | ||
| 121 | + that.setData({ select_classify_on: 0, index: 0, goodslist: null,classify_name:item.items.name,is_level_three: 0}); | ||
| 122 | + } | ||
| 123 | + clearInterval(that.data.pl_timer); | ||
| 124 | + } | ||
| 125 | + },1000); | ||
| 123 | 126 | ||
| 124 | - var one_level_classify = that.data.one_level_classify; | 127 | + } else if (that.data.is_show_gb != 1 && that.data.is_show_pp ){ | 
| 128 | + that.setData({ select_classify_on: 220, classify_name: "品牌" }); | ||
| 129 | + } | ||
| 125 | 130 | ||
| 126 | - | 131 | + | 
| 132 | + var one_level_classify = that.data.one_level_classify; | ||
| 133 | + | ||
| 127 | if (that.data.is_show_pl) that.setData({ currentTab: 0 }); | 134 | if (that.data.is_show_pl) that.setData({ currentTab: 0 }); | 
| 128 | else if (that.data.is_show_gb){ that.setData({ currentTab: 1 });that.get_nation(); } | 135 | else if (that.data.is_show_gb){ that.setData({ currentTab: 1 });that.get_nation(); } | 
| 129 | else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); } | 136 | else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); } | 
| 130 | 137 | ||
| 131 | - | ||
| 132 | //----求传参过来的控制----- | 138 | //----求传参过来的控制----- | 
| 133 | if (getApp().globalData.cat_type == 1 && that.data.is_show_gb ) { | 139 | if (getApp().globalData.cat_type == 1 && that.data.is_show_gb ) { | 
| 134 | that.setData({ currentTab: 1 }); | 140 | that.setData({ currentTab: 1 }); | 
| @@ -139,12 +145,9 @@ Page({ | @@ -139,12 +145,9 @@ Page({ | ||
| 139 | } else if (that.data.is_show_pl) { | 145 | } else if (that.data.is_show_pl) { | 
| 140 | that.setData({ currentTab: 0 }); | 146 | that.setData({ currentTab: 0 }); | 
| 141 | } | 147 | } | 
| 142 | - | ||
| 143 | }) | 148 | }) | 
| 144 | - | ||
| 145 | }, | 149 | }, | 
| 146 | 150 | ||
| 147 | - | ||
| 148 | //---------------分类请求接口,数据进行拼装------------------ | 151 | //---------------分类请求接口,数据进行拼装------------------ | 
| 149 | requestFirstCategoris: function() { | 152 | requestFirstCategoris: function() { | 
| 150 | var t = this; | 153 | var t = this; | 
| @@ -206,18 +209,16 @@ Page({ | @@ -206,18 +209,16 @@ Page({ | ||
| 206 | 209 | ||
| 207 | arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break; | 210 | arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break; | 
| 208 | } | 211 | } | 
| 209 | - | ||
| 210 | } | 212 | } | 
| 211 | - | ||
| 212 | } | 213 | } | 
| 213 | } | 214 | } | 
| 214 | - } | 215 | + } | 
| 215 | 216 | ||
| 216 | } | 217 | } | 
| 217 | 218 | ||
| 218 | console.log("现在是1级与2级所有的数据", arr) | 219 | console.log("现在是1级与2级所有的数据", arr) | 
| 219 | t.setData({one_level_classify:arr}); | 220 | t.setData({one_level_classify:arr}); | 
| 220 | - | 221 | + | 
| 221 | } | 222 | } | 
| 222 | } | 223 | } | 
| 223 | }); | 224 | }); | 
| @@ -237,6 +238,7 @@ Page({ | @@ -237,6 +238,7 @@ Page({ | ||
| 237 | } | 238 | } | 
| 238 | }); | 239 | }); | 
| 239 | }, | 240 | }, | 
| 241 | + | ||
| 240 | switchFirstCategory: function(t) { | 242 | switchFirstCategory: function(t) { | 
| 241 | this.requestCategories(t.currentTarget.dataset.id); | 243 | this.requestCategories(t.currentTarget.dataset.id); | 
| 242 | }, | 244 | }, | 
| @@ -360,7 +362,6 @@ Page({ | @@ -360,7 +362,6 @@ Page({ | ||
| 360 | s.setData({ nationlist:dda}) | 362 | s.setData({ nationlist:dda}) | 
| 361 | } | 363 | } | 
| 362 | }); | 364 | }); | 
| 363 | - | ||
| 364 | }, | 365 | }, | 
| 365 | 366 | ||
| 366 | //获取品牌 | 367 | //获取品牌 | 
| @@ -392,7 +393,6 @@ Page({ | @@ -392,7 +393,6 @@ Page({ | ||
| 392 | for (var i = 0; i < dda.length; i++) { | 393 | for (var i = 0; i < dda.length; i++) { | 
| 393 | 394 | ||
| 394 | dda[i].logo = oo.imghost+dda[i].logo; | 395 | dda[i].logo = oo.imghost+dda[i].logo; | 
| 395 | - | ||
| 396 | if (arr.length>0){ | 396 | if (arr.length>0){ | 
| 397 | var find = 0; | 397 | var find = 0; | 
| 398 | //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 | 398 | //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 | 
| @@ -455,50 +455,39 @@ Page({ | @@ -455,50 +455,39 @@ Page({ | ||
| 455 | // 新的版本分类点击一级分类 | 455 | // 新的版本分类点击一级分类 | 
| 456 | click_classify:function(e){ | 456 | click_classify:function(e){ | 
| 457 | this.data.ishaf_three=0; | 457 | this.data.ishaf_three=0; | 
| 458 | - var indexs=e.currentTarget.dataset.index; | 458 | + var indexs=e.currentTarget.dataset.index; | 
| 459 | var name = e.currentTarget.dataset.name; | 459 | var name = e.currentTarget.dataset.name; | 
| 460 | var cid = e.currentTarget.dataset.cid; | 460 | var cid = e.currentTarget.dataset.cid; | 
| 461 | var pid = e.currentTarget.dataset.pid; | 461 | var pid = e.currentTarget.dataset.pid; | 
| 462 | var arr = e.currentTarget.dataset.arr; | 462 | var arr = e.currentTarget.dataset.arr; | 
| 463 | - console.log("数据是什么",arr); | ||
| 464 | - if (indexs==220){ | ||
| 465 | - this.get_brand(); | ||
| 466 | - } | ||
| 467 | 463 | ||
| 464 | + if (indexs==220){ this.get_brand();} | ||
| 468 | if (arr!="undefined" && arr!=undefined){ | 465 | if (arr!="undefined" && arr!=undefined){ | 
| 469 | - if (arr.length==0){ | ||
| 470 | - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; | ||
| 471 | - wx.navigateTo({ url: lurl }); | ||
| 472 | - return false; | ||
| 473 | - } | ||
| 474 | - if (arr.length != 0){ | ||
| 475 | - | ||
| 476 | - for(var i=0;i<arr.length;i++){ | ||
| 477 | - if (arr[i].arrays.length>0) { | ||
| 478 | - | ||
| 479 | - this.setData({ is_level_three: 1 }); | ||
| 480 | - break; | ||
| 481 | - } | ||
| 482 | - this.setData({ is_level_three: 0 }); | ||
| 483 | - } | ||
| 484 | - if (this.data.is_level_three!=1) { | ||
| 485 | - | ||
| 486 | - | ||
| 487 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); | ||
| 488 | - | ||
| 489 | - | ||
| 490 | - } else { | ||
| 491 | - this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); | ||
| 492 | - | 466 | + if (arr.length==0){ | 
| 467 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, | ||
| 468 | + goodslist: null,is_level_three: 0 }); | ||
| 469 | + return false; | ||
| 470 | + } | ||
| 471 | + if (arr.length != 0){ | ||
| 472 | + var is_lev_thr=0 | ||
| 473 | + for(var i=0;i<arr.length;i++){ | ||
| 474 | + if (arr[i].arrays.length>0) {is_lev_thr=1;break; } | ||
| 475 | + } | ||
| 476 | + this.setData({ is_level_three: is_lev_thr }); | ||
| 493 | 477 | ||
| 478 | + if (this.data.is_level_three!=1) { | ||
| 479 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); | ||
| 480 | + } else { | ||
| 481 | + this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); | ||
| 482 | + } | ||
| 494 | } | 483 | } | 
| 495 | } | 484 | } | 
| 496 | - } | ||
| 497 | - | ||
| 498 | this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid}); | 485 | this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid}); | 
| 499 | 486 | ||
| 500 | }, | 487 | }, | 
| 501 | -// 图片失败 | 488 | + | 
| 489 | + | ||
| 490 | + //图片失败 | ||
| 502 | bind_bnerr_xc: function (e) { | 491 | bind_bnerr_xc: function (e) { | 
| 503 | var _errImg = e.target.dataset.errorimg; | 492 | var _errImg = e.target.dataset.errorimg; | 
| 504 | var _errurl = e.target.dataset.url; | 493 | var _errurl = e.target.dataset.url; | 
| @@ -529,7 +518,7 @@ Page({ | @@ -529,7 +518,7 @@ Page({ | ||
| 529 | } | 518 | } | 
| 530 | }) | 519 | }) | 
| 531 | }, | 520 | }, | 
| 532 | - onUnload: function () { | 521 | + onUnload: function () { | 
| 533 | this.destroyActivityTimer(); | 522 | this.destroyActivityTimer(); | 
| 534 | }, | 523 | }, | 
| 535 | 524 | 
pages/goods/categoryList/categoryList.wxml
| 1 | <block wx:if="{{is_used_share==0}}"> | 1 | <block wx:if="{{is_used_share==0}}"> | 
| 2 | -<view class='top_view' wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 2 | + <view class='top_view' wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 
| 3 | <view class="swiper-tab" > | 3 | <view class="swiper-tab" > | 
| 4 | <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}" | 4 | <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}" | 
| 5 | data-current="0" bindtap="clickTab">分类</view> | 5 | data-current="0" bindtap="clickTab">分类</view> | 
| @@ -9,9 +9,7 @@ | @@ -9,9 +9,7 @@ | ||
| 9 | data-current="2" bindtap="clickTab">品牌</view> | 9 | data-current="2" bindtap="clickTab">品牌</view> | 
| 10 | </view> | 10 | </view> | 
| 11 | </view> | 11 | </view> | 
| 12 | - | ||
| 13 | -<view class="search-box " bindtap="goseach"> | ||
| 14 | - | 12 | + <view class="search-box " bindtap="goseach"> | 
| 15 | <view class="search-inner"> | 13 | <view class="search-inner"> | 
| 16 | <view class="search-img"> | 14 | <view class="search-img"> | 
| 17 | <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image> | 15 | <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image> | 
| @@ -19,14 +17,12 @@ | @@ -19,14 +17,12 @@ | ||
| 19 | <input bindfocus="goseach" class="search-cont" placeholder="寻找好口碑" type="text"></input> | 17 | <input bindfocus="goseach" class="search-cont" placeholder="寻找好口碑" type="text"></input> | 
| 20 | </view> | 18 | </view> | 
| 21 | </view> | 19 | </view> | 
| 22 | - | ||
| 23 | -<block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 20 | + <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 
| 24 | <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;"> | 21 | <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;"> | 
| 25 | <!--------分类----------> | 22 | <!--------分类----------> | 
| 26 | <swiper-item > | 23 | <swiper-item > | 
| 27 | <scroll-view scroll-y="true" class="fenlei-list" | 24 | <scroll-view scroll-y="true" class="fenlei-list" | 
| 28 | scroll-with-animation="true" lower-threshold="1" bindscrolltolower="scrolltolower" style="height: {{abc}}rpx;" > | 25 | scroll-with-animation="true" lower-threshold="1" bindscrolltolower="scrolltolower" style="height: {{abc}}rpx;" > | 
| 29 | - | ||
| 30 | <block wx:for="{{catelist}}" wx:for-item="fitem" > | 26 | <block wx:for="{{catelist}}" wx:for-item="fitem" > | 
| 31 | <view class='f_item'> | 27 | <view class='f_item'> | 
| 32 | <view class="pic_view" bindtap="go_cate" data-cid="{{fitem.items.id}}" data-pid="0"><image class='fl_img' src='{{iurl}}{{fitem.items.image}}' binderror="bind_bnerr2" data-errorimg="catelist[{{index}}].items.image"></image> | 28 | <view class="pic_view" bindtap="go_cate" data-cid="{{fitem.items.id}}" data-pid="0"><image class='fl_img' src='{{iurl}}{{fitem.items.image}}' binderror="bind_bnerr2" data-errorimg="catelist[{{index}}].items.image"></image> | 
| @@ -37,9 +33,7 @@ | @@ -37,9 +33,7 @@ | ||
| 37 | bindtap="go_cate" data-cid="{{item.id}}" data-pid="{{item.parent_id}}">{{item.name}}</view> | 33 | bindtap="go_cate" data-cid="{{item.id}}" data-pid="{{item.parent_id}}">{{item.name}}</view> | 
| 38 | </view> | 34 | </view> | 
| 39 | </view> | 35 | </view> | 
| 40 | - </block> | ||
| 41 | - | ||
| 42 | - | 36 | + </block> | 
| 43 | </scroll-view> | 37 | </scroll-view> | 
| 44 | </swiper-item> | 38 | </swiper-item> | 
| 45 | <!-------国别----------> | 39 | <!-------国别----------> | 
| @@ -91,8 +85,7 @@ | @@ -91,8 +85,7 @@ | ||
| 91 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | 85 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | 
| 92 | </view> | 86 | </view> | 
| 93 | </block> | 87 | </block> | 
| 94 | - | ||
| 95 | -<block wx:elif="{{is_do}}"> | 88 | + <block wx:elif="{{is_do}}"> | 
| 96 | <view class="no-data" > | 89 | <view class="no-data" > | 
| 97 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | 90 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | 
| 98 | <view class="no-data-title">商家暂未设置分类</view> | 91 | <view class="no-data-title">商家暂未设置分类</view> | 
| @@ -101,169 +94,172 @@ | @@ -101,169 +94,172 @@ | ||
| 101 | </block> | 94 | </block> | 
| 102 | </block> | 95 | </block> | 
| 103 | <block wx:else> | 96 | <block wx:else> | 
| 104 | -<!-- 新版分类头部 --> | ||
| 105 | -<view class="xc-search-box flex-center white_b"> | ||
| 106 | - <view class="share-height t-c" bindtap="getScancode" > | ||
| 107 | - <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> | ||
| 108 | - <view class="fs24"> | ||
| 109 | - 扫一扫 | ||
| 110 | - </view> | ||
| 111 | - </view> | ||
| 112 | - <view class="xc-search-inner "> | ||
| 113 | - <view class="search-img left"> | ||
| 114 | - <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image> | ||
| 115 | - </view> | ||
| 116 | - <input bindfocus="goseach" class="search-cont" placeholder="搜索你想要的生活" type="text"></input> | ||
| 117 | - </view> | ||
| 118 | -</view> | ||
| 119 | - | ||
| 120 | -<!-- 分类项目内容 --> | ||
| 121 | -<view class="flex project_height"> | ||
| 122 | -<!-- 分类项目的类型 --> | ||
| 123 | -<view class="project_type"> | ||
| 124 | - <view class="project_type-frame"> | ||
| 125 | - <view wx:if="{{is_show_gb}}"> | ||
| 126 | - <view bindtap="click_classify" class="share_type fs32 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}"> | ||
| 127 | - <text>国</text><text>家</text> | ||
| 128 | - | ||
| 129 | - </view> | ||
| 130 | - </view> | ||
| 131 | - <view wx:if="{{is_show_pp}}"> | ||
| 132 | - <view bindtap="click_classify" class="{{select_classify_on==220?'select_classify':''}} share_type fs32 flex-space-between xc-letter-spacing" wx:if="{{is_brand}}"data-index="220"data-name="品牌"> | ||
| 133 | - <text>品</text><text>牌</text> | ||
| 134 | - </view> | ||
| 135 | - </view> | ||
| 136 | - <view wx:if="{{is_show_pl}}"> | ||
| 137 | - | ||
| 138 | - <view wx:for="{{one_level_classify}}" wx:for-item="ittms" > | ||
| 139 | - <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs32 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}"> | ||
| 140 | - <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}"> | ||
| 141 | - <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index"> | ||
| 142 | - <view> | ||
| 143 | - {{name}} | ||
| 144 | - </view> | ||
| 145 | - </view> | ||
| 146 | - | ||
| 147 | - </view> | ||
| 148 | - <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}} | ||
| 149 | - </view> | ||
| 150 | - </view> | ||
| 151 | - | ||
| 152 | - </view> | ||
| 153 | - | ||
| 154 | -</view> | ||
| 155 | - </view> | ||
| 156 | - | ||
| 157 | -</view> | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - | ||
| 161 | - | ||
| 162 | -<!-- 分类项目的内容 --> | ||
| 163 | - | ||
| 164 | -<view class="classify_content"> | ||
| 165 | -<!-- 国家的样式 --> | ||
| 166 | -<block wx:if="{{select_classify_on==223&&is_show_gb}}"> | ||
| 167 | -<view class="classify_name fs32 flex-space-between"> | ||
| 168 | -<view>{{ishaf_three==1?good_list.name:classify_name}}</view> | ||
| 169 | - | ||
| 170 | -</view> | ||
| 171 | - <view class=" classify_content-frame flex-space-between " > | ||
| 172 | - <view bindtap="go_nation" class="country_img-frame rel outer_location"wx:for="{{nationlist}}" wx:for-item="bitem" wx:for-index="pidx" data-nid="{{bitem.id}}" > | ||
| 173 | - <image class="country_img" src="{{iurl}}{{bitem.logo}}"></image> | ||
| 174 | - <view class='nation_box abs box'> | ||
| 175 | - <view class='nt_1 t-c line-height'> | ||
| 176 | - <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.name}}</text> | ||
| 177 | - </view> | 97 | + <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 
| 98 | + <!-- 新版分类头部 --> | ||
| 99 | + <view class="xc-search-box flex-center white_b"> | ||
| 100 | + <view class="share-height t-c" bindtap="getScancode" > | ||
| 101 | + <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> | ||
| 102 | + <view class="fs24"> | ||
| 103 | + 扫一扫 | ||
| 104 | + </view> | ||
| 178 | </view> | 105 | </view> | 
| 179 | - <view class='nation_box abs box'> | ||
| 180 | - <view class='nt_2 t-c line-height fs24'> | ||
| 181 | - <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.enname}}</text> | 106 | + <view class="xc-search-inner "> | 
| 107 | + <view class="search-img left"> | ||
| 108 | + <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image> | ||
| 182 | </view> | 109 | </view> | 
| 183 | - </view> | ||
| 184 | - </view> | ||
| 185 | -</view> | ||
| 186 | -</block> | ||
| 187 | -<!-- 品牌 --> | ||
| 188 | -<block wx:if="{{select_classify_on==220&&is_show_pp}}"> | ||
| 189 | - | ||
| 190 | -<view class="classify_name fs32 flex-space-between"> | ||
| 191 | -<view>{{classify_name}}</view> | 110 | + <input bindfocus="goseach" class="search-cont" placeholder="搜索你想要的生活" type="text"></input> | 
| 111 | + </view> | ||
| 112 | + </view> | ||
| 113 | + <!-- 分类项目内容 --> | ||
| 114 | + <view class="flex project_height"> | ||
| 115 | + <!-- 分类项目的类型 --> | ||
| 116 | + <view class="project_type"> | ||
| 117 | + <view class="project_type-frame"> | ||
| 118 | + <view wx:if="{{is_show_gb}}"> | ||
| 119 | + <view bindtap="click_classify" class="share_type fs32 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}"> | ||
| 120 | + <text>国</text><text>家</text> | ||
| 192 | 121 | ||
| 193 | -</view> | 122 | + </view> | 
| 123 | + </view> | ||
| 124 | + <view wx:if="{{is_show_pp}}"> | ||
| 125 | + <view bindtap="click_classify" class="{{select_classify_on==220?'select_classify':''}} share_type fs32 flex-space-between xc-letter-spacing" wx:if="{{is_brand}}"data-index="220"data-name="品牌"> | ||
| 126 | + <text>品</text><text>牌</text> | ||
| 127 | + </view> | ||
| 128 | + </view> | ||
| 129 | + <view wx:if="{{is_show_pl}}"> | ||
| 130 | + | ||
| 131 | + <view wx:for="{{one_level_classify}}" wx:for-item="ittms" > | ||
| 132 | + <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs32 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}"> | ||
| 133 | + <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}"> | ||
| 134 | + <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index"> | ||
| 135 | + <view> | ||
| 136 | + {{name}} | ||
| 137 | + </view> | ||
| 138 | + </view> | ||
| 139 | + | ||
| 140 | + </view> | ||
| 141 | + <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}} | ||
| 142 | + </view> | ||
| 143 | + </view> | ||
| 194 | 144 | ||
| 195 | -<view class="classify_content-frame flex flex-wrap"> | 145 | + </view> | 
| 196 | 146 | ||
| 197 | - <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> | ||
| 198 | - <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > | ||
| 199 | - | ||
| 200 | - <view class="brand_img t-c"> | ||
| 201 | - <image class=" brand_img" src="{{user.logo}}"data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr"></image> | ||
| 202 | - <view class="brand_img_name ellipsis-2 fs24">{{user.name}}</view> | ||
| 203 | - </view> | ||
| 204 | - </view> | 147 | + </view> | 
| 148 | + </view> | ||
| 205 | 149 | ||
| 150 | + </view> | ||
| 151 | + <!-- 分类项目的内容 --> | ||
| 152 | + <view class="classify_content"> | ||
| 153 | + <!-- 国家的样式 --> | ||
| 154 | + <block wx:if="{{select_classify_on==223&&is_show_gb}}"> | ||
| 155 | + <view class="classify_name fs32 flex-space-between"> | ||
| 156 | + <view>{{ishaf_three==1?good_list.name:classify_name}}</view> | ||
| 206 | 157 | ||
| 207 | -</block> | ||
| 208 | -</view> | ||
| 209 | -</block> | ||
| 210 | -<!-- 只是2级的 品类--> | ||
| 211 | -<block wx:if="{{is_show_pl}}"> | ||
| 212 | -<block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> | ||
| 213 | -<view> | ||
| 214 | -<view class="classify_name fs32 flex-space-between"data-pid="0"data-cid="{{cat_id}}" bindtap='select_more'> | ||
| 215 | -<view>{{classify_name}}</view> | ||
| 216 | - <view class="flex select_more" > | ||
| 217 | - <view class="red-co fs24" >更多</view> | ||
| 218 | - <view class="bg_right width_height"></view> | ||
| 219 | - </view> | ||
| 220 | -</view> | ||
| 221 | -<view class="classify_content-frame flex-wrap"> | ||
| 222 | -<block wx:for="{{goodslist}}"wx:for-item="goods"wx:for-index="indx"> | ||
| 223 | - | ||
| 224 | - <view class="type_img_frame t-c ib" data-cid="{{goods.items.id}}" data-pid="{{goods.items.parent_id}}" bindtap="go_cate"> | ||
| 225 | - <image class=" type_img" src="{{goods.items.icoimg==null||goods.items.icoimg==''?iurl+'/miniapp/images/no_cate_def.png':goods.items.icoimg}}"binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> | ||
| 226 | - <view class="brand_img_name fs24 ellipsis-1">{{goods.items.name}}</view> | ||
| 227 | - </view> | 158 | + </view> | 
| 159 | + <view class=" classify_content-frame flex-space-between " > | ||
| 160 | + <view bindtap="go_nation" class="country_img-frame rel outer_location"wx:for="{{nationlist}}" wx:for-item="bitem" wx:for-index="pidx" data-nid="{{bitem.id}}" > | ||
| 161 | + <image class="country_img" src="{{iurl}}{{bitem.logo}}"></image> | ||
| 162 | + <view class='nation_box abs box'> | ||
| 163 | + <view class='nt_1 t-c line-height' style="height:50rpx"> | ||
| 164 | + <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.name}}</text> | ||
| 165 | + </view> | ||
| 166 | + <view class='nt_2 t-c line-height fs24' style="line-height: 50rpx"> | ||
| 167 | + <text class="nation_y_name ellipsis-1 nt_1_t height fs24">{{bitem.enname}}</text> | ||
| 168 | + </view> | ||
| 169 | + </view> | ||
| 170 | + <!--<view class='nation_box abs box' style="top:20rpx">--> | ||
| 171 | + <!--</view>--> | ||
| 172 | + </view> | ||
| 173 | + </view> | ||
| 174 | + </block> | ||
| 175 | + <!-- 品牌 --> | ||
| 176 | + <block wx:if="{{select_classify_on==220&&is_show_pp}}"> | ||
| 228 | 177 | ||
| 229 | -</block> | ||
| 230 | - </view> | ||
| 231 | -</view> | ||
| 232 | -</block> | 178 | + <view class="classify_name fs32 flex-space-between"> | 
| 179 | + <view>{{classify_name}}</view> | ||
| 233 | 180 | ||
| 181 | + </view> | ||
| 234 | 182 | ||
| 235 | -<!-- 商品 含有3级的--> | ||
| 236 | -<block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three==1}}"> | ||
| 237 | -<block wx:for="{{goodslist}}"wx:for-item="goods"wx:for-index="inds"> | ||
| 238 | -<view> | 183 | + <view class="classify_content-frame flex flex-wrap"> | 
| 239 | 184 | ||
| 185 | + <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> | ||
| 186 | + <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > | ||
| 240 | 187 | ||
| 241 | -<view class="classify_name fs32 flex-space-between"data-pid="{{goods.items.parent_id}}" data-cid="{{goods.items.id}}" bindtap='select_more'> | ||
| 242 | -<view>{{goods.items.name}}</view> | ||
| 243 | -<view class="flex select_more" > | ||
| 244 | - <view class="red-co fs24" >更多</view> | ||
| 245 | - <view class="bg_right width_height"></view> | ||
| 246 | -</view> | ||
| 247 | -</view> | 188 | + <view class="brand_img t-c"> | 
| 189 | + <image class=" brand_img" src="{{user.logo}}"data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr"></image> | ||
| 190 | + <view class="brand_img_name ellipsis-2 fs24">{{user.name}}</view> | ||
| 191 | + </view> | ||
| 192 | + </view> | ||
| 248 | 193 | ||
| 249 | 194 | ||
| 250 | -<block wx:if="{{goods.arrays.length>0}}"> | ||
| 251 | -<view class="classify_content-frame flex-wrap"> | ||
| 252 | - <view class="type_img_frame t-c ib" data-cid="{{item.id}}" data-pid="three" wx:for="{{goods.arrays}}" wx:for-index="index" wx:for-item="item" bindtap="go_cate"> | ||
| 253 | - <image class=" type_img"src="{{item.icoimg==null||item.icoimg==''?iurl+'/miniapp/images/no_cate_def.png':item.icoimg}}"binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> | ||
| 254 | - <view class="brand_img_name fs24 ellipsis-1">{{item.name}}</view> | ||
| 255 | - </view> | ||
| 256 | -</view> | ||
| 257 | -<view class="divider_line"></view> | ||
| 258 | -</block> | 195 | + </block> | 
| 196 | + </view> | ||
| 197 | + </block> | ||
| 198 | + <!-- 品类--> | ||
| 199 | + <block wx:if="{{is_show_pl}}"> | ||
| 200 | + <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> | ||
| 201 | + <view> | ||
| 202 | + <view class="classify_name fs32 flex-space-between"data-pid="0"data-cid="{{cat_id}}" bindtap='select_more'> | ||
| 203 | + <view>{{classify_name}}</view> | ||
| 204 | + <view class="flex select_more" > | ||
| 205 | + <view class="red-co fs24" >更多</view> | ||
| 206 | + <view class="bg_right width_height"></view> | ||
| 207 | + </view> | ||
| 208 | + </view> | ||
| 209 | + <!-- 显示2级列表 --> | ||
| 210 | + <view class="classify_content-frame flex-wrap"> | ||
| 211 | + <block wx:if="{{goodslist && goodslist.length>0}}"> | ||
| 212 | + <block wx:for="{{goodslist}}" wx:for-item="goods"wx:for-index="indx"> | ||
| 213 | + <view class="type_img_frame t-c ib" data-cid="{{goods.items.id}}" data-pid="{{goods.items.parent_id}}" bindtap="go_cate"> | ||
| 214 | + <image class=" type_img" src="{{goods.items.icoimg==null||goods.items.icoimg==''?iurl+'/miniapp/images/no_cate_def.png':goods.items.icoimg}}"binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> | ||
| 215 | + <view class="brand_img_name fs24 ellipsis-1">{{goods.items.name}}</view> | ||
| 216 | + </view> | ||
| 217 | + </block> | ||
| 218 | + </block> | ||
| 219 | + <block wx:else> | ||
| 220 | + <view class="no_child_lev fs28">该类别无子级</view> | ||
| 221 | + </block> | ||
| 222 | + </view> | ||
| 259 | 223 | ||
| 260 | -</view> | ||
| 261 | -</block> | ||
| 262 | -</block> | ||
| 263 | -</block> | ||
| 264 | -</view> | 224 | + </view> | 
| 225 | + </block> | ||
| 226 | + | ||
| 227 | + <!-- 商品 含有3级的--> | ||
| 228 | + <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three==1}}"> | ||
| 229 | + <block wx:for="{{goodslist}}"wx:for-item="goods"wx:for-index="inds"> | ||
| 230 | + <view> | ||
| 231 | + | ||
| 232 | + <view class="classify_name fs32 flex-space-between"data-pid="{{goods.items.parent_id}}" data-cid="{{goods.items.id}}" bindtap='select_more'> | ||
| 233 | + <view>{{goods.items.name}}</view> | ||
| 234 | + <view class="flex select_more" > | ||
| 235 | + <view class="red-co fs24" >更多</view> | ||
| 236 | + <view class="bg_right width_height"></view> | ||
| 237 | + </view> | ||
| 238 | + </view> | ||
| 265 | 239 | ||
| 240 | + <block wx:if="{{goods.arrays.length>0}}"> | ||
| 241 | + <view class="classify_content-frame flex-wrap"> | ||
| 242 | + <view class="type_img_frame t-c ib" data-cid="{{item.id}}" data-pid="three" wx:for="{{goods.arrays}}" wx:for-index="index" wx:for-item="item" bindtap="go_cate"> | ||
| 243 | + <image class=" type_img"src="{{item.icoimg==null||item.icoimg==''?iurl+'/miniapp/images/no_cate_def.png':item.icoimg}}"binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> | ||
| 244 | + <view class="brand_img_name fs24 ellipsis-1">{{item.name}}</view> | ||
| 245 | + </view> | ||
| 246 | + </view> | ||
| 247 | + <view class="divider_line"></view> | ||
| 248 | + </block> | ||
| 266 | 249 | ||
| 267 | -</view> | 250 | + </view> | 
| 251 | + </block> | ||
| 252 | + </block> | ||
| 253 | + </block> | ||
| 254 | + </view> | ||
| 255 | + </view> | ||
| 256 | + </block> | ||
| 257 | + <block wx:elif="{{is_do}}"> | ||
| 258 | + <view class="no-data" > | ||
| 259 | + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | ||
| 260 | + <view class="no-data-title">商家暂未设置分类</view> | ||
| 261 | + <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | ||
| 262 | + </view> | ||
| 263 | + </block> | ||
| 268 | 264 | ||
| 269 | </block> | 265 | </block> | 
| 270 | \ No newline at end of file | 266 | \ No newline at end of file | 
pages/goods/categoryList/categoryList.wxss
| @@ -384,4 +384,6 @@ margin: auto; | @@ -384,4 +384,6 @@ margin: auto; | ||
| 384 | } | 384 | } | 
| 385 | 385 | ||
| 386 | .nation_z_name{ max-width: 130rpx} | 386 | .nation_z_name{ max-width: 130rpx} | 
| 387 | -.nation_y_name{ max-width: 130rpx} | ||
| 388 | \ No newline at end of file | 387 | \ No newline at end of file | 
| 388 | +.nation_y_name{ max-width: 130rpx; color: #888} | ||
| 389 | + | ||
| 390 | +.no_child_lev{width: 100%; text-align: center; color: #adadad; padding-top: 30rpx} | ||
| 389 | \ No newline at end of file | 391 | \ No newline at end of file |