Authored by huangyi

Merge branch 'develop' of http://git.yoho.cn/mobile/tt-yoho-app into develop

  1 +Component({
  2 + properties: {
  3 + data: {
  4 + type: null,
  5 + },
  6 + onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
  7 + type: String,
  8 + value: '0'
  9 + }
  10 + },
  11 +
  12 + data: {
  13 + textBrandKey:[],
  14 + textBrandData:[]
  15 + },
  16 + ready: function () {
  17 + //头条列表渲染不支持字典循环,故转换成数组 2018/12/7
  18 + if (this.properties.onlyTextBrand == '1') {
  19 + let textBrandKey = [];
  20 + let textBrandData = [];
  21 + for (const iterator of Object.keys(this.properties.data)) {
  22 + textBrandData.push(this.properties.data[iterator]);
  23 + textBrandKey.push(iterator);
  24 + }
  25 + this.setData({
  26 + textBrandData,
  27 + textBrandKey
  28 + })
  29 + }
  30 + },
  31 + methods: {
  32 + brandItemTapped: function(event) {
  33 + this.triggerEvent('brandItemTapped', event);
  34 + }
  35 + }
  36 +})
  1 +{
  2 + "component": true
  3 +}
  1 +
  2 +<block tt:if="{{onlyTextBrand == '0'}}">
  3 + <view class='rowType2'>
  4 + <block tt:for="{{data}}" tt:key="{{index}}" tt:for-item="item">
  5 + <view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
  6 + <image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>
  7 + <text class='item_title'>{{item.brand_name}}</text>
  8 + </view>
  9 + </block>
  10 + </view>
  11 +</block>
  12 +
  13 +<block tt:if="{{onlyTextBrand == '1'}}">
  14 + <view class='rowType'>
  15 + <block tt:for="{{textBrandData}}" tt:key="{{index}}" tt:for-item="item">
  16 + <view id="{{textBrandKey[index] == '0-9' ? 'last' : textBrandKey[index]}}" class='sessionTitle'>
  17 + <text class='sessionText'>{{textBrandKey[index] == '0-9' ? '0' : textBrandKey[index]}}</text>
  18 + </view>
  19 + <block tt:for="{{item}}" tt:key="{{unique}}" tt:for-item="item">
  20 + <view class='row' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
  21 + <view class='rowContent'>
  22 + <text class='title'>{{item.brand_name}}</text>
  23 + <view class='new' tt:if="{{item.is_show_new == 'Y'}}">
  24 + <text class='text'>NEW</text>
  25 + </view>
  26 + <view class='hot' tt:if="{{item.is_hot == 'Y'}}">
  27 + <text class='text'>HOT</text>
  28 + </view>
  29 + </view>
  30 + <view class='spaceLine'/>
  31 + </view>
  32 + </block>
  33 + </block>
  34 + </view>
  35 +</block>
  36 +
  1 +.rowType .sessionTitle {
  2 + display: flex;
  3 + align-items: center;
  4 + height: 58rpx;
  5 + width: 100%;
  6 + background: #F0F0F0;
  7 +}
  8 +
  9 +.rowType .sessionTitle .sessionText {
  10 + text-align: left;
  11 + margin-left: 30rpx;
  12 + font-weight: bold;
  13 + font-family: PingFang SC;
  14 + font-size: 28rpx;
  15 + color: #B0B0B0;
  16 + letter-spacing: -0.39px;
  17 +
  18 +}
  19 +
  20 +.row {
  21 + height: 88rpx;
  22 + width: 100%;
  23 + background-color-color: white;
  24 +}
  25 +
  26 +.row .rowContent {
  27 + display: flex;
  28 + align-items: center;
  29 + height: 86rpx;
  30 + width: 92%;
  31 + margin-left: 4%;
  32 + flex-direction: row;
  33 + background-color: white;
  34 +}
  35 +
  36 +.row .spaceLine {
  37 + height: 2rpx;
  38 + width: 92%;
  39 + margin-left: 4%;
  40 + background-color: #F0F0F0;
  41 +}
  42 +
  43 +.row .rowContent .title {
  44 + text-align: left;
  45 + max-width: 500rpx;
  46 + text-overflow: ellipsis;
  47 + overflow: hidden;
  48 + white-space: nowrap;
  49 + font-family: PingFang SC;
  50 + font-size: 28rpx;
  51 + color: #444444;
  52 + letter-spacing: -0.39px;
  53 +}
  54 +
  55 +.row .rowContent .hot {
  56 + display: flex;
  57 + align-items: center;
  58 + height: 30rpx;
  59 + width: 76rpx;
  60 + margin-left: 40rpx;
  61 + justify-content: center;
  62 + background-color: #D0021B;
  63 + border-radius: 104rpx;
  64 + font-family: PingFang SC;
  65 +}
  66 +
  67 + .row .rowContent .new {
  68 + display: flex;
  69 + align-items: center;
  70 + height: 30rpx;
  71 + width: 76rpx;
  72 + background-color: green;
  73 + margin-left: 40rpx;
  74 + justify-content: center;
  75 + border-radius: 104rpx;
  76 + font-family: PingFang SC;
  77 +}
  78 +
  79 +.row .rowContent .hot .text {
  80 + text-align: left;
  81 + font-family: PingFang SC Medium;
  82 + font-size: 24rpx;
  83 + color: #FFFFFF;
  84 + letter-spacing: -0.33px;
  85 +}
  86 +
  87 +.row .rowContent .new .text {
  88 + text-align: left;
  89 + font-family: PingFang SC Medium;
  90 + font-size: 24rpx;
  91 + color: #FFFFFF;
  92 + letter-spacing: -0.33px;
  93 +}
  94 +
  95 +.rowType2 {
  96 + display: flex;
  97 + flex-direction: row;
  98 + flex-wrap: wrap;
  99 +}
  100 +
  101 +.rowType2 .item {
  102 + width: 224rpx;
  103 + height: 210rpx;
  104 + margin-left: 20rpx;
  105 + display: flex;
  106 + flex-direction: column;
  107 +}
  108 +
  109 +.rowType2 .item .item_img{
  110 + width: 224rpx;
  111 + height: 100rpx;
  112 + margin-top: 41rpx;
  113 +}
  114 +
  115 +.rowType2 .item .item_title{
  116 + width: 224rpx;
  117 + height: 30rpx;
  118 + text-align: center;
  119 + text-overflow: ellipsis;
  120 + overflow: hidden;
  121 + white-space: nowrap;
  122 + font-family: PingFang SC;
  123 + font-size: 24rpx;
  124 + color: #B0B0B0;
  125 + letter-spacing: -0.33px;
  126 + margin-top: 20rpx;
  127 +}
