Authored by yyq

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuy-node into release/4.6

... ... @@ -185,7 +185,6 @@ exports.handleOutletsBannersData = (origin, params) => {
dest.limitedBuy.extra.sourceImg = {};
dest.limitedBuy.extra.sourceImg.href = value.data[0].url;
dest.limitedBuy.extra.sourceImg.img = value.data[0].src;
console.log(value.data[0].src);
}
// 处理热销推荐数据
... ...
... ... @@ -816,3 +816,24 @@ exports.handleSalePagerData = (total, params) => {
return dest;
};
/**
* 处理断码区尺码数据,输出整合后的筛选条件
* @param origin
*/
exports.handleSaleBreakingSizeData = (origin) => {
let dest = {};
dest.breakSize = '';
dest.breakSort = '';
_.forEach(origin, value => {
dest.breakSort += value.sort_id;
_.forEach(value.sub, subValue => {
dest.breakSize += subValue.size_id + ',';
});
});
return dest;
};
... ...
... ... @@ -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,55 @@ 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) {
finalResult.filters = saleHandler.handleSaleFilterData(
Object.assign(result[3].data.filter, { size: result[2].data }),
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.saleTitle = {};
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 (result[2].code === 200) {
let breakingSizeSort = saleHandler.handleSaleBreakingSizeData(result[2].data);
let breakParam = {}; // 为断码区筛选参数存储,为了不影响 params ,否则会导致链接过长
return api.all([
saleApi.getSaleGoodsList({
channel: channel,
saleType: '1',
limit: '1',
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
}),
saleApi.getSaleGoodsList(Object.assign(breakParam, params, {
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
}))
]).then(subResult => {
// 处理筛选条件数据
if (subResult[0].code === 200) {
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, subResult[0].data.total);
finalResult.totalCount = subResult[0].data.total;
finalResult.pager = saleHandler.handleSalePagerData(subResult[0].data.total, params);
// 处理所有商品标题数据
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
}
// 处理商品数据
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;
});
};
... ...