...
|
...
|
@@ -22,58 +22,73 @@ const getShopData = params => { |
|
|
|
|
|
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
|
|
|
|
|
|
/* 品牌名称 */
|
|
|
Object.assign(finalResult, {
|
|
|
brandName: result.data.brand_name
|
|
|
});
|
|
|
if (result.data) {
|
|
|
|
|
|
/* 品牌是否有店铺 */
|
|
|
if (result.data.shop_id) {
|
|
|
|
|
|
/* 是 BLK 的店铺 */
|
|
|
/* 品牌名称 */
|
|
|
Object.assign(finalResult, {
|
|
|
isBlkShop: true,
|
|
|
shopId: result.data.shop_id
|
|
|
brandName: result.data.brand_name
|
|
|
});
|
|
|
|
|
|
return shopApi.getShopInfoData({
|
|
|
shopId: result.data.shop_id,
|
|
|
uid: params.uid
|
|
|
|
|
|
// uid: '8050882'
|
|
|
}).then(subResult => {
|
|
|
/* 品牌是否有店铺 */
|
|
|
if (result.data.shop_id) {
|
|
|
|
|
|
/* 取店铺的基本信息 */
|
|
|
/* 是 BLK 的店铺 */
|
|
|
Object.assign(finalResult, {
|
|
|
shopLogo: subResult.data.shop_logo,
|
|
|
shopName: subResult.data.shop_name,
|
|
|
shopIntro: subResult.data.shop_intro,
|
|
|
isFav: subResult.data.is_favorite === 'Y'
|
|
|
isBlkShop: true,
|
|
|
shopId: result.data.shop_id
|
|
|
});
|
|
|
|
|
|
/* 取资源位店铺背景图 */
|
|
|
return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
|
|
|
_.forEach(thResult.data.list, value => {
|
|
|
|
|
|
if (value.resource_name === 'shopTopBanner_app') {
|
|
|
Object.assign(finalResult, {
|
|
|
shopBg: JSON.parse(value.resource_data).shopSrc
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return shopApi.getShopInfoData({
|
|
|
shopId: result.data.shop_id,
|
|
|
uid: params.uid
|
|
|
|
|
|
// uid: '8050882'
|
|
|
}).then(subResult => {
|
|
|
|
|
|
if (subResult.data) {
|
|
|
|
|
|
/* 取店铺的基本信息 */
|
|
|
Object.assign(finalResult, {
|
|
|
shopLogo: subResult.data.shop_logo,
|
|
|
shopName: subResult.data.shop_name,
|
|
|
shopIntro: subResult.data.shop_intro,
|
|
|
isFav: subResult.data.is_favorite === 'Y'
|
|
|
});
|
|
|
|
|
|
/* 取资源位店铺背景图 */
|
|
|
return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
|
|
|
if (thResult.data) {
|
|
|
_.forEach(thResult.data.list, value => {
|
|
|
|
|
|
if (value.resource_name === 'shopTopBanner_app') {
|
|
|
Object.assign(finalResult, {
|
|
|
shopBg: JSON.parse(value.resource_data).shopSrc
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
logger.error('getShopsDecoratorList api no data');
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
|
|
} else {
|
|
|
logger.error('getShopInfoData api no data');
|
|
|
}
|
|
|
return finalResult;
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
/* 不是 BLK 的店铺 */
|
|
|
Object.assign(finalResult, {
|
|
|
isBlkShop: false
|
|
|
});
|
|
|
/* 不是 BLK 的店铺 */
|
|
|
Object.assign(finalResult, {
|
|
|
isBlkShop: false
|
|
|
});
|
|
|
|
|
|
logger.info('brand has no shop');
|
|
|
logger.info('brand has no shop');
|
|
|
}
|
|
|
return finalResult;
|
|
|
} else {
|
|
|
logger.error('getBrandInfoByDomain api no data');
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
...
|
...
|
@@ -88,28 +103,33 @@ const getShopData = params => { |
|
|
const getBrandShopGoodsData = params => {
|
|
|
let finalResult = {};
|
|
|
|
|
|
return shopApi.getBrandInfoByDomain({ domain: params.domain }).then(result => {
|
|
|
return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
|
|
|
brand: result.data.id,
|
|
|
shopId: result.data.shop_id
|
|
|
})).then(subResult => {
|
|
|
if (subResult.data) {
|
|
|
prettyFilter(subResult.data.filter);
|
|
|
finalResult = {
|
|
|
data: {
|
|
|
productList: processProductList(subResult.data.product_list),
|
|
|
filter: subResult.data.filter,
|
|
|
page: subResult.data.page,
|
|
|
pageTotal: subResult.data.page_total
|
|
|
},
|
|
|
code: 200
|
|
|
};
|
|
|
} else {
|
|
|
logger.error('getBrandShopGoodsOriginData api no data');
|
|
|
}
|
|
|
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
|
|
|
|
|
|
return camelCase(finalResult);
|
|
|
});
|
|
|
if (result.data) {
|
|
|
return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
|
|
|
brand: result.data.id,
|
|
|
shopId: result.data.shop_id
|
|
|
})).then(subResult => {
|
|
|
if (subResult.data) {
|
|
|
prettyFilter(subResult.data.filter);
|
|
|
finalResult = {
|
|
|
data: {
|
|
|
productList: processProductList(subResult.data.product_list),
|
|
|
filter: subResult.data.filter,
|
|
|
page: subResult.data.page,
|
|
|
pageTotal: subResult.data.page_total
|
|
|
},
|
|
|
code: 200
|
|
|
};
|
|
|
} else {
|
|
|
logger.error('getBrandShopGoodsOriginData api no data');
|
|
|
}
|
|
|
return camelCase(finalResult);
|
|
|
});
|
|
|
} else {
|
|
|
logger.error('getBrandInfoByDomain api no data');
|
|
|
}
|
|
|
return camelCase(finalResult);
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|