Authored by zhangxiaoru

品牌品类

... ... @@ -222,7 +222,8 @@ const category = (req, res) => {
}),
goodList: params,
showDownloadApp: true,
pageFooter: true
pageFooter: true,
category: true
});
};
... ...
... ... @@ -182,11 +182,16 @@ const search = (req, res, next) => {
params.isApp = req.yoho.isApp;
searchModel.getSearchData(params).then((result) => {
if(result.list.length > 0) {
res.render('search/page', {
layout: false,
new: result.list,
total: result.total
});
} else {
res.json(result);
}
}).catch(next);
};
... ...
... ... @@ -147,12 +147,15 @@ const getSearchData = (params) => {
if (result && result.code === 200) {
let newList = {};
newList.total = result.data.total;
newList.list = productProcess.processProductList(result.data.product_list || [], {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel]
});
if(parseInt(params.page) === 1) {
newList.total = result.data.total;
}
return newList;
} else {
logger.error('get product search api return code is not 200');
... ...
<div class="good-list-page yoho-page">
{{> search/list}}
{{#if category}}
<input type="text" id="category-point" style="display:none" value="{{category}}">
{{/if}}
</div>
... ...
... ... @@ -2,4 +2,3 @@
{{# new}}
{{> common/goods}}
{{/ new}}
... ...
... ... @@ -201,6 +201,13 @@ function search(opt) {
searching = true;
loading.showLoadingMask();
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
$.ajax({
type: 'GET',
url: '/product/new/selectNewSale',
... ...
... ... @@ -67,7 +67,9 @@ var $listNav = $('#list-nav'),
introHammer,
brandColHammer;
var getChannel, C_ID, RES_QTY, qwert;
var getChannel, C_ID, RES_QTY, argument, optype;
var category = $('#category-point').val();
require('../../common');
... ... @@ -373,7 +375,7 @@ function search(opt) {
searching = true;
loading.showLoadingMask();
qwert = setting;
argument = setting;
$.ajax({
type: 'GET',
... ... @@ -384,7 +386,8 @@ function search(opt) {
num,
$container,
goodIds = [],
FILTER_VALUE;
FILTER_VALUE,
yasparm;
switch (navType) {
case 'newest':
... ... @@ -399,14 +402,40 @@ function search(opt) {
default:
break;
}
//console.log(data)
if (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'));
... ... @@ -422,28 +451,29 @@ function search(opt) {
}
});
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_KEYWORD_GOOS_LIST_L',
param: JSON.stringify({
C_ID: C_ID,
KEYWORD: setting.query || '',
RES_QTY: RES_QTY,
yasparm = Object.assign(yasparm, {
PRD_LIST: goodIds,
PAGE_NUM: setting.page,
FILTER_VALUE: FILTER_VALUE,
SORT_TYPE: setting.type
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')) {
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');
... ... @@ -452,18 +482,16 @@ function search(opt) {
}
});
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_KEYWORD_GOOS_LIST_L',
param: JSON.stringify({
C_ID: C_ID,
KEYWORD: setting.query || '',
RES_QTY: RES_QTY,
yasparm = Object.assign(yasparm, {
PRD_LIST: goodIds,
PAGE_NUM: setting.page,
FILTER_VALUE: FILTER_VALUE,
SORT_TYPE: setting.type
RES_QTY: RES_QTY,
FILTER_VALUE: FILTER_VALUE
})
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
... ... @@ -745,24 +773,44 @@ $listNav.on('touchstart', 'li', function() {
$('#goods-container').on('click', '.good-info', function(event) {
var PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index() + 1,
FILTER_VALUE = JSON.stringify(qwert).replace(/\{|\}|\"/g, '');
PRD_NUM = $(this).index(),
FILTER_VALUE = JSON.stringify(argument).replace(/\{|\}|\"/g, ''),
yasparms;
event.preventDefault();
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_KEYWORD_GOODS_LIST_C',
param: JSON.stringify({
//event.preventDefault();
yasparms = {
C_ID: C_ID,
KEYWORD: qwert.query || '',
PRD_ID: PRD_ID,
PRD_NUM: PRD_NUM,
PAGE_NUM: qwert.page,
PAGE_NUM: argument.page,
FILTER_VALUE: FILTER_VALUE,
SORT_TYPE: qwert.type
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;
//return false;
});
... ...