Authored by 周少峰

separate activity and list method

... ... @@ -11,6 +11,7 @@ const utils = '../../../utils';
const API = require(`${library}/api`).API;
const api = new API();
const saleApi = require('./sale-api');
const outletsApi = require('./outlets-api');
const productProcess = require(`${utils}/product-process`);
const publicHandler = require('./public-handler');
... ... @@ -20,12 +21,23 @@ const publicHandler = require('./public-handler');
* @param {[type]} extra [左侧列表额外要拼接的参数]
* @return {[type]} [description]
*/
exports.getSaleOthersData = (params, channel) => {
return api.all([
// headerModel.requestHeaderData(channel),
saleApi.getSaleGoodsList(Object.assign(params, { channel: channel })),
saleApi.getSaleGoodsList({limit: '1', channel: channel })
]).then(result => {
exports.getListData = (params, channel) => {
let apiArr = [];
if (params.productPool) {
// 奥莱活动页调用app.search.sales
apiArr = [
saleApi.getSaleGoodsList({limit: '1', channel: channel }),
saleApi.getSaleGoodsList(Object.assign(params, { channel: channel }))
];
} else {
// 奥莱品类页调用app.search.li
apiArr = [
outletsApi.getOutletsGoodsList({limit: '1', channel: channel }),
outletsApi.getOutletsGoodsList(Object.assign(params, { channel: channel }))
];
}
return api.all(apiArr).then(result => {
let finalResult = {};
// 获取商品数据和顶部筛选条件
... ...
... ... @@ -183,7 +183,7 @@ exports.getOutletsSpecialData = (params, channel) => {
outletsProcess.handleOutletsSpecilData(result[1].data[0]));
return api.all([
list.getSaleOthersData(Object.assign({
list.getListData(Object.assign({
productPool: result[1].data[0].productPoolId,
saleType: 4
}, params), channel)
... ... @@ -216,7 +216,7 @@ exports.getOutletsCategoryData = (params, channel) => {
finalResult.headerData.headType = 'outlets';
return api.all([
list.getSaleOthersData(params, channel)
list.getListData(params, channel)
]).then(listResult => {
finalResult.saleList = listResult[0];
... ...