...
|
...
|
@@ -23,9 +23,11 @@ var tip = require('../../plugin/tip'); |
|
|
var loading = require('../../plugin/loading');
|
|
|
|
|
|
var $goodsContainer = $('#goods-container'),
|
|
|
$defaultgc = $goodsContainer.children('.default-goods'),
|
|
|
$ngc = $goodsContainer.children('.new-goods'),
|
|
|
$pgc = $goodsContainer.children('.price-goods'),
|
|
|
$dgc = $goodsContainer.children('.discount-goods');
|
|
|
$dgc = $goodsContainer.children('.discount-goods'),
|
|
|
$newList = $('.new-list');
|
|
|
|
|
|
var winH = $(window).height();
|
|
|
|
...
|
...
|
@@ -46,7 +48,13 @@ var $listNav = $('#list-nav'), |
|
|
newest: {
|
|
|
order: 1,
|
|
|
reload: true,
|
|
|
page: 0,
|
|
|
page: 1,
|
|
|
end: false
|
|
|
},
|
|
|
default: {
|
|
|
order: 0,
|
|
|
reload: true,
|
|
|
page: 1,
|
|
|
end: false
|
|
|
},
|
|
|
price: {
|
...
|
...
|
@@ -298,8 +306,9 @@ function search(opt) { |
|
|
navType = 'price';
|
|
|
} else if ($pre.hasClass('discount')) {
|
|
|
navType = 'discount';
|
|
|
} else if ($pre.hasClass('default')) {
|
|
|
navType = 'default';
|
|
|
}
|
|
|
|
|
|
nav = navInfo[navType];
|
|
|
|
|
|
page = nav.page + 1;
|
...
|
...
|
@@ -383,6 +392,9 @@ function search(opt) { |
|
|
case 'discount':
|
|
|
$container = $dgc;
|
|
|
break;
|
|
|
case 'default':
|
|
|
$container = $defaultgc;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -405,8 +417,10 @@ function search(opt) { |
|
|
first_load = false;
|
|
|
//移除头四个
|
|
|
goodList.splice(0, 4);
|
|
|
$container.append(goodList);
|
|
|
} else {
|
|
|
$container.html(goodList);
|
|
|
}
|
|
|
$container.append(goodList);
|
|
|
lazyLoad($container.find('.lazy'));
|
|
|
} else {
|
|
|
num = $container.find('.good-info').length;
|
...
|
...
|
@@ -417,7 +431,6 @@ function search(opt) { |
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
nav.reload = false;
|
|
|
nav.page = page;
|
|
|
|
...
|
...
|
@@ -448,6 +461,10 @@ function search(opt) { |
|
|
window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
|
|
|
'', $('.discount-goods .good-info .good-detail-img .good-thumb'));
|
|
|
break;
|
|
|
case 'default':
|
|
|
window._yas(1 * new Date(), '1.0.16', 'yohobuy_m', window._ozuid,
|
|
|
'', $('.default-goods .good-info .good-detail-img .good-thumb'));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -498,7 +515,84 @@ writeSearch.bindWirteLocal($('#search-form')); |
|
|
$listNav.bind('contextmenu', function() {
|
|
|
return false;
|
|
|
});
|
|
|
function newListHide() {
|
|
|
var $firstLi = $listNav.find('li.first-li-more');
|
|
|
|
|
|
if ($newList.hasClass('hide')) {
|
|
|
$firstLi.find('span.up').addClass('hide');
|
|
|
$firstLi.find('span.down').removeClass('hide');
|
|
|
} else {
|
|
|
$firstLi.find('span.down').addClass('hide');
|
|
|
$firstLi.find('span.up').removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$newList.on('touchstart', 'li', function(e) {
|
|
|
var navType, bpIdData = $(this).attr('data-bp-id') || '',
|
|
|
$firstLiDom = $listNav.find('li.first-li-more'),
|
|
|
cls = '';
|
|
|
|
|
|
e.preventDefault();
|
|
|
if ($(this).hasClass('new')) {
|
|
|
navType = 'newest';
|
|
|
cls = 'new';
|
|
|
} else if ($(this).hasClass('default')) {
|
|
|
navType = 'default';
|
|
|
cls = 'default';
|
|
|
} else if ($(this).hasClass('sale')) {
|
|
|
navType = 'sale';
|
|
|
cls = 'sale';
|
|
|
}
|
|
|
|
|
|
$newList.addClass('hide');
|
|
|
$firstLiDom.find('.nav-txt').text($(this).text());
|
|
|
$firstLiDom.attr('data-bp-id', bpIdData).addClass('active').siblings().removeClass('active');
|
|
|
$listNav.find('.first-li-more').removeClass('new default sale').addClass(cls);
|
|
|
|
|
|
$(document).trigger('shouldSendBpData', [bpIdData]);
|
|
|
newListHide();
|
|
|
|
|
|
// 切换container显示
|
|
|
$goodsContainer.children('.container:not(.hide)').addClass('hide');
|
|
|
|
|
|
switch (navType) {
|
|
|
case 'newest':
|
|
|
$ngc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'price':
|
|
|
$pgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'discount':
|
|
|
$dgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'default':
|
|
|
$defaultgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'sale':
|
|
|
$sgc.removeClass('hide');
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
$pre = $('.first-li-more');
|
|
|
var nav = navInfo[navType];
|
|
|
if (nav.reload) {
|
|
|
search();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
$(document).on('touchstart', function(e) {
|
|
|
if (!$newList.hasClass('hide') &&
|
|
|
$(e.target).closest('.new-list, li.first-li-more').length <= 0) {
|
|
|
$newList.addClass('hide');
|
|
|
newListHide();
|
|
|
}
|
|
|
});
|
|
|
$listNav.on('touchend touchcancel', function(e) {
|
|
|
var $this = $(e.target).closest('li'),
|
|
|
nav,
|
...
|
...
|
@@ -506,6 +600,22 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
$active;
|
|
|
var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
|
|
|
|
|
|
if ($this.hasClass('first-li-more')) {
|
|
|
filter.hideFilter();
|
|
|
$newList.toggleClass('hide');
|
|
|
if ($this.hasClass('default')) {
|
|
|
$newList.find('li.default').addClass('active').siblings().removeClass('active');
|
|
|
} else if ($this.hasClass('new')) {
|
|
|
$newList.find('li.new').addClass('active').siblings().removeClass('active');
|
|
|
} else if ($this.hasClass('sale')) {
|
|
|
$newList.find('li.sale').addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
newListHide();
|
|
|
return true;
|
|
|
}
|
|
|
// 最新li 列表
|
|
|
$newList.addClass('hide');
|
|
|
|
|
|
if ($this.hasClass('filter')) {
|
|
|
|
|
|
// 筛选面板切换状态
|
...
|
...
|
@@ -531,7 +641,9 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
navType = 'price';
|
|
|
} else if ($this.hasClass('discount')) {
|
|
|
navType = 'discount';
|
|
|
}
|
|
|
} else if ($pre.hasClass('default')) {
|
|
|
navType = 'default';
|
|
|
}
|
|
|
|
|
|
nav = navInfo[navType];
|
|
|
|
...
|
...
|
@@ -576,6 +688,10 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
case 'discount':
|
|
|
$dgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'default':
|
|
|
$defaultgc.removeClass('hide');
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -689,3 +805,4 @@ $listNav.on('touchstart', 'li', function() { |
|
|
});
|
|
|
|
|
|
require('../../common/footer');
|
|
|
require('./coupon'); |
...
|
...
|
|