...
|
...
|
@@ -84,6 +84,10 @@ var $listNav = $('#list-nav'), |
|
|
introHammer,
|
|
|
brandColHammer;
|
|
|
|
|
|
var getChannel, C_ID, RES_QTY, argument, optype;
|
|
|
|
|
|
var category = $('#category-point').val();
|
|
|
|
|
|
require('../../common');
|
|
|
|
|
|
ellipsis.init();
|
...
|
...
|
@@ -229,6 +233,19 @@ specialoffer = getQueryString('specialoffer'); |
|
|
specialsale_id = getQueryString('specialsale_id');
|
|
|
promotion = getQueryString('promotion');
|
|
|
|
|
|
getChannel = function functionName() {
|
|
|
var name = window.cookie('_Channel');
|
|
|
|
|
|
return {
|
|
|
boys: 1,
|
|
|
girls: 2,
|
|
|
kids: 3,
|
|
|
lifestyle: 4
|
|
|
}[name] || 1;
|
|
|
};
|
|
|
|
|
|
C_ID = getChannel();
|
|
|
|
|
|
/**
|
|
|
* 筛选注册的回调,筛选子项点击后逻辑
|
|
|
* 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
|
...
|
...
|
@@ -445,6 +462,8 @@ function search(opt) { |
|
|
searching = true;
|
|
|
loading.showLoadingMask();
|
|
|
|
|
|
argument = setting;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: location.protocol + '//m.yohobuy.com/product/search/search',
|
...
|
...
|
@@ -452,7 +471,11 @@ function search(opt) { |
|
|
success: function(data) {
|
|
|
var noResult = '<p class="no-result">未找到相关搜索结果</p>',
|
|
|
num,
|
|
|
$container;
|
|
|
$container,
|
|
|
goodIds = [],
|
|
|
FILTER_VALUE,
|
|
|
yasparm,
|
|
|
PRD_LIST;
|
|
|
|
|
|
switch (navType) {
|
|
|
case 'new':
|
...
|
...
|
@@ -474,24 +497,106 @@ function search(opt) { |
|
|
break;
|
|
|
}
|
|
|
|
|
|
if (data === '') {
|
|
|
// console.log(data)
|
|
|
|
|
|
if (data === '' || data.list) {
|
|
|
nav.end = true;
|
|
|
|
|
|
if (nav.reload) {
|
|
|
$container.html(noResult);
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
yasparm = {
|
|
|
C_ID: C_ID,
|
|
|
PAGE_NUM: setting.page,
|
|
|
FILTER_VALUE: FILTER_VALUE,
|
|
|
SORT_TYPE: setting.type
|
|
|
};
|
|
|
|
|
|
if (category) {
|
|
|
optype = 'YB_CATEGORY_GOODS_LIST_L',
|
|
|
yasparm = Object.assign(yasparm, {
|
|
|
CATEGORY_ID: window.queryString.title || '',
|
|
|
});
|
|
|
} else if ($brandHeader.length > 0) {
|
|
|
optype = 'YB_BRAND_GOODS_LIST_L',
|
|
|
yasparm = Object.assign(yasparm, {
|
|
|
BRAND_ID: $brandHeader.data('id')
|
|
|
});
|
|
|
} else {
|
|
|
optype = 'YB_KEYWORD_GOOS_LIST_L',
|
|
|
yasparm = Object.assign(yasparm, {
|
|
|
KEYWORD: setting.query || ''
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (nav.reload) {
|
|
|
$container.html(data);
|
|
|
lazyLoad($container.find('.lazy'));
|
|
|
|
|
|
RES_QTY = $container.find('.total').data('id');
|
|
|
FILTER_VALUE = JSON.stringify(setting).replace(/\{|\}|\"/g, '');
|
|
|
|
|
|
$container.find('.good-info').each(function() {
|
|
|
var goodid = $(this).data('good-id');
|
|
|
|
|
|
if (goodid) {
|
|
|
goodIds.push(goodid);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
PRD_LIST = JSON.stringify(goodIds).replace(/\[|\]/g, '');
|
|
|
|
|
|
yasparm = Object.assign(yasparm, {
|
|
|
PRD_LIST: PRD_LIST,
|
|
|
RES_QTY: RES_QTY,
|
|
|
FILTER_VALUE: FILTER_VALUE
|
|
|
});
|
|
|
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
op: optype,
|
|
|
param: JSON.stringify(yasparm)
|
|
|
}, true);
|
|
|
}
|
|
|
} else {
|
|
|
num = $container.find('.good-info').length;
|
|
|
$container.append(data);
|
|
|
|
|
|
if ($container.find('.total')[1]) {
|
|
|
$container.find('.total')[1].remove();
|
|
|
}
|
|
|
|
|
|
RES_QTY = $container.find('.total').data('id');
|
|
|
FILTER_VALUE = JSON.stringify(setting).replace(/\{|\}|\"/g, '');
|
|
|
|
|
|
$container.find('.good-info:gt(' + (num - 1) + ')').each(function() {
|
|
|
var goodid = $(this).data('good-id');
|
|
|
|
|
|
if (goodid) {
|
|
|
goodIds.push(goodid);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
PRD_LIST = JSON.stringify(goodIds).replace(/\[|\]/g, '');
|
|
|
|
|
|
yasparm = Object.assign(yasparm, {
|
|
|
PRD_LIST: PRD_LIST,
|
|
|
RES_QTY: RES_QTY,
|
|
|
FILTER_VALUE: FILTER_VALUE
|
|
|
});
|
|
|
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
op: optype,
|
|
|
param: JSON.stringify(yasparm)
|
|
|
}, true);
|
|
|
}
|
|
|
|
|
|
// lazy good-infos who append in
|
|
|
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
nav.reload = false;
|
...
|
...
|
@@ -536,9 +641,10 @@ function search(opt) { |
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
require('../../common/suspend-cart'); // 悬浮购物车
|
...
|
...
|
@@ -954,3 +1060,47 @@ $listNav.on('touchstart', 'li', function() { |
|
|
}).on('touchend touchcancel', 'li', function() {
|
|
|
$listNav.find('li').removeClass('bytouch');
|
|
|
});
|
|
|
|
|
|
$('#goods-container').on('click', '.good-info', function(event) {
|
|
|
var PRD_ID = $(this).data('good-id'),
|
|
|
PRD_NUM = $(this).index(),
|
|
|
FILTER_VALUE = JSON.stringify(argument).replace(/\{|\}|\"/g, ''),
|
|
|
yasparms;
|
|
|
|
|
|
// event.preventDefault();
|
|
|
|
|
|
yasparms = {
|
|
|
C_ID: C_ID,
|
|
|
PRD_ID: PRD_ID,
|
|
|
PRD_NUM: PRD_NUM,
|
|
|
PAGE_NUM: argument.page,
|
|
|
FILTER_VALUE: FILTER_VALUE,
|
|
|
SORT_TYPE: argument.type
|
|
|
};
|
|
|
|
|
|
if (category) {
|
|
|
optype = 'YB_CATEGORY_GOODS_LIST_C',
|
|
|
yasparms = Object.assign(yasparms, {
|
|
|
CATEGORY_ID: window.queryString.title || '',
|
|
|
});
|
|
|
} else if ($brandHeader.length > 0) {
|
|
|
optype = 'YB_BRAND_GOODS_LIST_C',
|
|
|
yasparms = Object.assign(yasparms, {
|
|
|
BRAND_ID: $brandHeader.data('id')
|
|
|
});
|
|
|
} else {
|
|
|
optype = 'YB_KEYWORD_GOOS_LIST_C',
|
|
|
yasparms = Object.assign(yasparms, {
|
|
|
KEYWORD: argument.query || ''
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
op: optype,
|
|
|
param: JSON.stringify(yasparms)
|
|
|
}, true);
|
|
|
}
|
|
|
|
|
|
// return false;
|
|
|
}); |
...
|
...
|
|