...
|
...
|
@@ -118,7 +118,9 @@ const getListData = (params, channel) => { |
|
|
totalCount: result[2].data.total,
|
|
|
footPager: searchHandler.handlePagerData(result[2].data.total, params),
|
|
|
goods: productProcess.processProductList(result[2].data.product_list,
|
|
|
Object.assign({showDiscount: false}, params)),
|
|
|
Object.assign({showDiscount: false}, params, {
|
|
|
from: {type: 'list', params: params}
|
|
|
})),
|
|
|
hasNextPage: searchHandler.handleNextPage(params, result[2].data.total),
|
|
|
|
|
|
// 最近浏览记录
|
...
|
...
|
@@ -194,7 +196,8 @@ const getListNewData = (params, channel) => { |
|
|
totalCount: result[2].data.total,
|
|
|
footPager: searchHandler.handlePagerData(result[2].data.total, params),
|
|
|
goods: productProcess.processProductList(result[2].data.product_list,
|
|
|
Object.assign({showDiscount: false, showNew: false}, params)),
|
|
|
Object.assign({showDiscount: false, showNew: false,
|
|
|
from: {type: 'listNew', params: params}}, params)),
|
|
|
hasNextPage: searchHandler.handleNextPage(params, result[2].data.total),
|
|
|
|
|
|
// 最近浏览记录
|
...
|
...
|
@@ -265,7 +268,7 @@ const getBrandData = (params, extra, channel) => { |
|
|
let apiMethod = [
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
searchApi.getSortList(queryBase),
|
|
|
searchApi.getProductList(Object.assign({order: order}, searchParams, queryBase))
|
|
|
searchApi.getProductList(Object.assign(searchParams, {order: order}, queryBase))
|
|
|
|
|
|
];
|
|
|
|
...
|
...
|
@@ -304,16 +307,16 @@ const getBrandData = (params, extra, channel) => { |
|
|
totalCount: result[2].data.total,
|
|
|
footPager: searchHandler.handlePagerData(result[2].data.total, params),
|
|
|
goods: productProcess.processProductList(result[2].data.product_list,
|
|
|
Object.assign({showDiscount: false}, params)),
|
|
|
Object.assign({showDiscount: false, from: {type: 'brand', params: params}}, params)),
|
|
|
hasNextPage: searchHandler.handleNextPage(params, result[2].data.total),
|
|
|
|
|
|
// 最近浏览记录
|
|
|
latestWalk: 7
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 品牌页不显示品牌筛选项
|
|
|
delete finalResult.brand.filters.brand;
|
|
|
// 品牌页不显示品牌筛选项
|
|
|
_.unset(finalResult, 'brand.filters.brand');
|
|
|
}
|
|
|
|
|
|
finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.brand, 'goods'))};
|
|
|
|
...
|
...
|
@@ -417,7 +420,7 @@ const getShopAbout = (shopId, uid, channel) => { |
|
|
|
|
|
if (result[1].code === 200) {
|
|
|
let data = result[1].data || {},
|
|
|
decorator = shopHandler.getShopDecorator(data, {}, shopId);
|
|
|
decorator = shopHandler.getShopDecorator(data, {}, shopId, true);
|
|
|
|
|
|
Object.assign(decorator.shopTopBannerBase, {
|
|
|
shopId: shopId,
|
...
|
...
|
@@ -637,7 +640,8 @@ const getShopData = (shopId, channel, params, shopInfo) => { |
|
|
finalResult.leftContent = searchHandler.handleSortData(groupSort, params);
|
|
|
|
|
|
if (finalResult.allGoods) {
|
|
|
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, params));
|
|
|
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, Object.assign({},
|
|
|
params, {page: 1})));
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -652,7 +656,7 @@ const getShopData = (shopId, channel, params, shopInfo) => { |
|
|
|
|
|
for (let i = 0; i < 3; i++) {
|
|
|
trendList.push({
|
|
|
href: articleList[i].url,
|
|
|
href: helpers.urlFormat(`/${articleList[i].id}.html`, '', 'guang'),
|
|
|
src: helpers.getForceSourceUrl(articleList[i].src) +
|
|
|
'?imageView/1/w/{width}/h/{height}',
|
|
|
mainTitle: articleList[i].title,
|
...
|
...
|
@@ -672,6 +676,55 @@ const getShopData = (shopId, channel, params, shopInfo) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取店铺商品数据
|
|
|
*/
|
|
|
const getShopGoodsData = (shopId, channel, params) => {
|
|
|
let gender = _getGender(channel);
|
|
|
let resData = {};
|
|
|
|
|
|
_.unset(params, '_pjax');
|
|
|
return Promise.all([
|
|
|
searchApi.getProductList(Object.assign({
|
|
|
shop_id: shopId
|
|
|
}, params)), // 搜索店铺商品
|
|
|
searchApi.getShopBrands(shopId) // 店铺品牌数据
|
|
|
]).then(result => {
|
|
|
// 获取商品数据和顶部筛选条件
|
|
|
if (result[0].code === 200) {
|
|
|
Object.assign(resData, {
|
|
|
sort: searchHandler.handleOptsData(params, _.get(result[0], 'data.total', 0)),
|
|
|
list: productProcess.processProductList(_.get(result[0], 'data.product_list', []), {
|
|
|
newCoverSort: true,
|
|
|
showDiscount: false,
|
|
|
gender: gender
|
|
|
})
|
|
|
});
|
|
|
_.set(resData, 'sort.newPage', true); // 启用新的分页导航
|
|
|
}
|
|
|
|
|
|
let shopBrandIds = []; // 店铺的所有品牌id
|
|
|
|
|
|
if (result[1].code === 200 && result[1].data) {
|
|
|
_.forEach(result[1].data, value => {
|
|
|
shopBrandIds.push(value.brand_id);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 根据品牌获取分类 (腾讯云测试没有该接口,暂时不调用分类)
|
|
|
return searchApi.getSortList({brand: shopBrandIds}).then(subRes => {
|
|
|
if (subRes.code === 200) {
|
|
|
let groupSort = _.get(subRes, 'data.sort', []);
|
|
|
|
|
|
Object.assign(resData, searchHandler.setShopSort(groupSort, Object.assign(params,
|
|
|
{page: 1})));
|
|
|
}
|
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getShopListData = (channel, params, uid) => {
|
|
|
let gender = _getGender(channel),
|
|
|
shopId = params.shopId,
|
...
|
...
|
@@ -741,10 +794,14 @@ const getShopListData = (channel, params, uid) => { |
|
|
goods: productProcess.processProductList(goodsList, {
|
|
|
newCoverSort: true,
|
|
|
showDiscount: false,
|
|
|
gender: _getGender(channel)
|
|
|
gender: _getGender(channel),
|
|
|
query: params.query
|
|
|
}),
|
|
|
footPager: {tip: tip}
|
|
|
});
|
|
|
|
|
|
_.set(finalResult, 'filters.checkedConditions.clearUrl',
|
|
|
`?navBar=${params.navBar}&shopId=${params.shopId}`);
|
|
|
} else {
|
|
|
finalResult.searchEmpty = true;
|
|
|
|
...
|
...
|
@@ -812,7 +869,7 @@ const getBaseShopData = (params, extra, channel, shopId) => { |
|
|
|
|
|
if (result[1].code === 200) {
|
|
|
let data = result[1].data || {},
|
|
|
decorator = shopHandler.getShopDecorator(data, {}, shopId);
|
|
|
decorator = shopHandler.getShopDecorator(data, {}, shopId, true);
|
|
|
|
|
|
Object.assign(decorator.shopTopBannerBase, {
|
|
|
shopId: shopId,
|
...
|
...
|
@@ -822,6 +879,10 @@ const getBaseShopData = (params, extra, channel, shopId) => { |
|
|
});
|
|
|
_.set(resData, 'brand.shopBanner', decorator.shopTopBannerBase);
|
|
|
_.unset(resData, 'brand.brandBanner');
|
|
|
|
|
|
if (decorator.signboard) {
|
|
|
_.set(resData, 'brand.signboard', decorator.signboard);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (result[2].code === 200) {
|
...
|
...
|
@@ -833,6 +894,11 @@ const getBaseShopData = (params, extra, channel, shopId) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 临时删除seo信息
|
|
|
_.unset(resData, 'title');
|
|
|
_.unset(resData, 'keywords');
|
|
|
_.unset(resData, 'description');
|
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -848,6 +914,7 @@ module.exports = { |
|
|
getAdnav,
|
|
|
getShopInfo,
|
|
|
getShopData,
|
|
|
getShopGoodsData,
|
|
|
getShopListData,
|
|
|
getBaseShopData
|
|
|
}; |
...
|
...
|
|