Showing
1 changed file
with
29 additions
and
20 deletions
@@ -16,6 +16,33 @@ var api = new API(); | @@ -16,6 +16,33 @@ var api = new API(); | ||
16 | var helpers = new HELPERS(); | 16 | var helpers = new HELPERS(); |
17 | 17 | ||
18 | /** | 18 | /** |
19 | + * 处理品牌关联店铺信息 | ||
20 | + * @param {array} | ||
21 | + * @return {array} | ||
22 | + */ | ||
23 | +const getShopsInfo = (data) => { | ||
24 | + var enterStore = {}; | ||
25 | + | ||
26 | + _.forEach(data, function(value, key) { | ||
27 | + enterStore[key] = {}; | ||
28 | + enterStore[key].img = helpers.getImageUrl(value.brand_ico, 47, 47); | ||
29 | + enterStore[key].storeName = value.brand_name; | ||
30 | + | ||
31 | + if (value.shop_id !== null && value.shop_id !== undefined) { | ||
32 | + let params = {}; | ||
33 | + | ||
34 | + params.shop_id = value.shop_id; | ||
35 | + enterStore[key].url = | ||
36 | + helpers.url('/product/index/brand', params); | ||
37 | + } else { | ||
38 | + enterStore[key].url = | ||
39 | + helpers.url('', null, value.brand_domain); | ||
40 | + } | ||
41 | + }); | ||
42 | + return enterStore; | ||
43 | +}; | ||
44 | + | ||
45 | +/** | ||
19 | * 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮) | 46 | * 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮) |
20 | * @param {array} 需要处理的数据 | 47 | * @param {array} 需要处理的数据 |
21 | * @param {int} 限购商品的关联状态 | 48 | * @param {int} 限购商品的关联状态 |
@@ -66,7 +93,7 @@ const procShowStatus = (data, showStatus, isBeginSale) => { | @@ -66,7 +93,7 @@ const procShowStatus = (data, showStatus, isBeginSale) => { | ||
66 | }; | 93 | }; |
67 | 94 | ||
68 | /** | 95 | /** |
69 | - * 根据设备类型获得限购商品跳转app的url | 96 | + * 根据设备类型获得限购商品跳转app的url 待处理 |
70 | * @param {[string]} productCode 限购商品码 | 97 | * @param {[string]} productCode 限购商品码 |
71 | * @param {[string]} skn 限购商品skn | 98 | * @param {[string]} skn 限购商品skn |
72 | * @return {[string]} 限购商品跳转url | 99 | * @return {[string]} 限购商品跳转url |
@@ -74,8 +101,6 @@ const procShowStatus = (data, showStatus, isBeginSale) => { | @@ -74,8 +101,6 @@ const procShowStatus = (data, showStatus, isBeginSale) => { | ||
74 | const getLimitCodeUrl = (productCode, skn) => { | 101 | const getLimitCodeUrl = (productCode, skn) => { |
75 | var url = 'yohoapp://yoho.app/openwith?limit_product_code=' + productCode + '&product_skn=' + skn; | 102 | var url = 'yohoapp://yoho.app/openwith?limit_product_code=' + productCode + '&product_skn=' + skn; |
76 | 103 | ||
77 | - console.log(navigator.userAgent); | ||
78 | - | ||
79 | return url; | 104 | return url; |
80 | }; | 105 | }; |
81 | 106 | ||
@@ -477,23 +502,7 @@ module.exports = (data) => { | @@ -477,23 +502,7 @@ module.exports = (data) => { | ||
477 | brand_id: result.brand.id | 502 | brand_id: result.brand.id |
478 | })).then(shops => { | 503 | })).then(shops => { |
479 | if (shops.code === 200) { | 504 | 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 | - }); | 505 | + finalResult.enterStore = getShopsInfo(shops.data); |
497 | } | 506 | } |
498 | return finalResult; | 507 | return finalResult; |
499 | }); | 508 | }); |
-
Please register or login to post a comment