...
|
...
|
@@ -3,10 +3,30 @@ |
|
|
* @author: sefon 2016-7-12 15:28:22
|
|
|
*/
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload');
|
|
|
var $ = require('yoho-jquery');
|
|
|
var yas = require('../common/data-yas');
|
|
|
var lazyLoad = require('yoho-jquery-lazyload');
|
|
|
|
|
|
|
|
|
|
|
|
var product = require('./index/product');
|
|
|
var qs = {};
|
|
|
|
|
|
var $footPage = $('.foot-pager1').data('total'),
|
|
|
$productIdArr = [],
|
|
|
$leftUl = $('.sort-container .sort-child-list'),
|
|
|
$leftLi = $leftUl.find('li.active');
|
|
|
|
|
|
var listType = $('.path-nav').attr('listType'),
|
|
|
brandId = $('.path-nav').attr('brandId');
|
|
|
|
|
|
var filterValue = yas.getFilterValue();
|
|
|
|
|
|
var commonParams = {};
|
|
|
|
|
|
$('.good-info .product-id').each(function() {
|
|
|
$productIdArr.push($(this).html());
|
|
|
});
|
|
|
|
|
|
require('../common');
|
|
|
require('../plugins/filter');
|
...
|
...
|
@@ -15,6 +35,93 @@ require('./detail/latest-walk'); |
|
|
|
|
|
product.init(4);
|
|
|
|
|
|
|
|
|
|
|
|
lazyLoad($('img.lazy'), {
|
|
|
failure_limit: 20
|
|
|
});
|
|
|
qs = window.queryString();
|
|
|
commonParams = {
|
|
|
PAGE_NUM: qs.pager || 1,
|
|
|
FILTER_VALUE: filterValue,
|
|
|
L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '',
|
|
|
L2_SORT: $leftLi.find('a').attr('title') || '',
|
|
|
SORT_TYPE: qs.order || 's_n_desc'
|
|
|
};
|
|
|
|
|
|
// 时间戳格式化
|
|
|
function getLocalTime(nS) {
|
|
|
return new Date(parseInt(nS, 10) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 页面加载完
|
|
|
*/
|
|
|
$(function() {
|
|
|
var sto = setInterval(function() {
|
|
|
var loadYas = {};
|
|
|
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
loadYas = {
|
|
|
RES_QTY: $footPage || 0,
|
|
|
PRD_LIST: $productIdArr.join(',')
|
|
|
};
|
|
|
switch (listType) {
|
|
|
case 'search':
|
|
|
loadYas.KEYWORD = qs.query || '';
|
|
|
break;
|
|
|
case 'brand':
|
|
|
loadYas.BRAND_ID = brandId;
|
|
|
break;
|
|
|
case 'new':
|
|
|
loadYas.SHELF_TIME = 'ALL';
|
|
|
break;
|
|
|
default:// 品类查找sort
|
|
|
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
|
|
|
break;
|
|
|
}
|
|
|
loadYas = $.extend(loadYas, commonParams);
|
|
|
|
|
|
// 关键词搜索结果页展示时
|
|
|
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas);
|
|
|
clearInterval(sto);
|
|
|
}
|
|
|
}, 100);
|
|
|
|
|
|
// 点击搜索列表商品
|
|
|
$('.good-item-wrapper').click(function() {
|
|
|
var $this = $(this),
|
|
|
proId = $this.find('.product-id').html(),
|
|
|
aIndex = $this.attr('activeIndex'),
|
|
|
pageNum = qs.pager || 1,
|
|
|
limit = qs.limit || 60,
|
|
|
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
|
|
|
shelveTime = $this.find('.shelve-time').html();
|
|
|
|
|
|
var loadYas = {
|
|
|
PRD_ID: proId,
|
|
|
PRD_NUM: proNum
|
|
|
};
|
|
|
|
|
|
switch (listType) {
|
|
|
case 'search':
|
|
|
loadYas.KEYWORD = qs.query || '';
|
|
|
break;
|
|
|
case 'brand':
|
|
|
loadYas.BRAND_ID = brandId;
|
|
|
break;
|
|
|
case 'new':
|
|
|
loadYas.SHELF_TIME = getLocalTime(shelveTime);
|
|
|
break;
|
|
|
default:// 品类查找sort
|
|
|
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
|
|
|
break;
|
|
|
}
|
|
|
loadYas = $.extend(loadYas, commonParams);
|
|
|
|
|
|
// 点击搜索列表商品埋点
|
|
|
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|