...
|
...
|
@@ -153,14 +153,19 @@ const index = (req) => { |
|
|
yh_channel: channelMap[channel].yh_channel,
|
|
|
uid: req.user.uid || ''
|
|
|
};
|
|
|
|
|
|
let shopParams = Object.assign({}, params, {contentCode: channelMap[channel].code});
|
|
|
let recParams = Object.assign({}, params);
|
|
|
let recParams = Object.assign({}, params, {
|
|
|
sort: req.query.sort || '',
|
|
|
page: req.query.page || 1
|
|
|
});
|
|
|
|
|
|
let apiMethod = [
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
api.recShop(shopParams),
|
|
|
api.recBrand(params),
|
|
|
api.recList(recParams)
|
|
|
api.recList(Object.assign({}, params)),//获取品类
|
|
|
api.recList(recParams)//获取商品数据
|
|
|
];
|
|
|
|
|
|
return Promise.all(apiMethod).then(result => {
|
...
|
...
|
@@ -253,22 +258,32 @@ const index = (req) => { |
|
|
// 推荐品类
|
|
|
_.forEach(groupSort, group =>{
|
|
|
_.forEach(group.sub, subSort =>{
|
|
|
let cateObj = {
|
|
|
cateId: subSort.category_id,
|
|
|
url: publicHandler.handleFilterUrl(params, {sort: subSort.relation_parameter.sort}),
|
|
|
name: subSort.category_name,
|
|
|
active: false
|
|
|
};
|
|
|
|
|
|
if (ctyList.length < 20) {
|
|
|
ctyList.push({
|
|
|
cateId: subSort.category_id,
|
|
|
url: publicHandler.handleFilterUrl(params, {sort: subSort.relation_parameter.sort}),
|
|
|
name: subSort.category_name
|
|
|
});
|
|
|
//默认选中判断
|
|
|
if (req.query.sort === subSort.relation_parameter.sort) {
|
|
|
cateObj.active = true;
|
|
|
}
|
|
|
ctyList.push(cateObj);
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
Object.assign(respData.newProduct.ctyList, ctyList);
|
|
|
}
|
|
|
|
|
|
// 最新上架
|
|
|
if (result[4].code === 200 && result[4].data) {
|
|
|
// 列表数据
|
|
|
Object.assign(respData.newProduct, _proListHandler(result[3].data,
|
|
|
Object.assign({}, recParams, {channel: channel})));
|
|
|
Object.assign(respData.newProduct, _proListHandler(result[4].data,
|
|
|
Object.assign({}, recParams, {channel: channel})));
|
|
|
}
|
|
|
|
|
|
// 数据为空,不显示页面模块
|
...
|
...
|
|