|
@@ -241,13 +241,11 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -241,13 +241,11 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
241
|
// 品牌信息
|
241
|
// 品牌信息
|
242
|
if (origin.brand !== null && origin.brand !== undefined) {
|
242
|
if (origin.brand !== null && origin.brand !== undefined) {
|
243
|
|
243
|
|
244
|
- dest.enterStore = {};
|
|
|
245
|
-
|
|
|
246
|
- dest.enterStore[0] = {};
|
|
|
247
|
- dest.enterStore[0].img =
|
|
|
248
|
- helpers.getImageUrl(origin.brand.brandIco, 47, 47);
|
|
|
249
|
- dest.enterStore[0].storeName = origin.brand.brandName;
|
|
|
250
|
- dest.enterStore[0].url = helpers.url('', null, origin.brand.brandDomain);
|
244
|
+ // dest.enterStore[0] = {};
|
|
|
245
|
+ // dest.enterStore[0].img =
|
|
|
246
|
+ // helpers.getImageUrl(origin.brand.brandIco, 47, 47);
|
|
|
247
|
+ // dest.enterStore[0].storeName = origin.brand.brandName;
|
|
|
248
|
+ // dest.enterStore[0].url = helpers.url('', null, origin.brand.brandDomain);
|
251
|
|
249
|
|
252
|
// 为你优选的链接
|
250
|
// 为你优选的链接
|
253
|
let params = {};
|
251
|
let params = {};
|
|
@@ -461,18 +459,43 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -461,18 +459,43 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
461
|
// 底部简介的URL链接
|
459
|
// 底部简介的URL链接
|
462
|
dest.introUrl = helpers.url('/product/intro_' + origin.erpProductId + '/' + origin.cnAlphabet + '.html', null, '');
|
460
|
dest.introUrl = helpers.url('/product/intro_' + origin.erpProductId + '/' + origin.cnAlphabet + '.html', null, '');
|
463
|
dest.id = origin.id;
|
461
|
dest.id = origin.id;
|
464
|
-
|
462
|
+ console.log('data:' + JSON.stringify(dest));
|
465
|
return dest;
|
463
|
return dest;
|
466
|
};
|
464
|
};
|
467
|
|
465
|
|
468
|
-module.exports = (data, cb) => {
|
|
|
469
|
- console.log('data:' + JSON.stringify(data));
|
|
|
470
|
- api.get('', sign.apiSign({
|
466
|
+module.exports = (data) => {
|
|
|
467
|
+ var finalResult;
|
|
|
468
|
+
|
|
|
469
|
+ return api.get('', sign.apiSign({
|
471
|
productId: data.id,
|
470
|
productId: data.id,
|
472
|
method: 'h5.product.data'
|
471
|
method: 'h5.product.data'
|
473
|
})).then(result => {
|
472
|
})).then(result => {
|
474
|
- var dJson = JSON.parse(result);
|
|
|
475
|
-
|
|
|
476
|
- cb(detailDataPkg(dJson, null, 0)); // 待处理 缺少 VIP 等级参数,暂时补充为 0
|
473
|
+ finalResult = detailDataPkg(result, null, 0);
|
|
|
474
|
+
|
|
|
475
|
+ return api.get('', sign.apiSign({
|
|
|
476
|
+ method: 'app.shop.queryShopsByBrandId',
|
|
|
477
|
+ brand_id: result.brand.id
|
|
|
478
|
+ })).then(shops => {
|
|
|
479
|
+ if (shops.code === 200) {
|
|
|
480
|
+ finalResult.enterStore = {};
|
|
|
481
|
+ _.forEach(shops.data, function(value, key) {
|
|
|
482
|
+ finalResult.enterStore[key] = {};
|
|
|
483
|
+ finalResult.enterStore[key].img = helpers.getImageUrl(value.brand_ico, 47, 47);
|
|
|
484
|
+ finalResult.enterStore[key].storeName = value.brand_name;
|
|
|
485
|
+
|
|
|
486
|
+ if (value.shop_id !== null && value.shop_id !== undefined) {
|
|
|
487
|
+ let params = {};
|
|
|
488
|
+
|
|
|
489
|
+ params.shop_id = value.shop_id;
|
|
|
490
|
+ finalResult.enterStore[key].url =
|
|
|
491
|
+ helpers.url('/product/index/brand', params);
|
|
|
492
|
+ } else {
|
|
|
493
|
+ finalResult.enterStore[key].url =
|
|
|
494
|
+ helpers.url('', null, value.brand_domain);
|
|
|
495
|
+ }
|
|
|
496
|
+ });
|
|
|
497
|
+ }
|
|
|
498
|
+ return finalResult;
|
|
|
499
|
+ });
|
477
|
});
|
500
|
});
|
478
|
}; |
501
|
}; |