...
|
...
|
@@ -106,29 +106,34 @@ exports.getOutletsIndexData = (params, channel) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.getOutletsChannelData = (params, channel) => {
|
|
|
// 频道资源位不存在
|
|
|
if (!channelCode[channel]) {
|
|
|
throw new Error('频道资源位不存在');
|
|
|
}
|
|
|
|
|
|
let channelData = {};
|
|
|
|
|
|
let apiArr = [
|
|
|
headerModel.requestHeaderData('outlets')
|
|
|
];
|
|
|
// 获取头部数据
|
|
|
headerModel.requestHeaderData('outlets'),
|
|
|
|
|
|
if (channelCode[channel]) {
|
|
|
apiArr.push(outletsApi.getChannelResouceData({
|
|
|
content_code: channelCode[channel]
|
|
|
}));
|
|
|
apiArr.push(outletsApi.getOutletsActivityOrigin({
|
|
|
// 获取频道资源位
|
|
|
outletsApi.getChannelResouceData({content_code: channelCode[channel]}),
|
|
|
|
|
|
// 获取奥莱活动
|
|
|
outletsApi.getOutletsActivityOrigin({
|
|
|
platform: 1,
|
|
|
size: 0,
|
|
|
channel: channel,
|
|
|
type: 1
|
|
|
}));
|
|
|
apiArr.push(outletsApi.getOutletsGoodsList(Object.assign(params, {channel: channel})));
|
|
|
} else {
|
|
|
// 错误页面
|
|
|
channelData.pageErr = true;
|
|
|
}
|
|
|
}),
|
|
|
|
|
|
// 获取奥莱商品列表
|
|
|
outletsApi.getOutletsGoodsList(Object.assign(params, {channel: channel}))
|
|
|
];
|
|
|
|
|
|
return api.all(apiArr).then(result => {
|
|
|
// 返回页面的数据
|
|
|
let finalResult = {
|
|
|
headerData: Object.assign(result[0].headerData, {
|
|
|
header: true,
|
...
|
...
|
@@ -138,33 +143,31 @@ exports.getOutletsChannelData = (params, channel) => { |
|
|
|
|
|
Object.assign(channelData, finalResult);
|
|
|
|
|
|
if (!channelData.pageErr) {
|
|
|
// 资源楼层
|
|
|
if (result[1].code === channelData) {
|
|
|
Object.assign(channelData, outletsProcess.processFloor(result[1].data.list, params));
|
|
|
}
|
|
|
// 资源楼层
|
|
|
if (result[1].code === channelData) {
|
|
|
Object.assign(channelData, outletsProcess.processFloor(result[1].data.list, params));
|
|
|
}
|
|
|
|
|
|
// 限时嗨购
|
|
|
if (result[2].code === 200) {
|
|
|
channelData.nearOver = outletsProcess.handleOutletsActivityData(result[2].data, '限时嗨购');
|
|
|
// 限时嗨购
|
|
|
if (result[2].code === 200) {
|
|
|
channelData.nearOver = outletsProcess.handleOutletsActivityData(result[2].data, '限时嗨购');
|
|
|
}
|
|
|
|
|
|
// 商品列表
|
|
|
if (result[3].code === 200) {
|
|
|
if (!channelData.goodsBoard) {
|
|
|
channelData.goodsBoard = {};
|
|
|
}
|
|
|
channelData.goodsBoard.sort = publicHandler.handleSaleOptsData(params, result[3].data.total);
|
|
|
channelData.goodsBoard.sort.newPage = true;
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(result[3].data.product_list);
|
|
|
channelData.pager = publicHandler.handleSalePagerData(result[3].data.total, params);
|
|
|
|
|
|
// 商品列表
|
|
|
if (result[3].code === 200) {
|
|
|
if (!channelData.goodsBoard) {
|
|
|
channelData.goodsBoard = {};
|
|
|
}
|
|
|
channelData.goodsBoard.sort = publicHandler.handleSaleOptsData(params, result[3].data.total);
|
|
|
channelData.goodsBoard.sort.newPage = true;
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(result[3].data.product_list);
|
|
|
channelData.pager = publicHandler.handleSalePagerData(result[3].data.total, params);
|
|
|
|
|
|
// 添加锚点
|
|
|
if (!_.isEmpty(channelData.goodsBoard.sort.sortType)) {
|
|
|
_.forEach(channelData.goodsBoard.sort.sortType, (value, key) => {
|
|
|
channelData.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
}
|
|
|
// 添加锚点
|
|
|
if (channelData.goodsBoard.sort.sortType) {
|
|
|
_.forEach(channelData.goodsBoard.sort.sortType, (value, key) => {
|
|
|
channelData.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|