@@ -7,14 +7,6 @@ Component({ @@ -7,14 +7,6 @@ Component({
7 data: { 7 data: {
8 8
9 }, 9 },
10 - // attached: function () {  
11 - // try {  
12 - // console.log('===========Component================');  
13 - // console.log(this.properties.data);  
14 - // console.log('====================================');  
15 - // } catch(e) {  
16 - // }  
17 - // },  
18 methods: { 10 methods: {
19 onButtonTapped: function (event) { 11 onButtonTapped: function (event) {
20 this.triggerEvent('tapOperationBar', event); 12 this.triggerEvent('tapOperationBar', event);
@@ -7,7 +7,16 @@ Component({ @@ -7,7 +7,16 @@ Component({
7 backgroudImage: "../../../images/filteritem-normal@2x.png", 7 backgroudImage: "../../../images/filteritem-normal@2x.png",
8 }, 8 },
9 attached: function () { 9 attached: function () {
10 - 10 + let isSelected = this.data.item.isSelected;
  11 + let backgroudImage = this.data.backgroudImage;
  12 + if(isSelected){
  13 + backgroudImage = "../../../images/filteritem-higjlight@2x.png";
  14 + }else {
  15 + backgroudImage = "../../../images/filteritem-normal@2x.png";
  16 + }
  17 + this.setData({
  18 + backgroudImage: backgroudImage,
  19 + });
11 }, 20 },
12 21
13 methods: { 22 methods: {
@@ -41,8 +41,7 @@ Page({ @@ -41,8 +41,7 @@ Page({
41 duration: 1000, 41 duration: 1000,
42 banner: [], 42 banner: [],
43 custom_brands: '', 43 custom_brands: '',
44 - brandsTextFilter: [],  
45 - currentBrandFliter: 0, 44 + switchData:{},
46 45
47 all_list: [], 46 all_list: [],
48 hot_list: [], 47 hot_list: [],
@@ -59,8 +58,7 @@ Page({ @@ -59,8 +58,7 @@ Page({
59 cacheBrandResourceDataForKid: '', 58 cacheBrandResourceDataForKid: '',
60 59
61 hotKeyword: {}, 60 hotKeyword: {},
62 - searching: false,  
63 - switchData:{} 61 + searching: false
64 }, 62 },
65 63
66 /** 64 /**
@@ -105,10 +103,15 @@ Page({ @@ -105,10 +103,15 @@ Page({
105 103
106 }, 104 },
107 105
  106 + onReachBottom: function () {
  107 +
  108 + },
  109 +
108 switchBrandFliter: function (event) { 110 switchBrandFliter: function (event) {
109 let currentBrandFliter = event.detail.currentTarget.dataset.brandFliter; 111 let currentBrandFliter = event.detail.currentTarget.dataset.brandFliter;
  112 + let brandsTextFilter = this.data.switchData.brandsTextFilter;
110 this.setData({ 113 this.setData({
111 - currentBrandFliter, 114 + switchData:{brandsTextFilter,currentBrandFliter}
112 }); 115 });
113 }, 116 },
114 117
@@ -165,9 +168,6 @@ Page({ @@ -165,9 +168,6 @@ Page({
165 new_list, 168 new_list,
166 all_list_key, 169 all_list_key,
167 }); 170 });
168 - console.log('============3=======================');  
169 - console.log(brandListData);  
170 - console.log('====================================');  
171 } else { 171 } else {
172 this.fetchBrandList(); 172 this.fetchBrandList();
173 } 173 }
@@ -180,8 +180,6 @@ Page({ @@ -180,8 +180,6 @@ Page({
180 this.setData({ 180 this.setData({
181 banner, 181 banner,
182 custom_brands, 182 custom_brands,
183 - brandsTextFilter,  
184 - currentBrandFliter,  
185 switchData:{brandsTextFilter,currentBrandFliter} 183 switchData:{brandsTextFilter,currentBrandFliter}
186 }); 184 });
187 } else { 185 } else {
@@ -203,19 +201,12 @@ Page({ @@ -203,19 +201,12 @@ Page({
203 api.get({data:param}) 201 api.get({data:param})
204 .then(data => { 202 .then(data => {
205 let json = parseListResources(data.data); 203 let json = parseListResources(data.data);
206 -  
207 - console.log('===============1====================');  
208 - console.log(json);  
209 - console.log('====================================');  
210 let all_list = json.all_list; 204 let all_list = json.all_list;
211 let hot_list = json.hot_list; 205 let hot_list = json.hot_list;
212 let new_list = json.new_list; 206 let new_list = json.new_list;
213 let all_list_key = json.all_list_key; 207 let all_list_key = json.all_list_key;
214 //记录缓存数据 208 //记录缓存数据
215 let key = that.data.currentChannelId; 209 let key = that.data.currentChannelId;
216 - console.log('===============&&&====================');  
217 - console.log(key);  
218 - console.log('====================================');  
219 if (key == 1) { 210 if (key == 1) {
220 that.setData({ 211 that.setData({
221 cacheBrandListDataForMen: json, 212 cacheBrandListDataForMen: json,
@@ -240,6 +231,7 @@ Page({ @@ -240,6 +231,7 @@ Page({
240 console.log('============2======================='); 231 console.log('============2=======================');
241 console.log(this.data.all_list); 232 console.log(this.data.all_list);
242 console.log(all_list); 233 console.log(all_list);
  234 + console.log(all_list_key);
243 console.log('===================================='); 235 console.log('====================================');
244 }) 236 })
245 .catch(error => { 237 .catch(error => {
@@ -292,8 +284,6 @@ Page({ @@ -292,8 +284,6 @@ Page({
292 that.setData({ 284 that.setData({
293 banner, 285 banner,
294 custom_brands, 286 custom_brands,
295 - brandsTextFilter,  
296 - currentBrandFliter,  
297 switchData:{brandsTextFilter,currentBrandFliter} 287 switchData:{brandsTextFilter,currentBrandFliter}
298 }); 288 });
299 }) 289 })
@@ -343,7 +333,7 @@ Page({ @@ -343,7 +333,7 @@ Page({
343 }, 333 },
344 334
345 brandItemTapped: function(event) { 335 brandItemTapped: function(event) {
346 - let brandItem = event.currentTarget.dataset.brandItem; 336 + let brandItem = event.detail.currentTarget.dataset.brandItem;
347 337
348 let shop_id = brandItem.shop_id; 338 let shop_id = brandItem.shop_id;
349 if (shop_id) { 339 if (shop_id) {
@@ -374,7 +364,11 @@ Page({ @@ -374,7 +364,11 @@ Page({
374 364
375 365
376 handlerAlphaTap(e) { 366 handlerAlphaTap(e) {
377 - let { ap } = e.target.dataset; 367 + let ap = e.target.dataset.ap;
  368 + console.log('====================================');
  369 + console.log(e);
  370 + console.log(ap);
  371 + console.log('====================================');
378 this.setData({ scrollToView: ap }); 372 this.setData({ scrollToView: ap });
379 }, 373 },
380 374
@@ -406,24 +400,18 @@ function parseListResources(json) { @@ -406,24 +400,18 @@ function parseListResources(json) {
406 let reg = /^[a-zA-Z]*$/; 400 let reg = /^[a-zA-Z]*$/;
407 let all_list = {}; 401 let all_list = {};
408 let otherList = []; 402 let otherList = [];
409 - let all_list_key = {}; 403 + let all_list_key = [];
410 404
411 for (let k in all_list_old) { 405 for (let k in all_list_old) {
  406 + all_list_key.push(k);
412 407
413 if (reg.test(k)) { 408 if (reg.test(k)) {
414 - all_list_key[k] = {  
415 - key: k,  
416 - };  
417 all_list[k] = all_list_old[k]; 409 all_list[k] = all_list_old[k];
418 } else { 410 } else {
419 Array.prototype.push.apply(otherList, all_list_old[k]); 411 Array.prototype.push.apply(otherList, all_list_old[k]);
420 } 412 }
421 } 413 }
422 -  
423 all_list['0-9'] = otherList; 414 all_list['0-9'] = otherList;
424 - all_list_key['0-9'] = {  
425 - key: '0-9',  
426 - };  
427 415
428 for (var i = 0; i < hot_list.length; i++) { 416 for (var i = 0; i < hot_list.length; i++) {
429 let item = hot_list[i]; 417 let item = hot_list[i];
@@ -434,17 +422,12 @@ function parseListResources(json) { @@ -434,17 +422,12 @@ function parseListResources(json) {
434 let item = new_list[i]; 422 let item = new_list[i];
435 item.brand_ico = item.brand_ico.replace(/{width}/g, 368).replace(/{height}/g, 184).replace('{mode}', 2); 423 item.brand_ico = item.brand_ico.replace(/{width}/g, 368).replace(/{height}/g, 184).replace('{mode}', 2);
436 } 424 }
437 - console.log('============4=======================');  
438 - console.log(all_list);  
439 - console.log('====================================');  
440 return { 425 return {
441 all_list, 426 all_list,
442 hot_list, 427 hot_list,
443 new_list, 428 new_list,
444 all_list_key, 429 all_list_key,
445 }; 430 };
446 -  
447 -  
448 } 431 }
449 432
450 function parseResourceResources(json) { 433 function parseResourceResources(json) {
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 "usingComponents": { 3 "usingComponents": {
4 "brandSearch": "../../components/category/brandSearch/brandSearch", 4 "brandSearch": "../../components/category/brandSearch/brandSearch",
5 "brandSwitcher": "../../components/category/brandSwitcher/brandSwitcher", 5 "brandSwitcher": "../../components/category/brandSwitcher/brandSwitcher",
6 - "genderSwitcher": "../../components/category/gender-switcher/gender-switcher" 6 + "genderSwitcher": "../../components/category/gender-switcher/gender-switcher",
  7 + "allBrandsComponent": "../../components/category/allBrands/allBrands"
7 } 8 }
8 } 9 }
@@ -37,57 +37,20 @@ @@ -37,57 +37,20 @@
37 37
38 <brandSwitcher data='{{switchData}}' catchswitchBrandFliter="switchBrandFliter"></brandSwitcher> 38 <brandSwitcher data='{{switchData}}' catchswitchBrandFliter="switchBrandFliter"></brandSwitcher>
39 39
40 - <view>{{currentBrandFliter}}</view>  
41 - <view>{{all_list.length}}</view>  
42 -  
43 - <block tt:if="{{currentBrandFliter == 0}}">  
44 - <view>{{all_list.length}}</view>  
45 - <block tt:for="{{all_list}}" tt:key="{{index}}" tt:for-item="item">  
46 - <view id="{{index == '0-9' ? 'last' : index}}" class='sessionTitle'>  
47 - <text class='sessionText'>{{index == '0-9' ? '0' : index}}</text>  
48 - </view>  
49 - <block tt:for="{{item}}" tt:key="{{unique}}" tt:for-item="item">  
50 - <view class='row' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">  
51 - <view class='rowContent'>  
52 - <text class='title'>{{item.brand_name}}</text>  
53 - <view class='new' tt:if="{{item.is_show_new == 'Y'}}">  
54 - <text class='text'>NEW</text>  
55 - </view>  
56 - <view class='hot' tt:if="{{item.is_hot == 'Y'}}">  
57 - <text class='text'>HOT</text>  
58 - </view>  
59 - </view>  
60 - <view class='spaceLine'/>  
61 - </view>  
62 - </block>  
63 - </block> 40 + <block tt:if="{{switchData.currentBrandFliter == 0}}">
  41 + <allBrandsComponent data="{{all_list}}" onlyTextBrand="1" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
64 </block> 42 </block>
65 - <block tt:elif="{{currentBrandFliter == 1}}">  
66 - <view class='rowType2'>  
67 - <block tt:for="{{new_list}}" tt:key="{{index}}" tt:for-item="item">  
68 - <view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">  
69 - <image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>  
70 - <text class='item_title'>{{item.brand_name}}</text>  
71 - </view>  
72 - </block>  
73 - </view> 43 + <block tt:elif="{{switchData.currentBrandFliter == 1}}">
  44 + <allBrandsComponent data="{{new_list}}" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
74 </block> 45 </block>
75 - <block tt:elif="{{currentBrandFliter == 2}}">  
76 - <view class='rowType2'>  
77 - <block tt:for="{{hot_list}}" tt:key="{{index}}" tt:for-item="item">  
78 - <view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">  
79 - <image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>  
80 - <text class='item_title'>{{item.brand_name}}</text>  
81 - </view>  
82 - </block>  
83 - </view> 46 + <block tt:elif="{{switchData.currentBrandFliter == 2}}">
  47 + <allBrandsComponent data="{{hot_list}}" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
84 </block> 48 </block>
85 </scroll-view> 49 </scroll-view>
86 50
87 - <view class="alphanet-selector" data-id="selector" catchtouchstart="handlerAlphaTap" catchtouchmove="handlerMove" tt:if="{{currentBrandFliter == 0}}">  
88 -  
89 - <view class="selector-one" data-ap="{{item.key=='0-9' ? 'last' : item.key}}" tt:for="{{all_list_key}}" tt:key="unique">  
90 - {{item.key=="0-9" ? '0' : item.key}} 51 + <view class="alphanet-selector" data-id="selector" catchtouchstart="handlerAlphaTap" catchtouchmove="handlerMove" tt:if="{{switchData.currentBrandFliter == 0}}">
  52 + <view class="selector-one" data-ap="{{item.key=='0-9' ? 'last' : item}}" tt:for="{{all_list_key}}" tt:key="unique">
  53 + {{(item=="0-9" || item=="0~9") ? '0' : item}}
91 </view> 54 </view>
92 </view> 55 </view>
93 </view> 56 </view>
@@ -91,134 +91,6 @@ @@ -91,134 +91,6 @@
91 margin-top: 10rpx; 91 margin-top: 10rpx;
92 } 92 }
93 93
94 -.sessionTitle {  
95 - display: flex;  
96 - align-items: center;  
97 - height: 58rpx;  
98 - width: 100%;  
99 - background: #F0F0F0;  
100 -}  
101 -  
102 -.sessionTitle .sessionText {  
103 - text-align: left;  
104 - margin-left: 30rpx;  
105 - font-weight: bold;  
106 -  
107 - font-family: PingFang SC;  
108 - font-size: 28rpx;  
109 - color: #B0B0B0;  
110 - letter-spacing: -0.39px;  
111 -  
112 -}  
113 -  
114 -  
115 -.row {  
116 - height: 88rpx;  
117 - width: 100%;  
118 - background: white;  
119 -}  
120 -  
121 -.row .rowContent {  
122 - display: flex;  
123 - align-items: center;  
124 - height: 86rpx;  
125 - width: 92%;  
126 - margin-left: 4%;  
127 - flex-direction: row;  
128 - background: white;  
129 -}  
130 -  
131 -.row .spaceLine {  
132 - height: 2rpx;  
133 - width: 92%;  
134 - margin-left: 4%;  
135 - background: #F0F0F0;  
136 -}  
137 -  
138 -.row .rowContent .title {  
139 - text-align: left;  
140 - max-width: 500rpx;  
141 - text-overflow: ellipsis;  
142 - overflow: hidden;  
143 - white-space: nowrap;  
144 - font-family: PingFang SC;  
145 - font-size: 28rpx;  
146 - color: #444444;  
147 - letter-spacing: -0.39px;  
148 -}  
149 -  
150 -.row .rowContent .hot {  
151 - display: flex;  
152 - align-items: center;  
153 - height: 30rpx;  
154 - width: 76rpx;  
155 - margin-left: 40rpx;  
156 - justify-content: center;  
157 - background: #D0021B;  
158 - border-radius: 104rpx;  
159 -}  
160 -  
161 - .row .rowContent .new {  
162 - display: flex;  
163 - align-items: center;  
164 - height: 30rpx;  
165 - width: 76rpx;  
166 - background: green;  
167 - margin-left: 40rpx;  
168 - justify-content: center;  
169 - border-radius: 104rpx;  
170 -}  
171 -  
172 -.row .rowContent .hot .text {  
173 - text-align: left;  
174 - font-family: PingFang SC Medium;  
175 - font-size: 24rpx;  
176 - color: #FFFFFF;  
177 - letter-spacing: -0.33px;  
178 -}  
179 -  
180 -.row .rowContent .new .text {  
181 - text-align: left;  
182 - font-family: PingFang SC Medium;  
183 - font-size: 24rpx;  
184 - color: #FFFFFF;  
185 - letter-spacing: -0.33px;  
186 -}  
187 -  
188 -.rowType2 {  
189 - display: flex;  
190 - flex-direction: row;  
191 - flex-wrap: wrap;  
192 -}  
193 -  
194 -.rowType2 .item {  
195 - width: 224rpx;  
196 - height: 210rpx;  
197 - margin-left: 20rpx;  
198 - display: flex;  
199 - flex-direction: column;  
200 -}  
201 -  
202 -.rowType2 .item .item_img{  
203 - width: 224rpx;  
204 - height: 100rpx;  
205 - margin-top: 41rpx;  
206 -}  
207 -  
208 -.rowType2 .item .item_title{  
209 - width: 224rpx;  
210 - height: 30rpx;  
211 - text-align: center;  
212 - text-overflow: ellipsis;  
213 - overflow: hidden;  
214 - white-space: nowrap;  
215 - font-family: PingFang SC;  
216 - font-size: 24rpx;  
217 - color: #B0B0B0;  
218 - letter-spacing: -0.33px;  
219 - margin-top: 20rpx;  
220 -}  
221 -  
222 .alphanet-selector { 94 .alphanet-selector {
223 position: absolute; 95 position: absolute;
224 top: 0px; 96 top: 0px;
@@ -241,7 +113,7 @@ @@ -241,7 +113,7 @@
241 font-style: normal; 113 font-style: normal;
242 font-stretch: normal; 114 font-stretch: normal;
243 text-align: center; 115 text-align: center;
244 - font-family: PingFang SC Medium; 116 + font-family: PingFang SC;
245 font-size: 22rpx; 117 font-size: 22rpx;
246 color: #444444; 118 color: #444444;
247 letter-spacing: 0.79px; 119 letter-spacing: 0.79px;
@@ -242,7 +242,7 @@ Page({ @@ -242,7 +242,7 @@ Page({
242 // } 242 // }
243 // logEvent(YB_CATEGORY_FL,param); 243 // logEvent(YB_CATEGORY_FL,param);
244 tt.navigateTo({ 244 tt.navigateTo({
245 - url: '../goodsList/goodsList' + queryString 245 + url: '../productList/index' + queryString
246 }); 246 });
247 247
248 }, 248 },
@@ -276,9 +276,9 @@ Page({ @@ -276,9 +276,9 @@ Page({
276 let queryString = "?gender=" + gender + "&sort=" + sort + "&title=" + categoryName + 276 let queryString = "?gender=" + gender + "&sort=" + sort + "&title=" + categoryName +
277 "&categoryId=" + parentCategoryId + "&subCategoryId=" + categoryId + "&firstProductSkn=" + firstProductSkn; 277 "&categoryId=" + parentCategoryId + "&subCategoryId=" + categoryId + "&firstProductSkn=" + firstProductSkn;
278 278
279 - tt.navigateTo({  
280 - url: '../productList/index' + queryString  
281 - }); 279 + tt.navigateTo({
  280 + url: '../productList/index' + queryString
  281 + });
282 }, 282 },
283 283
284 /** 284 /**
@@ -248,7 +248,7 @@ Page(extend({}, Actionsheet,{ @@ -248,7 +248,7 @@ Page(extend({}, Actionsheet,{
248 msort: msort, 248 msort: msort,
249 misort: misort, 249 misort: misort,
250 page_name: this.data.current_page_name, 250 page_name: this.data.current_page_name,
251 - sharePath: '/pages/goodsList/goodsList?union_type=' + app.globalData.user_union_type + "&" + params, 251 + sharePath: '/pages/productList/index?union_type=' + app.globalData.user_union_type + "&" + params,
252 sort: this.data.sort, 252 sort: this.data.sort,
253 categoryID: this.data.current_page_param, 253 categoryID: this.data.current_page_param,
254 } 254 }
@@ -48,19 +48,28 @@ Page({ @@ -48,19 +48,28 @@ Page({
48 }, 48 },
49 onLoad: function (option) { 49 onLoad: function (option) {
50 try{ 50 try{
  51 + console.log('====================================');
  52 + console.log(option);
  53 + console.log('====================================');
51 if(option){ 54 if(option){
52 let categoryId = option.categoryId; 55 let categoryId = option.categoryId;
53 - let firstProductSkn = option.firstProductSkn;  
54 - // let navigate = option.navigate;  
55 - let sort = option.sort;  
56 - let subCategoryId = option.subCategoryId;  
57 - let title = option.title; 56 + let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
  57 + let sort = option.sort ? option.sort : '';
  58 + let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
  59 + let title = option.title ? option.title : '';
  60 + let gender = option.gender ? option.gender : '';
58 console.log("categoryId:"+categoryId+"==subCategoryId:"+subCategoryId+"==sort:"+sort+"==firstProductSkn:"+firstProductSkn); 61 console.log("categoryId:"+categoryId+"==subCategoryId:"+subCategoryId+"==sort:"+sort+"==firstProductSkn:"+firstProductSkn);
59 62
60 - this.data.categoryId = option.categoryId;  
61 - this.data.subCategoryId = option.subCategoryId;  
62 - this.data.sort = option.sort;  
63 - this.data.firstProductSkn = option.firstProductSkn; 63 + this.data.categoryId = categoryId;
  64 + this.data.subCategoryId = subCategoryId;
  65 + this.data.sort = sort;
  66 + this.data.firstProductSkn = firstProductSkn;
  67 + this.data.title = title;
  68 + this.data.gender = gender;
  69 +
  70 + tt.setNavigationBarTitle({
  71 + title: title
  72 + });
64 } 73 }
65 let systemInfo = tt.getSystemInfoSync(); 74 let systemInfo = tt.getSystemInfoSync();
66 let contentWidth = systemInfo.screenWidth; 75 let contentWidth = systemInfo.screenWidth;
@@ -77,7 +86,7 @@ Page({ @@ -77,7 +86,7 @@ Page({
77 let tab = this.data.tabs[0]; 86 let tab = this.data.tabs[0];
78 // let filterParams = this.data.filterParams; 87 // let filterParams = this.data.filterParams;
79 this.fechProductList(tab,1); 88 this.fechProductList(tab,1);
80 - this.fechFilter(); 89 + // this.fechFilter();
81 }, 90 },
82 onShow: function () { 91 onShow: function () {
83 if(this.data.isRefresh){ 92 if(this.data.isRefresh){
@@ -95,7 +104,6 @@ Page({ @@ -95,7 +104,6 @@ Page({
95 let tab = this.data.tabs[current]; 104 let tab = this.data.tabs[current];
96 this.fechProductList(tab,1); 105 this.fechProductList(tab,1);
97 } 106 }
98 -  
99 } 107 }
100 }, 108 },
101 onTabClick: function (e) { 109 onTabClick: function (e) {
@@ -119,7 +127,6 @@ Page({ @@ -119,7 +127,6 @@ Page({
119 if(tabData && tabData.page){ 127 if(tabData && tabData.page){
120 page = tabData.page; 128 page = tabData.page;
121 } 129 }
122 - // let filterParams = {};  
123 this.fechProductList(tab,page); 130 this.fechProductList(tab,page);
124 } 131 }
125 132
@@ -130,7 +137,6 @@ Page({ @@ -130,7 +137,6 @@ Page({
130 let orderType = tab.iconType; 137 let orderType = tab.iconType;
131 let iconUrl = tab.iconUrl; 138 let iconUrl = tab.iconUrl;
132 let order = "s_p_desc"; 139 let order = "s_p_desc";
133 - // console.log("id:"+id+"===orderType:"+orderType);  
134 140
135 //设置是否显示加载中 141 //设置是否显示加载中
136 let thatTabs = this.data.tabs; 142 let thatTabs = this.data.tabs;
@@ -159,16 +165,18 @@ Page({ @@ -159,16 +165,18 @@ Page({
159 let categoryId = that.data.categoryId; 165 let categoryId = that.data.categoryId;
160 let subCategoryId = that.data.subCategoryId; 166 let subCategoryId = that.data.subCategoryId;
161 let firstProductSkn = that.data.firstProductSkn; 167 let firstProductSkn = that.data.firstProductSkn;
  168 + let title = that.data.title;
  169 + let gender = that.data.gender;
162 let param = { 170 let param = {
163 method: "app.search.category", 171 method: "app.search.category",
164 firstProductSkn: firstProductSkn, 172 firstProductSkn: firstProductSkn,
165 - gender:"1,3",  
166 - limit: 10, 173 + gender,
  174 + limit: 60,
167 page: currentPage, 175 page: currentPage,
168 sort: sort, 176 sort: sort,
169 - subCategoryId: subCategoryId,  
170 - title: "POLO",  
171 - order: order, 177 + categoryId,
  178 + subCategoryId,
  179 + title
172 } 180 }
173 let params = Object.assign(filterParams, param); 181 let params = Object.assign(filterParams, param);
174 api.get({data: params}) 182 api.get({data: params})
@@ -219,126 +227,4 @@ Page({ @@ -219,126 +227,4 @@ Page({
219 } 227 }
220 228
221 }, 229 },
222 - fechFilter: function() {  
223 - let that = this;  
224 - let sort = that.data.sort;  
225 - let categoryId = that.data.categoryId;  
226 - let subCategoryId = that.data.subCategoryId;  
227 - let firstProductSkn = that.data.firstProductSkn;  
228 - let params = {  
229 - categoryId: categoryId,  
230 - firstProductSkn: firstProductSkn,  
231 - limit: 20,  
232 - method: "app.search.category.filter",  
233 - new_filter: 1,  
234 - // order: "",  
235 - page: 1,  
236 - sort: sort,  
237 - subCategoryId: subCategoryId,  
238 - }  
239 - api.get({data: params})  
240 - .then(data => {  
241 - let filter = data.data.filter;  
242 - let newFilter = this.parseFilter(filter);  
243 - that.setData({  
244 - filter: newFilter,  
245 - });  
246 -  
247 - });  
248 -  
249 - },  
250 - parseFilter: function (filter){  
251 - let newFilter = [];  
252 - for(var i = 0; i < filter.length; i++){  
253 - let itemList = filter[i].itemList;  
254 - // let newItemList = [];  
255 - for(var j = 0; j < itemList.length; j++){  
256 - let item = itemList[j];  
257 - let columnIndex = j % 3;  
258 - item.columnIndex = columnIndex;  
259 - item.subItemIndex = j;  
260 - item.itemIndex = i;  
261 - // newItemList.push(item)  
262 - }  
263 - // newFilter.push(newItemList);  
264 - }  
265 -  
266 - let new_filter = filter;  
267 - return new_filter  
268 - },  
269 - onItemClick: function(e) {  
270 - let subItem = e.detail;  
271 - if(subItem){  
272 - let subItemIndex = subItem.subItemIndex;  
273 - let itemIndex = subItem.itemIndex;  
274 - let itemId = subItem.itemId;  
275 - let itemName = subItem.itemName;  
276 - let itemIsSelected = subItem.isSelected;  
277 -  
278 -  
279 - let filter = this.data.filter;  
280 - let itemInfo = filter[itemIndex];  
281 - //已经选择的信息。默认为undefind  
282 - let itemSelectedName = itemInfo.selectedName;  
283 - let itemSelectedId = itemInfo.selectedId;  
284 -  
285 - //当前选择的信息  
286 - let currentSelectedName = subItem.itemName+",";  
287 - let currentSelectedId = subItem.itemId+",";  
288 -  
289 - //即将选择的信息  
290 - let futureSelectedId = "";  
291 - let futureSelectedName = "";  
292 - //已经有选择项  
293 - if(itemSelectedId) {  
294 - //取消该选择项  
295 - if(!itemIsSelected) {  
296 - futureSelectedId = itemSelectedId.replace(currentSelectedId,"");  
297 - futureSelectedName = itemSelectedName.replace(currentSelectedName,"");  
298 - }else {//添加该选项  
299 - futureSelectedId = itemSelectedId+currentSelectedId;  
300 - futureSelectedName = itemSelectedName+currentSelectedName;  
301 - }  
302 - }else {  
303 - futureSelectedId = currentSelectedId;  
304 - futureSelectedName = currentSelectedName;  
305 - }  
306 - console.log("itemIsSelected:"+itemIsSelected+"==futureSelectedId:"+futureSelectedId)  
307 -  
308 - itemInfo.itemList[subItemIndex] = subItem;  
309 - itemInfo.selectedName = futureSelectedName;  
310 - itemInfo.selectedId = futureSelectedId;  
311 - //用于搜索  
312 - itemInfo.selectedIdParam = futureSelectedId.substring(0, futureSelectedId.lastIndexOf(','));  
313 - //用于显示  
314 - itemInfo.selectedNameStr = futureSelectedName.substring(0, futureSelectedName.lastIndexOf(','));  
315 -  
316 - filter[itemIndex] = itemInfo;  
317 - this.setData({  
318 - filter: filter,  
319 - });  
320 -  
321 -  
322 - console.log(itemId)  
323 - }  
324 -  
325 -  
326 - },  
327 - onShowItem: function(e) {  
328 - let detail = e.detail;  
329 - console.log("itemIndex:"+itemIndex);  
330 - let itemIndex = detail.itemIndex;  
331 - let filter = this.data.filter;  
332 - let itemInfo = filter[itemIndex];  
333 - let isShowItem = itemInfo.isShowItem;  
334 - if(isShowItem){  
335 - itemInfo.isShowItem = false;  
336 - }else {  
337 - itemInfo.isShowItem = true;  
338 - }  
339 - this.setData({  
340 - filter: filter,  
341 - });  
342 - },  
343 -  
344 }) 230 })
@@ -4,24 +4,57 @@ Page({ @@ -4,24 +4,57 @@ Page({
4 filter: [] 4 filter: []
5 }, 5 },
6 onLoad: function (option) { 6 onLoad: function (option) {
7 - if(option){  
8 - this.data.categoryId = option.categoryId;  
9 - this.data.subCategoryId = option.subCategoryId;  
10 - this.data.sort = option.sort;  
11 - this.data.firstProductSkn = option.firstProductSkn;  
12 - } 7 + //获取已经选择的筛选数据
13 let pages = getCurrentPages(); 8 let pages = getCurrentPages();
14 let length =pages.length; 9 let length =pages.length;
  10 + let selectedFilter = [];
15 if(length > 1){ 11 if(length > 1){
16 let lastPageData = pages[length - 2].data; 12 let lastPageData = pages[length - 2].data;
17 - let filter = lastPageData.filter;  
18 - let newFilter = this.parseFilter(filter); 13 + selectedFilter = lastPageData.filter;
  14 + }
  15 + //有筛选数据使用筛选数据,没有筛选数据使用接口请求的数据
  16 +
  17 + if(selectedFilter && selectedFilter.length > 0){
19 this.setData({ 18 this.setData({
20 - filter: newFilter, 19 + filter: selectedFilter,
21 }); 20 });
  21 + }else {
  22 + if(option){
  23 + this.fechFilter(option);
  24 + }
22 } 25 }
23 26
24 - 27 + },
  28 + fechFilter: function(option) {
  29 + console.log('====================================');
  30 + console.log(option);
  31 + console.log('====================================');
  32 + let that = this;
  33 + let sort = option.sort ? option.sort : '';
  34 + let categoryId = option.categoryId ? option.categoryId : '';
  35 + let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
  36 + let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
  37 + let query = option.query ? option.query : '';
  38 + let method = option.method ? option.method : "app.search.category.filter";
  39 + let params = {
  40 + categoryId,
  41 + firstProductSkn,
  42 + method,
  43 + query,
  44 + new_filter: 1,
  45 + // order: "",
  46 + sort,
  47 + subCategoryId,
  48 + }
  49 + api.get({data: params})
  50 + .then(data => {
  51 + let filter = data.data.filter;
  52 + let newFilter = this.parseFilter(filter);
  53 + that.setData({
  54 + filter: newFilter,
  55 + });
  56 + });
  57 +
25 }, 58 },
26 parseFilter: function (filter){ 59 parseFilter: function (filter){
27 let newFilter = []; 60 let newFilter = [];
@@ -35,7 +68,6 @@ Page({ @@ -35,7 +68,6 @@ Page({
35 item.itemIndex = i; 68 item.itemIndex = i;
36 } 69 }
37 } 70 }
38 -  
39 let new_filter = filter; 71 let new_filter = filter;
40 return new_filter 72 return new_filter
41 }, 73 },
@@ -93,6 +125,11 @@ Page({ @@ -93,6 +125,11 @@ Page({
93 let pages = getCurrentPages(); 125 let pages = getCurrentPages();
94 let length =pages.length; 126 let length =pages.length;
95 if(length > 1){ 127 if(length > 1){
  128 + let filterParams = pages[length - 2].data.filterParams;
  129 + let itemId = itemInfo.filterId;
  130 + let selectedIdParam = itemInfo.selectedIdParam;
  131 + filterParams[itemId] = selectedIdParam;
  132 + pages[length - 2].data.filterParams = filterParams;
96 pages[length - 2].data.filter = filter; 133 pages[length - 2].data.filter = filter;
97 } 134 }
98 } 135 }
@@ -117,28 +154,32 @@ Page({ @@ -117,28 +154,32 @@ Page({
117 }); 154 });
118 }, 155 },
119 onButtonAction: function (e) { 156 onButtonAction: function (e) {
120 - let detail = e.detail;  
121 - let actionId = detail.actionId; 157 + let detail = e.detail;
  158 + let actionId = detail.actionId;
122 159
123 - //取消  
124 - if(actionId === 2){  
125 - let filterparams = {}  
126 - let filter = this.data.filter;  
127 - for(var i = 0; i < filter.length; i++){  
128 - let item = filter[i];  
129 - let filterId = item.filterId;  
130 - let filterValue = item.selectedIdParam;  
131 - if(filterValue){  
132 - filterparams[filterId] = filterValue;  
133 - }  
134 - } 160 + //取消
135 let pages = getCurrentPages(); 161 let pages = getCurrentPages();
136 let length =pages.length; 162 let length =pages.length;
137 - if(length > 1){  
138 - pages[length - 2].data.isRefresh = true;  
139 - } 163 + if(actionId === 2){
  164 + let filterparams = {}
  165 + let filter = this.data.filter;
  166 + for(var i = 0; i < filter.length; i++){
  167 + let item = filter[i];
  168 + let filterId = item.filterId;
  169 + let filterValue = item.selectedIdParam;
  170 + if(filterValue){
  171 + filterparams[filterId] = filterValue;
  172 + }
  173 + }
  174 +
  175 + if(length > 1){
  176 + pages[length - 2].data.isRefresh = true;
  177 + }
140 }else { 178 }else {
141 - 179 + this.data.filterParams = {};
  180 + if(length > 1){
  181 + pages[length - 2].data.filterParams = {};
  182 + }
142 } 183 }
143 //返回上一页 184 //返回上一页
144 tt.navigateBack({ 185 tt.navigateBack({
1 { 1 {
2 - "usingComponents": {  
3 - "proFilter": "../../components/productFilter/proFilter",  
4 - "filter-item": "../../components/productFilter/item/filter-item",  
5 - "filter-title": "../../components/productFilter/item/filter-title"  
6 - }  
7 - 2 + "navigationBarTitleText": "筛选",
  3 + "usingComponents": {
  4 + "proFilter": "../../components/productFilter/proFilter",
  5 + "filter-item": "../../components/productFilter/item/filter-item",
  6 + "filter-title": "../../components/productFilter/item/filter-title"
  7 + }
8 } 8 }
@@ -558,11 +558,8 @@ Page(extend({}, Actionsheet,{ @@ -558,11 +558,8 @@ Page(extend({}, Actionsheet,{
558 }, 558 },
559 559
560 jumpToFilterPage: function () { 560 jumpToFilterPage: function () {
561 - let params = Object.assign({ method: 'miniapp.search.fuzzy.filter' }, this.data.keyword_param);  
562 - let storageKey = this.data.filterStorageKey;  
563 - let paramString = JSON.stringify(params);  
564 tt.navigateTo({ 561 tt.navigateTo({
565 - url: '../goodsList/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString 562 + url: '../productListFilter/filter?storageKey=' + this.data.filterStorageKey + '&method=' + 'miniapp.search.fuzzy.filter' + '&query=' + this.data.keyword
566 }) 563 })
567 }, 564 },
568 565
@@ -6,7 +6,7 @@ import router from './router'; @@ -6,7 +6,7 @@ import router from './router';
6 6
7 const ACTION_TYPE = { 7 const ACTION_TYPE = {
8 h5: 'go.h5', 8 h5: 'go.h5',
9 - goodsList: 'go.list', 9 + productList: 'go.list',
10 brandStore: 'go.shop', 10 brandStore: 'go.shop',
11 } 11 }
12 12
@@ -63,13 +63,13 @@ export default { @@ -63,13 +63,13 @@ export default {
63 this.go('webview', yohobuy); 63 this.go('webview', yohobuy);
64 break; 64 break;
65 } 65 }
66 - case ACTION_TYPE.goodsList: { 66 + case ACTION_TYPE.productList: {
67 let yohobuy = { 67 let yohobuy = {
68 ...yoho.params, 68 ...yoho.params,
69 url: yoho.params.url, 69 url: yoho.params.url,
70 action: yoho.action 70 action: yoho.action
71 } 71 }
72 - this.go('goodsList', yohobuy); 72 + this.go('productList', yohobuy);
73 break; 73 break;
74 } 74 }
75 case ACTION_TYPE.brandStore: { 75 case ACTION_TYPE.brandStore: {
@@ -2,8 +2,8 @@ export default { @@ -2,8 +2,8 @@ export default {
2 home: { 2 home: {
3 path: '../index/index' 3 path: '../index/index'
4 }, 4 },
5 - goodsList: {  
6 - path: '../goodsList/goodsList' 5 + productList: {
  6 + path: '../productList/index'
7 }, 7 },
8 brandStore: { 8 brandStore: {
9 path: '../goodsList/brandStore' 9 path: '../goodsList/brandStore'