Authored by zzzzzzz

部分接口

@@ -150,6 +150,18 @@ let bottomBanner = (req, res, next) => { @@ -150,6 +150,18 @@ let bottomBanner = (req, res, next) => {
150 }).catch(next); 150 }).catch(next);
151 }; 151 };
152 152
  153 +/**
  154 + * 店铺推荐收藏状态人数
  155 + */
  156 +let shopRecom = (req, res, next) => {
  157 + channelModel.shopRecom({
  158 + shopIds: req.body.shopIds || '',
  159 + uid: req.user.uid || 0,
  160 + }).then(result => {
  161 + res.send(result);
  162 + }).catch(next);
  163 +}
  164 +
153 module.exports = { 165 module.exports = {
154 switchChannel, 166 switchChannel,
155 index, 167 index,
@@ -157,5 +169,6 @@ module.exports = { @@ -157,5 +169,6 @@ module.exports = {
157 girls, 169 girls,
158 kids, 170 kids,
159 lifestyle, 171 lifestyle,
160 - bottomBanner 172 + bottomBanner,
  173 + shopRecom,
161 }; 174 };
@@ -29,4 +29,6 @@ router.post('/brands/searchAsync', brandController.searchAsync); // 品牌搜索 @@ -29,4 +29,6 @@ router.post('/brands/searchAsync', brandController.searchAsync); // 品牌搜索
29 router.post('/brands/addBrandSearch', brandController.addBrandSearch); // 添加品牌搜索记录 29 router.post('/brands/addBrandSearch', brandController.addBrandSearch); // 添加品牌搜索记录
30 router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删除品牌搜索记录 30 router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删除品牌搜索记录
31 31
  32 +// 5.2新楼层功能
  33 +router.post('/shopRecom', channel.shopRecom); // 店铺推荐收藏状态
32 module.exports = router; 34 module.exports = router;
@@ -72,16 +72,22 @@ @@ -72,16 +72,22 @@
72 {{#if sixLinesFloor}} 72 {{#if sixLinesFloor}}
73 {{> resources/six-lines-floor}} 73 {{> resources/six-lines-floor}}
74 {{/if}} 74 {{/if}}
  75 + {{! vip专属}}
  76 + {{#if vipUse}}
  77 + {{> resources/vip-only}}
  78 + {{/if}}
  79 + {{! 店铺推荐}}
  80 + {{#if shopRecommend}}
  81 + {{> resources/shop-recommand}}
  82 + {{/if}}
75 {{/content}} 83 {{/content}}
76 {{! 新新人专享}} 84 {{! 新新人专享}}
77 {{> resources/new-user-floor}} 85 {{> resources/new-user-floor}}
78 {{! 人气单品}} 86 {{! 人气单品}}
79 {{> resources/hot-single}} 87 {{> resources/hot-single}}
80 -{{! vip专属}}  
81 - {{> resources/vip-only}} 88 +
82 {{! 新品首发楼层}} 89 {{! 新品首发楼层}}
83 {{> resources/new-first}} 90 {{> resources/new-first}}
84 -{{! 店铺推荐}}  
85 - {{> resources/shop-recommand}} 91 +
86 {{! SALE}} 92 {{! SALE}}
87 {{> resources/sale-floor}} 93 {{> resources/sale-floor}}
  1 +{{#data}}
1 <div class="shop-recom"> 2 <div class="shop-recom">
2 - {{! title不传不显示}} 3 + {{#if title}}
3 {{> common/floor-header-more}} 4 {{> common/floor-header-more}}
  5 + {{/if}}
4 <div class="shop-recom-container shop-recom-swiper-container"> 6 <div class="shop-recom-container shop-recom-swiper-container">
5 <ul class="swiper-wrapper"> 7 <ul class="swiper-wrapper">
6 - <li class="swiper-slide recom-shop">  
7 - <div class="fav-container">  
8 - <div class="shop-fav"></div><span>已收藏</span>  
9 - </div>  
10 - <span class="faved-num">1234人以收藏</span>  
11 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/21/13/0149f69bae453be2b9766205c360611a7b.jpg?imageView2/2/w/411/h/239/q/90" alt="banner" class="top">  
12 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/017deb63b74900161d516b506370066877.jpg?imageView2/2/w/206/h/168/q/90" alt="left" class="bottom">  
13 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/01907c964b9c98ba8b37606c4963508bc9.jpg?imageView2/2/w/206/h/168/q/90" alt="right" class="bottom">  
14 - </li>  
15 -  
16 - <li class="swiper-slide recom-shop">  
17 - <div class="fav-container"> 8 + {{#list}}
  9 + <li class="swiper-slide recom-shop" shopId={{shopId}}>
  10 + <div class="fav-container fav-no">
18 <div class="shop-notfav"></div><span>收藏</span> 11 <div class="shop-notfav"></div><span>收藏</span>
19 </div> 12 </div>
20 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/21/13/0149f69bae453be2b9766205c360611a7b.jpg?imageView2/2/w/411/h/239/q/90" alt="banner" class="top">  
21 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/017deb63b74900161d516b506370066877.jpg?imageView2/2/w/206/h/168/q/90" alt="left" class="bottom">  
22 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/01907c964b9c98ba8b37606c4963508bc9.jpg?imageView2/2/w/206/h/168/q/90" alt="right" class="bottom">  
23 - </li>  
24 -  
25 - <li class="swiper-slide recom-shop">  
26 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/21/13/0149f69bae453be2b9766205c360611a7b.jpg?imageView2/2/w/411/h/239/q/90" alt="banner" class="top">  
27 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/017deb63b74900161d516b506370066877.jpg?imageView2/2/w/206/h/168/q/90" alt="left" class="bottom">  
28 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/01907c964b9c98ba8b37606c4963508bc9.jpg?imageView2/2/w/206/h/168/q/90" alt="right" class="bottom">  
29 - </li>  
30 -  
31 - <li class="swiper-slide recom-shop">  
32 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/21/13/0149f69bae453be2b9766205c360611a7b.jpg?imageView2/2/w/411/h/239/q/90" alt="banner" class="top">  
33 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/017deb63b74900161d516b506370066877.jpg?imageView2/2/w/206/h/168/q/90" alt="left" class="bottom">  
34 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/01907c964b9c98ba8b37606c4963508bc9.jpg?imageView2/2/w/206/h/168/q/90" alt="right" class="bottom">  
35 - </li>  
36 -  
37 - <li class="swiper-slide recom-shop">  
38 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/21/13/0149f69bae453be2b9766205c360611a7b.jpg?imageView2/2/w/411/h/239/q/90" alt="banner" class="top">  
39 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/017deb63b74900161d516b506370066877.jpg?imageView2/2/w/206/h/168/q/90" alt="left" class="bottom">  
40 - <img src="//img10.static.yhbimg.com/yhb-img01/2016/10/27/10/01907c964b9c98ba8b37606c4963508bc9.jpg?imageView2/2/w/206/h/168/q/90" alt="right" class="bottom"> 13 + <div class="fav-container fav-yes" style="display:none">
  14 + <div class="shop-fav"></div><span>已收藏</span>
  15 + </div>
  16 + <span class="faved-num"></span>
  17 + <a href="{{url}}">
  18 + <img src="{{image src 640 208}}" alt="banner" class="top">
  19 + </a>
  20 + {{#goods0}}
  21 + <a href="{{url}}">
  22 + <img src="{{image src 320 146}}" alt="left" class="bottom">
  23 + </a>
  24 + {{/goods0}}
  25 + {{#goods1}}
  26 + <a href="{{url}}">
  27 + <img src="{{image src 320 146}}" alt="right" class="bottom">
  28 + </a>
  29 + {{/goods1}}
41 </li> 30 </li>
  31 + {{/list}}
42 </ul> 32 </ul>
43 </div> 33 </div>
44 -</div>  
  34 +</div>
  35 +{{/data}}
  1 +{{#data}}
1 <div class="vip-only"> 2 <div class="vip-only">
2 {{> common/floor-header-more}} 3 {{> common/floor-header-more}}
3 - <a>  
4 - <img src="" alt="vip-only-banner" class="vip-only-banner" /> 4 + {{#banner_image}}
  5 + <a href="{{url}}">
  6 + <img src="{{image src 640 200}}" alt="vip-only-banner" class="vip-only-banner" />
5 </a> 7 </a>
6 - <div class="vip-only-goods-list" style="background: #000013"> 8 + {{/banner_image}}
  9 + <div class="vip-only-goods-list" {{#background}} style="background: url({{src}})" {{/background}}>
7 <ul> 10 <ul>
  11 + {{#list}}
  12 + <a href="//m.yohobuy.com/product/show_{{product_skn}}">
8 <li class="vip-only-goods"> 13 <li class="vip-only-goods">
9 - <img src="" alt="goods" class="goods-pic"> 14 + <img src="{{image default_images 153 206}}" alt="goods" class="goods-pic">
10 <div class="goods-info"> 15 <div class="goods-info">
11 - <h3 class="vip-price">&yen; 3988.00</h3>  
12 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p>  
13 - </div>  
14 - </li>  
15 - <li class="vip-only-goods">  
16 - <img src="" alt="goods" class="goods-pic">  
17 - <div class="goods-info">  
18 - <h3 class="vip-price">&yen; 3988.00</h3>  
19 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p>  
20 - </div>  
21 - </li>  
22 -  
23 - <li class="vip-only-goods">  
24 - <img src="" alt="goods" class="goods-pic">  
25 - <div class="goods-info">  
26 - <h3 class="vip-price">&yen; 3988.00</h3>  
27 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p>  
28 - </div>  
29 - </li>  
30 - <li class="vip-only-goods">  
31 - <img src="" alt="goods" class="goods-pic">  
32 - <div class="goods-info">  
33 - <h3 class="vip-price">&yen; 3988.00</h3>  
34 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p>  
35 - </div>  
36 - </li>  
37 - <li class="vip-only-goods">  
38 - <img src="" alt="goods" class="goods-pic">  
39 - <div class="goods-info">  
40 - <h3 class="vip-price">&yen; 3988.00</h3>  
41 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p>  
42 - </div>  
43 - </li>  
44 - <li class="vip-only-goods">  
45 - <img src="" alt="goods" class="goods-pic">  
46 - <div class="goods-info">  
47 - <h3 class="vip-price">&yen; 3988.00</h3>  
48 - <p class="sale-price">&yen; 9999.00 <span class="vip-icon"></span></p> 16 + <h3 class="vip-price">&yen; {{vip1_price}}</h3>
  17 + <p class="sale-price">&yen; {{market_price}} <span class="vip-icon"></span></p>
49 </div> 18 </div>
50 </li> 19 </li>
  20 + </a>
  21 + {{/list}}
51 </ul> 22 </ul>
52 </div> 23 </div>
53 -</div>  
  24 +</div>
  25 +{{/data}}
@@ -235,4 +235,32 @@ var shopSwiper = new Swiper('.shop-recom-swiper-container', { @@ -235,4 +235,32 @@ var shopSwiper = new Swiper('.shop-recom-swiper-container', {
235 paginationClickable: true, 235 paginationClickable: true,
236 slideActiveClass : 'recom-active', 236 slideActiveClass : 'recom-active',
237 }); 237 });
  238 +
  239 +// 店铺推荐人数和收藏初始查询
  240 +var checkShop = function() {
  241 + var shopIds = [];
  242 + $('.recom-shop').each(function() {
  243 + shopIds.push($(this).attr('shopId'));
  244 + });
  245 + $.ajax({
  246 + type: 'POST',
  247 + url: '/shopRecom',
  248 + data: {
  249 + shopIds: shopIds.join(','),
  250 + },
  251 + }).then(function(result) {
  252 + if (result.code === 200) {
  253 + for (var i = 0, elem; (elem = result.data[i]) != null; i++) {
  254 + var a = $('.recom-shop[shopId = '+ elem.id + ']');
  255 + a.find('.faved-num').text(elem.collectionNum + "人已收藏");
  256 + if (elem.favorite) {
  257 + a.find('.fav-no').hide();
  258 + a.find('.fav-yes').show();
  259 + }
  260 + }
  261 + }
  262 + });
  263 +}
  264 +
  265 +checkShop();
238 require('./maybe-like')(); 266 require('./maybe-like')();
  1 +'use strict';
  2 +
1 const _ = require('lodash'); 3 const _ = require('lodash');
2 const processTime = require('./time-process'); 4 const processTime = require('./time-process');
3 5
@@ -73,6 +75,13 @@ module.exports = (list) => { @@ -73,6 +75,13 @@ module.exports = (list) => {
73 floor.data.length === 1 && 75 floor.data.length === 1 &&
74 (floor.singleOne = true); 76 (floor.singleOne = true);
75 77
  78 + // vip专享
  79 + if (floor.vipUse && floor.data && floor.data.background) {
  80 + let a = floor.data.background.src;
  81 + a = a.substr(0, a.indexOf('?'));
  82 + floor.data.background.src = a;
  83 + }
  84 +
76 formatData.push(floor); 85 formatData.push(floor);
77 }); 86 });
78 87