...
|
...
|
@@ -44,6 +44,11 @@ let navInfo = { |
|
|
sale: {
|
|
|
order: 0,
|
|
|
end: false
|
|
|
},
|
|
|
popularity: {
|
|
|
order: 0,
|
|
|
end: false,
|
|
|
type: 'popularity'
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -54,6 +59,24 @@ let onSearching = false; // 是否正在搜索 |
|
|
let isScrollLoad = false; // 是否是滚动加载
|
|
|
let page = 1; // 页码
|
|
|
let nav;
|
|
|
let popularity = false;
|
|
|
let $dropList = $('.drop-list');
|
|
|
let $firstText = $('.first-li-more').find('.nav-txt');
|
|
|
let $thisLi = '';
|
|
|
|
|
|
// 物料商品列表标记
|
|
|
if ($('#material-flag').val() === 'material') {
|
|
|
let material = true;
|
|
|
|
|
|
popularity = true;
|
|
|
if ($('.first-li-more').hasClass('active')) {
|
|
|
page = 2; // 已在服务端渲染第一页
|
|
|
}
|
|
|
Object.assign(defaultOpt, {
|
|
|
material: material,
|
|
|
unionType: window.queryString.union_type
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处理筛选参数
|
...
|
...
|
@@ -191,6 +214,18 @@ $listNav.bind('contextmenu', function() { |
|
|
return false;
|
|
|
});
|
|
|
|
|
|
const popularityFilter = function(thisLi, type) {
|
|
|
if (thisLi.hasClass('active')) {
|
|
|
$dropList.hide();
|
|
|
return false;
|
|
|
}
|
|
|
$thisLi.addClass('active').siblings('li').removeClass('active');
|
|
|
defaultOpt.type = type;
|
|
|
Object.assign(defaultOpt, nav);
|
|
|
getGoodsList();
|
|
|
$dropList.hide();
|
|
|
};
|
|
|
|
|
|
$listNav.on('touchend touchcancel', function(e) {
|
|
|
page = 1;
|
|
|
beforeScroll = $(window).scrollTop();
|
...
|
...
|
@@ -199,7 +234,24 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
let $this = $(e.target).closest('li'); // 被点击的 Tab
|
|
|
let $active;
|
|
|
|
|
|
if ($this.hasClass('filter')) { // 筛选面板
|
|
|
// 默认列表增加人气筛选
|
|
|
if ($this.hasClass('default') && popularity) {
|
|
|
$this.siblings('.active').removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
$dropList.toggle();
|
|
|
$dropList.find('.default').on('touchend touchcancel', function() {
|
|
|
$thisLi = $(this);
|
|
|
$firstText.html('默认');
|
|
|
popularityFilter($thisLi, 'default');
|
|
|
return false;
|
|
|
});
|
|
|
$dropList.find('.popularity').on('touchend touchcancel', function() {
|
|
|
$thisLi = $(this);
|
|
|
$firstText.html('人气');
|
|
|
popularityFilter($thisLi, 'popularity');
|
|
|
return false;
|
|
|
});
|
|
|
} else if ($this.hasClass('filter')) { // 筛选面板
|
|
|
|
|
|
// 筛选面板切换状态
|
|
|
if ($this.hasClass('active')) {
|
...
|
...
|
@@ -216,6 +268,7 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
|
|
|
filter.showFilter();
|
|
|
}
|
|
|
$dropList.hide().find('li').removeClass('active');
|
|
|
} else { // 排序改变
|
|
|
|
|
|
if ($this.hasClass('new')) {
|
...
|
...
|
@@ -265,6 +318,7 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
/* 排序条件更新 */
|
|
|
defaultOpt.type = navType;
|
|
|
Object.assign(defaultOpt, nav);
|
|
|
$dropList.hide().find('li').removeClass('active');
|
|
|
|
|
|
getGoodsList();
|
|
|
}
|
...
|
...
|
|