Showing
7 changed files
with
205 additions
and
40 deletions
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | -const meGiftModel = require('../models/me-gift-service'); | 8 | +const meGiftService = require('../models/me-gift-service'); |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * 礼品卡列表 | 11 | * 礼品卡列表 |
@@ -17,7 +17,7 @@ exports.index = (req, res, next) => { | @@ -17,7 +17,7 @@ exports.index = (req, res, next) => { | ||
17 | page: 'me-gift' | 17 | page: 'me-gift' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | - req.ctx(meGiftModel).getList(req.query, uid).then(result => { | 20 | + req.ctx(meGiftService).getList(req.query, uid).then(result => { |
21 | responseData.meGiftPage = true; | 21 | responseData.meGiftPage = true; |
22 | Object.assign(responseData, result); | 22 | Object.assign(responseData, result); |
23 | res.render('home/gift/me-gift', responseData); | 23 | res.render('home/gift/me-gift', responseData); |
@@ -34,7 +34,7 @@ exports.detail = (req, res, next) => { | @@ -34,7 +34,7 @@ exports.detail = (req, res, next) => { | ||
34 | page: 'me-gift' | 34 | page: 'me-gift' |
35 | }; | 35 | }; |
36 | 36 | ||
37 | - req.ctx(meGiftModel).detailList(req.query, uid).then(result => { | 37 | + req.ctx(meGiftService).detailList(req.query, uid).then(result => { |
38 | responseData.meGiftPage = true; | 38 | responseData.meGiftPage = true; |
39 | Object.assign(responseData, result); | 39 | Object.assign(responseData, result); |
40 | res.render('home/gift/me-detail', responseData); | 40 | res.render('home/gift/me-detail', responseData); |
apps/home/models/me-gift-api.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +module.exports = class extends global.yoho.BaseModel { | ||
4 | + constructor(ctx) { | ||
5 | + super(ctx); | ||
6 | + } | ||
7 | + | ||
8 | + /** | ||
9 | + * [获取礼品卡列表] | ||
10 | + * @param {[type]} uid [用户id] | ||
11 | + * @param {[type]} status [1-可使用,2-已冻结,3-已过期,4-已用完] | ||
12 | + * @return {[type]} [{}] | ||
13 | + */ | ||
14 | + getList(uid, status) { | ||
15 | + let options = { | ||
16 | + method: 'app.giftcard.pagelist', | ||
17 | + uid: uid, | ||
18 | + status: status | ||
19 | + }; | ||
20 | + | ||
21 | + return this.get({data: options}); | ||
22 | + } | ||
23 | + | ||
24 | + /** | ||
25 | + * [获取礼品卡消费记录] | ||
26 | + * @param {[type]} cardCode [礼品卡号] | ||
27 | + * @param {[type]} uid [用户id] | ||
28 | + * @param {[type]} page [当前页] | ||
29 | + * @param {[type]} limit [页大小] | ||
30 | + * @return {[type]} [{}] | ||
31 | + */ | ||
32 | + consumeList(cardCode, uid, page, limit) { | ||
33 | + let options = { | ||
34 | + method: 'app.giftcard.consumelist', | ||
35 | + cardCode: cardCode, | ||
36 | + uid: uid, | ||
37 | + page: page, | ||
38 | + limit: limit | ||
39 | + }; | ||
40 | + | ||
41 | + return this.get({data: options}); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * [发送邮箱验证码] | ||
46 | + * @param {[type]} email [邮箱] | ||
47 | + * @param {[type]} uid [用户id] | ||
48 | + * @return {[type]} [{}] | ||
49 | + */ | ||
50 | + emailCode(email, uid) { | ||
51 | + let options = { | ||
52 | + method: 'app.giftcard.emailcode', | ||
53 | + email: email, | ||
54 | + uid: uid | ||
55 | + }; | ||
56 | + | ||
57 | + return this.get({data: options}); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * [验证邮箱验证码] | ||
62 | + * @param {[type]} uid [用户id] | ||
63 | + * @param {[type]} email [邮箱] | ||
64 | + * @return {[type]} [{}] | ||
65 | + */ | ||
66 | + verifyEmail(uid, code) { | ||
67 | + let options = { | ||
68 | + method: 'app.giftcard.verifyemail', | ||
69 | + uid: uid, | ||
70 | + code: code | ||
71 | + }; | ||
72 | + | ||
73 | + return this.get({data: options}); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * [激活礼品卡] | ||
78 | + * @param {[type]} uid [用户id] | ||
79 | + * @param {[type]} cardCode [礼品卡卡号] | ||
80 | + * @param {[type]} cardPwd [礼品卡卡密] | ||
81 | + * @return {[type]} [{}] | ||
82 | + */ | ||
83 | + activateGift(uid, cardCode, cardPwd) { | ||
84 | + let options = { | ||
85 | + method: 'app.giftcard.activate', | ||
86 | + uid: uid, | ||
87 | + cardCode: cardCode, | ||
88 | + cardPwd: cardPwd | ||
89 | + }; | ||
90 | + | ||
91 | + return this.get({data: options}); | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * [检查是否绑定手机号] | ||
96 | + * @param {[type]} area [区号] | ||
97 | + * @param {[type]} mobile [手机号] | ||
98 | + * @return {[type]} [{}] | ||
99 | + */ | ||
100 | + checkIsCanBind(area, mobile) { | ||
101 | + let options = { | ||
102 | + method: 'app.passport.checkIsCanBind', | ||
103 | + area: area, | ||
104 | + mobile: mobile | ||
105 | + }; | ||
106 | + | ||
107 | + return this.get({data: options}); | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * [发验证码] | ||
112 | + * @param {[type]} area [区号] | ||
113 | + * @param {[type]} mobile [手机号] | ||
114 | + * @return {[type]} [{}] | ||
115 | + */ | ||
116 | + smsbind(area, mobile) { | ||
117 | + let options = { | ||
118 | + method: 'app.passport.smsbind', | ||
119 | + area: area, | ||
120 | + mobile: mobile | ||
121 | + }; | ||
122 | + | ||
123 | + return this.get({data: options}); | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * [修改绑定的手机号] | ||
128 | + * @param {[type]} area [区号] | ||
129 | + * @param {[type]} mobile [手机号] | ||
130 | + * @param {[type]} code [验证码] | ||
131 | + * @param {[type]} uid [用户id] | ||
132 | + * @return {[type]} [{}] | ||
133 | + */ | ||
134 | + changeMobile(area, mobile, code, uid) { | ||
135 | + let options = { | ||
136 | + method: 'app.passport.changeMobile', | ||
137 | + area: area, | ||
138 | + mobile: mobile, | ||
139 | + code: code, | ||
140 | + uid: uid | ||
141 | + }; | ||
142 | + | ||
143 | + return this.get({data: options}); | ||
144 | + } | ||
145 | +}; |
@@ -6,10 +6,12 @@ | @@ -6,10 +6,12 @@ | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | const Promise = require('bluebird'); | 7 | const Promise = require('bluebird'); |
8 | const helpers = global.yoho.helpers; | 8 | const helpers = global.yoho.helpers; |
9 | +const MeGiftAPi = require('./me-gift-api'); | ||
9 | 10 | ||
10 | module.exports = class extends global.yoho.BaseModel { | 11 | module.exports = class extends global.yoho.BaseModel { |
11 | constructor(ctx) { | 12 | constructor(ctx) { |
12 | super(ctx); | 13 | super(ctx); |
14 | + this.meGiftAPi = new MeGiftAPi(this.ctx); | ||
13 | } | 15 | } |
14 | 16 | ||
15 | headTab(params) { | 17 | headTab(params) { |
@@ -41,22 +41,6 @@ | @@ -41,22 +41,6 @@ | ||
41 | <div>2017-12-36</div> | 41 | <div>2017-12-36</div> |
42 | <div class="info-list">消费明细</div> | 42 | <div class="info-list">消费明细</div> |
43 | </div> | 43 | </div> |
44 | - <div class="me-gift-tr"> | ||
45 | - <div>L242353456436456</div> | ||
46 | - <div>2000</div> | ||
47 | - <div>1980</div> | ||
48 | - <div>2017-12-36</div> | ||
49 | - <div>2017-12-36</div> | ||
50 | - <div class="info-list">消费明细</div> | ||
51 | - </div> | ||
52 | - <div class="me-gift-tr"> | ||
53 | - <div>L242353456436456</div> | ||
54 | - <div>2000</div> | ||
55 | - <div>1980</div> | ||
56 | - <div>2017-12-36</div> | ||
57 | - <div>2017-12-36</div> | ||
58 | - <div class="info-list">消费明细</div> | ||
59 | - </div> | ||
60 | <div class="cart-list-empty"></div> | 44 | <div class="cart-list-empty"></div> |
61 | </div> | 45 | </div> |
62 | </div> | 46 | </div> |
@@ -84,7 +68,7 @@ | @@ -84,7 +68,7 @@ | ||
84 | <span class="mobile-area left"> | 68 | <span class="mobile-area left"> |
85 | <em>+86</em> | 69 | <em>+86</em> |
86 | <i class="iconfont"></i> | 70 | <i class="iconfont"></i> |
87 | - <ul class="mobile-area-list"> | 71 | + <ul class="ul-list mobile-area-list"> |
88 | <li data-cc="+61">澳大利亚 +61</li> | 72 | <li data-cc="+61">澳大利亚 +61</li> |
89 | <li data-cc="+82">韩国 +82</li> | 73 | <li data-cc="+82">韩国 +82</li> |
90 | <li data-cc="+1">加拿大 +1</li> | 74 | <li data-cc="+1">加拿大 +1</li> |
@@ -134,10 +118,18 @@ | @@ -134,10 +118,18 @@ | ||
134 | </table> | 118 | </table> |
135 | <div class="me-gift-info-table"> | 119 | <div class="me-gift-info-table"> |
136 | <div class="me-gift-header"> | 120 | <div class="me-gift-header"> |
137 | - <div class="card-number">时间</div> | ||
138 | - <div class="card-price">订单编号</div> | ||
139 | - <div class="card-balance">类型</div> | ||
140 | - <div class="activate-time">金额(元)</div> | 121 | + <div>时间</div> |
122 | + <div>订单编号</div> | ||
123 | + <div> | ||
124 | + <span class="gift-filter"> | ||
125 | + <em class="gift-type">类型</em> | ||
126 | + <ul class="ul-list"> | ||
127 | + <li data-cc="1">消费</li> | ||
128 | + <li data-cc="2">退款</li> | ||
129 | + </ul> | ||
130 | + </span> | ||
131 | + </div> | ||
132 | + <div>金额(元)</div> | ||
141 | </div> | 133 | </div> |
142 | <div class="me-gift-tr"> | 134 | <div class="me-gift-tr"> |
143 | <div>2017-12-21 09:30</div> | 135 | <div>2017-12-21 09:30</div> |
public/img/home/gift-filter.png
0 → 100644
![](/fe/yohobuy-node/raw/02a5036d663d1a040164c925deb6e9b083969e24/public/img/home/gift-filter.png)
1.12 KB
@@ -35,9 +35,9 @@ meGift = { | @@ -35,9 +35,9 @@ meGift = { | ||
35 | that.infoList(); | 35 | that.infoList(); |
36 | }); | 36 | }); |
37 | 37 | ||
38 | - // 显示手机区号列表 | ||
39 | - $('body').on('click', '.mobile-area', function() { | ||
40 | - $(this).find('.mobile-area-list').toggle(); | 38 | + // 显示手机区号或类型下拉列表 |
39 | + $('body').on('click', '.mobile-area,.gift-filter', function() { | ||
40 | + $(this).find('.ul-list').toggle(); | ||
41 | }); | 41 | }); |
42 | 42 | ||
43 | // 选择手机区号 | 43 | // 选择手机区号 |
@@ -46,6 +46,13 @@ meGift = { | @@ -46,6 +46,13 @@ meGift = { | ||
46 | 46 | ||
47 | $('.mobile-area').find('em').text($li.data('cc')); | 47 | $('.mobile-area').find('em').text($li.data('cc')); |
48 | }); | 48 | }); |
49 | + | ||
50 | + // 选择类型筛选 | ||
51 | + $('body').on('click', '.gift-filter ul', function(event) { | ||
52 | + var $li = $(event.target).closest('li'); | ||
53 | + | ||
54 | + $('.gift-filter').find('em').text($li.text()); | ||
55 | + }); | ||
49 | }, | 56 | }, |
50 | 57 | ||
51 | // 我的礼品卡列表 | 58 | // 我的礼品卡列表 |
@@ -167,22 +167,25 @@ | @@ -167,22 +167,25 @@ | ||
167 | border-right: none; | 167 | border-right: none; |
168 | background-color: #fff; | 168 | background-color: #fff; |
169 | cursor: pointer; | 169 | cursor: pointer; |
170 | + } | ||
170 | 171 | ||
171 | - .mobile-area-list { | ||
172 | - position: absolute; | ||
173 | - width: 139px; | ||
174 | - margin-left: -35px; | ||
175 | - background-color: #fff; | ||
176 | - margin-top: -3px; | ||
177 | - border: 1px solid #e6e6e6; | ||
178 | - display: none; | 172 | + .ul-list { |
173 | + position: absolute; | ||
174 | + width: 139px; | ||
175 | + margin-left: -35px; | ||
176 | + background-color: #fff; | ||
177 | + margin-top: -3px; | ||
178 | + border: 1px solid #e6e6e6; | ||
179 | + display: none; | ||
180 | + cursor: pointer; | ||
179 | 181 | ||
180 | - li { | ||
181 | - border-bottom: 1px solid #e6e6e6; | 182 | + li { |
183 | + border-bottom: 1px solid #e6e6e6; | ||
184 | + height: 30px; | ||
185 | + line-height: 30px; | ||
182 | 186 | ||
183 | - &:hover { | ||
184 | - color: #4a90e2; | ||
185 | - } | 187 | + &:hover { |
188 | + color: #4a90e2; | ||
186 | } | 189 | } |
187 | } | 190 | } |
188 | } | 191 | } |
@@ -222,4 +225,20 @@ | @@ -222,4 +225,20 @@ | ||
222 | width: 360px; | 225 | width: 360px; |
223 | } | 226 | } |
224 | } | 227 | } |
228 | + | ||
229 | + .gift-type { | ||
230 | + background: resolve("home/gift-filter.png") no-repeat center; | ||
231 | + background-size: 69px 21px; | ||
232 | + width: 69px; | ||
233 | + height: 21px; | ||
234 | + line-height: 21px; | ||
235 | + display: inline-block; | ||
236 | + cursor: pointer; | ||
237 | + } | ||
238 | + | ||
239 | + .gift-filter .ul-list { | ||
240 | + width: 69px; | ||
241 | + margin-left: 51px; | ||
242 | + margin-top: 0; | ||
243 | + } | ||
225 | } | 244 | } |
-
Please register or login to post a comment