Authored by 郭成尧

'标签屏蔽'

... ... @@ -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));
}
... ...
... ... @@ -80,7 +80,7 @@ const handleFilterUrl = (originParam, newParam) => {
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
_.forEach(tempOriginParam, function(value, key) {
_.forEach(tempOriginParam, function (value, key) {
dest = dest + key + '=' + value + '&';
});
... ... @@ -163,8 +163,8 @@ const handleBrandCheckedData = (params, origin) => {
if (!_.isEmpty(origin)) {
_.forEach(origin, (value) => {
if (typeof _.find(intBrands, o => {
return _.isEqual(o, value.id);
}) !== 'undefined') {
return _.isEqual(o, value.id);
}) !== 'undefined') {
let checked = {}; // push 到已选择数组
... ... @@ -211,16 +211,16 @@ const handleSalebreakingYardsSortData = (origin, params) => {
if (!_.isEmpty(params.sort)) {
// 是否有分类筛选参数,如果有
_.forEach(params.sort.split(','), function(sortParam) {
_.forEach(origin, function(value) {
_.forEach(params.sort.split(','), function (sortParam) {
_.forEach(origin, function (value) {
// 判断是否在这组数据里面
if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
return o === sortParam;
}))) {
return o === sortParam;
}))) {
// 如果在某组数据里面,组合数据退出循环
_.forEach(value.sub, function(subValue) {
_.forEach(value.sub, function (subValue) {
let size = {};
size.checked =
... ... @@ -235,8 +235,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
});
});
} else { // 如果没有筛选参数,返回所有分类
_.forEach(origin, function(value) {
_.forEach(value.sub, function(subValue) {
_.forEach(origin, function (value) {
_.forEach(value.sub, function (subValue) {
let size = {};
size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false;
... ... @@ -301,7 +301,7 @@ exports.handleSaleFilterData = (origin, params) => {
if (!_.isEmpty(origin.brand)) {
let count = 0;
_.forEach(origin.brand, function(value) {
_.forEach(origin.brand, function (value) {
let brand = {};
brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false;
... ... @@ -328,13 +328,13 @@ exports.handleSaleFilterData = (origin, params) => {
}
// 来排排序
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) {
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function (o) {
return o.index;
});
// 处理 价格 筛选数据
if (!_.isEmpty(origin.priceRange)) {
_.forEach(origin.priceRange, function(value, key) {
_.forEach(origin.priceRange, function (value, key) {
let price = {
checked: (params.price === key) ? true : false,
href: handleFilterUrl(params, {price: key}),
... ... @@ -408,15 +408,15 @@ 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;
_.forEach(origin, function (value, key) {
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) {
... ... @@ -455,9 +455,9 @@ exports.handleSaleBannerData = (origin) => {
var dest = {};
dest.list = [];
_.forEach(origin, function(value) {
_.forEach(origin, function (value) {
if (value.template_name === 'focus') {
_.forEach(value.data, function(subValue) {
_.forEach(value.data, function (subValue) {
let banner = {};
banner.bannerHeight = 450;
... ... @@ -482,9 +482,9 @@ exports.handleSaleBannerSmallData = (origin) => {
var dest = [];
let count = 0;
_.forEach(origin, function(value) {
_.forEach(origin, function (value) {
if (value.template_name === 'threePicture') {
_.forEach(value.data, function(picList) {
_.forEach(value.data, function (picList) {
if (count++ < 3) {
let smallPic = {};
... ...
... ... @@ -316,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;
});
};
... ... @@ -410,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 标签
... ...