Authored by 王水玲

sale

@@ -70,12 +70,30 @@ exports.specialDetail = (req, res) => { @@ -70,12 +70,30 @@ exports.specialDetail = (req, res) => {
70 let headerData = headerModel.setNavHeader('折扣专场'); 70 let headerData = headerModel.setNavHeader('折扣专场');
71 let renderData = { 71 let renderData = {
72 module: 'product', 72 module: 'product',
73 - page: 'sale', 73 + page: 'special',
74 pageHeader: headerData, 74 pageHeader: headerData,
75 pageFooter: true 75 pageFooter: true
76 }; 76 };
77 77
78 saleModel.getSpecialDetailData().then((result) => { 78 saleModel.getSpecialDetailData().then((result) => {
  79 + result = {
  80 + src: 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/0239e814b8121913aa67b9ad509bd4e310.jpg?imageView2/2/w/{width}/h/{height}',
  81 + goods: {
  82 + url: 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',
  83 + thumb: 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',
  84 + name: 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',
  85 + salePrice: '759.00',
  86 + price: '799.00',
  87 + tags: {
  88 + isNew: true,
  89 + isAdvance: false,
  90 + isDiscount: false,
  91 + isYohoood: false,
  92 + isLimited: false
  93 + },
  94 + isSoonSoldOut: true
  95 + }
  96 + };
79 res.render('special-detail', Object.assign(renderData, result)); 97 res.render('special-detail', Object.assign(renderData, result));
80 }).catch((err) => { 98 }).catch((err) => {
81 saleLogger(err, res); 99 saleLogger(err, res);
@@ -118,3 +136,40 @@ exports.breakCode = (req, res) => { @@ -118,3 +136,40 @@ exports.breakCode = (req, res) => {
118 saleLogger(err, res); 136 saleLogger(err, res);
119 }); 137 });
120 }; 138 };
  139 +
  140 +/**
  141 + * vip
  142 + */
  143 +exports.vip = (req, res) => {
  144 + let headerData = headerModel.setNavHeader('会员专享');
  145 + let renderData = {
  146 + module: 'product',
  147 + page: 'break-code',
  148 + pageHeader: headerData,
  149 + pageFooter: true
  150 + };
  151 +
  152 + saleModel.getVipData().then((result) => {
  153 + result = {
  154 + src: 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/0239e814b8121913aa67b9ad509bd4e310.jpg?imageView2/2/w/{width}/h/{height}',
  155 + goods: {
  156 + url: 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',
  157 + thumb: 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',
  158 + name: 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',
  159 + salePrice: '759.00',
  160 + price: '799.00',
  161 + tags: {
  162 + isNew: true,
  163 + isAdvance: false,
  164 + isDiscount: false,
  165 + isYohoood: false,
  166 + isLimited: false
  167 + },
  168 + isSoonSoldOut: true
  169 + }
  170 + };
  171 + res.render('vip', Object.assign(renderData, result));
  172 + }).catch((err) => {
  173 + saleLogger(err, res);
  174 + });
  175 +}
@@ -132,3 +132,23 @@ exports.getBreakCodeData = (params) => { @@ -132,3 +132,23 @@ exports.getBreakCodeData = (params) => {
132 } 132 }
133 }); 133 });
134 }; 134 };
  135 +
  136 +
  137 +/**
  138 + * 获取会员享数据
  139 + * @param {[object]} params
  140 + * @return {[object]}
  141 + */
  142 +exports.getVipData = (params) => {
  143 + return api.get('', sign.apiSign(Object.assign({
  144 + method: 'app.activity.get',
  145 + sort: 2,
  146 + plateform: 2
  147 + }, params))).then((result) => {
  148 + if (result && result.code === 200) {
  149 + return camelCase(result.data);
  150 + } else {
  151 + return Promise.reject('error');
  152 + }
  153 + });
  154 +}
@@ -25,5 +25,7 @@ router.get('/sale', sale.index); @@ -25,5 +25,7 @@ router.get('/sale', sale.index);
25 router.get('/special', sale.special); 25 router.get('/special', sale.special);
26 router.get('/specialDetail', sale.specialDetail); 26 router.get('/specialDetail', sale.specialDetail);
27 router.get('/breakCode', sale.breakCode); 27 router.get('/breakCode', sale.breakCode);
  28 +router.get('/vip', sale.vip);
  29 +// router.get('/outlet', sale.outlet);
