Showing
7 changed files
with
135 additions
and
114 deletions
1 | /* eslint no-unused-vars: ["error", { "args": "none" }]*/ | 1 | /* eslint no-unused-vars: ["error", { "args": "none" }]*/ |
2 | /* eslint-disable no-shadow, camelcase */ | 2 | /* eslint-disable no-shadow, camelcase */ |
3 | 'use strict'; | 3 | 'use strict'; |
4 | -const url = require('url'); | 4 | +const _ = require('lodash'); |
5 | +const camelCase = global.yoho.camelCase; | ||
5 | const helpers = global.yoho.helpers; | 6 | const helpers = global.yoho.helpers; |
6 | const vipDayModel = require('../models/vipDay'); | 7 | const vipDayModel = require('../models/vipDay'); |
7 | const auth = require('../../passport/models/auth-helper'); | 8 | const auth = require('../../passport/models/auth-helper'); |
8 | const co = require('bluebird').coroutine; | 9 | const co = require('bluebird').coroutine; |
10 | +const util = require(global.utils + '/product-process'); | ||
9 | 11 | ||
10 | 12 | ||
11 | 13 | ||
@@ -38,49 +40,28 @@ exports.index = (req, res, next) => { | @@ -38,49 +40,28 @@ exports.index = (req, res, next) => { | ||
38 | res.locals.page = 'vipday_entry'; | 40 | res.locals.page = 'vipday_entry'; |
39 | res.locals.width750 = true; | 41 | res.locals.width750 = true; |
40 | 42 | ||
43 | + let cate = { | ||
44 | + goods1: [51203592, 51228151, 51315660], | ||
45 | + goods2: [51338322, 51299644, 51344316], | ||
46 | + goods3: [51374524, 51333192, 51311138] | ||
47 | + }; | ||
41 | 48 | ||
42 | - res.render('vip_day/index', { | ||
43 | - pageStyle: 'vip-day entry', | ||
44 | - goods1: [{ | ||
45 | - skn: 51281322, | ||
46 | - link: 'http://item.yohobuy.com/product/pro_479436_600840/MADNESSNAPOXFORDSHIRTOSD006_NV.html?from=search-s-51281322_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51281322"}}', | ||
47 | - label: '余文乐同款MADNESS NAPOXFORD' | ||
48 | - }, { | ||
49 | - skn: 51228151, | ||
50 | - link: 'http://item.yohobuy.com/product/pro_416307_697688/SMGOBLIQUEZIPPERJACKETJ1609Hei.html?from=search-s-51228151_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51228151"}}', | ||
51 | - label: '林俊杰同款SMG Oblique Zipper Jacket 斜拉链丹宁夹克' | ||
52 | - }, { | ||
53 | - skn: 51315660, | ||
54 | - link: 'http://item.yohobuy.com/product/pro_513734_640162/AKOPChangXiuTXuAKOPA603LT03.html?from=search-s-51315660_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51315660"}}', | ||
55 | - label: '韩火火同款AKOP. 插肩长袖T恤', | ||
56 | - }], | ||
57 | - goods2: [{ | ||
58 | - skn: 51338322, | ||
59 | - link: 'http://item.yohobuy.com/product/pro_536266_665692/IZZUEIZXJKJ7501F67WOMENJACKETS.html?from=sale-s-7_1_12&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51338322"}}', | ||
60 | - label: 'izzue 磨毛短款牛仔夹克' | ||
61 | - }, { | ||
62 | - skn: 51299644, | ||
63 | - link: 'http://item.yohobuy.com/product/pro_497636_622252/ONITSUKATIGERMEXICO66XiuXianYunDongXieDL4081659.html?from=sale-s-7_1_29&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51299644"}}', | ||
64 | - label: 'Onitsuka Tiger MEXICO 66 女 休闲运动鞋' | ||
65 | - }, { | ||
66 | - skn: 51344316, | ||
67 | - link: 'http://item.yohobuy.com/product/pro_530006_658340/LEVIQuanS519LINE8WuDaiKuanNiuZaiKu187200012HeiSe.html?from=sale-s-7_1_8&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51344316"}}', | ||
68 | - label: 'Levi’s Line8系列 519 女士窄脚修身牛仔裤' | ||
69 | - }], | ||
70 | - goods3: [{ | ||
71 | - skn: 51374524, | ||
72 | - link: 'http://item.yohobuy.com/product/pro_570070_704384/STAYREALShuGeZiLianMaoChenShanUS16010K1.html?from=sale-s-7_1_3&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51374524"}}', | ||
73 | - label: 'STAYREAL 数格子连帽衬衫', | ||
74 | - }, { | ||
75 | - skn: 51333192, | ||
76 | - link: 'http://item.yohobuy.com/product/pro_531262_660006/PHANTACIChenShanPH16PS28G.html?from=search-s-51333192_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51333192"}}', | ||
77 | - label: 'PHANTACi FANTASY LONG SHIRT-Green' | ||
78 | - }, { | ||
79 | - skn: 51311138, | ||
80 | - link: 'http://item.yohobuy.com/product/pro_509230_635258/OVKLABBangQiuMaoOVKA6FWBP88BKX.html?from=sale-s-7_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51311138"}}', | ||
81 | - label: 'OVKLAB 图案字母刺绣棒球帽' | ||
82 | - }] | ||
83 | - }); | 49 | + vipDayModel.getGoods(cate) |
50 | + .then(result => { | ||
51 | + // console.log(result.data) | ||
52 | + if (result.code !== 200) { | ||
53 | + return Promise.reject('error'); | ||
54 | + } | ||
55 | + | ||
56 | + res.render('vip_day/index', { | ||
57 | + title: '会员日活动', | ||
58 | + pageStyle: 'vip-day entry', | ||
59 | + goods1: result.data.goods1, | ||
60 | + goods2: result.data.goods2, | ||
61 | + goods3: result.data.goods3 | ||
62 | + }); | ||
63 | + return; | ||
64 | + }).catch(next); | ||
84 | }; | 65 | }; |
85 | 66 | ||
86 | exports.crazyWheel = (req, res, next) => { | 67 | exports.crazyWheel = (req, res, next) => { |
@@ -94,6 +75,7 @@ exports.crazyWheel = (req, res, next) => { | @@ -94,6 +75,7 @@ exports.crazyWheel = (req, res, next) => { | ||
94 | 75 | ||
95 | vipDayModel.getJoinNum(1).then(result => { | 76 | vipDayModel.getJoinNum(1).then(result => { |
96 | res.render('vip_day/crazy_wheel', { | 77 | res.render('vip_day/crazy_wheel', { |
78 | + title: '会员日-疯狂大转盘', | ||
97 | pageStyle: 'vip-day game', | 79 | pageStyle: 'vip-day game', |
98 | isWheel: true, | 80 | isWheel: true, |
99 | joinNum: result && result.data || 0, | 81 | joinNum: result && result.data || 0, |
@@ -113,6 +95,7 @@ exports.crazyLuck = (req, res, next) => { | @@ -113,6 +95,7 @@ exports.crazyLuck = (req, res, next) => { | ||
113 | let joinNum = yield vipDayModel.getJoinNum(2); | 95 | let joinNum = yield vipDayModel.getJoinNum(2); |
114 | 96 | ||
115 | res.render('vip_day/crazy_luck', { | 97 | res.render('vip_day/crazy_luck', { |
98 | + title: '拼手气', | ||
116 | pageStyle: 'vip-day game', | 99 | pageStyle: 'vip-day game', |
117 | isLuck: true, | 100 | isLuck: true, |
118 | coin: coins && coins.data && (coins.data.total > 9999 ? (coins.data.total / 10000).toFixed(2) + '万' : coins.data.total), | 101 | coin: coins && coins.data && (coins.data.total > 9999 ? (coins.data.total / 10000).toFixed(2) + '万' : coins.data.total), |
@@ -202,7 +185,7 @@ exports.luckResult = (req, res, next) => { | @@ -202,7 +185,7 @@ exports.luckResult = (req, res, next) => { | ||
202 | 185 | ||
203 | let coin = r1.data.total; | 186 | let coin = r1.data.total; |
204 | 187 | ||
205 | - console.log(coin); | 188 | + // console.log(coin); |
206 | if (coin < 20) { | 189 | if (coin < 20) { |
207 | return { code: 400, message: '有货币不够...' }; | 190 | return { code: 400, message: '有货币不够...' }; |
208 | } | 191 | } |
1 | /* eslint-disable camelcase */ | 1 | /* eslint-disable camelcase */ |
2 | 'use strict'; | 2 | 'use strict'; |
3 | +const _ = require('lodash'); | ||
3 | const API = global.yoho.API; | 4 | const API = global.yoho.API; |
4 | const serviceAPI = global.yoho.ServiceAPI; | 5 | const serviceAPI = global.yoho.ServiceAPI; |
6 | +const utils = require(global.utils + '/product-process'); | ||
7 | +const helpers = global.yoho.helpers; | ||
5 | 8 | ||
6 | // 签到 | 9 | // 签到 |
7 | // doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E4%BC%9A%E5%91%98%E6%97%A5%E7%AD%BE%E5%88%B0.md | 10 | // doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E4%BC%9A%E5%91%98%E6%97%A5%E7%AD%BE%E5%88%B0.md |
@@ -61,12 +64,69 @@ exports.getCoins = uid => { | @@ -61,12 +64,69 @@ exports.getCoins = uid => { | ||
61 | }); | 64 | }); |
62 | }; | 65 | }; |
63 | 66 | ||
64 | -//获取抽奖人数 | ||
65 | -//doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E6%9F%A5%E8%AF%A2%E5%8F%82%E4%B8%8E%E6%8A%BD%E5%A5%96%E4%BA%BA%E6%95%B0.md | 67 | +// 获取抽奖人数 |
68 | +// doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E6%9F%A5%E8%AF%A2%E5%8F%82%E4%B8%8E%E6%8A%BD%E5%A5%96%E4%BA%BA%E6%95%B0.md | ||
66 | exports.getJoinNum = prize_type => { | 69 | exports.getJoinNum = prize_type => { |
67 | const url = '/activity/UserdayPrizeLogController/queryPrizeLogNum'; | 70 | const url = '/activity/UserdayPrizeLogController/queryPrizeLogNum'; |
68 | 71 | ||
69 | return serviceAPI.get(url, { | 72 | return serviceAPI.get(url, { |
70 | prize_type, | 73 | prize_type, |
71 | }); | 74 | }); |
72 | -} | ||
75 | +}; | ||
76 | + | ||
77 | +/** | ||
78 | + * cate [object Object] | ||
79 | + */ | ||
80 | +exports.getGoods = cate => { | ||
81 | + let skns = ''; | ||
82 | + let cates = Object.keys(cate); | ||
83 | + | ||
84 | + _.forEach(cate, function(val, key) { | ||
85 | + skns = skns.concat(',').concat(val.join(',')); | ||
86 | + }); | ||
87 | + | ||
88 | + skns = skns.slice(1); | ||
89 | + | ||
90 | + return API.get('', { | ||
91 | + method: 'h5.product.batch', | ||
92 | + productSkn: skns | ||
93 | + }).then(result => { | ||
94 | + if (result.code !== 200) { | ||
95 | + return { | ||
96 | + code: result.code, | ||
97 | + message: result.message | ||
98 | + }; | ||
99 | + } | ||
100 | + let productList = utils.processProductList(result.data.product_list); | ||
101 | + let data = {}; | ||
102 | + | ||
103 | + productList.forEach(product=> { | ||
104 | + let skn = product.productSkn; | ||
105 | + | ||
106 | + product.url = helpers.appUrlFormat(product.url, 'go.productDetail', { | ||
107 | + product_skn: skn | ||
108 | + }); | ||
109 | + | ||
110 | + for (let c of cates) { | ||
111 | + let index = cate[c].indexOf(skn); | ||
112 | + | ||
113 | + if (index !== -1) { | ||
114 | + cate[c].splice(index, 1); | ||
115 | + | ||
116 | + data[c] || (data[c] = []); | ||
117 | + data[c].push(product); | ||
118 | + break; | ||
119 | + } | ||
120 | + } | ||
121 | + }); | ||
122 | + | ||
123 | + // console.log(data.goods1.length) | ||
124 | + // console.log(data.goods2.length) | ||
125 | + // console.log(data.goods3.length) | ||
126 | + | ||
127 | + return { | ||
128 | + code: 200, | ||
129 | + data | ||
130 | + }; | ||
131 | + }); | ||
132 | +}; |
@@ -43,6 +43,7 @@ | @@ -43,6 +43,7 @@ | ||
43 | <i class="title-pic"></i> | 43 | <i class="title-pic"></i> |
44 | </header> | 44 | </header> |
45 | <div class="content text-center" data-toggle="ymodal" data-target="#vip-privilege"> | 45 | <div class="content text-center" data-toggle="ymodal" data-target="#vip-privilege"> |
46 | + <i class="vip-rocket-point"></i> | ||
46 | </div> | 47 | </div> |
47 | </section> | 48 | </section> |
48 | 49 | ||
@@ -57,75 +58,21 @@ | @@ -57,75 +58,21 @@ | ||
57 | <h5 class="vip-goods-sec-label">潮牌尖货</h5> | 58 | <h5 class="vip-goods-sec-label">潮牌尖货</h5> |
58 | <ul class="vip-goods-list clearfix"> | 59 | <ul class="vip-goods-list clearfix"> |
59 | {{#each goods1}} | 60 | {{#each goods1}} |
60 | - <li class="vip-good"> | ||
61 | - <img class="vip-good-show" src="" alt=""> | ||
62 | - <div class="vip-good-price"> | ||
63 | - {{!-- | ||
64 | - <div class="text-right"> | ||
65 | - <sup>¥</sup><span>539</span> | ||
66 | - </div> | ||
67 | - <div class="text-left"> | ||
68 | - <span class="disable-price">¥539</span> | ||
69 | - </div> | ||
70 | - --}} | ||
71 | - <sup>¥</sup><span>539</span><span class="disable-price">¥539</span> | ||
72 | - </div> | ||
73 | - <div class="vip-good-bottom"> | ||
74 | - <h6 class="vip-good-name">The Hundreds</h6> | ||
75 | - <button class="vip-good-fav" type="button">马上购买</button> | ||
76 | - </div> | ||
77 | - <a class="vip-good-link" href="{{link}}"></a> | ||
78 | - </li> | 61 | + {{> vip_day/vip-good}} |
79 | {{/each}} | 62 | {{/each}} |
80 | </ul> | 63 | </ul> |
81 | <!-- good class 2--> | 64 | <!-- good class 2--> |
82 | <h5 class="vip-goods-sec-label">新品示出</h5> | 65 | <h5 class="vip-goods-sec-label">新品示出</h5> |
83 | <ul class="vip-goods-list clearfix"> | 66 | <ul class="vip-goods-list clearfix"> |
84 | {{#each goods2}} | 67 | {{#each goods2}} |
85 | - <li class="vip-good"> | ||
86 | - <img class="vip-good-show" src="" alt=""> | ||
87 | - <div class="vip-good-price"> | ||
88 | - {{!-- | ||
89 | - <div class="text-right"> | ||
90 | - <sup>¥</sup><span>539</span> | ||
91 | - </div> | ||
92 | - <div class="text-left"> | ||
93 | - <span class="disable-price">¥539</span> | ||
94 | - </div> | ||
95 | - --}} | ||
96 | - <sup>¥</sup><span>539</span><span class="disable-price">¥539</span> | ||
97 | - </div> | ||
98 | - <div class="vip-good-bottom"> | ||
99 | - <h6 class="vip-good-name">The Hundreds</h6> | ||
100 | - <button class="vip-good-fav" type="button">马上购买</button> | ||
101 | - </div> | ||
102 | - <a class="vip-good-link" href="{{link}}"></a> | ||
103 | - </li> | 68 | + {{> vip_day/vip-good}} |
104 | {{/each}} | 69 | {{/each}} |
105 | </ul> | 70 | </ul> |
106 | <!-- good class 3--> | 71 | <!-- good class 3--> |
107 | <h5 class="vip-goods-sec-label">VIP独享</h5> | 72 | <h5 class="vip-goods-sec-label">VIP独享</h5> |
108 | <ul class="vip-goods-list clearfix"> | 73 | <ul class="vip-goods-list clearfix"> |
109 | {{#each goods3}} | 74 | {{#each goods3}} |
110 | - <li class="vip-good"> | ||
111 | - <img class="vip-good-show" src="" alt=""> | ||
112 | - <div class="vip-good-price"> | ||
113 | - {{!-- | ||
114 | - <div class="text-right"> | ||
115 | - <sup>¥</sup><span>539</span> | ||
116 | - </div> | ||
117 | - <div class="text-left"> | ||
118 | - <span class="disable-price">¥539</span> | ||
119 | - </div> | ||
120 | - --}} | ||
121 | - <sup>¥</sup><span>539</span><span class="disable-price">¥539</span> | ||
122 | - </div> | ||
123 | - <div class="vip-good-bottom"> | ||
124 | - <h6 class="vip-good-name">The Hundreds</h6> | ||
125 | - <button class="vip-good-fav" type="button">马上购买</button> | ||
126 | - </div> | ||
127 | - <a class="vip-good-link" href="{{link}}"></a> | ||
128 | - </li> | 75 | + {{> vip_day/vip-good}} |
129 | {{/each}} | 76 | {{/each}} |
130 | </ul> | 77 | </ul> |
131 | <div class="text-center"> | 78 | <div class="text-center"> |
1 | +<li class="vip-good"> | ||
2 | + <img class="vip-good-show" src="{{image defaultImages 220 115}}" alt=""> | ||
3 | + <div class="vip-good-price"> | ||
4 | + {{!-- | ||
5 | + <div class="text-right"> | ||
6 | + <sup>¥</sup><span>539</span> | ||
7 | + </div> | ||
8 | + <div class="text-left"> | ||
9 | + <span class="disable-price">¥539</span> | ||
10 | + </div> | ||
11 | + --}} | ||
12 | + {{#if marketPrice}} | ||
13 | + <sup>¥</sup><span>{{salesPrice}}</span><span class="disable-price">¥{{marketPrice}}</span> | ||
14 | + {{else}} | ||
15 | + <sup>¥</sup><span>{{salesPrice}}</span> | ||
16 | + {{/if}} | ||
17 | + </div> | ||
18 | + <div class="vip-good-bottom"> | ||
19 | + <h6 class="vip-good-name line-clamp-2">{{productName}}</h6> | ||
20 | + <button class="vip-good-fav" type="button">马上购买</button> | ||
21 | + </div> | ||
22 | + <a class="vip-good-link" href="{{url}}"></a> | ||
23 | +</li> |
public/img/activity/vip_day/point.png
0 → 100644

5.92 KB
@@ -163,16 +163,14 @@ | @@ -163,16 +163,14 @@ | ||
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | - .vip-rocket-privilege { | ||
167 | - margin-bottom: 20px; | ||
168 | - background-color: #000; | ||
169 | - color: #fff; | ||
170 | - } | ||
171 | - | ||
172 | - .vip-rocket-buynow { | ||
173 | - margin-bottom: 40px; | ||
174 | - border: 2PX solid #000; | ||
175 | - background-color: #fff; | 166 | + .vip-rocket-point { |
167 | + position: absolute; | ||
168 | + left: 50%; | ||
169 | + bottom: -50px; | ||
170 | + margin-left: -38px; | ||
171 | + width: 76px; | ||
172 | + height: 107px; | ||
173 | + background: no-repeat center center url('/activity/vip_day/point.png'); | ||
176 | } | 174 | } |
177 | 175 | ||
178 | /* 福利 会员日专享商品 */ | 176 | /* 福利 会员日专享商品 */ |
@@ -295,6 +293,7 @@ | @@ -295,6 +293,7 @@ | ||
295 | .vip-good-name { | 293 | .vip-good-name { |
296 | font-size: 20px; | 294 | font-size: 20px; |
297 | color: #fff; | 295 | color: #fff; |
296 | + height: 53px; | ||
298 | } | 297 | } |
299 | 298 | ||
300 | .vip-good-fav { | 299 | .vip-good-fav { |
@@ -363,6 +362,7 @@ | @@ -363,6 +362,7 @@ | ||
363 | 362 | ||
364 | strong { | 363 | strong { |
365 | font-size: 27px; | 364 | font-size: 27px; |
365 | + color: #e95d3f; | ||
366 | } | 366 | } |
367 | } | 367 | } |
368 | } | 368 | } |
@@ -36,6 +36,14 @@ | @@ -36,6 +36,14 @@ | ||
36 | text-overflow: ellipsis; | 36 | text-overflow: ellipsis; |
37 | } | 37 | } |
38 | 38 | ||
39 | +.line-clamp-2 { | ||
40 | + display: -webkit-box; | ||
41 | + -webkit-line-clamp: 2; | ||
42 | + overflow: hidden; | ||
43 | + text-overflow: ellipsis; | ||
44 | + -webkit-box-orient: vertical | ||
45 | +} | ||
46 | + | ||
39 | .vh-center { | 47 | .vh-center { |
40 | text-align: center; | 48 | text-align: center; |
41 | 49 |
-
Please register or login to post a comment