Showing
13 changed files
with
281 additions
and
85 deletions
@@ -9,21 +9,16 @@ | @@ -9,21 +9,16 @@ | ||
9 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 9 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
10 | 10 | ||
11 | const raffleModel = require('../models/raffle'); | 11 | const raffleModel = require('../models/raffle'); |
12 | -const _ = require('lodash'); | ||
13 | 12 | ||
14 | exports.activity = (req, res, next) => { | 13 | exports.activity = (req, res, next) => { |
15 | - | ||
16 | raffleModel.activity({ | 14 | raffleModel.activity({ |
17 | - | 15 | + uid: req.user.uid |
18 | }).then((result) => { | 16 | }).then((result) => { |
19 | - | ||
20 | - res.render('raffle/activity', Object.assign({test: 'aaaa'}, { | 17 | + res.render('raffle/activity', Object.assign(result, { |
21 | title: 'Yoho!Buy 有货', | 18 | title: 'Yoho!Buy 有货', |
22 | width750: true | 19 | width750: true |
23 | })); | 20 | })); |
24 | - | ||
25 | }).catch(next); | 21 | }).catch(next); |
26 | - | ||
27 | }; | 22 | }; |
28 | 23 | ||
29 | /** | 24 | /** |
@@ -38,7 +33,7 @@ exports.order = (req, res, next) => { | @@ -38,7 +33,7 @@ exports.order = (req, res, next) => { | ||
38 | page: req.query.page || 1, | 33 | page: req.query.page || 1, |
39 | gender: req.query.gender || '1,3', | 34 | gender: req.query.gender || '1,3', |
40 | yh_channel: req.query.channel || 1, | 35 | yh_channel: req.query.channel || 1, |
41 | - uid: req.user.uid || 10851797 // TODO | 36 | + uid: req.user.uid |
42 | }; | 37 | }; |
43 | 38 | ||
44 | raffleModel.order(params).then(result => { | 39 | raffleModel.order(params).then(result => { |
@@ -67,28 +62,56 @@ exports.getOrders = (req, res, next) => { | @@ -67,28 +62,56 @@ exports.getOrders = (req, res, next) => { | ||
67 | page: req.query.page || 1, | 62 | page: req.query.page || 1, |
68 | gender: req.query.gender || '1,3', | 63 | gender: req.query.gender || '1,3', |
69 | yh_channel: req.query.channel || 1, | 64 | yh_channel: req.query.channel || 1, |
70 | - uid: req.user.uid || 10851797 // TODO | 65 | + uid: req.user.uid |
71 | }).then(result => { | 66 | }).then(result => { |
72 | res.json(result); | 67 | res.json(result); |
73 | }).catch(next); | 68 | }).catch(next); |
74 | }; | 69 | }; |
75 | 70 | ||
76 | /** | 71 | /** |
77 | - * 非首次绑定 | 72 | + * 入口页 |
78 | * @param req | 73 | * @param req |
79 | * @param res | 74 | * @param res |
80 | * @param next | 75 | * @param next |
81 | */ | 76 | */ |
82 | -exports.tip = (req, res, next) => { | 77 | +exports.enter = (req, res) => { |
78 | + if (!req.user.uid) { | ||
79 | + res.redirect('http://m.yohobuy.com/passport/login/wechat?refer=http://m.yohobuy.com/activity/raffle/enter'); | ||
80 | + } else { | ||
81 | + res.render('raffle/enter', { | ||
82 | + module: 'activity', | ||
83 | + page: 'raffle', | ||
84 | + uid: req.user.uid | ||
85 | + }); | ||
86 | + } | ||
87 | +}; | ||
83 | 88 | ||
84 | - res.render('raffle/tip', { | ||
85 | - module: 'activity', | ||
86 | - page: 'raffle', | ||
87 | - pageHeader: headerModel.setNav({ | ||
88 | - navTitle: '我的订单' | ||
89 | - }), | ||
90 | - title: 'Yoho!Buy 有货', | ||
91 | - pageFooter: true | ||
92 | - }); | 89 | +/** |
90 | + * 抽奖 | ||
91 | + * @param req | ||
92 | + * @param res | ||
93 | + * @param next | ||
94 | + */ | ||
95 | +exports.lucky = (req, res, next) => { | ||
96 | + raffleModel.lucky({ | ||
97 | + lotteryId: req.body.lotteryId, | ||
98 | + userId: req.body.userId, | ||
99 | + orderCode: req.body.orderCode | ||
100 | + }).then(result => { | ||
101 | + res.json(result); | ||
102 | + }).catch(next); | ||
103 | +}; | ||
93 | 104 | ||
105 | +/** | ||
106 | + * 送有货币 | ||
107 | + * @param req | ||
108 | + * @param res | ||
109 | + * @param next | ||
110 | + */ | ||
111 | +exports.bind = (req, res, next) => { | ||
112 | + raffleModel.bind({ | ||
113 | + userId: req.query.userId | ||
114 | + }).then(result => { | ||
115 | + res.json(result); | ||
116 | + }).catch(next); | ||
94 | }; | 117 | }; |
@@ -11,12 +11,40 @@ const helpers = global.yoho.helpers; | @@ -11,12 +11,40 @@ const helpers = global.yoho.helpers; | ||
11 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
12 | const service = global.yoho.ServiceAPI; | 12 | const service = global.yoho.ServiceAPI; |
13 | 13 | ||
14 | -const activity = () => { | ||
15 | - return service.get('/operations/api/v5/resource/home', { | ||
16 | - content_code: '8512bf0755cc549ac323f852c9fd945d', | ||
17 | - gender: 1, | ||
18 | - limit: 1000, | ||
19 | - page: 1 | 14 | +const _activity = () => { |
15 | + return service.get('/activity/lottery/getLotteryInfo', { | ||
16 | + lotteryId: 20 | ||
17 | + }); | ||
18 | +}; | ||
19 | + | ||
20 | +const _user = (params) => { | ||
21 | + return api.get('', { | ||
22 | + method: 'app.passport.profile', | ||
23 | + uid: params.uid | ||
24 | + }, { | ||
25 | + code: 200 | ||
26 | + }); | ||
27 | +}; | ||
28 | + | ||
29 | +const activity = (params) => { | ||
30 | + return Promise.all([_activity(params), _user(params)]).then((result) => { | ||
31 | + | ||
32 | + let resu = ''; | ||
33 | + | ||
34 | + let mobile = ''; | ||
35 | + | ||
36 | + if (result && result[0] && result[1] && result[1].data) { | ||
37 | + | ||
38 | + resu = result[0].data; | ||
39 | + | ||
40 | + mobile = result[1].data.mobile; | ||
41 | + | ||
42 | + Object.assign(resu, { | ||
43 | + mobile: mobile.substr(0,3) + '****' + mobile.substr(7) | ||
44 | + }); | ||
45 | + } | ||
46 | + | ||
47 | + return resu; | ||
20 | }); | 48 | }); |
21 | }; | 49 | }; |
22 | 50 | ||
@@ -43,7 +71,7 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => { | @@ -43,7 +71,7 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => { | ||
43 | color: value.color_name, | 71 | color: value.color_name, |
44 | size: value.size_name, | 72 | size: value.size_name, |
45 | price: value.goods_price, | 73 | price: value.goods_price, |
46 | - count: value.buy_number | 74 | + count: value.buy_num |
47 | }; | 75 | }; |
48 | 76 | ||
49 | /* gift=>是否赠品,advanceBuy=>是否加价购 */ | 77 | /* gift=>是否赠品,advanceBuy=>是否加价购 */ |
@@ -117,13 +145,9 @@ const _assignExpressInfo = (showLogistics, order) => { | @@ -117,13 +145,9 @@ const _assignExpressInfo = (showLogistics, order) => { | ||
117 | * @param params | 145 | * @param params |
118 | */ | 146 | */ |
119 | const _getOrderData = (params) => { | 147 | const _getOrderData = (params) => { |
120 | - return api.get('', { | ||
121 | - method: 'app.SpaceOrders.get', | ||
122 | - type: params.type, | 148 | + return service.get('/activity/lottery/getValidOrderList', { |
123 | page: params.page, | 149 | page: params.page, |
124 | - limit: params.limit, | ||
125 | - gender: params.gender, | ||
126 | - yh_channel: params.yh_channel, | 150 | + limit: 100, |
127 | uid: params.uid | 151 | uid: params.uid |
128 | }, {code: 200}); | 152 | }, {code: 200}); |
129 | }; | 153 | }; |
@@ -319,19 +343,26 @@ const getOrders = (params) => { | @@ -319,19 +343,26 @@ const getOrders = (params) => { | ||
319 | count = 0; | 343 | count = 0; |
320 | 344 | ||
321 | let perOrder = _getOrderStatus(value); | 345 | let perOrder = _getOrderStatus(value); |
322 | - | ||
323 | /* 是否是虚拟商品 */ | 346 | /* 是否是虚拟商品 */ |
324 | let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3; | 347 | let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3; |
325 | - | ||
326 | Object.assign(perOrder, { | 348 | Object.assign(perOrder, { |
327 | orderNum: value.order_code, | 349 | orderNum: value.order_code, |
328 | orderStatus: value.status_str, | 350 | orderStatus: value.status_str, |
329 | sumCost: value.amount, | 351 | sumCost: value.amount, |
330 | goods: _formatOrderGoods(value.order_goods, count, false, isTickets), | 352 | goods: _formatOrderGoods(value.order_goods, count, false, isTickets), |
331 | detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}), | 353 | detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}), |
332 | - count: value.buy_total, | 354 | + // count: value.buy_total, |
333 | isVirtual: isTickets, | 355 | isVirtual: isTickets, |
334 | - isDepositAdvance: value.attribute * 1 === 9// 定金预售 | 356 | + isDepositAdvance: value.attribute * 1 === 9, // 定金预售 |
357 | + status: value.status === 0 ? true : false, | ||
358 | + uid: value.uid, | ||
359 | + order_code: value.order_code | ||
360 | + }); | ||
361 | + | ||
362 | + _.forEach(value.order_goods, item => { | ||
363 | + Object.assign(perOrder, { | ||
364 | + count: item.buy_num | ||
365 | + }); | ||
335 | }); | 366 | }); |
336 | 367 | ||
337 | /* 如果运费大于0,会显示运费 */ | 368 | /* 如果运费大于0,会显示运费 */ |
@@ -355,9 +386,38 @@ const getOrders = (params) => { | @@ -355,9 +386,38 @@ const getOrders = (params) => { | ||
355 | }); | 386 | }); |
356 | }; | 387 | }; |
357 | 388 | ||
389 | +/** | ||
390 | + * 抽奖 | ||
391 | + * @returns {*} | ||
392 | + * @private | ||
393 | + * @param params | ||
394 | + */ | ||
395 | +const lucky = (params) => { | ||
396 | + return service.post('/activity/lottery/lucky', { | ||
397 | + lotteryId: params.lotteryId, | ||
398 | + userId: params.userId, | ||
399 | + orderCode: params.orderCode | ||
400 | + }, {code: 200}); | ||
401 | +}; | ||
402 | + | ||
403 | +/** | ||
404 | + * 送有货币 | ||
405 | + * @returns {*} | ||
406 | + * @private | ||
407 | + * @param params | ||
408 | + */ | ||
409 | +const bind = (params) => { | ||
410 | + return service.get('/activity/lottery/giveBindPrize', { | ||
411 | + userId: params.userId | ||
412 | + }, {code: 200}); | ||
413 | +}; | ||
414 | + | ||
415 | + | ||
358 | module.exports = { | 416 | module.exports = { |
359 | order, | 417 | order, |
360 | getOrders, | 418 | getOrders, |
361 | - activity | 419 | + activity, |
420 | + lucky, | ||
421 | + bind | ||
362 | }; | 422 | }; |
363 | 423 |
@@ -79,7 +79,9 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä | @@ -79,7 +79,9 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä | ||
79 | router.get('/raffle/activity', raffle.activity); // 微信免单抽奖活动 | 79 | router.get('/raffle/activity', raffle.activity); // 微信免单抽奖活动 |
80 | router.get('/raffle/orders', raffle.order); // 微信免单抽奖活动订单列表 | 80 | router.get('/raffle/orders', raffle.order); // 微信免单抽奖活动订单列表 |
81 | router.get('/raffle/getOrders', raffle.getOrders); // 微信免单抽奖活动获取订单列表数据 | 81 | router.get('/raffle/getOrders', raffle.getOrders); // 微信免单抽奖活动获取订单列表数据 |
82 | -router.get('/raffle/tip', raffle.tip); // 微信免单抽奖活动非首次绑定 | 82 | +router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页 |
83 | +router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮 | ||
84 | +router.get('/raffle/bind', raffle.bind); // 送有货币 | ||
83 | 85 | ||
84 | router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share); | 86 | router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share); |
85 | 87 |
@@ -2,33 +2,25 @@ | @@ -2,33 +2,25 @@ | ||
2 | <div class="wx-act-c"> | 2 | <div class="wx-act-c"> |
3 | <div class="logo"></div> | 3 | <div class="logo"></div> |
4 | <div class="title"> | 4 | <div class="title"> |
5 | - <p>·下单后一个月内的成功订单才能参加抽奖·</p> | ||
6 | - <p>·成功订单只签收起15日内没有退换货的订单·</p> | ||
7 | - <p>·每一笔成功订单均可享有一次抽奖机会·</p> | 5 | + {{# lottery}} |
6 | + <p>{{name}}</p> | ||
7 | + {{/ lottery}} | ||
8 | </div> | 8 | </div> |
9 | <div class="kind"></div> | 9 | <div class="kind"></div> |
10 | <ul class="kind-list"> | 10 | <ul class="kind-list"> |
11 | - <li>免单奖:全额免单</li> | ||
12 | - <li>现金券:100元、50元、10元</li> | ||
13 | - <li>满减卷:满299~50元、满499~100元</li> | 11 | + {{# prizes}} |
12 | + <li>{{name}}:{{remark}}</li> | ||
13 | + {{/ prizes}} | ||
14 | </ul> | 14 | </ul> |
15 | <a class="btn" href="./orders"></a> | 15 | <a class="btn" href="./orders"></a> |
16 | - <div class="account">您已绑定账号:186****1234</div> | 16 | + <div class="account">{{# mobile}}您已绑定账号:{{.}}{{/ mobile}}</div> |
17 | <div class="rule-c"> | 17 | <div class="rule-c"> |
18 | <p class="rule-title">活动说明</p> | 18 | <p class="rule-title">活动说明</p> |
19 | <div class="rule-list-c"> | 19 | <div class="rule-list-c"> |
20 | <ul> | 20 | <ul> |
21 | - <li>1. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
22 | - <li>2. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
23 | - <li>3. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
24 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
25 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
26 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
27 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
28 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
29 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
30 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | ||
31 | - <li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li> | 21 | + {{# lottery}} |
22 | + <li>{{remark}}</li> | ||
23 | + {{/ lottery}} | ||
32 | </ul> | 24 | </ul> |
33 | </div> | 25 | </div> |
34 | </div> | 26 | </div> |
apps/activity/views/action/raffle/enter.hbs
0 → 100644
1 | +<div id="order-container" class="order-container"> | ||
2 | + <input type="hidden" class="dia-tip" value="{{uid}}" /> | ||
3 | + <div id="dialog-wrapper" class="dialog-wrapper dia-diy hide" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); display: block;"> | ||
4 | + <div class="dialog-box" style="top: 50%; margin-top: -94.5px;"> | ||
5 | + <div class="dialog-content"></div> | ||
6 | + <div class="dialog-footer"> | ||
7 | + <span class="dialog-right-btn tap-hightlight" style="float: none; color: rgb(68, 68, 68); display: inline-block; border: 0px;">我知道了</span> | ||
8 | + </div> | ||
9 | + </div> | ||
10 | + </div> | ||
11 | +</div> |
@@ -32,8 +32,9 @@ | @@ -32,8 +32,9 @@ | ||
32 | <div class="dia-bg"></div> | 32 | <div class="dia-bg"></div> |
33 | <div class="dia-main"> | 33 | <div class="dia-main"> |
34 | <span class="close"></span> | 34 | <span class="close"></span> |
35 | - <img src="{{imgSrc 'img/activity/raffle/dia-succ.png'}}" /> | ||
36 | - <img class="hide" src="{{imgSrc 'img/activity/raffle/dia-err.png'}}" /> | 35 | + <div class="lucky hide"></div> |
36 | + <div class="unlucky hide"></div> | ||
37 | + <p class="hide">免单金额会以有货币形式,在订单<span class="code"></span>,发货15天后且无退换货情况,返还至您的有货个人中心账户内,请注意查收!</p> | ||
37 | <a></a> | 38 | <a></a> |
38 | </div> | 39 | </div> |
39 | </div> | 40 | </div> |
@@ -249,6 +249,9 @@ const bind = { | @@ -249,6 +249,9 @@ const bind = { | ||
249 | refer = helpers.urlFormat('/?go=1'); | 249 | refer = helpers.urlFormat('/?go=1'); |
250 | } | 250 | } |
251 | 251 | ||
252 | + // 微信免单活动,判断来源地址 2.16.12.28 by jing.li@yoho.cn | ||
253 | + res.cookie('bindUrl', 'http://m.yohobuy.com/passport/bind/success?type=bind'); | ||
254 | + | ||
252 | res.render('bind/success', { | 255 | res.render('bind/success', { |
253 | isPassportPage: true, | 256 | isPassportPage: true, |
254 | successTip: type === 'bind' ? '恭喜您,第三方账号绑定手机号码成功!' : '恭喜您,第三方账号关联手机号码成功!', | 257 | successTip: type === 'bind' ? '恭喜您,第三方账号绑定手机号码成功!' : '恭喜您,第三方账号关联手机号码成功!', |
1 | <div class="order" data-id="{{orderNum}}" data-href="{{detailUrl}}"> | 1 | <div class="order" data-id="{{orderNum}}" data-href="{{detailUrl}}"> |
2 | <header class="header"> | 2 | <header class="header"> |
3 | 订单编号:{{orderNum}} | 3 | 订单编号:{{orderNum}} |
4 | - <div class="raffle-btn">参与抽奖</div> | ||
5 | - <div class="disable-btn hide">已抽奖</div> | 4 | + {{#if status}} |
5 | + <div class="raffle-btn" data-uid="{{uid}}" data-code="{{order_code}}">参加抽奖</div> | ||
6 | + {{else}} | ||
7 | + <div class="disable-btn">已抽奖</div> | ||
8 | + {{/ if}} | ||
6 | <span class="order-status">{{orderStatus}}</span> | 9 | <span class="order-status">{{orderStatus}}</span> |
7 | </header> | 10 | </header> |
8 | <section class="order-goods"> | 11 | <section class="order-goods"> |
@@ -17,14 +20,14 @@ | @@ -17,14 +20,14 @@ | ||
17 | 20 | ||
18 | {{!-- 对应订单状态的操作逻辑 --}} | 21 | {{!-- 对应订单状态的操作逻辑 --}} |
19 | {{#if isDepositAdvance}} | 22 | {{#if isDepositAdvance}} |
20 | - <div class="order-opt"> | 23 | + <div class="order-opt hide"> |
21 | <span class="order-opt-info">请到App完成订单相关操作</span> | 24 | <span class="order-opt-info">请到App完成订单相关操作</span> |
22 | </div> | 25 | </div> |
23 | {{^}} | 26 | {{^}} |
24 | {{!-- 完成和取消订单显示删除按钮 --}} | 27 | {{!-- 完成和取消订单显示删除按钮 --}} |
25 | {{#unless isAdvance}} | 28 | {{#unless isAdvance}} |
26 | {{#unless unpaid}} | 29 | {{#unless unpaid}} |
27 | - <div class="order-opt"> | 30 | + <div class="order-opt hide"> |
28 | {{#unless unreceived}} | 31 | {{#unless unreceived}} |
29 | <span class="btn del">删除订单</span> | 32 | <span class="btn del">删除订单</span> |
30 | {{#if isVirtual}} | 33 | {{#if isVirtual}} |
@@ -45,7 +48,7 @@ | @@ -45,7 +48,7 @@ | ||
45 | 48 | ||
46 | {{#unless isAdvance}} | 49 | {{#unless isAdvance}} |
47 | {{#if unpaid}} | 50 | {{#if unpaid}} |
48 | - <div class="order-opt"> | 51 | + <div class="order-opt hide"> |
49 | <ul class="count-down hide"> | 52 | <ul class="count-down hide"> |
50 | <li> | 53 | <li> |
51 | <span class="iconfont count-down-icon"></span> | 54 | <span class="iconfont count-down-icon"></span> |
@@ -63,7 +66,7 @@ | @@ -63,7 +66,7 @@ | ||
63 | </div> | 66 | </div> |
64 | {{/if}} | 67 | {{/if}} |
65 | {{^}} | 68 | {{^}} |
66 | - <div class="order-opt"> | 69 | + <div class="order-opt hide"> |
67 | *定金预售订单只能在APP端操作 | 70 | *定金预售订单只能在APP端操作 |
68 | </div> | 71 | </div> |
69 | {{/unless}} | 72 | {{/unless}} |
@@ -71,7 +74,7 @@ | @@ -71,7 +74,7 @@ | ||
71 | {{!-- 包含未发货和已发货状态,未发货不传logisticsUrl --}} | 74 | {{!-- 包含未发货和已发货状态,未发货不传logisticsUrl --}} |
72 | {{#if unreceived}} | 75 | {{#if unreceived}} |
73 | {{#if logisticsUrl}} | 76 | {{#if logisticsUrl}} |
74 | - <div class="order-opt"> | 77 | + <div class="order-opt hide"> |
75 | <a class="locHref" href="{{logisticsUrl}}"> | 78 | <a class="locHref" href="{{logisticsUrl}}"> |
76 | <span class="btn check-logistics">查看物流</span> | 79 | <span class="btn check-logistics">查看物流</span> |
77 | </a> | 80 | </a> |
public/img/activity/raffle/big-bg.png
0 → 100644
57.2 KB
@@ -34,6 +34,9 @@ var orderHammer, | @@ -34,6 +34,9 @@ var orderHammer, | ||
34 | $reaMask = $('.reason-mask'), | 34 | $reaMask = $('.reason-mask'), |
35 | reasonSwiper; | 35 | reasonSwiper; |
36 | 36 | ||
37 | +var userId = '', | ||
38 | + orderCode = ''; | ||
39 | + | ||
37 | var orderContent = require('activity/raffle/order-content.hbs'); | 40 | var orderContent = require('activity/raffle/order-content.hbs'); |
38 | 41 | ||
39 | require('../common'); | 42 | require('../common'); |
@@ -197,10 +200,47 @@ orderHammer.on('tap', function(e) { | @@ -197,10 +200,47 @@ orderHammer.on('tap', function(e) { | ||
197 | $reaMask.data('orderId', id); | 200 | $reaMask.data('orderId', id); |
198 | 201 | ||
199 | if ($cur.closest('.raffle-btn').length > 0) { | 202 | if ($cur.closest('.raffle-btn').length > 0) { |
200 | - $('.dia-c').show(); | ||
201 | - var dia_h = $('.dia-main').height() / 2; | ||
202 | - | ||
203 | - $('.dia-main').css('margin-top', '-' + dia_h + 'px'); | 203 | + userId = $cur.closest('.raffle-btn').attr('data-uid'); |
204 | + orderCode = $cur.closest('.raffle-btn').attr('data-code'); | ||
205 | + $.ajax({ | ||
206 | + type: 'POST', | ||
207 | + url: 'lucky', | ||
208 | + data: { | ||
209 | + lotteryId: 1001, | ||
210 | + userId: userId, | ||
211 | + orderCode: orderCode | ||
212 | + }, | ||
213 | + success: function(data) { | ||
214 | + var lucky = data.data.orderLotteryCode; | ||
215 | + switch(lucky){ | ||
216 | + case 0: | ||
217 | + break; | ||
218 | + case 1: | ||
219 | + $('.lucky').show(); | ||
220 | + $('.dia-c').show(); | ||
221 | + $('.dia-main').find('p').show(); | ||
222 | + var dia_h = $('.dia-main').height() / 2; | ||
223 | + $('.dia-main').css('margin-top', '-' + dia_h + 'px'); | ||
224 | + $('.dia-main').find('.code').text(orderCode); | ||
225 | + break; | ||
226 | + case 2: | ||
227 | + $('.unlucky').show(); | ||
228 | + $('.dia-c').show(); | ||
229 | + var dia_h = $('.dia-main').height() / 2; | ||
230 | + $('.dia-main').css('margin-top', '-' + dia_h + 'px'); | ||
231 | + break; | ||
232 | + case 3: | ||
233 | + tip.show('用户抽奖不能多个客户端一起抽奖'); | ||
234 | + break; | ||
235 | + case 4: | ||
236 | + tip.show('不符合抽奖条件'); | ||
237 | + break; | ||
238 | + } | ||
239 | + }, | ||
240 | + error: function(data) { | ||
241 | + tip.show(data.message); | ||
242 | + } | ||
243 | + }); | ||
204 | } | 244 | } |
205 | 245 | ||
206 | if ($cur.closest('.del').length > 0) { | 246 | if ($cur.closest('.del').length > 0) { |
@@ -280,19 +320,44 @@ $(window).scroll(function() { | @@ -280,19 +320,44 @@ $(window).scroll(function() { | ||
280 | getOrders(); | 320 | getOrders(); |
281 | 321 | ||
282 | $(function() { | 322 | $(function() { |
323 | + $('.dia-main').on('click', function () { | ||
324 | + window.location.href = '//m.yohobuy.com/activity/raffle/orders' | ||
325 | + }); | ||
283 | 326 | ||
284 | - if ($(".dia-tip").length > 0) { | ||
285 | - // Order delete | ||
286 | - dialog.showDialog({ | ||
287 | - dialogText: '您不是首次绑定,不能再领有货币啦,去参加免单抽奖吧', | ||
288 | - hasFooter: { | ||
289 | - leftBtnText: '我知道了' | ||
290 | - } | ||
291 | - }, function() { | ||
292 | - | ||
293 | - }); | 327 | + if ($('.dia-tip').length > 0) { |
328 | + if(window.cookie('bindUrl') == 'http://m.yohobuy.com/passport/bind/success?type=bind') { | ||
329 | + userId = $('.dia-tip').val(); | ||
330 | + $.ajax({ | ||
331 | + type: 'GET', | ||
332 | + url: 'bind', | ||
333 | + data: { | ||
334 | + userId: userId | ||
335 | + }, | ||
336 | + success: function(res) { | ||
337 | + var LotteryCode = res.data.orderLotteryCode; | ||
338 | + switch(LotteryCode){ | ||
339 | + case 5: | ||
340 | + $('.dialog-content').text('首次绑定50个有货币已到账,可以到个人中心查看,去参加抽奖吧'); | ||
341 | + break; | ||
342 | + case 6: | ||
343 | + $('.dialog-content').text('首次绑定送有货币失败'); | ||
344 | + break; | ||
345 | + case 7: | ||
346 | + $('.dialog-content').text('不是首次绑定,不能赠送有货币'); | ||
347 | + break; | ||
348 | + } | ||
349 | + }, | ||
350 | + error: function(res) { | ||
351 | + tip.show(res.message); | ||
352 | + } | ||
353 | + }); | ||
354 | + } else { | ||
355 | + $('.dialog-content').text('您不是首次绑定,不能再领有货币啦,去参加免单抽奖吧'); | ||
356 | + }; | ||
294 | 357 | ||
295 | - $(".dialog-left-btn").css({"float":"none","color":"#444","display":"inline-block","border":"0"}); | 358 | + $('.dialog-right-btn').on('click', function () { |
359 | + window.location.href = '//m.yohobuy.com/activity/raffle/activity' | ||
360 | + }); | ||
296 | } | 361 | } |
297 | 362 | ||
298 | reasonSwiper = new Swiper('.box-main', { | 363 | reasonSwiper = new Swiper('.box-main', { |
@@ -368,4 +433,4 @@ $reaMask.on('touchend', function(event) { | @@ -368,4 +433,4 @@ $reaMask.on('touchend', function(event) { | ||
368 | 433 | ||
369 | $('.dia-c .close').on('click', function() { | 434 | $('.dia-c .close').on('click', function() { |
370 | $('.dia-c').hide(); | 435 | $('.dia-c').hide(); |
371 | -}); | 436 | +}); |
@@ -27,6 +27,9 @@ | @@ -27,6 +27,9 @@ | ||
27 | font-size: 20px; | 27 | font-size: 20px; |
28 | color: #fff; | 28 | color: #fff; |
29 | line-height: 40px; | 29 | line-height: 40px; |
30 | + padding: 0 30px; | ||
31 | + max-height: 160px; | ||
32 | + overflow: hidden; | ||
30 | } | 33 | } |
31 | } | 34 | } |
32 | 35 | ||
@@ -147,6 +150,7 @@ | @@ -147,6 +150,7 @@ | ||
147 | bottom: 0; | 150 | bottom: 0; |
148 | right: 0; | 151 | right: 0; |
149 | left: 0; | 152 | left: 0; |
153 | + z-index: 1; | ||
150 | 154 | ||
151 | .dia-bg { | 155 | .dia-bg { |
152 | width: 100%; | 156 | width: 100%; |
@@ -165,6 +169,41 @@ | @@ -165,6 +169,41 @@ | ||
165 | top: 50%; | 169 | top: 50%; |
166 | left: 50%; | 170 | left: 50%; |
167 | margin-left: -270px; | 171 | margin-left: -270px; |
172 | + | ||
173 | + .lucky { | ||
174 | + width: 540px; | ||
175 | + height: 421px; | ||
176 | + background: resolve("activity/raffle/dia-succ.png"); | ||
177 | + background-size: 100%; | ||
178 | + } | ||
179 | + | ||
180 | + .unlucky { | ||
181 | + width: 540px; | ||
182 | + height: 421px; | ||
183 | + background: resolve("activity/raffle/dia-err.png"); | ||
184 | + background-size: 100%; | ||
185 | + } | ||
186 | + | ||
187 | + p { | ||
188 | + width: 540px; | ||
189 | + height: 128px; | ||
190 | + position: absolute; | ||
191 | + bottom: 83px; | ||
192 | + left: 0; | ||
193 | + font-size: 20px; | ||
194 | + color: #444; | ||
195 | + padding: 30px; | ||
196 | + line-height: 30px; | ||
197 | + } | ||
198 | + | ||
199 | + a { | ||
200 | + width: 214px; | ||
201 | + height: 53px; | ||
202 | + display: block; | ||
203 | + position: absolute; | ||
204 | + left: 162px; | ||
205 | + bottom: 30px; | ||
206 | + } | ||
168 | } | 207 | } |
169 | 208 | ||
170 | .close { | 209 | .close { |
-
Please register or login to post a comment