Authored by 周少峰

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

... ... @@ -212,26 +212,21 @@ exports.handleOutletsBannersData = (origin, params) => {
* @return {[type]} [description]
*/
exports.handleOutletsActivityData = (origin, name) => {
let dest = {};
let nowTime = Math.round(new Date().getTime() / 1000);
dest.name = name || '限时嗨购'; // 需要根据 name 传值修改
dest.topic = [];
let dest = {
name: name || '限时嗨购',
topic: []
};
// 处理奥莱活动列表数据
_.forEach(origin, value => {
let activity = {
href: helpers.urlFormat('/product/outlets/special/detail', {productPool: value.productPoolId})
href: helpers.urlFormat('/product/outlets/special/detail', {id: value.id}),
img: value.webCoverUrl,
logo: value.logoUrl,
title: value.title,
limit: parseInt(value.endLeftTime, 10) * 1000
};
activity.href = helpers.urlFormat('/product/outlets/special/detail', {productPool: value.productPoolId});
activity.img = value.webCoverUrl;
activity.logo = value.logoUrl;
activity.title = value.title;
activity.limit = (value.endTime - nowTime) * 1000;
if (value.promotionName) {
Object.assign(activity, discountSplit(value.promotionName));
}
... ...
... ... @@ -98,7 +98,7 @@ exports.getOutletsIndexData = (params, channel) => {
}
// 处理即将上架品牌数据
if (result[6].code === 200) {
if (result[6].code === 200 && !_.isEmpty(result[6].data)) {
finalResult.limitedBuy.extra.comeSoon = outletsProcess.handleComeSoonData(result[6].data);
}
... ... @@ -248,8 +248,9 @@ exports.getOutletsCategoryData = (params, channel) => {
if (!_.isEmpty(params.bannerImage)) {
finalResult.saleList.topBanner = {};
finalResult.saleList.topBanner.list = [];
finalResult.saleList.topBanner.list[0] = {};
finalResult.saleList.topBanner.list[0].img = params.bannerImage;
finalResult.saleList.topBanner.list[0] = {
img: params.bannerImage
};
}
return finalResult;
});
... ...
... ... @@ -409,14 +409,14 @@ exports.handleSaleActivityData = (origin, channel) => {
dest.big = [];
dest.normal = [];
_.forEach(origin, function(value, key) {
let activity = {};
activity.link =
helpers.urlFormat('/product/sale/discount/detail', {productPool: value.product_pool, channel: channel});
activity.img = value.cover_url;
activity.time = processTime(parseInt(value.left_time, 10) * 1000);
activity.brand = value.logo_url;
activity.title = value.title;
let activity = {
link: helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel}),
img: value.cover_url,
time: processTime(parseInt(value.left_time, 10) * 1000),
brand: value.logo_url,
title: value.title
};
activity = Object.assign(activity, discountSplit(value.promotion_name));
if (key < 3) {
... ...
... ... @@ -63,8 +63,9 @@ exports.getSaleGoodsData = (params) => {
if (result[0].code === 200) {
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
finalResult.goods[key].tags.isSale = false;
delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
delete finalResult.goods[key].tags.isSale;// 屏蔽 sale 标签
delete finalResult.goods[key].discount; // 屏蔽折扣信息
});
}
... ... @@ -315,45 +316,52 @@ exports.getSaleOthersData = (params, channel) => {
exports.getSaleDiscountData = (params, channel) => {
return api.all([
headerModel.requestHeaderData(channel),
saleApi.getSaleGoodsList(params),
saleApi.getSaleActivityList(params, channel),
saleApi.getSaleGoodsList({channel: channel, saleType: '3', limit: '1'})
saleApi.getSaleGoodsList({channel: channel, saleType: '3', limit: '1'}),
saleApi.getSaleActivityList(params, channel)
]).then(result => {
let finalResult = result[0];
// 处理商品数据,顶部分类
// 处理折扣专场标题 banner 数据
if (result[1].code === 200) {
finalResult.saleList = {};
finalResult.saleList.goods = productProcess.processProductList(result[1].data.product_list);
finalResult.saleList.totalCount = result[1].data.total;
_.forEach(finalResult.saleList.goods, (value, key) => {
delete finalResult.saleList.goods[key].tags.isNew; // 屏蔽 new 标签
delete finalResult.saleList.goods[key].tags.isSale;// 屏蔽 sale 标签
delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息
Object.assign(finalResult, {
leftContent: publicHandler.handleSaleSortData(result[1].data.filter.group_sort, params, 'discount'),
saleList: {
pager: publicHandler.handleSalePagerData(result[1].data.total, params),
opts: publicHandler.handleSaleOptsData(params, result[1].data.total)
}
});
}
// 处理折扣专场标题 banner 数据
// 处理分页等筛选信息
if (result[2].code === 200) {
if (_.size(result[2].data) === 1) {
finalResult.saleTitle = saleHandler.handleDiscountTitleData(result[2].data[0]);
finalResult.topBanner = {};
finalResult.topBanner.list = [];
finalResult.topBanner.list[0] = {};
finalResult.topBanner.list[0].img = result[2].data[0].web_url;
finalResult.topBanner.list[0] = {
img: result[2].data[0].web_url
};
}
}
// 处理分页等筛选信息
if (result[3].code === 200) {
finalResult.leftContent =
publicHandler.handleSaleSortData(result[3].data.filter.group_sort, params, 'discount');
finalResult.saleList.pager = publicHandler.handleSalePagerData(result[3].data.total, params);
finalResult.saleList.opts = publicHandler.handleSaleOptsData(params, result[3].data.total);
}
return api.all([
saleApi.getSaleGoodsList(Object.assign(params, {productPool: result[2].data[0].product_pool}))
]).then(subResult => {
// 处理商品数据,顶部分类
if (subResult[0].code === 200) {
finalResult.saleList.goods = productProcess.processProductList(subResult[0].data.product_list);
finalResult.saleList.totalCount = subResult[0].data.total;
_.forEach(finalResult.saleList.goods, (value, key) => {
delete finalResult.saleList.goods[key].tags.isNew; // 屏蔽 new 标签
delete finalResult.saleList.goods[key].tags.isSale;// 屏蔽 sale 标签
delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息
});
}
return finalResult;
});
}
return finalResult;
});
};
... ... @@ -409,17 +417,18 @@ exports.getSalebreakingYardsData = (params, channel) => {
Object.assign(subResult[1].data.filter, {size: result[2].data}),
params);
}
finalResult.goods = productProcess.processProductList(subResult[1].data.product_list);
finalResult.opts = publicHandler.handleSaleOptsData(params, subResult[1].data.total);
finalResult.totalCount = subResult[1].data.total;
finalResult.pager = publicHandler.handleSalePagerData(subResult[1].data.total, params);
Object.assign(finalResult, {
goods: productProcess.processProductList(subResult[1].data.product_list),
opts: publicHandler.handleSaleOptsData(params, subResult[1].data.total),
totalCount: subResult[1].data.total,
pager: publicHandler.handleSalePagerData(subResult[1].data.total, params)
});
// 处理所有商品标题数据
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = subResult[1].data.count;
finalResult.saleTitle = {
name: '所有商品',
count: subResult[1].data.count
};
_.forEach(finalResult.goods, (value, key) => {
delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
... ...