Authored by 郭成尧

'奥莱首页分类数据'

... ... @@ -330,9 +330,7 @@ exports.getSalebreakingYardsData = (params, channel) => {
return api.all([
headerModel.requestHeaderData(channel),
saleApi.getSaleBannerList(contentCode[channel].breakCode),
saleApi.getSalebreakingYardsSortList(params),
saleApi.getSaleGoodsList({channel: channel, saleType: '1', limit: '1'}),
saleApi.getSaleGoodsList(params)
saleApi.getSalebreakingYardsSortList(params)
]).then(result => {
let finalResult = result[0];
... ... @@ -341,39 +339,43 @@ exports.getSalebreakingYardsData = (params, channel) => {
finalResult.topBanner = saleHandler.handleSaleBannerData(result[1].data);
}
// 处理筛选条件数据
if (result[3].code === 200) {
finalResult.leftContent = saleHandler.handleSaleSortData(result[3].data.filter.group_sort, params);
// 断码区产品筛选需要断码区尺码数据,改为串行处理
if (result[2].code === 200) {
return api.all([
saleApi.getSaleGoodsList({channel: channel, saleType: '1', limit: '1'}),
saleApi.getSaleGoodsList(params)
]).then(subResult => {
// 处理筛选条件数据
if (subResult[0].code === 200) {
// 这边整合了尺码数据处理
if (result[2].code === 200) {
finalResult.filters = saleHandler.handleSaleFilterData(
Object.assign(result[3].data.filter, { size: result[2].data }),
params);
}
finalResult.filters = saleHandler.handleSaleFilterData(
Object.assign(subResult[0].data.filter, {size: result[2].data}),
params);
finalResult.leftContent =
saleHandler.handleSaleSortData(subResult[0].data.filter.group_sort, params);
finalResult.opts = saleHandler.handleSaleOptsData(params, result[3].data.total);
finalResult.totalCount = result[3].data.total;
finalResult.pager = saleHandler.handleSalePagerData(result[3].data.total, params);
finalResult.opts = saleHandler.handleSaleOptsData(params, subResult[0].data.total);
finalResult.totalCount = subResult[0].data.total;
finalResult.pager = saleHandler.handleSalePagerData(subResult[0].data.total, params);
// 处理所有商品标题数据
finalResult.saleTitle = {};
// 处理所有商品标题数据
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
}
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
// 处理商品数据
if (result[4].code === 200) {
finalResult.goods = productProcess.processProductList(result[4].data.product_list);
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
});
}
// 处理商品数据
if (subResult[1].code === 200) {
finalResult.goods = productProcess.processProductList(subResult[1].data.product_list);
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
});
}
return finalResult;
});
}
return finalResult;
});
};
... ...