Authored by 郝肖肖

merage shopSort筛选功能

@@ -121,10 +121,11 @@ @@ -121,10 +121,11 @@
121 121
122 <div class="discount-area first" id="navlist2"> 122 <div class="discount-area first" id="navlist2">
123 <ul id="list-nav" class="home-sub-nav list-nav pos-list clearfix"> 123 <ul id="list-nav" class="home-sub-nav list-nav pos-list clearfix">
124 - <li data-bp-id="shop_listnav_new_1" class="new active buriedpoint"> 124 + <li data-bp-id="shop_listnav_new_1" class="new active buriedpoint first-li-more">
125 <a href="javascript:void(0);"> 125 <a href="javascript:void(0);">
126 <span class="spanTest">最新</span> 126 <span class="spanTest">最新</span>
127 - <span class="iconfont cur">&#xe616;</span> 127 + <span class="iconfont up cur hide">&#xe615;</span>
  128 + <span class="iconfont down cur">&#xe616;</span>
128 </a> 129 </a>
129 </li> 130 </li>
130 <li class="price buriedpoint" data-bp-id="shop_listnav_price_1"> 131 <li class="price buriedpoint" data-bp-id="shop_listnav_price_1">
@@ -152,6 +153,12 @@ @@ -152,6 +153,12 @@
152 </a> 153 </a>
153 </li> 154 </li>
154 </ul> 155 </ul>
  156 + <div class='new-list hide'>
  157 + <ul>
  158 + <li class='active default' data-bp-id='shop_listnav_default_1'>默认</li>
  159 + <li class='new' data-bp-id='shop_listnav_new_1'>最新</li>
  160 + </ul>
  161 + </div>
155 </div> 162 </div>
156 163
157 <div class="discount-area first"> 164 <div class="discount-area first">
@@ -161,10 +168,10 @@ @@ -161,10 +168,10 @@
161 {{> common/goods}} 168 {{> common/goods}}
162 {{/ goods}} 169 {{/ goods}}
163 </div> 170 </div>
  171 + <div class="default-goods container hide clearfix"></div>
  172 + <div class="sale-goods container hide clearfix"></div>
164 <div class="price-goods container hide clearfix"></div> 173 <div class="price-goods container hide clearfix"></div>
165 <div class="discount-goods container hide clearfix"></div> 174 <div class="discount-goods container hide clearfix"></div>
166 -  
167 -  
168 </div> 175 </div>
169 </div> 176 </div>
170 </div> 177 </div>
@@ -182,42 +189,51 @@ @@ -182,42 +189,51 @@
182 <a href="{{allGoods}}" target="_blank">全部商品</a> 189 <a href="{{allGoods}}" target="_blank">全部商品</a>
183 </li> 190 </li>
184 </ul> 191 </ul>
  192 + <div id="pos-list" class='hide'>
  193 + <ul class="home-sub-nav pos-list">
  194 + <li class="new active buriedpoint first-li-more" data-bp-id="shop_poslist_new_1">
  195 + <a href="javascript:void(0);">
  196 + <span class="spanTest">最新</span>
  197 + <span class="iconfont cur">&#xe616;</span>
  198 + <b></b>
  199 + </a>
  200 + </li>
  201 + <li class="price buriedpoint" data-bp-id="shop_poslist_price_1">
  202 + <a href="javascript:void(0);">
  203 + <span class="spanTest">价格</span>
  204 + <span class="icon">
  205 + <i class="iconfont up cur">&#xe615;</i>
  206 + <i class="iconfont down">&#xe616;</i>
  207 + </span>
  208 + <b></b>
  209 + </a>
  210 + </li>
  211 + <li class="discount buriedpoint" data-bp-id="shop_poslist_discount_1">
  212 + <a href="javascript:void(0);">
  213 + <span class="spanTest">折扣</span>
  214 + <span class="icon">
  215 + <i class="iconfont up cur">&#xe615;</i>
  216 + <i class="iconfont down">&#xe616;</i>
  217 + </span>
  218 + <b></b>
  219 + </a>
  220 + </li>
  221 + <li class="filter buriedpoint" data-bp-id="shop_poslist_filter_1">
  222 + <a href="javascript:void(0);">
  223 + <span class="spanTest">筛选</span>
  224 + <span class="iconfont cur">&#xe613;</span>
  225 + </a>
  226 + </li>
  227 + </ul>
185 228
186 - <ul id="pos-list" class="home-sub-nav pos-list hide">  
187 - <li class="new active buriedpoint" data-bp-id="shop_poslist_new_1">  
188 - <a href="javascript:void(0);">  
189 - <span class="spanTest">最新</span>  
190 - <span class="iconfont cur">&#xe616;</span>  
191 - <b></b>  
192 - </a>  
193 - </li>  
194 - <li class="price buriedpoint" data-bp-id="shop_poslist_price_1">  
195 - <a href="javascript:void(0);">  
196 - <span class="spanTest">价格</span>  
197 - <span class="icon">  
198 - <i class="iconfont up cur">&#xe615;</i>  
199 - <i class="iconfont down">&#xe616;</i>  
200 - </span>  
201 - <b></b>  
202 - </a>  
203 - </li>  
204 - <li class="discount buriedpoint" data-bp-id="shop_poslist_discount_1">  
205 - <a href="javascript:void(0);">  
206 - <span class="spanTest">折扣</span>  
207 - <span class="icon">  
208 - <i class="iconfont up cur">&#xe615;</i>  
209 - <i class="iconfont down">&#xe616;</i>  
210 - </span>  
211 - <b></b>  
212 - </a>  
213 - </li>  
214 - <li class="filter buriedpoint" data-bp-id="shop_poslist_filter_1">  
215 - <a href="javascript:void(0);">  
216 - <span class="spanTest">筛选</span>  
217 - <span class="iconfont cur">&#xe613;</span>  
218 - </a>  
219 - </li>  
220 - </ul> 229 + <div class='new-list hide'>
  230 + <ul>
  231 + <li class='active default' data-bp-id='shop_listnav_default_1'>默认</li>
  232 + <li class='new' data-bp-id='shop_listnav_new_1'>最新</li>
  233 + <li class='sale' data-bp-id='shop_listnav_sale_1'>销量</li>
  234 + </ul>
  235 + </div>
  236 + </div>
