...
|
...
|
@@ -16,6 +16,33 @@ var api = new API(); |
|
|
var helpers = new HELPERS();
|
|
|
|
|
|
/**
|
|
|
* 处理品牌关联店铺信息
|
|
|
* @param {array}
|
|
|
* @return {array}
|
|
|
*/
|
|
|
const getShopsInfo = (data) => {
|
|
|
var enterStore = {};
|
|
|
|
|
|
_.forEach(data, function(value, key) {
|
|
|
enterStore[key] = {};
|
|
|
enterStore[key].img = helpers.getImageUrl(value.brand_ico, 47, 47);
|
|
|
enterStore[key].storeName = value.brand_name;
|
|
|
|
|
|
if (value.shop_id !== null && value.shop_id !== undefined) {
|
|
|
let params = {};
|
|
|
|
|
|
params.shop_id = value.shop_id;
|
|
|
enterStore[key].url =
|
|
|
helpers.url('/product/index/brand', params);
|
|
|
} else {
|
|
|
enterStore[key].url =
|
|
|
helpers.url('', null, value.brand_domain);
|
|
|
}
|
|
|
});
|
|
|
return enterStore;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
|
|
|
* @param {array} 需要处理的数据
|
|
|
* @param {int} 限购商品的关联状态
|
...
|
...
|
@@ -66,7 +93,7 @@ const procShowStatus = (data, showStatus, isBeginSale) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 根据设备类型获得限购商品跳转app的url
|
|
|
* 根据设备类型获得限购商品跳转app的url 待处理
|
|
|
* @param {[string]} productCode 限购商品码
|
|
|
* @param {[string]} skn 限购商品skn
|
|
|
* @return {[string]} 限购商品跳转url
|
...
|
...
|
@@ -74,8 +101,6 @@ const procShowStatus = (data, showStatus, isBeginSale) => { |
|
|
const getLimitCodeUrl = (productCode, skn) => {
|
|
|
var url = 'yohoapp://yoho.app/openwith?limit_product_code=' + productCode + '&product_skn=' + skn;
|
|
|
|
|
|
console.log(navigator.userAgent);
|
|
|
|
|
|
return url;
|
|
|
};
|
|
|
|
...
|
...
|
@@ -477,23 +502,7 @@ module.exports = (data) => { |
|
|
brand_id: result.brand.id
|
|
|
})).then(shops => {
|
|
|
if (shops.code === 200) {
|
|
|
finalResult.enterStore = {};
|
|
|
_.forEach(shops.data, function(value, key) {
|
|
|
finalResult.enterStore[key] = {};
|
|
|
finalResult.enterStore[key].img = helpers.getImageUrl(value.brand_ico, 47, 47);
|
|
|
finalResult.enterStore[key].storeName = value.brand_name;
|
|
|
|
|
|
if (value.shop_id !== null && value.shop_id !== undefined) {
|
|
|
let params = {};
|
|
|
|
|
|
params.shop_id = value.shop_id;
|
|
|
finalResult.enterStore[key].url =
|
|
|
helpers.url('/product/index/brand', params);
|
|
|
} else {
|
|
|
finalResult.enterStore[key].url =
|
|
|
helpers.url('', null, value.brand_domain);
|
|
|
}
|
|
|
});
|
|
|
finalResult.enterStore = getShopsInfo(shops.data);
|
|
|
}
|
|
|
return finalResult;
|
|
|
});
|
...
|
...
|
|