Authored by 郭成尧

品牌信息获取

@@ -16,11 +16,26 @@ var api = new API(); @@ -16,11 +16,26 @@ var api = new API();
16 var helpers = new HELPERS(); 16 var helpers = new HELPERS();
17 17
18 /** 18 /**
  19 + * 一品多店 获取品牌相关店铺信息
  20 + * @param {int} 品牌 ID
  21 + * @param {Function}
  22 + * @return {[type]}
  23 + */
  24 +// const getBrandsInfo = (brand_id, cb) => {
  25 +// api.get('', sign.apiSign({
  26 +// method:'app.shop.queryShopsByBrandId',
  27 +// brand_id: brand_id
  28 +// })).then(result => {
  29 +// cb(result);
  30 +// });
  31 +// }
  32 +
  33 +/**
19 * 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮) 34 * 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
20 - * @param {[array]} 需要处理的数据  
21 - * @param {[int]} 限购商品的关联状态 35 + * @param {array} 需要处理的数据
  36 + * @param {int} 限购商品的关联状态
22 * @param {Boolean} 限购商品是否已开售 37 * @param {Boolean} 限购商品是否已开售
23 - * @return {[array]} 38 + * @return {array}
24 */ 39 */
25 const procShowStatus = (data, showStatus, isBeginSale) => { 40 const procShowStatus = (data, showStatus, isBeginSale) => {
26 switch (showStatus) { 41 switch (showStatus) {
@@ -176,7 +191,6 @@ const detailDataPkg = (origin, uid, vipLevel) => { @@ -176,7 +191,6 @@ const detailDataPkg = (origin, uid, vipLevel) => {
176 dest.goodsDiscount = {}; 191 dest.goodsDiscount = {};
177 dest.goodsDiscount.list = {}; 192 dest.goodsDiscount.list = {};
178 193
179 - // console.log(origin.promotionBoList);return;  
180 if (origin.promotionBoList !== null && origin.promotionBoList !== undefined) { 194 if (origin.promotionBoList !== null && origin.promotionBoList !== undefined) {
181 _.forEach(origin.promotionBoList, function(value, key) { 195 _.forEach(origin.promotionBoList, function(value, key) {
182 dest.goodsDiscount.list[key] = {}; 196 dest.goodsDiscount.list[key] = {};
@@ -239,9 +253,37 @@ const detailDataPkg = (origin, uid, vipLevel) => { @@ -239,9 +253,37 @@ const detailDataPkg = (origin, uid, vipLevel) => {
239 dest.feedbacks.commentsUrl = helpers.url('/product/detail/comments', params); 253 dest.feedbacks.commentsUrl = helpers.url('/product/detail/comments', params);
240 } 254 }
241 255
242 - // 品牌信息 待开发 需要调新的接口 256 + // 品牌信息
243 if (origin.brand !== null && origin.brand !== undefined) { 257 if (origin.brand !== null && origin.brand !== undefined) {
244 258
  259 + dest.enterStore = {};
  260 +
  261 + dest.enterStore.img =
  262 + helpers.getImageUrl(origin.brand.brandIco, 47 , 47);
  263 + dest.enterStore.storeName = origin.brand.brandName;
  264 + dest.enterStore.url = helpers.url('', null, origin.brand.brandDomain);
  265 +
  266 + // getBrandsInfo(origin.brand.id, (shops) => {
  267 + // if (shops.code === 200) {
  268 + // _.forEach(shops.data, function(value, key){
  269 + // enterStore[key] = {};
  270 + // enterStore[key].img = helpers.getImageUrl(value.brand_ico, 47, 47);
  271 + // enterStore[key].storeName = value.brand_name;
  272 +
  273 + // if (value.shop_id !== null && value.shop_id !== undefined) {
  274 + // let params = {};
  275 +
  276 + // params.shop_id = value.shop_id;
  277 + // enterStore[key].url =
  278 + // helpers.url('/product/index/brand', params);
  279 + // } else {
  280 + // enterStore[key].url =
  281 + // helpers.url('', null, value.brand_domain);
  282 + // }
  283 + // });
  284 + // }
  285 + // });
  286 +
245 // 为你优选的链接 287 // 为你优选的链接
246 let params = {}; 288 let params = {};
247 289
@@ -463,8 +505,8 @@ module.exports = (data, cb) => { @@ -463,8 +505,8 @@ module.exports = (data, cb) => {
463 api.get('', sign.apiSign({ 505 api.get('', sign.apiSign({
464 productId: data.id, 506 productId: data.id,
465 method: 'h5.product.data' 507 method: 'h5.product.data'
466 - })).then(data => {  
467 - var dJson = JSON.parse(data); 508 + })).then(result => {
  509 + var dJson = JSON.parse(result);
468 510
469 cb(detailDataPkg(dJson, null, 0)); // 待处理 缺少 VIP 等级参数,暂时补充为 0 511 cb(detailDataPkg(dJson, null, 0)); // 待处理 缺少 VIP 等级参数,暂时补充为 0
470 }); 512 });