221 </div> 237 </div>
222 {{> common/filter}} 238 {{> common/filter}}
223 {{/ shopIndex}} 239 {{/ shopIndex}}
@@ -90,49 +90,52 @@ @@ -90,49 +90,52 @@
90 <!-- 优惠卷 --> 90 <!-- 优惠卷 -->
91 <div class="coupon-group"></div> 91 <div class="coupon-group"></div>
92 92
93 - <ul id="list-nav" class="list-nav clearfix">  
94 - {{#if isSearch}}  
95 - <li class="new active buriedpoint" data-bp-id="">  
96 - <a href="javascript:void(0);">  
97 - <span class="nav-txt">默认</span>  
98 - <span class="iconfont cur">&#xe616;</span>  
99 - </a>  
100 - </li>  
101 - {{else}}  
102 - <li class="new active buriedpoint" data-bp-id="shop_listnav_new_1">  
103 - <a href="javascript:void(0);">  
104 - <span class="nav-txt">最新</span>  
105 - <span class="iconfont cur">&#xe616;</span>  
106 - </a>  
107 - </li>  
108 - {{/if}}  
109 - <li class="price buriedpoint" data-bp-id="shop_listnav_price_1">  
110 - <a href="javascript:void(0);">  
111 - <span class="nav-txt">价格</span>  
112 - <span class="icon">  
113 - <i class="iconfont up cur">&#xe615;</i>  
114 - <i class="iconfont down">&#xe616;</i>  
115 - </span>  
116 - </a>  
117 - </li>  
118 - <li class="discount buriedpoint" data-bp-id="shop_listnav_discount_1">  
119 - <a href="javascript:void(0);">  
120 - <span class="nav-txt">折扣</span>  
121 - <span class="icon">  
122 - <i class="iconfont up cur">&#xe615;</i>  
123 - <i class="iconfont down">&#xe616;</i>  
124 - </span>  
125 - </a>  
126 - </li>  
127 - <li class="filter buriedpoint" data-bp-id="shop_listnav_filter_1">  
128 - <a href="javascript:void(0);">  
129 - <span class="nav-txt">筛选</span>  
130 - <span class="iconfont cur">&#xe613;</span>  
131 - </a>  
132 - </li>  
133 - </ul> 93 + <div>
  94 + <ul id="list-nav" class="list-nav clearfix">
  95 + <li class="new active buriedpoint first-li-more" data-bp-id="shop_listnav_new_1">
  96 + <a href="javascript:void(0);">
  97 + <span class="nav-txt">最新</span>
  98 + <span class="iconfont up cur hide">&#xe615;</span>
  99 + <span class="iconfont down cur">&#xe616;</span>
  100 + </a>
  101 + </li>
  102 + <li class="price buriedpoint" data-bp-id="shop_listnav_price_1">
  103 + <a href="javascript:void(0);">
  104 + <span class="nav-txt">价格</span>
  105 + <span class="icon">
  106 + <i class="iconfont up cur">&#xe615;</i>
  107 + <i class="iconfont down">&#xe616;</i>
  108 + </span>
  109 + </a>
  110 + </li>
  111 + <li class="discount buriedpoint" data-bp-id="shop_listnav_discount_1">
  112 + <a href="javascript:void(0);">
  113 + <span class="nav-txt">折扣</span>
  114 + <span class="icon">
  115 + <i class="iconfont up cur">&#xe615;</i>
  116 + <i class="iconfont down">&#xe616;</i>
  117 + </span>
  118 + </a>
  119 + </li>
  120 + <li class="filter buriedpoint" data-bp-id="shop_listnav_filter_1">
  121 + <a href="javascript:void(0);">
  122 + <span class="nav-txt">筛选</span>
  123 + <span class="iconfont cur">&#xe613;</span>
  124 + </a>
  125 + </li>
  126 + </ul>
  127 + <div class='new-list hide'>
  128 + <ul>
  129 + <li class='active default' data-bp-id='shop_listnav_default_1'>默认</li>
  130 + <li class='new' data-bp-id='shop_listnav_new_1'>最新</li>
  131 + </ul>
  132 + </div>
  133 + </div>
  134 +
134 <div id="goods-container" class="goods-container"> 135 <div id="goods-container" class="goods-container">
  136 + <div class="default-goods container clearfix"></div>
135 <div class="new-goods container clearfix"></div> 137 <div class="new-goods container clearfix"></div>
  138 + <div class="sale-goods container clearfix"></div>
136 <div class="price-goods container clearfix hide"></div> 139 <div class="price-goods container clearfix hide"></div>
137 <div class="discount-goods container clearfix hide"></div> 140 <div class="discount-goods container clearfix hide"></div>
138 141
@@ -22,9 +22,12 @@ var tip = require('../../plugin/tip'); @@ -22,9 +22,12 @@ var tip = require('../../plugin/tip');
22 var loading = require('../../plugin/loading'); 22 var loading = require('../../plugin/loading');
23 23
24 var $goodsContainer = $('#goods-container'), 24 var $goodsContainer = $('#goods-container'),
  25 + $defaultgc = $goodsContainer.children('.default-goods'),
25 $ngc = $goodsContainer.children('.new-goods'), 26 $ngc = $goodsContainer.children('.new-goods'),
  27 + $sgc = $goodsContainer.children('.sale-goods'),
26 $pgc = $goodsContainer.children('.price-goods'), 28 $pgc = $goodsContainer.children('.price-goods'),
27 - $dgc = $goodsContainer.children('.discount-goods'); 29 + $dgc = $goodsContainer.children('.discount-goods'),
  30 + $newList = $('.new-list');
28 31
29 var winH = $(window).height(); 32 var winH = $(window).height();
30 33
@@ -42,22 +45,34 @@ var $listNav = $('#list-nav'), @@ -42,22 +45,34 @@ var $listNav = $('#list-nav'),
42 45
43 // 导航数据信息 46 // 导航数据信息
44 navInfo = { 47 navInfo = {
45 - newest: { 48 + price: {
46 order: 1, 49 order: 1,
47 reload: true, 50 reload: true,
48 page: 0, 51 page: 0,
49 end: false 52 end: false
50 }, 53 },
51 - price: { 54 + discount: {
52 order: 1, 55 order: 1,
53 reload: true, 56 reload: true,
54 page: 0, 57 page: 0,
55 end: false 58 end: false
56 }, 59 },
57 - discount: {  
58 - order: 1, 60 + default: {
  61 + order: 0,
59 reload: true, 62 reload: true,
60 - page: 0, 63 + page: 1,
  64 + end: false
  65 + },
  66 + new: {
  67 + order: 0,
  68 + reload: true,
  69 + page: 1,
  70 + end: false
  71 + },
  72 + sale: {
  73 + order: 0,
  74 + reload: true,
  75 + page: 1,
61 end: false 76 end: false
62 } 77 }
63 }, 78 },
@@ -290,11 +305,15 @@ function search(opt) { @@ -290,11 +305,15 @@ function search(opt) {
290 305
291 // 导航类别 306 // 导航类别
292 if ($pre.hasClass('new')) { 307 if ($pre.hasClass('new')) {
293 - navType = 'newest'; 308 + navType = 'new';
294 } else if ($pre.hasClass('price')) { 309 } else if ($pre.hasClass('price')) {
295 navType = 'price'; 310 navType = 'price';
296 } else if ($pre.hasClass('discount')) { 311 } else if ($pre.hasClass('discount')) {
297 navType = 'discount'; 312 navType = 'discount';
  313 + } else if ($pre.hasClass('default')) {
  314 + navType = 'default';
  315 + } else if ($pre.hasClass('sale')) {
  316 + navType = 'sale';
298 } 317 }
299 318
300 nav = navInfo[navType]; 319 nav = navInfo[navType];
@@ -368,7 +387,7 @@ function search(opt) { @@ -368,7 +387,7 @@ function search(opt) {
368 $container; 387 $container;
369 388
370 switch (navType) { 389 switch (navType) {
371 - case 'newest': 390 + case 'new':
372 $container = $ngc; 391 $container = $ngc;
373 break; 392 break;
374 case 'price': 393 case 'price':
@@ -377,6 +396,12 @@ function search(opt) { @@ -377,6 +396,12 @@ function search(opt) {
377 case 'discount': 396 case 'discount':
378 $container = $dgc; 397 $container = $dgc;
379 break; 398 break;
  399 + case 'default':
  400 + $container = $defaultgc;
  401 + break;
  402 + case 'sale':
  403 + $container = $sgc;
  404 + break;
380 default: 405 default:
381 break; 406 break;
382 } 407 }
@@ -419,7 +444,7 @@ function search(opt) { @@ -419,7 +444,7 @@ function search(opt) {
419 // 用于统计点击了商品列表的第几个商品,序号从1开始计算。 444 // 用于统计点击了商品列表的第几个商品,序号从1开始计算。
420 if (window._yas) { 445 if (window._yas) {
421 switch (navType) { 446 switch (navType) {
422 - case 'newest': 447 + case 'new':
423 window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid, 448 window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
424 '', $('.new-goods .good-info .good-detail-img .good-thumb')); 449 '', $('.new-goods .good-info .good-detail-img .good-thumb'));
425 break; 450 break;
@@ -431,6 +456,14 @@ function search(opt) { @@ -431,6 +456,14 @@ function search(opt) {
431 window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid, 456 window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
432 '', $('.discount-goods .good-info .good-detail-img .good-thumb')); 457 '', $('.discount-goods .good-info .good-detail-img .good-thumb'));
433 break; 458 break;
  459 + case 'default':
  460 + window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
  461 + '', $('.default-goods .good-info .good-detail-img .good-thumb'));
  462 + break;
  463 + case 'sale':
  464 + window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
  465 + '', $('.sale-goods .good-info .good-detail-img .good-thumb'));
  466 + break;
434 default: 467 default:
435 break; 468 break;
436 } 469 }
@@ -482,6 +515,77 @@ $listNav.bind('contextmenu', function() { @@ -482,6 +515,77 @@ $listNav.bind('contextmenu', function() {
482 return false; 515 return false;
483 }); 516 });
484 517
  518 +function newListHide() {
  519 + var $firstLi = $listNav.find('li.first-li-more');
  520 +
  521 + if ($newList.hasClass('hide')) {
  522 + $firstLi.find('span.up').addClass('hide');
  523 + $firstLi.find('span.down').removeClass('hide');
  524 + } else {
  525 + $firstLi.find('span.down').addClass('hide');
  526 + $firstLi.find('span.up').removeClass('hide');
  527 + }
  528 +}
  529 +
  530 +$newList.on('touchstart', 'li', function(e) {
  531 + var navType, bpIdData = $(this).attr('data-bp-id') || '',
  532 + $firstLiDom = $listNav.find('li.first-li-more');
  533 +
  534 + e.preventDefault();
  535 + if ($(this).hasClass('new')) {
  536 + navType = 'new';
  537 + } else if ($(this).hasClass('default')) {
  538 + navType = 'default';
  539 + } else if ($(this).hasClass('sale')) {
  540 + navType = 'sale';
  541 + }
  542 +
  543 + $newList.addClass('hide');
  544 + $firstLiDom.find('.nav-txt').text($(this).text());
  545 + $firstLiDom.attr('data-bp-id', bpIdData).addClass('active').siblings().removeClass('active');
  546 + $listNav.find('.first-li-more').removeClass('new default sale').addClass(navType);
  547 +
  548 + $(document).trigger('shouldSendBpData', [bpIdData]);
  549 + newListHide();
  550 +
  551 + // 切换container显示
  552 + $goodsContainer.children('.container:not(.hide)').addClass('hide');
  553 +
  554 + switch (navType) {
  555 + case 'new':
  556 + $ngc.removeClass('hide');
  557 + break;
  558 +
  559 + case 'price':
  560 + $pgc.removeClass('hide');
  561 + break;
  562 +
  563 + case 'discount':
  564 + $dgc.removeClass('hide');
  565 + break;
  566 +
  567 + case 'default':
  568 + $defaultgc.removeClass('hide');
  569 + break;
  570 +
  571 + case 'sale':
  572 + $sgc.removeClass('hide');
  573 + break;
  574 + default:
  575 + break;
  576 + }
  577 +
  578 + search();
  579 +});
  580 +
  581 +$(document).on('touchstart', function(e) {
  582 + if (!$newList.hasClass('hide') &&
  583 + $(e.target).closest('.new-list, li.first-li-more').length <= 0) {
  584 + $newList.addClass('hide');
  585 + newListHide();
  586 + }
  587 +});
  588 +
485 $listNav.on('touchend touchcancel', function(e) { 589 $listNav.on('touchend touchcancel', function(e) {
486 var $this = $(e.target).closest('li'), 590 var $this = $(e.target).closest('li'),
487 nav, 591 nav,
@@ -489,6 +593,23 @@ $listNav.on('touchend touchcancel', function(e) { @@ -489,6 +593,23 @@ $listNav.on('touchend touchcancel', function(e) {
489 $active; 593 $active;
490 var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || ''; 594 var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
491 595
  596 + if ($this.hasClass('first-li-more')) {
  597 + filter.hideFilter();
  598 + $newList.removeClass('hide');
  599 + if ($this.hasClass('default')) {
  600 + $newList.find('li.default').addClass('active').siblings().removeClass('active');
  601 + } else if ($this.hasClass('new')) {
  602 + $newList.find('li.new').addClass('active').siblings().removeClass('active');
  603 + } else if ($this.hasClass('sale')) {
  604 + $newList.find('li.sale').addClass('active').siblings().removeClass('active');
  605 + }
  606 + newListHide();
  607 + return true;
  608 + }
  609 +
  610 + // 最新li 列表
  611 + $newList.addClass('hide');
  612 +
492 if ($this.hasClass('filter')) { 613 if ($this.hasClass('filter')) {
493 614
494 // 筛选面板切换状态 615 // 筛选面板切换状态
@@ -509,11 +630,15 @@ $listNav.on('touchend touchcancel', function(e) { @@ -509,11 +630,15 @@ $listNav.on('touchend touchcancel', function(e) {
509 } else { 630 } else {
510 631
511 if ($this.hasClass('new')) { 632 if ($this.hasClass('new')) {
512 - navType = 'newest'; 633 + navType = 'new';
513 } else if ($this.hasClass('price')) { 634 } else if ($this.hasClass('price')) {
514 navType = 'price'; 635 navType = 'price';
515 } else if ($this.hasClass('discount')) { 636 } else if ($this.hasClass('discount')) {
516 navType = 'discount'; 637 navType = 'discount';
  638 + } else if ($this.hasClass('default')) {
  639 + navType = 'default';
  640 + } else if ($this.hasClass('sale')) {
  641 + navType = 'sale';
517 } 642 }
518 643
519 nav = navInfo[navType]; 644 nav = navInfo[navType];
@@ -548,7 +673,7 @@ $listNav.on('touchend touchcancel', function(e) { @@ -548,7 +673,7 @@ $listNav.on('touchend touchcancel', function(e) {
548 $goodsContainer.children('.container:not(.hide)').addClass('hide'); 673 $goodsContainer.children('.container:not(.hide)').addClass('hide');
549 674
550 switch (navType) { 675 switch (navType) {
551 - case 'newest': 676 + case 'new':
552 $ngc.removeClass('hide'); 677 $ngc.removeClass('hide');
553 break; 678 break;
554 679
@@ -559,6 +684,14 @@ $listNav.on('touchend touchcancel', function(e) { @@ -559,6 +684,14 @@ $listNav.on('touchend touchcancel', function(e) {
559 case 'discount': 684 case 'discount':
560 $dgc.removeClass('hide'); 685 $dgc.removeClass('hide');
561 break; 686 break;
  687 +
  688 + case 'default':
  689 + $defaultgc.removeClass('hide');
  690 + break;
  691 +
  692 + case 'sale':
  693 + $sgc.removeClass('hide');
  694 + break;
562 default: 695 default:
563 break; 696 break;
564 } 697 }
@@ -27,16 +27,18 @@ var tip = require('../../plugin/tip'), @@ -27,16 +27,18 @@ var tip = require('../../plugin/tip'),
27 var $subNav = $('.home-sub-nav'), 27 var $subNav = $('.home-sub-nav'),
28 $collect = $('#collect'), 28 $collect = $('#collect'),
29 $goodsContainer = $('#goods-container'), 29 $goodsContainer = $('#goods-container'),
30 - $goodsChildren = $goodsContainer.children(),  
31 - $ngc = $($goodsChildren.get(0)),  
32 - $pgc = $($goodsChildren.get(1)),  
33 - $dgc = $($goodsChildren.get(2)), 30 + $ngc = $goodsContainer.children('.new-goods'),
  31 + $defaultgc = $goodsContainer.children('.default-goods'),
  32 + $sgc = $goodsContainer.children('.sale-goods'),
  33 + $pgc = $goodsContainer.children('.price-goods'),
  34 + $dgc = $goodsContainer.children('.discount-goods'),
34 shopId = $('input[name="shop_id"]').val(), 35 shopId = $('input[name="shop_id"]').val(),
35 appVersion = $('input[name="app_version"]').val(), 36 appVersion = $('input[name="app_version"]').val(),
36 brand = $('input[name="brand"]').val(), 37 brand = $('input[name="brand"]').val(),
37 coverChannel = $('input[name="coverChannel"]').val(), 38 coverChannel = $('input[name="coverChannel"]').val(),
38 favId = $('input[name="favId"]').val(), 39 favId = $('input[name="favId"]').val(),
39 - uid = $('input[name="uid"]').val(); 40 + uid = $('input[name="uid"]').val(),
  41 + $newList = $('.new-list');
40 42
41 var winH = $(window).height(), 43 var winH = $(window).height(),
42 noResult = '<p class="no-result">未找到相关搜索结果</p>'; 44 noResult = '<p class="no-result">未找到相关搜索结果</p>';
@@ -89,7 +91,7 @@ var $listNav = $('#list-nav'), @@ -89,7 +91,7 @@ var $listNav = $('#list-nav'),
89 // 导航数据信息 91 // 导航数据信息
90 navInfo = { 92 navInfo = {
91 new: { 93 new: {
92 - order: 1, 94 + order: 0,
93 reload: true, 95 reload: true,
94 page: 1, 96 page: 1,
95 end: false 97 end: false
@@ -97,12 +99,6 @@ var $listNav = $('#list-nav'), @@ -97,12 +99,6 @@ var $listNav = $('#list-nav'),
97 hot: { 99 hot: {
98 order: 1, 100 order: 1,
99 reload: true, 101 reload: true,
100 - page: 1,  
101 - end: false  
102 - },  
103 - newest: {  
104 - order: 0,  
105 - reload: true,  
106 page: 0, 102 page: 0,
107 end: false 103 end: false
108 }, 104 },
@@ -117,6 +113,18 @@ var $listNav = $('#list-nav'), @@ -117,6 +113,18 @@ var $listNav = $('#list-nav'),
117 reload: true, 113 reload: true,
118 page: 0, 114 page: 0,
119 end: false 115 end: false
  116 + },
  117 + default: {
  118 + order: 0,
  119 + reload: true,
  120 + page: 0,
  121 + end: false
  122 + },
  123 + sale: {
  124 + order: 0,
  125 + reload: true,
  126 + page: 0,
  127 + end: false
120 } 128 }
121 }, 129 },
122 $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 130 $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项
@@ -199,7 +207,7 @@ function getPageGoods(info) { @@ -199,7 +207,7 @@ function getPageGoods(info) {
199 url: info.url, 207 url: info.url,
200 data: info.data, 208 data: info.data,
201 success: function(data) { 209 success: function(data) {
202 - if (data === ' ') { 210 + if (data === '') {
203 nav.end = true; 211 nav.end = true;
204 } 212 }
205 213
@@ -324,7 +332,8 @@ var theY; @@ -324,7 +332,8 @@ var theY;
324 * 筛选后内容变化,导致nav1位置错掉,重新计算确保位置正确显示 332 * 筛选后内容变化,导致nav1位置错掉,重新计算确保位置正确显示
325 */ 333 */
326 function reNav1Pos() { 334 function reNav1Pos() {
327 - var sTop = theY ? theY : 0; 335 + var sTop = theY ? theY : 0, tra;
  336 +
328 if (sTop < imgH + main1oH + nav1H) { 337 if (sTop < imgH + main1oH + nav1H) {
329 if ($nav1.hasClass('hide')) { 338 if ($nav1.hasClass('hide')) {
330 $nav1.removeClass('hide'); 339 $nav1.removeClass('hide');
@@ -385,6 +394,7 @@ function scrollHandler() { @@ -385,6 +394,7 @@ function scrollHandler() {
385 if (sTop + winH * 2 > scH) { 394 if (sTop + winH * 2 > scH) {
386 scrollCall = function() { 395 scrollCall = function() {
387 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)'; 396 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
  397 +
388 $nav1.css({ 398 $nav1.css({
389 transform: translate, 399 transform: translate,
390 '-moz-transform': translate, 400 '-moz-transform': translate,
@@ -620,11 +630,15 @@ function search(opt) { @@ -620,11 +630,15 @@ function search(opt) {
620 630
621 // 导航类别 631 // 导航类别
622 if ($pre.hasClass('new')) { 632 if ($pre.hasClass('new')) {
623 - navType = 'newest'; 633 + navType = 'new';
624 } else if ($pre.hasClass('price')) { 634 } else if ($pre.hasClass('price')) {
625 navType = 'price'; 635 navType = 'price';
626 } else if ($pre.hasClass('discount')) { 636 } else if ($pre.hasClass('discount')) {
627 navType = 'discount'; 637 navType = 'discount';
  638 + } else if ($pre.hasClass('default')) {
  639 + navType = 'default';
  640 + } else if ($pre.hasClass('sale')) {
  641 + navType = 'sale';
628 } 642 }
629 nav = navInfo[navType]; 643 nav = navInfo[navType];
630 644
@@ -668,7 +682,7 @@ function search(opt) { @@ -668,7 +682,7 @@ function search(opt) {
668 num; 682 num;
669 683
670 switch (navType) { 684 switch (navType) {
671 - case 'newest': 685 + case 'new':
672 $container = $ngc; 686 $container = $ngc;
673 break; 687 break;
674 case 'price': 688 case 'price':
@@ -677,11 +691,17 @@ function search(opt) { @@ -677,11 +691,17 @@ function search(opt) {
677 case 'discount': 691 case 'discount':
678 $container = $dgc; 692 $container = $dgc;
679 break; 693 break;
  694 + case 'default':
  695 + $container = $defaultgc;
  696 + break;
  697 + case 'sale':
  698 + $container = $sgc;
  699 + break;
680 default: 700 default:
681 break; 701 break;
682 } 702 }
683 703
684 - if (data === ' ') { 704 + if (data === '') {
685 nav.end = true; 705 nav.end = true;
686 706
687 if (nav.reload) { 707 if (nav.reload) {
@@ -722,10 +742,88 @@ function search(opt) { @@ -722,10 +742,88 @@ function search(opt) {
722 } 742 }
723 743
724 744
725 -$listNav.bind('contextmenu', function(e) { 745 +$listNav.bind('contextmenu', function() {
726 return false; 746 return false;
727 }); 747 });
728 748
  749 +function newListHide() {
  750 + var $firstLi = $('ul.pos-list').find('li.first-li-more');
  751 +
  752 + if ($newList.hasClass('hide')) {
  753 + $firstLi.find('span.up').addClass('hide');
  754 + $firstLi.find('span.down').removeClass('hide');
  755 + } else {
  756 + $firstLi.find('span.down').addClass('hide');
  757 + $firstLi.find('span.up').removeClass('hide');
  758 + }
  759 +}
  760 +
  761 +$newList.on('touchstart', 'li', function(e) {
  762 + var navType, bpIdData = $(this).attr('data-bp-id') || '',
  763 + $firstLiDom = $('ul.pos-list').find('li.first-li-more');
  764 +
  765 + e.preventDefault();
  766 + if ($(this).hasClass('new')) {
  767 + navType = 'new';
  768 + } else if ($(this).hasClass('default')) {
  769 + navType = 'default';
  770 + } else if ($(this).hasClass('sale')) {
  771 + navType = 'sale';
  772 + }
  773 +
  774 + $newList.addClass('hide');
  775 + $firstLiDom.find('.spanTest').text($(this).text());
  776 + $firstLiDom.attr('data-bp-id', bpIdData).addClass('active').siblings().removeClass('active');
  777 + $subNav.find('.first-li-more').removeClass('new default sale').addClass(navType);
  778 +
  779 + $(document).trigger('shouldSendBpData', [bpIdData]);
  780 + newListHide();
  781 +
  782 + // 切换container显示
  783 + $goodsContainer.children('.container:not(.hide)').addClass('hide');
  784 +
  785 + switch (navType) {
  786 + case 'new':
  787 + $ngc.removeClass('hide');
  788 + break;
  789 +
  790 + case 'price':
  791 + $pgc.removeClass('hide');
  792 + break;
  793 +
  794 + case 'discount':
  795 + $dgc.removeClass('hide');
  796 + break;
  797 +
  798 + case 'default':
  799 + $defaultgc.removeClass('hide');
  800 + break;
  801 +
  802 + case 'sale':
  803 + $sgc.removeClass('hide');
  804 + break;
  805 + default:
  806 + break;
  807 + }
  808 +
  809 + search({
  810 + type: 'shop_id',
  811 + id: shopId,
  812 + brand: brand,
  813 + appVersion: appVersion,
  814 + url: location.protocol + '//m.yohobuy.com/product/search/search',
  815 + nextPage: false
  816 + });
  817 +});
  818 +
  819 +$(document).on('touchstart', function(e) {
  820 + if (!$newList.hasClass('hide') &&
  821 + $(e.target).closest('.new-list, li.first-li-more').length <= 0) {
  822 + $newList.addClass('hide');
  823 + newListHide();
  824 + }
  825 +});
  826 +
729 $subNav.on('touchend touchcancel', function(e) { 827 $subNav.on('touchend touchcancel', function(e) {
730 var $this = $(e.target).closest('li'), 828 var $this = $(e.target).closest('li'),
731 cname, 829 cname,
@@ -735,6 +833,24 @@ $subNav.on('touchend touchcancel', function(e) { @@ -735,6 +833,24 @@ $subNav.on('touchend touchcancel', function(e) {
735 var bpIdData = $this.attr('data-bp-id') || ''; 833 var bpIdData = $this.attr('data-bp-id') || '';
736 834
737 e.preventDefault(); 835 e.preventDefault();
  836 +
  837 + if ($this.hasClass('first-li-more')) {
  838 + filter.hideFilter();
  839 + $newList.removeClass('hide');
  840 + if ($this.hasClass('default')) {
  841 + $newList.find('li.default').addClass('active').siblings().removeClass('active');
  842 + } else if ($this.hasClass('new')) {
  843 + $newList.find('li.new').addClass('active').siblings().removeClass('active');
  844 + } else if ($this.hasClass('sale')) {
  845 + $newList.find('li.sale').addClass('active').siblings().removeClass('active');
  846 + }
  847 + newListHide();
  848 + return true;
  849 + }
  850 +
  851 + // 最新li 列表
  852 + $newList.addClass('hide');
  853 +
738 $(document).trigger('shouldSendBpData', [bpIdData]); 854 $(document).trigger('shouldSendBpData', [bpIdData]);
739 855
740 if (typeof $this === 'undefined' || $this.length === 0) { 856 if (typeof $this === 'undefined' || $this.length === 0) {
@@ -772,13 +888,19 @@ $subNav.on('touchend touchcancel', function(e) { @@ -772,13 +888,19 @@ $subNav.on('touchend touchcancel', function(e) {
772 888
773 if ($this.hasClass('new')) { 889 if ($this.hasClass('new')) {
774 cname = '.new'; 890 cname = '.new';
775 - navType = 'newest'; 891 + navType = 'new';
776 } else if ($this.hasClass('price')) { 892 } else if ($this.hasClass('price')) {
777 cname = '.price'; 893 cname = '.price';
778 navType = 'price'; 894 navType = 'price';
779 } else if ($this.hasClass('discount')) { 895 } else if ($this.hasClass('discount')) {
780 cname = '.discount'; 896 cname = '.discount';
781 navType = 'discount'; 897 navType = 'discount';
  898 + } else if ($this.hasClass('hot')) {
  899 + cname = '.default';
  900 + navType = 'default';
  901 + } else if ($this.hasClass('sale')) {
  902 + cname = '.sale';
  903 + navType = 'sale';
782 } 904 }
783 905
784 myScroll && myScroll.enable(); 906 myScroll && myScroll.enable();
@@ -803,7 +925,7 @@ $subNav.on('touchend touchcancel', function(e) { @@ -803,7 +925,7 @@ $subNav.on('touchend touchcancel', function(e) {
803 $goodsContainer.children('.container:not(.hide)').addClass('hide'); 925 $goodsContainer.children('.container:not(.hide)').addClass('hide');
804 926
805 switch (navType) { 927 switch (navType) {
806 - case 'newest': 928 + case 'new':
807 $ngc.removeClass('hide'); 929 $ngc.removeClass('hide');
808 break; 930 break;
809 931
@@ -814,6 +936,14 @@ $subNav.on('touchend touchcancel', function(e) { @@ -814,6 +936,14 @@ $subNav.on('touchend touchcancel', function(e) {
814 case 'discount': 936 case 'discount':
815 $dgc.removeClass('hide'); 937 $dgc.removeClass('hide');
816 break; 938 break;
  939 +
  940 + case 'default':
  941 + $defaultgc.removeClass('hide');
  942 + break;
  943 +
  944 + case 'sale':
  945 + $sgc.removeClass('hide');
  946 + break;
817 default: 947 default:
818 break; 948 break;
819 } 949 }
@@ -832,7 +962,7 @@ $subNav.on('touchend touchcancel', function(e) { @@ -832,7 +962,7 @@ $subNav.on('touchend touchcancel', function(e) {
832 $goodsContainer.children('.container:not(.hide)').addClass('hide'); 962 $goodsContainer.children('.container:not(.hide)').addClass('hide');
833 963
834 switch (navType) { 964 switch (navType) {
835 - case 'newest': 965 + case 'new':
836 $ngc.removeClass('hide'); 966 $ngc.removeClass('hide');
837 break; 967 break;
838 968
@@ -843,6 +973,14 @@ $subNav.on('touchend touchcancel', function(e) { @@ -843,6 +973,14 @@ $subNav.on('touchend touchcancel', function(e) {
843 case 'discount': 973 case 'discount':
844 $dgc.removeClass('hide'); 974 $dgc.removeClass('hide');
845 break; 975 break;
  976 +
  977 + case 'default':
  978 + $defaultgc.removeClass('hide');
  979 + break;
  980 +
  981 + case 'sale':
  982 + $sgc.removeClass('hide');
  983 + break;
846 default: 984 default:
847 break; 985 break;
848 } 986 }
@@ -885,7 +1023,7 @@ filter.initFilter({ @@ -885,7 +1023,7 @@ filter.initFilter({
885 missStatus: true 1023 missStatus: true
886 }); 1024 });
887 1025
888 -$listNav.on('touchstart', 'li', function(e) { 1026 +$listNav.on('touchstart', 'li', function() {
889 $(this).addClass('bytouch'); 1027 $(this).addClass('bytouch');
890 }).on('touchend touchcancel', function() { 1028 }).on('touchend touchcancel', function() {
891 $listNav.find('li').removeClass('bytouch'); 1029 $listNav.find('li').removeClass('bytouch');
@@ -893,7 +1031,7 @@ $listNav.on('touchstart', 'li', function(e) { @@ -893,7 +1031,7 @@ $listNav.on('touchstart', 'li', function(e) {
893 // myScroll && myScroll.refresh(); 1031 // myScroll && myScroll.refresh();
894 }); 1032 });
895 1033
896 -$nav2.on('touchstart', 'li', function(e) { 1034 +$nav2.on('touchstart', 'li', function() {
897 $(this).addClass('bytouch'); 1035 $(this).addClass('bytouch');
898 }).on('touchend touchcancel', function() { 1036 }).on('touchend touchcancel', function() {
899 $nav2.find('li').removeClass('bytouch'); 1037 $nav2.find('li').removeClass('bytouch');
@@ -929,6 +1067,7 @@ $nav2.on('touchstart', 'li', function(e) { @@ -929,6 +1067,7 @@ $nav2.on('touchstart', 'li', function(e) {
929 1067
930 $('.shop-foot-wrapper .buriedpoint').click(function() { 1068 $('.shop-foot-wrapper .buriedpoint').click(function() {
931 var subGroup = $(this).find('.sub-group'); 1069 var subGroup = $(this).find('.sub-group');
  1070 +
932 if (subGroup.hasClass('hide')) { 1071 if (subGroup.hasClass('hide')) {
933 subGroup.removeClass('hide'); 1072 subGroup.removeClass('hide');
934 } else { 1073 } else {
@@ -953,7 +1092,7 @@ $collect.on('touchstart', function() { @@ -953,7 +1092,7 @@ $collect.on('touchstart', function() {
953 1092
954 $.ajax({ 1093 $.ajax({
955 method: 'get', 1094 method: 'get',
956 - url: location.protocol + '//m.yohobuy.com' + '/product/opt/favoriteBrand', 1095 + url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
957 data: { 1096 data: {
958 id: favId ? favId : shopId, 1097 id: favId ? favId : shopId,
959 appVersion: appVersion, 1098 appVersion: appVersion,
@@ -114,7 +114,6 @@ @@ -114,7 +114,6 @@
114 text-align: center; 114 text-align: center;
115 border: 1px solid #fff; 115 border: 1px solid #fff;
116 color: #fff; 116 color: #fff;
117 -  
118 top: 50%; 117 top: 50%;
119 margin-top: -24px; 118 margin-top: -24px;
120 } 119 }
@@ -286,4 +285,30 @@ @@ -286,4 +285,30 @@
286 padding-left: 0.375rem; 285 padding-left: 0.375rem;
287 padding-top: 0.2rem; 286 padding-top: 0.2rem;
288 } 287 }
  288 +
  289 + .new-list {
  290 + width: 100%;
  291 + background-color: #fff;
  292 + font-size: 28px;
  293 + color: #444;
  294 + position: absolute;
  295 + z-index: 5;
  296 +
  297 + li {
  298 + margin-left: 35px;
  299 + height: 88px;
  300 + line-height: 88px;
  301 + border-bottom: 1px solid #e0e0e0;
  302 + padding-right: 38px;
  303 +
  304 + &:last-child {
  305 + border-bottom: none;
  306 + }
  307 +
  308 + &.active {
  309 + background: resolve('product/shop/check.png') no-repeat 94% center;
  310 + background-size: 36px 26px;
  311 + }
  312 + }
  313 + }
289 } 314 }
@@ -373,10 +373,8 @@ @@ -373,10 +373,8 @@
373 } 373 }
374 } 374 }
375 375
376 - .active {  
377 - .cur {  
378 - color: #444;  
379 - } 376 + .active .cur{
  377 + color: #444;
380 } 378 }
381 379
382 .list-nav .icon .up { 380 .list-nav .icon .up {
@@ -523,14 +521,7 @@ @@ -523,14 +521,7 @@
523 width: 100%; 521 width: 100%;
524 height: 100%; 522 height: 100%;
525 color: #b0b0b0; 523 color: #b0b0b0;
526 -  
527 - /*b {  
528 - height: 28px;  
529 - border-left: 1px solid #e0e0e0;  
530 - float: right;  
531 - margin-top: 25px;  
532 - }*/  
533 - } 524 + }
534 } 525 }
535 526
536 .active .cur { 527 .active .cur {
@@ -581,6 +572,32 @@ @@ -581,6 +572,32 @@
581 .category-list-only-one-row { 572 .category-list-only-one-row {
582 border-top: none!important; 573 border-top: none!important;
583 } 574 }
  575 +
  576 + .new-list {
  577 + width: 100%;
  578 + background-color: #fff;
  579 + font-size: 28px;
  580 + color: #444;
  581 + position: absolute;
  582 + z-index: 5;
  583 +
  584 + li {
  585 + margin-left: 35px;
  586 + height: 88px;
  587 + line-height: 88px;
  588 + border-bottom: 1px solid #e0e0e0;
  589 + padding-right: 38px;
  590 +
  591 + &:last-child {
  592 + border-bottom: none;
  593 + }
  594 +
  595 + &.active {
  596 + background: resolve('product/shop/check.png') no-repeat 94% center;
  597 + background-size: 36px 26px;
  598 + }
  599 + }
  600 + }
584 } 601 }
585 602
586 .shop-index + .filter-mask { 603 .shop-index + .filter-mask {
@@ -59,6 +59,8 @@ const getTypeCont = (type, order) => { @@ -59,6 +59,8 @@ const getTypeCont = (type, order) => {
59 return order === '0' ? 's_t_desc' : 's_t_asc'; 59 return order === '0' ? 's_t_desc' : 's_t_asc';
60 case 'hot': 60 case 'hot':
61 return order === '0' ? 's_n_desc' : 's_n_asc'; 61 return order === '0' ? 's_n_desc' : 's_n_asc';
  62 + case 'default':
  63 + return order === '0' ? 's_n_desc' : 's_n_asc';
62 default: 64 default:
63 return order === '0' ? 's_t_desc' : 's_t_asc'; 65 return order === '0' ? 's_t_desc' : 's_t_asc';
64 } 66 }