28 30
29 module.exports = router; 31 module.exports = router;
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 <div id="goods-container" class="goods-container"> 51 <div id="goods-container" class="goods-container">
52 <div class="new-goods container clearfix"> 52 <div class="new-goods container clearfix">
53 {{# goods}} 53 {{# goods}}
54 - {{> common/good}} 54 + {{> common/goods}}
55 {{/ goods}} 55 {{/ goods}}
56 </div> 56 </div>
57 <div class="price-goods container hide clearfix"></div> 57 <div class="price-goods container hide clearfix"></div>
1 -<div class="sale-channel-page yoho-page">  
2 - <div class="banner">  
3 - <img src="{{image src 640 250}}"/>  
4 - <span class="activity-time"><i class="iconfont time-ico">&#xe603;</i>{{time}}</span>  
5 - </div> 1 +<div class="sale-channel-page discount-page yoho-page">
  2 + {{> product/sale-common}}
6 </div> 3 </div>
  1 +<div class="sale-vip-page discount-page yoho-page">
  2 + {{> product/sale-common}}
  3 +</div>
  1 +<div class="banner">
  2 + <img src="{{image src 640 200}}"/>
  3 + <p class="activity-time" data-time-ms = '{{msTime}}'><i class="iconfont time-ico">&#xe603;</i><span>剩1天2小时38分4秒</span></p>
  4 +</div>
  5 +<ul id="list-nav" class="list-nav clearfix">
  6 + <li class="new active">
  7 + <a href="javascript:void(0);">
  8 + <span class="span-test">最新</span>
  9 + <span class="iconfont cur">&#xe616;</span>
  10 + </a>
  11 + </li>
  12 + <li class="price">
  13 + <a href="javascript:void(0);">
  14 + <span class="span-test">价格</span>
  15 + <span class="icon">
  16 + <i class="iconfont up cur">&#xe615;</i>
  17 + <i class="iconfont down">&#xe616;</i>
  18 + </span>
  19 + </a>
  20 + </li>
  21 + <li class="discount">
  22 + <a href="javascript:void(0);">
  23 + <span class="span-test">折扣</span>
  24 + <span class="icon">
  25 + <i class="iconfont up cur">&#xe615;</i>
  26 + <i class="iconfont down">&#xe616;</i>
  27 + </span>
  28 + </a>
  29 + </li>
  30 + <li class="filter">
  31 + <a href="javascript:void(0);">
  32 + <span class="span-test">筛选</span>
  33 + <span class="iconfont cur">&#xe613;</span>
  34 + </a>
  35 + </li>
  36 +</ul>
  37 +
  38 +<div id="goods-container" class="goods-container">
  39 + <div class="new-goods container clearfix">
  40 + {{# goods}}
  41 + {{> common/goods}}
  42 + {{/ goods}}
  43 + </div>
  44 + <div class="price-goods container hide clearfix"></div>
  45 + <div class="discount-goods container hide clearfix"></div>
  46 +
  47 + {{> common/filter}}
  48 +</div>
  49 +
  50 +{{> common/query-param}}
  51 +
  52 +{{> common/suspend-cart}}
@@ -32,11 +32,19 @@ @@ -32,11 +32,19 @@
32 <a href="{{url}}">{{name}}</a> 32 <a href="{{url}}">{{name}}</a>
33 </div> 33 </div>
34 <div class="price"> 34 <div class="price">
  35 + {{#if saleViplogin}}
  36 + <i class="vip-grade-{{vipGrade}}"></i>
  37 + {{/if}}
35 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> 38 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
36 {{#price}} 39 {{#price}}
37 <span class="market-price">¥{{.}}</span> 40 <span class="market-price">¥{{.}}</span>
38 {{/price}} 41 {{/price}}
39 </div> 42 </div>
  43 + {{#if saleVip}}
  44 + <div class="vip-info">
  45 + <i class="vip-icon"></i>更优惠
  46 + </div>
  47 + {{/if}}
40 </div> 48 </div>
41 </div> 49 </div>
42 {{/if}} 50 {{/if}}
@@ -3,8 +3,40 @@ @@ -3,8 +3,40 @@
3 * @author: wsl<shuiling.wang@yoho.cn> 3 * @author: wsl<shuiling.wang@yoho.cn>
4 * @date: 2016/5/20 4 * @date: 2016/5/20
5 */ 5 */
6 -  
7 var $ = require('yoho-jquery'), 6 var $ = require('yoho-jquery'),
8 lazyLoad = require('yoho-jquery-lazyload'); 7 lazyLoad = require('yoho-jquery-lazyload');
9 8
  9 +var $activityTime = $('.activity-time');
  10 +
10 lazyLoad($('img.lazy')); 11 lazyLoad($('img.lazy'));
  12 +
  13 +function getRTime(){
  14 + // var EndTime = $activityTime.data('time-ms'),
  15 + var EndTime = 1463743993785,
  16 + NowTime = new Date(),
  17 + t = EndTime - NowTime.getTime(),
  18 + anHour = 3600000,
  19 + anMinute = 60000,
  20 + anSecond = 1000,
  21 + showTime = '',
  22 + d = 0,
  23 + h = 0,
  24 + m = 0,
  25 + s = 0;
  26 +
  27 + if (t >= 0) {
  28 + d = Math.floor(t / anHour / 24);
  29 + h = Math.floor(t / anHour % 24);
  30 + m = Math.floor(t / anMinute % 60);
  31 + s = Math.floor(t / anSecond % 60);
  32 + }
  33 +
  34 + showTime += d > 0 ? d + '剩天' : '';
  35 + showTime += h > 0 ? h + '小时' : '';
  36 + showTime += m > 0 ? m + '分钟' : '';
  37 + showTime += s > 0 ? s + '秒' : '';
  38 +
  39 + $activityTime.find('span').html(showTime);
  40 +}
  41 +
  42 +setInterval(getRTime,0);
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 @import "product/recommend-for-you"; 12 @import "product/recommend-for-you";
13 @import "product/sale"; 13 @import "product/sale";
14 @import "product/special"; 14 @import "product/special";
  15 +@import "product/special-detail";
15 @import "product/break-code"; 16 @import "product/break-code";
16 @import "product/discount"; 17 @import "product/discount";
17 @import "product/good"; 18 @import "product/good";
@@ -128,4 +128,44 @@ @@ -128,4 +128,44 @@
128 text-decoration: line-through; 128 text-decoration: line-through;
129 } 129 }
130 } 130 }
  131 +
  132 + .vip-grade {
  133 + width: 52px;
  134 + height: 32px;
  135 + display: inline-block;
  136 + margin-right: 8px;
  137 + vertical-align: text-bottom;
  138 + }
  139 +
  140 + .vip-grade-golden {
  141 + background: resolve('product/golden.png') no-repeat;
  142 + background-size: contain;
  143 + }
  144 +
  145 + .vip-grade-platinum {
  146 + background: resolve('product/platinum.png') no-repeat;
  147 + background-size: contain;
  148 + }
  149 +
  150 + .vip-grade-silver {
  151 + background: resolve('product/silver.png') no-repeat;
  152 + background-size: contain;
  153 + }
  154 +
  155 + .vip-info {
  156 + margin-top: 19px;
  157 + line-height: 32px;
  158 + font-size: 18px;
  159 + color: #444;
  160 +
  161 + .vip-icon {
  162 + width: 88px;
  163 + height: 32px;
  164 + background: resolve('product/vip-icon.png') no-repeat;
  165 + background-size: contain;
  166 + display: inline-block;
  167 + vertical-align: bottom;
  168 + margin-right: 8px;
  169 + }
  170 + }
131 } 171 }
  1 +.sale-channel-page {
  2 + .banner {
  3 + position: relative;
  4 + height: auto;
  5 + overflow: hidden;
  6 +
  7 + .activity-time {
  8 + width: 100%;
  9 + height: 50px;
  10 + position: absolute;
  11 + bottom: 0;
  12 + left: 0;
  13 + z-index: 2;
  14 + background: rgba(0, 0 ,0 , .5);
  15 + text-align: right;
  16 + color: #fff;
  17 + font-size: 22px;
  18 + line-height: 50px;
  19 + padding-right: 28px;
  20 + box-sizing: border-box;
  21 +
  22 + .time-ico {
  23 + margin-right: 15px;
  24 + font-size: 26px;
  25 + vertical-align: text-bottom;
  26 + }
  27 +
  28 + span {
  29 + vertical-align: super;
  30 + }
  31 + }
  32 + }
  33 +}