Authored by 郭成尧

左侧分类取频道分类下的数据

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-25 18:16:59
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 11:28:54
* @Last Modified time: 2016-06-07 13:43:02
*/
'use strict';
... ... @@ -179,8 +179,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
// 判断是否在这组数据里面
if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
return o === sortParam;
}))) {
return o === sortParam;
}))) {
// 如果在某组数据里面,组合数据退出循环
_.forEach(value.sub, function(subValue) {
... ... @@ -330,7 +330,7 @@ exports.handleSaleFilterData = (origin, params) => {
}
// 断码区尺码数据处理
if (!_.isEmpty(origin.size)) {
if (!_.isEmpty(origin.size) && params.saleType === '1') {
dest.size = handleSalebreakingYardsSortData(origin.size, params);
// 最新降价筛选数据处理
... ... @@ -450,13 +450,11 @@ exports.handleSaleSortData = (origin, params) => {
category.checked = (params.sort === value.relation_parameter.sort) ? true : false;
category.href = handleFilterUrl(params, { sort: value.relation_parameter.sort });
let gender = !_.isEmpty(params.gender) ? `&gender=${params.gender}` : '';
_.forEach(value.sub, function(subValue) {
category.childList.push({
name: subValue.category_name,
num: subValue.node_count,
href: '?sort=' + subValue.relation_parameter.sort + gender
href: handleFilterUrl(params, { sort: subValue.relation_parameter.sort })
});
});
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 13:11:53
* @Last Modified time: 2016-06-07 13:48:17
*/
'use strict';
... ... @@ -189,14 +189,14 @@ exports.getSaleOthersData = (params, channel) => {
promiseObject = [
saleApi.getSaleGoodsList(params),
saleApi.getSaleBannerList(contentCode[channel].vip),
saleApi.getLeftContentList(),
saleApi.getSaleGoodsList({ saleType: '2', limit: '1', channel: channel }),
saleApi.getUserProfile(params.uid)
];
} else {
promiseObject = [
saleApi.getSaleGoodsList(params),
saleApi.getSaleBannerList(contentCode[channel].vip),
saleApi.getLeftContentList()
saleApi.getSaleGoodsList({ saleType: '3', limit: '1', channel: channel })
];
}
... ... @@ -204,23 +204,9 @@ exports.getSaleOthersData = (params, channel) => {
return api.all(promiseObject).then(result => {
let finalResult = {};
// 获取商品数据和顶部筛选条件
// 获取商品数据
if (result[0].code === 200) {
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
if (!_.isEmpty(result[0].data.filter)) {
finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
}
// 处理排序数据
finalResult.opts = saleHandler.handleSaleOptsData(params, result[0].data.total);
finalResult.totalCount = result[0].data.total;
finalResult.pager = saleHandler.handleSalePagerData(result[0].data.total, params);
// 处理所有商品标题数据
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
}
// 获取焦点图数据
... ... @@ -228,13 +214,25 @@ exports.getSaleOthersData = (params, channel) => {
finalResult.topBanner = saleHandler.handleSaleBannerData(result[1].data);
}
// 获取左侧类目数据
// 获取分类筛选数据
if (result[2].code === 200) {
if (params.gender === '2,3') {
finalResult.leftContent = saleHandler.handleSaleSortData(result[2].data.girl, params);
} else {
finalResult.leftContent = saleHandler.handleSaleSortData(result[2].data.boy, params);
}
// 获取左侧类目数据
finalResult.leftContent = saleHandler.handleSaleSortData(result[2].data.filter.group_sort, params);
// 顶部筛选条件
finalResult.filters = saleHandler.handleSaleFilterData(result[2].data.filter, params);
// 处理排序数据
finalResult.opts = saleHandler.handleSaleOptsData(params, result[2].data.total);
finalResult.totalCount = result[2].data.total;
finalResult.pager = saleHandler.handleSalePagerData(result[2].data.total, params);
// 处理所有商品标题数据
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
}
if (!_.isEmpty(result[3])) {
... ... @@ -293,7 +291,7 @@ exports.getSaleDiscountData = (params, channel) => {
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
finalResult.saleTitle.count = finalResult.saleList.totalCount;
}
// 处理焦点图数据
... ... @@ -322,7 +320,7 @@ exports.getSalebreakingYardsData = (params, channel) => {
saleApi.getSaleGoodsList(params),
saleApi.getSalebreakingYardsSortList(params),
saleApi.getSaleBannerList(contentCode[channel].breakCode),
saleApi.getLeftContentList()
saleApi.getSaleGoodsList({ channel: channel, saleType: '1', limit: '1' })
]).then(result => {
let finalResult = {};
... ... @@ -354,12 +352,7 @@ exports.getSalebreakingYardsData = (params, channel) => {
}
if (result[3].code === 200) {
if (params.gender === '2,3') {
finalResult.leftContent = saleHandler.handleSaleSortData(result[3].data.girl, params);
} else {
finalResult.leftContent = saleHandler.handleSaleSortData(result[3].data.boy, params);
}
finalResult.leftContent = saleHandler.handleSaleSortData(result[3].data.filter.group_sort, params);
}
return finalResult;
... ...