Authored by zhangxiaoru

merge feature/brandJump

@@ -42,7 +42,7 @@ const _packageAd = (params) => { @@ -42,7 +42,7 @@ const _packageAd = (params) => {
42 42
43 const _packageList = (channel) => { 43 const _packageList = (channel) => {
44 return api.get('', { 44 return api.get('', {
45 - method: 'app.brand.newBrandList', 45 + method: 'app.brand.allBrandList',
46 yh_channel: channel 46 yh_channel: channel
47 }, { 47 }, {
48 cache: true, 48 cache: true,
@@ -172,7 +172,12 @@ const getBrandListByChannel = (channel) => { @@ -172,7 +172,12 @@ const getBrandListByChannel = (channel) => {
172 name: row.brand_name, 172 name: row.brand_name,
173 isHot: row.is_hot === 'Y' ? true : false, 173 isHot: row.is_hot === 'Y' ? true : false,
174 isNew: row.is_show_new === 'Y' ? true : false, 174 isNew: row.is_show_new === 'Y' ? true : false,
175 - url: helpers.urlFormat('/product/index/brand?domain=' + row.brand_domain) 175 + url: row.type !== '3' ? helpers.urlFormat('/product/index/brand', {
  176 + domain: row.brand_domain,
  177 + shopType: row.type
  178 + }) : helpers.urlFormat('/product/global/list/', {
  179 + brand: row.global_brand_id
  180 + })
176 }); 181 });
177 }); 182 });
178 resu.brandList.push(obj); 183 resu.brandList.push(obj);
@@ -190,7 +195,10 @@ const getBrandListByChannel = (channel) => { @@ -190,7 +195,10 @@ const getBrandListByChannel = (channel) => {
190 195
191 obj.list.push({ 196 obj.list.push({
192 brandName: newList[key].brand_name, 197 brandName: newList[key].brand_name,
193 - url: helpers.urlFormat('/product/index/brand?domain=' + newList[key].brand_domain), 198 + url: helpers.urlFormat('/product/index/brand', {
  199 + domain: newList[key].brand_domain,
  200 + shopType: newList[key].type
  201 + }),
194 img: helpers.image(newList[key].brand_ico, 186, 115), 202 img: helpers.image(newList[key].brand_ico, 186, 115),
195 }); 203 });
196 resu.newBrandWall.push(obj); 204 resu.newBrandWall.push(obj);
@@ -208,7 +216,10 @@ const getBrandListByChannel = (channel) => { @@ -208,7 +216,10 @@ const getBrandListByChannel = (channel) => {
208 216
209 obj.list.push({ 217 obj.list.push({
210 brandName: hotList[key].brand_name, 218 brandName: hotList[key].brand_name,
211 - url: helpers.urlFormat('/product/index/brand?domain=' + hotList[key].brand_domain), 219 + url: helpers.urlFormat('/product/index/brand', {
  220 + domain: hotList[key].brand_domain,
  221 + shopType: hotList[key].type
  222 + }),
212 img: helpers.image(hotList[key].brand_ico, 186, 115), 223 img: helpers.image(hotList[key].brand_ico, 186, 115),
213 }); 224 });
214 resu.recommandBrandWall.push(obj); 225 resu.recommandBrandWall.push(obj);
@@ -44,6 +44,7 @@ const shop = { @@ -44,6 +44,7 @@ const shop = {
44 let title = ''; 44 let title = '';
45 let uid = req.user.uid || 0; 45 let uid = req.user.uid || 0;
46 let shopEnter; 46 let shopEnter;
  47 + let shopType = req.query.shopType;
47 48
48 if (req.query.shop_id) { 49 if (req.query.shop_id) {
49 return shop.shop(req, res, next); 50 return shop.shop(req, res, next);
@@ -82,13 +83,13 @@ const shop = { @@ -82,13 +83,13 @@ const shop = {
82 searchParam.uid = uid; 83 searchParam.uid = uid;
83 } 84 }
84 85
85 - if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) { 86 + if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId && shopType !== '1') {
86 req.query.shop_id = brandLogo.shopId; 87 req.query.shop_id = brandLogo.shopId;
87 shop.shop(req, res, next); 88 shop.shop(req, res, next);
88 return false; 89 return false;
89 - } else if (req.query.from === 'search') { 90 + } else if (req.query.from === 'search' || shopType === '1') {
90 return Promise.all([ 91 return Promise.all([
91 - listModel.getBrandShops(brandId, req), 92 + listModel.getBrandShops(brandLogo.brandDomain, req),
92 searchModel.getSearchData(searchParam) 93 searchModel.getSearchData(searchParam)
93 ]).then(shopResult => { 94 ]).then(shopResult => {
94 let brandShop = shopResult[0]; 95 let brandShop = shopResult[0];
@@ -114,14 +115,16 @@ const shop = { @@ -114,14 +115,16 @@ const shop = {
114 } 115 }
115 116
116 if (brandShop.length > 0 || brandLogo && shopEnter) { 117 if (brandShop.length > 0 || brandLogo && shopEnter) {
  118 +
117 params = _.assign({ 119 params = _.assign({
118 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop, 120 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
119 search: { 121 search: {
120 - default: req.query.query, 122 + default: req.query.query || req.query.domain,
121 url: helpers.urlFormat('', null, 'search') 123 url: helpers.urlFormat('', null, 'search')
122 } 124 }
123 }, params); 125 }, params);
124 } 126 }
  127 +
125 return true; 128 return true;
126 }); 129 });
127 } else { 130 } else {
@@ -29,17 +29,29 @@ const _processBrandShops = (list) => { @@ -29,17 +29,29 @@ const _processBrandShops = (list) => {
29 let formatDat = []; 29 let formatDat = [];
30 30
31 _.forEach(list, item => { 31 _.forEach(list, item => {
32 - if (item.shop_id) { 32 + if (item.shop_type === 'yoho_shop') {
33 formatDat.push({ 33 formatDat.push({
34 url: helpers.urlFormat('/product/index/brand/', { 34 url: helpers.urlFormat('/product/index/brand/', {
35 shop_id: item.shop_id 35 shop_id: item.shop_id
36 }), 36 }),
  37 + thumb: helpers.image(item.shop_logo, 75, 40),
  38 + name: item.shop_name
  39 + });
  40 + } else if (item.shop_type === 'tbl_brand') {
  41 + formatDat.push({
  42 + url: helpers.urlFormat('/product/global/list/', {
  43 + brand: item.global_brand_id
  44 + }),
37 thumb: helpers.image(item.brand_ico, 75, 40), 45 thumb: helpers.image(item.brand_ico, 75, 40),
38 name: item.brand_name 46 name: item.brand_name
39 }); 47 });
40 } 48 }
41 }); 49 });
42 50
  51 + if (formatDat.length > 2) {
  52 + formatDat.moreShop = true;
  53 + }
  54 +
43 return formatDat; 55 return formatDat;
44 }; 56 };
45 57
@@ -749,7 +761,8 @@ const getBrandLogoByDomain = (domain) => { @@ -749,7 +761,8 @@ const getBrandLogoByDomain = (domain) => {
749 thumb: helpers.image(formatData.brand_ico, 75, 40), 761 thumb: helpers.image(formatData.brand_ico, 75, 40),
750 name: formatData.brand_name, 762 name: formatData.brand_name,
751 shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id 763 shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
752 - type: formatData.type ? formatData.type : 0 764 + type: formatData.type ? formatData.type : 0,
  765 + brandDomain: formatData.brand_domain
753 }; 766 };
754 } else { 767 } else {
755 return false; 768 return false;
@@ -763,18 +776,18 @@ const getBrandLogoByDomain = (domain) => { @@ -763,18 +776,18 @@ const getBrandLogoByDomain = (domain) => {
763 * @param req 776 * @param req
764 * @return array 777 * @return array
765 */ 778 */
766 -const getBrandShops = (brandId, req) => { 779 +const getBrandShops = (domain, req) => {
767 return api.get('', { 780 return api.get('', {
768 - method: 'app.shop.queryShopsByBrandId',  
769 - brand_id: brandId 781 + method: 'app.search.li',
  782 + query: domain
770 }, { 783 }, {
771 code: 200, 784 code: 200,
772 cache: true 785 cache: true
773 }).then(result => { 786 }).then(result => {
774 - if (_.isArray(result.data)) { 787 + if (result.data.shopList && _.isArray(result.data.shopList)) {
775 let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query); 788 let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query);
776 789
777 - return Object.assign(_processBrandShops(result.data), {seoResult: seoResult}); 790 + return Object.assign(_processBrandShops(result.data.shopList), {seoResult: seoResult});
778 } else { 791 } else {
779 return []; 792 return [];
780 } 793 }
@@ -12,8 +12,10 @@ @@ -12,8 +12,10 @@
12 </div> 12 </div>
13 <ul class="search-associate"></ul> 13 <ul class="search-associate"></ul>
14 {{/ search}} 14 {{/ search}}
15 - {{# brandWay}} 15 + {{#if brandWay}}
16 <div class="brand-way"> 16 <div class="brand-way">
  17 + <div class="brand-enter">
  18 + {{# brandWay}}
17 <a href={{url}}> 19 <a href={{url}}>
18 <img class="brand-thumb" src={{image2 thumb q=60}}> 20 <img class="brand-thumb" src={{image2 thumb q=60}}>
19 <span class="brand-name">{{name}}</span> 21 <span class="brand-name">{{name}}</span>
@@ -22,8 +24,16 @@ @@ -22,8 +24,16 @@
22 <i class="iconfont">&#xe614;</i> 24 <i class="iconfont">&#xe614;</i>
23 </span> 25 </span>
24 </a> 26 </a>
25 - </div>  
26 {{/ brandWay}} 27 {{/ brandWay}}
  28 + </div>
  29 +
  30 + {{#if brandWay.moreShop}}
  31 + <div class="more-shop down">
  32 + <span class="iconfont">&#xe616;</span>
  33 + </div>
  34 + {{/if}}
  35 + </div>
  36 + {{/if}}
27 <!-- 品牌页面 --> 37 <!-- 品牌页面 -->
28 {{# brandHome}} 38 {{# brandHome}}
29 <div id="brand-header" class="brand-header" data-id={{id}}> 39 <div id="brand-header" class="brand-header" data-id={{id}}>
@@ -24,6 +24,11 @@ @@ -24,6 +24,11 @@
24 {{# is_presell}} 24 {{# is_presell}}
25 <p class="good-tag is-presell">预售</p> 25 <p class="good-tag is-presell">预售</p>
26 {{/ is_presell}} 26 {{/ is_presell}}
  27 + {{# is_global}}
  28 + <p class="good-tag is-global">
  29 + <span>{{../tbl_country_name}}</span>
  30 + </p>
  31 + {{/ is_global}}
27 {{/ tags}} 32 {{/ tags}}
28 </div> 33 </div>
29 <div class="good-detail-img"> 34 <div class="good-detail-img">
@@ -200,7 +200,7 @@ function getQueryString(name) { @@ -200,7 +200,7 @@ function getQueryString(name) {
200 let r = window.location.search.substr(1).match(reg); 200 let r = window.location.search.substr(1).match(reg);
201 201
202 if (r !== null) { 202 if (r !== null) {
203 - return window.unescape(r[2]); 203 + return decodeURIComponent(r[2]);
204 } 204 }
205 return null; 205 return null;
206 } 206 }
@@ -577,7 +577,6 @@ if ($brandHeader.data('isbaseshop') === true) { @@ -577,7 +577,6 @@ if ($brandHeader.data('isbaseshop') === true) {
577 Object.assign(defaultOpt, {shop_id: $brandHeader.data('id')}); 577 Object.assign(defaultOpt, {shop_id: $brandHeader.data('id')});
578 } 578 }
579 579
580 -  
581 $.ajax({ 580 $.ajax({
582 type: 'GET', 581 type: 'GET',
583 url: location.protocol + '//m.yohobuy.com/product/search/filter', 582 url: location.protocol + '//m.yohobuy.com/product/search/filter',
@@ -834,4 +833,14 @@ $('#goods-container').on('click', '.good-info', function() { @@ -834,4 +833,14 @@ $('#goods-container').on('click', '.good-info', function() {
834 // return false; 833 // return false;
835 }); 834 });
836 835
  836 +$('.more-shop').on('click', function() {
  837 + if ($(this).hasClass('down')) {
  838 + $('.brand-enter').css('max-height', '100%');
  839 + $('.more-shop').removeClass('down').find('span').html('&#xe615;');
  840 + } else {
  841 + $('.brand-enter').removeAttr('style');
  842 + $('.more-shop').addClass('down').find('span').html('&#xe616;');
  843 + }
  844 +});
  845 +
837 require('channel/maybe-like')({recpose: 100101, isExecute: true}); 846 require('channel/maybe-like')({recpose: 100101, isExecute: true});
@@ -69,6 +69,21 @@ @@ -69,6 +69,21 @@
69 background-color: #000; 69 background-color: #000;
70 color: #fff; 70 color: #fff;
71 } 71 }
  72 +
  73 + .is-global {
  74 + padding: 3px 10px 0 8px;
  75 + color: #fff;
  76 + background-color: #462e3e;
  77 + line-height: 26px;
  78 +
  79 + span {
  80 + display: inline-block;
  81 + background-image: resolve("product/airplane.png");
  82 + background-repeat: no-repeat;
  83 + padding-left: 32px;
  84 + background-size: auto 95%;
  85 + }
  86 + }
72 } 87 }
73 } 88 }
74 89
@@ -65,12 +65,16 @@ @@ -65,12 +65,16 @@
65 padding-bottom: 20px; 65 padding-bottom: 20px;
66 background: #f4f4f4; 66 background: #f4f4f4;
67 67
68 - > a { 68 + .brand-enter {
  69 + max-height: 160px;
  70 + overflow: hidden;
  71 + }
  72 +
  73 + a {
69 display: block; 74 display: block;
70 height: 80px; 75 height: 80px;
71 line-height: 80px; 76 line-height: 80px;
72 padding: 0 20px; 77 padding: 0 20px;
73 - border-bottom: 1px solid #e6e6e6;  
74 border-top: 1px solid #e6e6e6; 78 border-top: 1px solid #e6e6e6;
75 font-size: 34px; 79 font-size: 34px;
76 background: #fff; 80 background: #fff;
@@ -78,6 +82,10 @@ @@ -78,6 +82,10 @@
78 overflow: hidden; 82 overflow: hidden;
79 } 83 }
80 84
  85 + /* a:last-child {
  86 + border-bottom: 1px solid #e6e6e6;
  87 + } */
  88 +
81 span { 89 span {
82 font-size: 28px; 90 font-size: 28px;
83 overflow: hidden; 91 overflow: hidden;
@@ -90,21 +98,38 @@ @@ -90,21 +98,38 @@
90 overflow: hidden; 98 overflow: hidden;
91 text-overflow: ellipsis; 99 text-overflow: ellipsis;
92 white-space: nowrap; 100 white-space: nowrap;
93 - position: absolute; 101 + display: inline-block;
  102 +
  103 + /* position: absolute; */
94 } 104 }
95 105
96 .brand-thumb { 106 .brand-thumb {
97 - display: block;  
98 float: left; 107 float: left;
99 width: 150px; 108 width: 150px;
100 height: 80px; 109 height: 80px;
101 margin: 0; 110 margin: 0;
  111 + display: inline-block;
102 } 112 }
103 113
104 .entry { 114 .entry {
105 color: #999; 115 color: #999;
106 font-size: 28px; 116 font-size: 28px;
107 float: right; 117 float: right;
  118 + display: inline-block;
  119 + }
  120 +
  121 + .more-shop {
  122 + width: 100%;
  123 + height: 40px;
  124 + background: #fff;
  125 + color: #999;
  126 + margin-top: 0;
  127 + text-align: center;
  128 +
  129 + span {
  130 + position: relative;
  131 + top: -6px;
  132 + }
108 } 133 }
109 } 134 }
110 135
@@ -103,9 +103,9 @@ exports.processProductList = (list, options) => { @@ -103,9 +103,9 @@ exports.processProductList = (list, options) => {
103 } 103 }
104 104
105 // H5 暂时不支持全球购商品,先过滤掉 2017.04.09 105 // H5 暂时不支持全球购商品,先过滤掉 2017.04.09
106 - if (product.is_global === 'Y') {  
107 - return;  
108 - } 106 + // if (product.is_global === 'Y') {
  107 + // return;
  108 + // }
109 109
110 // 商品信息有问题,则不显示 110 // 商品信息有问题,则不显示
111 if (!( 111 if (!(
@@ -114,7 +114,6 @@ exports.processProductList = (list, options) => { @@ -114,7 +114,6 @@ exports.processProductList = (list, options) => {
114 return; 114 return;
115 } 115 }
116 116
117 -  
118 if (product.recommend_type) { 117 if (product.recommend_type) {
119 // recommend_type 对应 附加属性 118 // recommend_type 对应 附加属性
120 let flagMap = { 119 let flagMap = {
@@ -170,7 +169,8 @@ exports.processProductList = (list, options) => { @@ -170,7 +169,8 @@ exports.processProductList = (list, options) => {
170 product.cn_alphabet = productNameProcess(product.cn_alphabet); 169 product.cn_alphabet = productNameProcess(product.cn_alphabet);
171 } 170 }
172 171
173 - product.url = helpers.urlFormat(`/product/${product.product_skn}.html`); // 商品url改版 // eslint-disable-line 172 + product.url = product.is_global === 'Y' ? helpers.urlFormat(`/product/global/${product.product_skn}.html`) :
  173 + helpers.urlFormat(`/product/${product.product_skn}.html`); // 商品url改版 // eslint-disable-line
174 174
175 // APP访问需要加附加的参数 175 // APP访问需要加附加的参数
176 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 176 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
@@ -191,6 +191,10 @@ exports.processProductList = (list, options) => { @@ -191,6 +191,10 @@ exports.processProductList = (list, options) => {
191 product.is_solded = true; 191 product.is_solded = true;
192 } 192 }
193 193
  194 + if (product.is_global === 'Y') {
  195 + tags.is_global = true;
  196 + }
  197 +
194 product.is_soon_sold_out = tags.is_soon_sold_out; 198 product.is_soon_sold_out = tags.is_soon_sold_out;
195 199
196 } 200 }