Authored by htoooth

add shopId

@@ -1126,6 +1126,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1126,6 +1126,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1126 result.skn = propOrigin('product_skn'); 1126 result.skn = propOrigin('product_skn');
1127 result.productId = propOrigin('product_id'); 1127 result.productId = propOrigin('product_id');
1128 result.shopId = propOrigin('shop_id', 0); 1128 result.shopId = propOrigin('shop_id', 0);
  1129 + result.brandId = propOrigin('brand_info.brand_id', '');
1129 1130
1130 result.maxSortId = propOrigin('maxSortId', ''); 1131 result.maxSortId = propOrigin('maxSortId', '');
1131 result.smallSortId = propOrigin('smallSortId', ''); 1132 result.smallSortId = propOrigin('smallSortId', '');
@@ -1462,17 +1463,25 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1462,17 +1463,25 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1462 result.brandImg = helpers.image(propOrigin('brand_info.brand_ico', ''), 47, 47); 1463 result.brandImg = helpers.image(propOrigin('brand_info.brand_ico', ''), 47, 47);
1463 result.brandName = propOrigin('brand_info.brand_name', ''); 1464 result.brandName = propOrigin('brand_info.brand_name', '');
1464 bandInfo = _getBrandDataByProductBaseInfo(origin, additionalData); 1465 bandInfo = _getBrandDataByProductBaseInfo(origin, additionalData);
1465 - bandInfo.homeUrl = helpers.urlFormat('',  
1466 - result.shopId ? {shopId: result.shopId} : null,  
1467 - propOrigin('brand_info.brand_domain')  
1468 - );  
1469 bandInfo.isCollect = favoriteData.brand; 1466 bandInfo.isCollect = favoriteData.brand;
1470 1467
1471 if (result.shopId) { 1468 if (result.shopId) {
1472 - let bannerImg = yield shopService.getShopBannerAsync(result.shopId); 1469 + let shopData = yield Promise.props({
  1470 + bannerImg: shopService.getShopBannerAsync(result.shopId),
  1471 + isShopOpen: shopService.queryShopByBrandIdAsync(result.brandId)
  1472 + });
  1473 +
  1474 + if (shopData.bannerImg) {
  1475 + bandInfo.bgImg = shopData.bannerImg;
  1476 + }
1473 1477
1474 - if (bannerImg) {  
1475 - bandInfo.bgImg = bannerImg; 1478 + if (shopData.isShopOpen) {
  1479 + bandInfo.homeUrl = helpers.urlFormat('',
  1480 + {shopId: result.shopId},
  1481 + propOrigin('brand_info.brand_domain')
  1482 + );
  1483 + } else {
  1484 + result.shopId = '0';
1476 } 1485 }
1477 } 1486 }
1478 } 1487 }
@@ -41,3 +41,10 @@ exports.shopBannerAsync = (shopId) => { @@ -41,3 +41,10 @@ exports.shopBannerAsync = (shopId) => {
41 shop_id: shopId 41 shop_id: shopId
42 }); 42 });
43 }; 43 };
  44 +
  45 +exports.queryShopsByBrandId = (bid) => {
  46 + return api.get('', {
  47 + method: 'app.shop.queryShopsByBrandId',
  48 + brand_id: bid
  49 + });
  50 +};
@@ -126,3 +126,15 @@ exports.getShopBannerAsync = (shopId) => { @@ -126,3 +126,15 @@ exports.getShopBannerAsync = (shopId) => {
126 } 126 }
127 }); 127 });
128 }; 128 };
  129 +
  130 +exports.queryShopByBrandIdAsync = (bid) => {
  131 + return co(function * () {
  132 + let result = yield api.queryShopsByBrandId(bid);
  133 +
  134 + if (_.get(result, 'code') !== 200) {
  135 + return false;
  136 + }
  137 +
  138 + return _.some(_.get(result, 'data', []), i => _.has(i, 'shop_id'));
  139 + })();
  140 +};
@@ -17,13 +17,13 @@ module.exports = { @@ -17,13 +17,13 @@ module.exports = {
17 cookieDomain: '.yohobuy.com', 17 cookieDomain: '.yohobuy.com',
18 domains: { 18 domains: {
19 // test3 19 // test3
20 - singleApi: 'http://api-test3.yohops.com:9999/',  
21 - api: 'http://api-test3.yohops.com:9999/',  
22 - service: 'http://service-test3.yohops.com:9999/', 20 + //singleApi: 'http://api-test3.yohops.com:9999/',
  21 + //api: 'http://api-test3.yohops.com:9999/',
  22 + //service: 'http://service-test3.yohops.com:9999/',
23 23
24 - //singleApi: 'http://single.yohops.com/',  
25 - //api: 'http://api.yoho.cn/',  
26 - //service: 'http://service.yoho.cn/', 24 + singleApi: 'http://single.gray.yohops.com/',
  25 + api: 'http://api.yoho.cn/',
  26 + service: 'http://service.yoho.cn/',
27 27
28 // api: 'http://dev-api.yohops.com:9999/', 28 // api: 'http://dev-api.yohops.com:9999/',
29 // service: 'http://dev-service.yohops.com:9999/', 29 // service: 'http://dev-service.yohops.com:9999/',
@@ -1827,9 +1827,14 @@ @@ -1827,9 +1827,14 @@
1827 1827
1828 .name { 1828 .name {
1829 display: block; 1829 display: block;
1830 - margin: 15px auto;  
1831 - color: #222; 1830 + max-width: 150px;
  1831 + height: 18px;
1832 line-height: 16px; 1832 line-height: 16px;
  1833 + margin: 5px auto;
  1834 + color: #222;
  1835 + overflow: hidden;
  1836 + text-overflow: ellipsis;
  1837 + white-space: nowrap;
1833 } 1838 }
1834 1839
1835 .price { 1840 .price {