Authored by 郭成尧

品牌信息获取

... ... @@ -16,11 +16,26 @@ var api = new API();
var helpers = new HELPERS();
/**
* 一品多店 获取品牌相关店铺信息
* @param {int} 品牌 ID
* @param {Function}
* @return {[type]}
*/
// const getBrandsInfo = (brand_id, cb) => {
// api.get('', sign.apiSign({
// method:'app.shop.queryShopsByBrandId',
// brand_id: brand_id
// })).then(result => {
// cb(result);
// });
// }
/**
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
* @param {[array]} 需要处理的数据
* @param {[int]} 限购商品的关联状态
* @param {array} 需要处理的数据
* @param {int} 限购商品的关联状态
* @param {Boolean} 限购商品是否已开售
* @return {[array]}
* @return {array}
*/
const procShowStatus = (data, showStatus, isBeginSale) => {
switch (showStatus) {
... ... @@ -176,7 +191,6 @@ const detailDataPkg = (origin, uid, vipLevel) => {
dest.goodsDiscount = {};
dest.goodsDiscount.list = {};
// console.log(origin.promotionBoList);return;
if (origin.promotionBoList !== null && origin.promotionBoList !== undefined) {
_.forEach(origin.promotionBoList, function(value, key) {
dest.goodsDiscount.list[key] = {};
... ... @@ -239,9 +253,37 @@ const detailDataPkg = (origin, uid, vipLevel) => {
dest.feedbacks.commentsUrl = helpers.url('/product/detail/comments', params);
}
// 品牌信息 待开发 需要调新的接口
// 品牌信息
if (origin.brand !== null && origin.brand !== undefined) {
dest.enterStore = {};
dest.enterStore.img =
helpers.getImageUrl(origin.brand.brandIco, 47 , 47);
dest.enterStore.storeName = origin.brand.brandName;
dest.enterStore.url = helpers.url('', null, origin.brand.brandDomain);
// getBrandsInfo(origin.brand.id, (shops) => {
// if (shops.code === 200) {
// _.forEach(shops.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);
// }
// });
// }
// });
// 为你优选的链接
let params = {};
... ... @@ -463,8 +505,8 @@ module.exports = (data, cb) => {
api.get('', sign.apiSign({
productId: data.id,
method: 'h5.product.data'
})).then(data => {
var dJson = JSON.parse(data);
})).then(result => {
var dJson = JSON.parse(result);
cb(detailDataPkg(dJson, null, 0)); // 待处理 缺少 VIP 等级参数,暂时补充为 0
});
... ...