...
|
...
|
@@ -5,7 +5,6 @@ |
|
|
|
|
|
'use strict';
|
|
|
const utils = '../../../utils';
|
|
|
const api = global.yoho.API;
|
|
|
const searchApi = require('./search-api');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const productProcess = require(`${utils}/product-process`);
|
...
|
...
|
@@ -46,7 +45,7 @@ exports.getListData = (params) => { |
|
|
apiMethod.push(searchApi.getSortAds(Object.assign(IntroParams, {position_id: sortAdsId})));
|
|
|
}
|
|
|
|
|
|
return api.all(apiMethod).then(result => {
|
|
|
return Promise.all(apiMethod).then(result => {
|
|
|
let finalResult = {
|
|
|
headerData: Object.assign(result[0].headerData, {
|
|
|
header: true
|
...
|
...
|
@@ -102,7 +101,7 @@ exports.getListNewData = (params) => { |
|
|
searchApi.getWeekNew(params)
|
|
|
];
|
|
|
|
|
|
return api.all(apiMethod).then(result => {
|
|
|
return Promise.all(apiMethod).then(result => {
|
|
|
let finalResult = {
|
|
|
headerData: Object.assign(result[0].headerData, {
|
|
|
header: true
|
...
|
...
|
@@ -185,7 +184,7 @@ exports.getBrandData = (params, extra) => { |
|
|
|
|
|
];
|
|
|
|
|
|
return api.all(apiMethod).then(result => {
|
|
|
return Promise.all(apiMethod).then(result => {
|
|
|
let finalResult = {
|
|
|
headerData: Object.assign(result[0].headerData, {
|
|
|
header: true
|
...
|
...
|
@@ -241,7 +240,7 @@ exports.getNodeContentData = (params) => { |
|
|
*/
|
|
|
exports.getAdnav = (params) => {
|
|
|
|
|
|
return api.all([searchApi.getBrandFolder(params), searchApi.getBrandSeries(params)]).then(result => {
|
|
|
return Promise.all([searchApi.getBrandFolder(params), searchApi.getBrandSeries(params)]).then(result => {
|
|
|
|
|
|
let dest = {
|
|
|
picTitle: '',
|
...
|
...
|
@@ -296,6 +295,8 @@ exports.getShopInfo = (shopId, uid) => { |
|
|
* @param shopInfo 店铺介绍
|
|
|
*/
|
|
|
exports.getShopData = (shopId, uid, params, shopInfo) => {
|
|
|
params = params || {};
|
|
|
params.shopId = shopId;
|
|
|
|
|
|
// 店铺所有品牌
|
|
|
return searchApi.getShopBrands(shopId).then(shopBrands => {
|
...
|
...
|
@@ -336,16 +337,16 @@ exports.getShopData = (shopId, uid, params, shopInfo) => { |
|
|
});
|
|
|
|
|
|
// 根据品牌获取分类 (腾讯云测试没有该接口,暂时不调用分类)
|
|
|
// apiMethod.push(
|
|
|
// // 店铺分类
|
|
|
// searchApi.getSortList({brand: shopBrandIds})
|
|
|
// );
|
|
|
apiMethod.push(
|
|
|
|
|
|
// 店铺分类
|
|
|
searchApi.getSortList({brand: shopBrandIds})
|
|
|
);
|
|
|
|
|
|
// apiMethod 添加调用相关文章的接口
|
|
|
apiMethod = _.concat(apiMethod, articleApiMethod);
|
|
|
|
|
|
return api.all(apiMethod).then(result => {
|
|
|
|
|
|
return Promise.all(apiMethod).then(result => {
|
|
|
let finalResult = {
|
|
|
headerData: Object.assign(result[0].headerData, {header: true}),
|
|
|
pathNav: searchHandler.handlePathNavData(shopInfo, params, 'shop')
|
...
|
...
|
@@ -363,6 +364,8 @@ exports.getShopData = (shopId, uid, params, shopInfo) => { |
|
|
return Promise.reject('No ShopDecorator data');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// // 获取左侧类目数据
|
|
|
// if (result[1].code === 200) {
|
|
|
// Object.assign(finalResult.shop, {
|
...
|
...
|
@@ -377,16 +380,28 @@ exports.getShopData = (shopId, uid, params, shopInfo) => { |
|
|
// }
|
|
|
|
|
|
// 获取商品数据和顶部筛选条件
|
|
|
// if (result[2].code === 200) {
|
|
|
// Object.assign(finalResult.shop, {
|
|
|
// filters: searchHandler.handleFilterData(result[2].data.filter, params),
|
|
|
// opts: searchHandler.handleOptsData(params, result[2].data.total, result[2].data.filter),
|
|
|
// totalCount: result[2].data.total,
|
|
|
// footPager: searchHandler.handlePagerData(result[2].data.total, params),
|
|
|
// goods: productProcess.processProductList(result[2].data.product_list,
|
|
|
// Object.assign({showDiscount: false}, params))
|
|
|
// });
|
|
|
// }
|
|
|
if (result[2].code === 200) {
|
|
|
let allGoods = {
|
|
|
name: '全部商品 ALL',
|
|
|
sort: searchHandler.handleOptsData(params, _.get(result[2], 'data.total', 0)),
|
|
|
list: productProcess.processProductList(_.get(result[2], 'data.product_list', []))
|
|
|
};
|
|
|
|
|
|
_.set(allGoods, 'sort.newPage', true); // 启用新的分页导航
|
|
|
|
|
|
finalResult.allGoods = allGoods;
|
|
|
}
|
|
|
|
|
|
if (result[3].code === 200) {
|
|
|
let groupSort = _.get(result[3], 'data.filter.group_sort', []);
|
|
|
|
|
|
finalResult.leftContent = searchHandler.handleSortData(groupSort, params);
|
|
|
|
|
|
if (finalResult.allGoods) {
|
|
|
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, params));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
|
|
|
...
|
...
|
|