...
|
...
|
@@ -35,7 +35,7 @@ const _getUserProfile = (uid) => { |
|
|
* @param {array}
|
|
|
* @return {array}
|
|
|
*/
|
|
|
const _getShopsInfo = (data) => {
|
|
|
const _processShopsInfo = (data) => {
|
|
|
let enterStore = [];
|
|
|
|
|
|
_.forEach(data, function(value) {
|
...
|
...
|
@@ -529,6 +529,36 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
let _getShopsInfo = (brandId) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.shop.queryShopsByBrandId',
|
|
|
brand_id: _.toString(brandId)
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then(shops => {
|
|
|
if (shops.code === 200) {
|
|
|
return _processShopsInfo(shops.data);
|
|
|
}
|
|
|
|
|
|
return [];
|
|
|
});
|
|
|
};
|
|
|
|
|
|
let _getPromotionInfo = (skn) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.product.promotion',
|
|
|
product_skn: _.toString(skn)
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
return result.data;
|
|
|
}
|
|
|
|
|
|
return {};
|
|
|
});
|
|
|
};
|
|
|
|
|
|
let getProductData = (data) => {
|
|
|
let finalResult;
|
|
|
let params = {
|
...
|
...
|
@@ -546,20 +576,15 @@ let getProductData = (data) => { |
|
|
return api.get('', params, {
|
|
|
cache: true
|
|
|
}).then(result => {
|
|
|
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.shop.queryShopsByBrandId',
|
|
|
brand_id: _.toString(result.brandId)
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then(shops => {
|
|
|
if (shops.code === 200) {
|
|
|
finalResult.enterStore = _getShopsInfo(shops.data);
|
|
|
}
|
|
|
return Promise.all([_getShopsInfo(result.brandId), _getPromotionInfo(result.erpProductId)]).then((info) => {
|
|
|
result.promotionBoList = info[1];
|
|
|
|
|
|
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
|
|
finalResult.enterStore = info[0];
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
|
|
|
|
|
});
|
|
|
});
|
|
|
};
|
...
|
...
|
|