...
|
...
|
@@ -32,39 +32,40 @@ const channelCode = { |
|
|
*/
|
|
|
exports.getOutletsIndexData = (params) => {
|
|
|
return api.all([
|
|
|
headerModel.requestHeaderData('outlets'),
|
|
|
outletsApi.getChannelResouceData({ content_code: channelCode.index }),
|
|
|
outletsApi.getOutletsActivityOrigin(params), // 获取限时活动列表
|
|
|
outletsApi.getOutletsActivityOrigin(params), // 获取即将结束列表
|
|
|
outletsApi.getOutletsTrendData(params), // 获取潮流速递商品数据
|
|
|
saleApi.getSaleGoodsList(params) // 获取底部商品数据
|
|
|
]).then(result => {
|
|
|
let finalResult = {};
|
|
|
let finalResult = result[0];
|
|
|
|
|
|
// 处理资源位数据
|
|
|
if (result[0].code === 200) {
|
|
|
if (result[1].code === 200) {
|
|
|
finalResult = Object.assign(finalResult,
|
|
|
outletsProcess.handleOutletsBannersData(result[0].data));
|
|
|
outletsProcess.handleOutletsBannersData(result[1].data));
|
|
|
}
|
|
|
|
|
|
// 处理限时嗨购列表数据
|
|
|
if (result[1].code === 200) {
|
|
|
if (result[2].code === 200) {
|
|
|
finalResult.limitedBuy = Object.assign(finalResult.limitedBuy,
|
|
|
outletsProcess.handleOutletsActivityData(result[1].data));
|
|
|
outletsProcess.handleOutletsActivityData(result[2].data));
|
|
|
}
|
|
|
|
|
|
// 处理即将结束列表数据
|
|
|
if (result[2].code === 200) {
|
|
|
finalResult.nearOver = outletsProcess.handleOutletsActivityData(result[2].data);
|
|
|
if (result[3].code === 200) {
|
|
|
finalResult.nearOver = outletsProcess.handleOutletsActivityData(result[3].data);
|
|
|
}
|
|
|
|
|
|
// 处理潮品推荐数据
|
|
|
if (result[3].code === 200) {
|
|
|
finalResult.limitedBuy.extra.trendGood = outletsProcess.handleOutletstrendGoodData(result[3].data);
|
|
|
if (result[4].code === 200) {
|
|
|
finalResult.limitedBuy.extra.trendGood = outletsProcess.handleOutletstrendGoodData(result[4].data);
|
|
|
}
|
|
|
|
|
|
// 处理底部商品数据
|
|
|
if (result[4].code === 200) {
|
|
|
finalResult.goodsBoard.list = productProcess.processProductList(result[4].data.product_list);
|
|
|
if (result[5].code === 200) {
|
|
|
finalResult.goodsBoard.list = productProcess.processProductList(result[5].data.product_list);
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
...
|
...
|
@@ -79,25 +80,46 @@ exports.getOutletsIndexData = (params) => { |
|
|
exports.getOutletsChannelData = (params) => {
|
|
|
let channelData = {};
|
|
|
|
|
|
return api.all([
|
|
|
outletsApi.getChannelResouceData({ content_code: channelCode[params.channel] }),
|
|
|
outletsApi.getOutletsActivityOrigin({ platform: 2, size: 0, type: 1 }),
|
|
|
saleApi.getSaleGoodsList(params)
|
|
|
]).then(result => {
|
|
|
// 资源楼层
|
|
|
if (result[0].code === 200) {
|
|
|
Object.assign(channelData, outletsProcess.processFloor(result[0].data.list));
|
|
|
}
|
|
|
|
|
|
// 限时嗨购
|
|
|
if (result[1].code === 200) {
|
|
|
Object.assign(channelData, { flashSale: outletsProcess.formatActivityData(result[1].data) });
|
|
|
let apiArr = [
|
|
|
headerModel.requestHeaderData('outlets'),
|
|
|
];
|
|
|
|
|
|
if (channelCode[params]) {
|
|
|
apiArr.push(outletsApi.getChannelResouceData({
|
|
|
content_code: channelCode[params.channel]
|
|
|
}));
|
|
|
apiArr.push(outletsApi.getOutletsActivityOrigin({
|
|
|
platform: 2,
|
|
|
size: 0,
|
|
|
type: 1
|
|
|
}));
|
|
|
apiArr.push(saleApi.getSaleGoodsList(params));
|
|
|
} else {
|
|
|
// 错误页面
|
|
|
channelData.pageErr = true;
|
|
|
}
|
|
|
|
|
|
return api.all(apiArr).then(result => {
|
|
|
Object.assign(channelData, result[0]);
|
|
|
|
|
|
if (!channelData.pageErr) {
|
|
|
// 资源楼层
|
|
|
if (result[1].code === 200) {
|
|
|
Object.assign(channelData, outletsProcess.processFloor(result[1].data.list));
|
|
|
}
|
|
|
|
|
|
// 限时嗨购
|
|
|
if (result[2].code === 200) {
|
|
|
Object.assign(channelData, { flashSale: outletsProcess.formatActivityData(result[2].data) });
|
|
|
}
|
|
|
|
|
|
// 商品列表
|
|
|
if (result[3].code === 200) {
|
|
|
channelData.goodsBoard = {};
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(result[3].data.product_list);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 商品列表
|
|
|
if (result[2].code === 200) {
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(result[2].data.product_list);
|
|
|
}
|
|
|
return channelData;
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -119,7 +141,7 @@ exports.getOutletsSpecialData = (params) => { |
|
|
specialData.pageErr = true;
|
|
|
if (result[1].code === 200) {
|
|
|
delete specialData.pageErr;
|
|
|
specialData = Object.assign(specialData,
|
|
|
Object.assign(specialData,
|
|
|
outletsProcess.handleOutletsSpecilData(result[1].data[0]));
|
|
|
}
|
|
|
|
...
|
...
|
|