Merge remote-tracking branch 'origin/master' into release/6.1
Showing
38 changed files
with
1268 additions
and
2 deletions
apps/activity/controllers/store-home.js
0 → 100644
1 | + | ||
2 | +'use strict'; | ||
3 | + | ||
4 | +const headerModel = require('../../../doraemon/models/header'); | ||
5 | +const storeHomeModel = require('../models/store-home'); | ||
6 | + | ||
7 | +exports.photography = (req, res, next) => { | ||
8 | + let responseData = { | ||
9 | + module: 'activity', | ||
10 | + page: 'store-photography', | ||
11 | + pageHeader: headerModel.setNav({ | ||
12 | + navTitle: '个人中心' | ||
13 | + }), | ||
14 | + width750: true, | ||
15 | + localCss: true, | ||
16 | + }; | ||
17 | + | ||
18 | + let params = { | ||
19 | + uid: req.user.uid, | ||
20 | + shopType: 3 | ||
21 | + }; | ||
22 | + | ||
23 | + req.ctx(storeHomeModel).baseInfo(params).then(result => { | ||
24 | + res.render('store-home/photography', Object.assign(responseData, result)); | ||
25 | + }).catch(next); | ||
26 | +}; | ||
27 | + | ||
28 | +exports.coffee = (req, res, next) => { | ||
29 | + let responseData = { | ||
30 | + module: 'activity', | ||
31 | + page: 'store-coffee', | ||
32 | + pageHeader: headerModel.setNav({ | ||
33 | + navTitle: '个人中心' | ||
34 | + }), | ||
35 | + width750: true, | ||
36 | + localCss: true, | ||
37 | + }; | ||
38 | + | ||
39 | + let params = { | ||
40 | + uid: req.user.uid, | ||
41 | + shopType: 1 | ||
42 | + }; | ||
43 | + | ||
44 | + req.ctx(storeHomeModel).baseInfo(params).then(result => { | ||
45 | + res.render('store-home/coffee', Object.assign(responseData, result)); | ||
46 | + }).catch(next); | ||
47 | +}; | ||
48 | + | ||
49 | +exports.green = (req, res, next) => { | ||
50 | + let responseData = { | ||
51 | + module: 'activity', | ||
52 | + page: 'store-green', | ||
53 | + pageHeader: headerModel.setNav({ | ||
54 | + navTitle: '个人中心' | ||
55 | + }), | ||
56 | + width750: true, | ||
57 | + localCss: true, | ||
58 | + }; | ||
59 | + | ||
60 | + let params = { | ||
61 | + uid: req.user.uid, | ||
62 | + shopType: 2 | ||
63 | + }; | ||
64 | + | ||
65 | + req.ctx(storeHomeModel).baseInfo(params).then(result => { | ||
66 | + res.render('store-home/green', Object.assign(responseData, result)); | ||
67 | + }).catch(next); | ||
68 | +}; | ||
69 | + | ||
70 | +exports.history = (req, res, next) => { | ||
71 | + let responseData = { | ||
72 | + module: 'activity', | ||
73 | + page: 'store-history', | ||
74 | + pageHeader: headerModel.setNav({ | ||
75 | + navTitle: '消费明细' | ||
76 | + }), | ||
77 | + width750: true, | ||
78 | + localCss: true, | ||
79 | + }; | ||
80 | + | ||
81 | + let params = { | ||
82 | + uid: req.user.uid, | ||
83 | + shopType: req.query.shopType | ||
84 | + }; | ||
85 | + | ||
86 | + req.ctx(storeHomeModel).history(params).then(result => { | ||
87 | + res.render('store-home/history', Object.assign(responseData, result)); | ||
88 | + }).catch(next); | ||
89 | +}; | ||
90 | + | ||
91 | +exports.moreHistory = (req, res, next) => { | ||
92 | + let params = { | ||
93 | + uid: req.user.uid, | ||
94 | + page: req.query.page, | ||
95 | + shopType: req.query.shopType, | ||
96 | + }; | ||
97 | + | ||
98 | + req.ctx(storeHomeModel).history(params).then(result => { | ||
99 | + res.json(result); | ||
100 | + }).catch(next); | ||
101 | +}; | ||
102 | + | ||
103 | +exports.ewm = (req, res) => { | ||
104 | + let responseData = { | ||
105 | + module: 'activity', | ||
106 | + page: 'store-ewm', | ||
107 | + pageHeader: headerModel.setNav({ | ||
108 | + navTitle: '我的二维码' | ||
109 | + }), | ||
110 | + width750: true, | ||
111 | + localCss: true, | ||
112 | + }; | ||
113 | + | ||
114 | + res.render('store-home/ewm', responseData); | ||
115 | +}; | ||
116 | + | ||
117 | +exports.coupon = (req, res, next) => { | ||
118 | + let responseData = { | ||
119 | + module: 'activity', | ||
120 | + page: 'store-coupon', | ||
121 | + pageHeader: headerModel.setNav({ | ||
122 | + navTitle: '我的优惠卷' | ||
123 | + }), | ||
124 | + width750: true, | ||
125 | + localCss: true, | ||
126 | + }; | ||
127 | + | ||
128 | + let params = { | ||
129 | + uid: req.user.uid, | ||
130 | + shopType: req.query.shopType | ||
131 | + }; | ||
132 | + | ||
133 | + req.ctx(storeHomeModel).baseInfo(params).then(result => { | ||
134 | + res.render('store-home/coupon', Object.assign(responseData, result)); | ||
135 | + }).catch(next); | ||
136 | +}; | ||
137 | + | ||
138 | +exports.modify = (req, res, next) => { | ||
139 | + let params = { | ||
140 | + uid: req.user.uid, | ||
141 | + nickName: req.query.nickName, | ||
142 | + gender: req.query.gender, | ||
143 | + birthday: req.query.birthday | ||
144 | + }; | ||
145 | + | ||
146 | + req.ctx(storeHomeModel).modify(params).then((result) => { | ||
147 | + res.json(result); | ||
148 | + }).catch(next); | ||
149 | +}; |
apps/activity/models/store-home.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +const camelCase = global.yoho.camelCase; | ||
4 | +const _ = require('lodash'); | ||
5 | + | ||
6 | +class storeHome extends global.yoho.BaseModel { | ||
7 | + constructor(ctx) { | ||
8 | + super(ctx); | ||
9 | + } | ||
10 | + | ||
11 | + _userInfo(params) { | ||
12 | + let options = { | ||
13 | + data: { | ||
14 | + method: 'extend.trade.userinfo', | ||
15 | + uid: params.uid, | ||
16 | + shop_type: params.shopType | ||
17 | + }, | ||
18 | + param: { | ||
19 | + code: 200 | ||
20 | + } | ||
21 | + }; | ||
22 | + | ||
23 | + return this.get(options).then(result => { | ||
24 | + return result; | ||
25 | + }); | ||
26 | + } | ||
27 | + | ||
28 | + baseInfo(params) { | ||
29 | + return Promise.all([ | ||
30 | + this._userInfo(params) | ||
31 | + ]).then(result => { | ||
32 | + if (_.get(result, '[0].data')) { | ||
33 | + let coffee = result[0].data.vip_type === 1; | ||
34 | + let green = result[0].data.vip_type === 2; | ||
35 | + let photography = result[0].data.vip_type === 3; | ||
36 | + | ||
37 | + Object.assign(result[0].data, { | ||
38 | + photography: photography, | ||
39 | + coffee: coffee, | ||
40 | + green: green, | ||
41 | + process: this.getProcess(result[0].data.cousume_amount, result[0].data.vip_type) | ||
42 | + }); | ||
43 | + | ||
44 | + result[0].data.gender = result[0].data.gender === '1' ? '男' : '女'; | ||
45 | + | ||
46 | + if (result[0].data.babyInfo) { | ||
47 | + let thisGender = result[0].data.babyInfo.gender; | ||
48 | + | ||
49 | + result[0].data.gender = (thisGender === '1' ? '男' : '女'); | ||
50 | + result[0].data.otherGender = (thisGender === '1' ? '女' : '男'); | ||
51 | + if (result[0].data.gender === '男') { | ||
52 | + result[0].data.genderId = 1; | ||
53 | + result[0].data.otherGenderId = 2; | ||
54 | + } else { | ||
55 | + result[0].data.genderId = 2; | ||
56 | + result[0].data.otherGenderId = 1; | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + result = camelCase(result[0].data); | ||
61 | + } | ||
62 | + return result; | ||
63 | + }); | ||
64 | + } | ||
65 | + | ||
66 | + history(params) { | ||
67 | + let options = { | ||
68 | + data: { | ||
69 | + method: 'extend.trade.consumelist', | ||
70 | + uid: params.uid, | ||
71 | + shop_type: params.shopType, | ||
72 | + page: params.page || 1, | ||
73 | + limit: 20 | ||
74 | + }, | ||
75 | + param: { | ||
76 | + code: 200 | ||
77 | + } | ||
78 | + }; | ||
79 | + | ||
80 | + return this.get(options).then(result => { | ||
81 | + let resu = { | ||
82 | + list: [] | ||
83 | + }; | ||
84 | + | ||
85 | + if (_.get(result, 'data.consume_list')) { | ||
86 | + let build = []; | ||
87 | + | ||
88 | + _.forEach(result.data.consume_list, val => { | ||
89 | + build.push({ | ||
90 | + amount: val.trade_amount, | ||
91 | + date: val.trade_date, | ||
92 | + title: val.trade_title | ||
93 | + }); | ||
94 | + }); | ||
95 | + | ||
96 | + resu.list = build; | ||
97 | + } | ||
98 | + return resu; | ||
99 | + }); | ||
100 | + } | ||
101 | + | ||
102 | + modify(params) { | ||
103 | + let options = { | ||
104 | + data: { | ||
105 | + method: 'extend.trade.editBabyInfo', | ||
106 | + uid: params.uid, | ||
107 | + nick_name: params.nickName, | ||
108 | + gender: params.gender, | ||
109 | + birthday: params.birthday | ||
110 | + }, | ||
111 | + param: { | ||
112 | + code: 200 | ||
113 | + } | ||
114 | + }; | ||
115 | + | ||
116 | + return this.get(options).then(result => { | ||
117 | + return result; | ||
118 | + }); | ||
119 | + } | ||
120 | + | ||
121 | + getProcess(amount, type) { | ||
122 | + let process = 0; | ||
123 | + | ||
124 | + switch (type) { | ||
125 | + case 1: | ||
126 | + if (amount < 0) { | ||
127 | + amount = 0; | ||
128 | + } | ||
129 | + if (amount > 2000) { | ||
130 | + amount = 2000; | ||
131 | + } | ||
132 | + process = (amount / 2000) * 100; | ||
133 | + return process; | ||
134 | + case 2: | ||
135 | + amount -= 1000; | ||
136 | + if (amount < 0) { | ||
137 | + amount = 0; | ||
138 | + } | ||
139 | + if (amount > 4000) { | ||
140 | + amount = 4000; | ||
141 | + } | ||
142 | + process = (amount / 4000) * 100; | ||
143 | + return process; | ||
144 | + case 3: | ||
145 | + if (amount < 0) { | ||
146 | + amount = 0; | ||
147 | + } | ||
148 | + if (amount > 10000) { | ||
149 | + amount = 10000; | ||
150 | + } | ||
151 | + process = (amount / 10000) * 100; | ||
152 | + return process; | ||
153 | + default: | ||
154 | + return process; | ||
155 | + } | ||
156 | + } | ||
157 | +} | ||
158 | + | ||
159 | +module.exports = storeHome; |
@@ -55,6 +55,8 @@ const expand = require(`${cRoot}/expand-new`); | @@ -55,6 +55,8 @@ const expand = require(`${cRoot}/expand-new`); | ||
55 | 55 | ||
56 | const freeMail = require(`${cRoot}/free-mail`); | 56 | const freeMail = require(`${cRoot}/free-mail`); |
57 | 57 | ||
58 | +const storeHome = require(`${cRoot}/store-home`); | ||
59 | + | ||
58 | // routers | 60 | // routers |
59 | 61 | ||
60 | router.get('/demo', demo.index); | 62 | router.get('/demo', demo.index); |
@@ -281,4 +283,13 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表 | @@ -281,4 +283,13 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表 | ||
281 | router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证 | 283 | router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证 |
282 | router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取 | 284 | router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取 |
283 | 285 | ||
286 | +router.get('/store-home/photography', auth, storeHome.photography); // 线下店个人中心-摄影 | ||
287 | +router.get('/store-home/coffee', auth, storeHome.coffee); // 线下店个人中心-咖啡 | ||
288 | +router.get('/store-home/green', auth, storeHome.green); // 线下店个人中心-绿植 | ||
289 | +router.get('/store-home/history', auth, storeHome.history); // 线下店个人中心-消费明细 | ||
290 | +router.get('/store-home/ewm', auth, storeHome.ewm); // 线下店个人中心-二维码 | ||
291 | +router.get('/store-home/coupon', auth, storeHome.coupon); // 线下店个人中心-优惠卷 | ||
292 | +router.get('/store-home/moreHistory', auth, storeHome.moreHistory); // 线下店个人中心-更多记录 | ||
293 | +router.get('/store-home/modify', auth, storeHome.modify); // 线下店个人中心-修改宝宝信息 | ||
294 | + | ||
284 | module.exports = router; | 295 | module.exports = router; |
1 | +<div class="store-home"> | ||
2 | + <div class="coupon-list"> | ||
3 | + {{# coupons}} | ||
4 | + <div class="coupon-item"> | ||
5 | + <div class="coupon-title eps">{{couponName}}</div> | ||
6 | + <div class="coupon-main"> | ||
7 | + <div class="left"> | ||
8 | + <p class="price">{{couponAmount}}</p> | ||
9 | + <p class="limit">{{useLimit}}</p> | ||
10 | + </div> | ||
11 | + <div class="right"> | ||
12 | + <p class="date">{{validateDate}}</p> | ||
13 | + <p class="detail-btn">详细信息 | ||
14 | + <span class="iconfont up"></span> | ||
15 | + <span class="iconfont down"></span> | ||
16 | + </p> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + <div class="coupon-foot"> | ||
20 | + <div class="dot-line"> | ||
21 | + <div class="left-dot"></div> | ||
22 | + <div class="right-dot"></div> | ||
23 | + <p></p> | ||
24 | + </div> | ||
25 | + <p>{{explains}}</p> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + {{/ coupons}} | ||
29 | + </div> | ||
30 | +</div> |
1 | +<div class="store-home"> | ||
2 | + {{> store-home/user-info}} | ||
3 | + <div class="edit-title">编辑宝宝资料</div> | ||
4 | + <ul class="list"> | ||
5 | + <li class="list-item"> | ||
6 | + <span class="title">宝宝昵称</span> | ||
7 | + <span class="iconfont"></span> | ||
8 | + <input class="s-title baby-name modify" type="text" value="{{babyInfo/nickName}}" /> | ||
9 | + </li> | ||
10 | + <li class="list-item"> | ||
11 | + <span class="title">宝宝生日</span> | ||
12 | + <span class="iconfont"></span> | ||
13 | + <span class="date-c"> | ||
14 | + <input class="s-title baby-birthday modify" type="date" value="{{babyInfo/birthDay}}" /> | ||
15 | + </span> | ||
16 | + </li> | ||
17 | + <li class="list-item"> | ||
18 | + <span class="title">宝宝性别</span> | ||
19 | + <span class="iconfont"></span> | ||
20 | + <div class="select-c"> | ||
21 | + <select class="s-title baby-gender modify"> | ||
22 | + <option value="{{genderId}}">{{gender}}</option> | ||
23 | + <option value="{{otherGenderId}}">{{otherGender}}</option> | ||
24 | + </select> | ||
25 | + </div> | ||
26 | + </li> | ||
27 | + </ul> | ||
28 | + {{> store-home/yoho-family}} | ||
29 | +</div> |
1 | +<div class="bg-pic"> | ||
2 | + <div class="pic {{#if coffee}}coffee{{/if}} {{#if photography}}photography{{/if}} {{#if green}}green{{/if}}"> | ||
3 | + <div class="cover"></div> | ||
4 | + </div> | ||
5 | + <div class="base-info"> | ||
6 | + <div class="left"> | ||
7 | + <div class="user"> | ||
8 | + <span class="name">{{nickName}}</span> | ||
9 | + <span class="vip vip-{{vipLevel}}"></span> | ||
10 | + </div> | ||
11 | + <div class="tel">{{mobile}}</div> | ||
12 | + </div> | ||
13 | + <div class="right"> | ||
14 | + <div class="ewm-c"> | ||
15 | + <a class="ewm" href="//m.yohobuy.com/home/newQrcode"></a> | ||
16 | + </div> | ||
17 | + <div class="id hide">ID:475247198</div> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | +<div class="user-info"> | ||
22 | + <div class="logo {{#if coffee}}coffee{{/if}} {{#if photography}}photography{{/if}} {{#if green}}green{{/if}}"></div> | ||
23 | + <ul class="info-list"> | ||
24 | + <li> | ||
25 | + <div class="left">消费金额</div> | ||
26 | + <a class="right"{{#if cousumeAmount}} href="//m.yohobuy.com/activity/store-home/history?shopType={{vipType}}"{{/if}}>¥{{cousumeAmount}} | ||
27 | + {{#if cousumeAmount}} | ||
28 | + <span class="iconfont"></span> | ||
29 | + {{/if}} | ||
30 | + </a> | ||
31 | + </li> | ||
32 | + <li> | ||
33 | + <div class="left">消费次数</div> | ||
34 | + <div class="right">{{cousumeNum}}次</div> | ||
35 | + </li> | ||
36 | + <li> | ||
37 | + <div class="left">我的积分</div> | ||
38 | + <div class="right">{{creditPoints}}</div> | ||
39 | + </li> | ||
40 | + </ul> | ||
41 | + <div class="process-c"> | ||
42 | + <div class="process-line"> | ||
43 | + <div style="width: {{process}}%;"></div> | ||
44 | + </div> | ||
45 | + <ul class="level-c" data-vip="{{vipLevel}}"> | ||
46 | + <li class="disable"> | ||
47 | + <div class="dot"></div> | ||
48 | + <span class="vip vip-1"></span> | ||
49 | + <div class="price">¥{{#if coffee}}0{{/if}}{{#if photography}}0{{/if}}{{#if green}}1000{{/if}}</div> | ||
50 | + </li> | ||
51 | + <li class="disable"> | ||
52 | + <div class="dot"></div> | ||
53 | + <span class="vip vip-2"></span> | ||
54 | + <div class="price">¥{{#if coffee}}800{{/if}}{{#if photography}}5000{{/if}}{{#if green}}3000{{/if}}</div> | ||
55 | + </li> | ||
56 | + <li class="disable"> | ||
57 | + <div class="dot"></div> | ||
58 | + <span class="vip vip-3"></span> | ||
59 | + <div class="price">¥{{#if coffee}}2000{{/if}}{{#if photography}}10000{{/if}}{{#if green}}5000{{/if}}</div> | ||
60 | + </li> | ||
61 | + </ul> | ||
62 | + </div> | ||
63 | + <ul class="list coupon"> | ||
64 | + <a href="//m.yohobuy.com/activity/store-home/coupon?shopType={{vipType}}"> | ||
65 | + <li class="list-item"> | ||
66 | + <span class="title">我的优惠券</span> | ||
67 | + <span class="iconfont"></span> | ||
68 | + <span class="s-title">{{couponsNum}}</span> | ||
69 | + </li> | ||
70 | + </a> | ||
71 | + </ul> | ||
72 | +</div> | ||
73 | +<div class="edit-title hide">编辑资料</div> | ||
74 | +<ul class="list hide"> | ||
75 | + <li class="list-item"> | ||
76 | + <span class="title">昵称</span> | ||
77 | + <span class="iconfont"></span> | ||
78 | + <span class="s-title">{{nickName}}</span> | ||
79 | + </li> | ||
80 | + <li class="list-item"> | ||
81 | + <span class="title">生日</span> | ||
82 | + <span class="iconfont"></span> | ||
83 | + <span class="s-title">{{birthDay}}</span> | ||
84 | + </li> | ||
85 | + <li class="list-item"> | ||
86 | + <span class="title">性别</span> | ||
87 | + <span class="iconfont"></span> | ||
88 | + <span class="s-title">{{gender}}</span> | ||
89 | + </select> | ||
90 | + </li> | ||
91 | +</ul> |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | <div class="user-info"> | 8 | <div class="user-info"> |
9 | <div class="name eps">{{nickname}}</div> | 9 | <div class="name eps">{{nickname}}</div> |
10 | <div class="passcode"> | 10 | <div class="passcode"> |
11 | + {{#if trendWord}} | ||
11 | <div class="dot"># </div> | 12 | <div class="dot"># </div> |
12 | <div class="auto-scroll"> | 13 | <div class="auto-scroll"> |
13 | <div class="scroll-words go-scroll"> | 14 | <div class="scroll-words go-scroll"> |
@@ -19,6 +20,7 @@ | @@ -19,6 +20,7 @@ | ||
19 | </div> | 20 | </div> |
20 | </div> | 21 | </div> |
21 | <div class="dot"> #</div> | 22 | <div class="dot"> #</div> |
23 | + {{/if}} | ||
22 | </div> | 24 | </div> |
23 | </div> | 25 | </div> |
24 | </div> | 26 | </div> |
public/hbs/activity/store-home/history.hbs
0 → 100644
public/img/activity/store-home/coffee-bg.jpg
0 → 100644

32.9 KB
public/img/activity/store-home/coffee.png
0 → 100644

3.78 KB

2.22 KB
public/img/activity/store-home/ewm.png
0 → 100644

1.13 KB
public/img/activity/store-home/green-bg.jpg
0 → 100644

44.5 KB
public/img/activity/store-home/green.png
0 → 100644

3.76 KB

60.6 KB

3.61 KB
public/img/activity/store-home/vip1-1.png
0 → 100644

941 Bytes
public/img/activity/store-home/vip1.png
0 → 100644

1.05 KB
public/img/activity/store-home/vip2-1.png
0 → 100644

958 Bytes
public/img/activity/store-home/vip2.png
0 → 100644

1.07 KB
public/img/activity/store-home/vip3-1.png
0 → 100644

962 Bytes
public/img/activity/store-home/vip3.png
0 → 100644

1.08 KB
public/js/activity/store-coffee.page.js
0 → 100644
public/js/activity/store-coupon.page.js
0 → 100644
1 | + | ||
2 | +require('activity/store-home.page.css'); | ||
3 | + | ||
4 | +import $ from 'yoho-jquery'; | ||
5 | +import Page from 'yoho-page'; | ||
6 | + | ||
7 | +class StoreCoupon extends Page { | ||
8 | + constructor() { | ||
9 | + super(); | ||
10 | + this.selector = { | ||
11 | + $toggleBtn: $('.detail-btn'), | ||
12 | + }; | ||
13 | + | ||
14 | + this.init(); | ||
15 | + } | ||
16 | + | ||
17 | + init() { | ||
18 | + this.bindEvents(); | ||
19 | + } | ||
20 | + | ||
21 | + bindEvents() { | ||
22 | + this.selector.$toggleBtn.on('click', this.toggle.bind(this)); | ||
23 | + } | ||
24 | + | ||
25 | + toggle(e) { | ||
26 | + let $this = $(e.currentTarget); | ||
27 | + | ||
28 | + $this.parents('.coupon-item').find('.coupon-foot').toggle().find('.up').toggle().find('.down').toggle(); | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +$(() => { | ||
33 | + new StoreCoupon(); | ||
34 | +}); |
public/js/activity/store-ewm.page.js
0 → 100644
1 | +require('activity/store-home.page.css'); | ||
2 | + | ||
3 | +import Page from 'yoho-page'; | ||
4 | +import $ from 'yoho-jquery'; | ||
5 | +import 'yoho-jquery-qrcode'; | ||
6 | + | ||
7 | +class PersonDetail extends Page { | ||
8 | + constructor() { | ||
9 | + super(); | ||
10 | + this.selector = { | ||
11 | + $ewm: $('.ewm-pic') | ||
12 | + }; | ||
13 | + | ||
14 | + this.init(); | ||
15 | + } | ||
16 | + | ||
17 | + init() { | ||
18 | + this.selector.$ewm.qrcode({ | ||
19 | + render: 'canvas', // 显示方式,canvas,image和div | ||
20 | + text: '20364534', // 二维码的内容 | ||
21 | + size: parseInt(420, 10), // 大小 | ||
22 | + ecLevel: 'H', // 纠错级别 | ||
23 | + }); | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +$(() => { | ||
28 | + new PersonDetail(); | ||
29 | +}); |
public/js/activity/store-green.page.js
0 → 100644
public/js/activity/store-history.page.js
0 → 100644
1 | +require('activity/store-home.page.css'); | ||
2 | + | ||
3 | +import $ from 'yoho-jquery'; | ||
4 | +import Page from 'yoho-page'; | ||
5 | +import historyRender from 'activity/store-home/history.hbs'; | ||
6 | + | ||
7 | +class History extends Page { | ||
8 | + constructor() { | ||
9 | + super(); | ||
10 | + this.page = 1; | ||
11 | + this.loading = false; | ||
12 | + this.selector = { | ||
13 | + $hisUl: $('.his-ul') | ||
14 | + }; | ||
15 | + this.view = { | ||
16 | + historyRender | ||
17 | + }; | ||
18 | + this.init(); | ||
19 | + } | ||
20 | + | ||
21 | + init() { | ||
22 | + $(window).scroll(() => { | ||
23 | + window.requestAnimationFrame(this.scrollHandler.bind(this)); | ||
24 | + }); | ||
25 | + } | ||
26 | + | ||
27 | + scrollHandler() { | ||
28 | + if (($(window).scrollTop() + $(window).height() >= $(document).height() * 0.8)) { | ||
29 | + this.doMore(); | ||
30 | + } | ||
31 | + } | ||
32 | + | ||
33 | + doMore() { | ||
34 | + if (!this.end && !this.loading) { | ||
35 | + this.page++; | ||
36 | + this.moreList(this.page); | ||
37 | + } | ||
38 | + } | ||
39 | + | ||
40 | + moreList() { | ||
41 | + this.loading = true; | ||
42 | + this.ajax({ | ||
43 | + url: '/activity/store-home/moreHistory', | ||
44 | + data: { | ||
45 | + page: this.page, | ||
46 | + shopType: window.queryString.shopType | ||
47 | + }, | ||
48 | + }).then(result => { | ||
49 | + if (result && result.list.length > 0) { | ||
50 | + this.selector.$hisUl.append(this.view.historyRender(result)); | ||
51 | + this.loading = false; | ||
52 | + } else { | ||
53 | + this.end = true; | ||
54 | + } | ||
55 | + }).catch(error => { | ||
56 | + console.error(error); | ||
57 | + }); | ||
58 | + } | ||
59 | +} | ||
60 | + | ||
61 | +$(() => { | ||
62 | + new History(); | ||
63 | +}); |
public/js/activity/store-home/index.js
0 → 100644
1 | +import $ from 'yoho-jquery'; | ||
2 | +import Page from 'yoho-page'; | ||
3 | +import tip from 'plugin/tip'; | ||
4 | +import yoho from 'yoho-app'; | ||
5 | + | ||
6 | +class Photography extends Page { | ||
7 | + constructor() { | ||
8 | + super(); | ||
9 | + this.selector = { | ||
10 | + $levelC: $('.level-c'), | ||
11 | + $modifyInp: $('.s-title.modify'), | ||
12 | + $nickName: $('.s-title.baby-name'), | ||
13 | + $gender: $('.s-title.baby-gender'), | ||
14 | + $birthday: $('.s-title.baby-birthday'), | ||
15 | + $noDate: $('.s-title.modify[type!=date]'), | ||
16 | + }; | ||
17 | + | ||
18 | + this.init(); | ||
19 | + } | ||
20 | + | ||
21 | + init() { | ||
22 | + this.bindEvents(); | ||
23 | + let vipLevel = this.selector.$levelC.data('vip'); | ||
24 | + | ||
25 | + this.selector.$levelC.find(`li:lt(${vipLevel})`).removeClass('disable'); | ||
26 | + } | ||
27 | + | ||
28 | + bindEvents() { | ||
29 | + if (yoho.isWechat) { | ||
30 | + this.selector.$modifyInp.on('change', this.modifyInp.bind(this)); | ||
31 | + } else { | ||
32 | + this.selector.$noDate.on('change', this.modifyInp.bind(this)); | ||
33 | + this.selector.$birthday.on('blur', this.modifyInp.bind(this)); | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
37 | + modifyInp() { | ||
38 | + this.ajax({ | ||
39 | + url: '/activity/store-home/modify', | ||
40 | + data: { | ||
41 | + nickName: this.selector.$nickName.val(), | ||
42 | + gender: this.selector.$gender.val(), | ||
43 | + birthday: this.selector.$birthday.val() | ||
44 | + }, | ||
45 | + }).then(result => { | ||
46 | + if (result && result.code === 200) { | ||
47 | + location.href = location.href; | ||
48 | + } else { | ||
49 | + tip.show(result.message); | ||
50 | + } | ||
51 | + }).catch(error => { | ||
52 | + tip.show(error); | ||
53 | + }); | ||
54 | + } | ||
55 | +} | ||
56 | + | ||
57 | +module.exports = Photography; |
public/js/activity/store-photography.page.js
0 → 100644
@@ -72,7 +72,7 @@ let functions = { | @@ -72,7 +72,7 @@ let functions = { | ||
72 | if (!yoho.isLogin()) { | 72 | if (!yoho.isLogin()) { |
73 | let preInfo = `${sku}_${skn}_${buyNum}`; | 73 | let preInfo = `${sku}_${skn}_${buyNum}`; |
74 | let actCkOpthn = { | 74 | let actCkOpthn = { |
75 | - path: '/', | 75 | + path: '/product', |
76 | expires: 1 | 76 | expires: 1 |
77 | }; | 77 | }; |
78 | 78 |
@@ -43,6 +43,7 @@ yoho = { | @@ -43,6 +43,7 @@ yoho = { | ||
43 | qs && qs.app_version || cookie.get('app_version'), | 43 | qs && qs.app_version || cookie.get('app_version'), |
44 | isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), | 44 | isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), |
45 | isAndroid: /Android/i.test(navigator.userAgent || ''), | 45 | isAndroid: /Android/i.test(navigator.userAgent || ''), |
46 | + isWechat: /micromessenger/i.test(navigator.userAgent || ''), | ||
46 | 47 | ||
47 | /** | 48 | /** |
48 | * JS 与 APP 共享的对象 | 49 | * JS 与 APP 共享的对象 |
public/scss/activity/store-home.page.css
0 → 100644
1 | +body, | ||
2 | +html { | ||
3 | + background-color: #f0f0f0; | ||
4 | +} | ||
5 | + | ||
6 | +input { | ||
7 | + padding: 0; | ||
8 | +} | ||
9 | + | ||
10 | +input::-webkit-clear-button { | ||
11 | + width: 0; | ||
12 | +} | ||
13 | + | ||
14 | +input::-webkit-calendar-picker-indicator { | ||
15 | + width: 0; | ||
16 | +} | ||
17 | + | ||
18 | +::-webkit-input-placeholder { | ||
19 | + color: #b0b0b0; | ||
20 | +} | ||
21 | + | ||
22 | +:-moz-placeholder { | ||
23 | + color: #b0b0b0; | ||
24 | +} | ||
25 | + | ||
26 | +::-moz-placeholder { | ||
27 | + color: #b0b0b0; | ||
28 | +} | ||
29 | + | ||
30 | +:-ms-input-placeholder { | ||
31 | + color: #b0b0b0; | ||
32 | +} | ||
33 | + | ||
34 | +.store-home { | ||
35 | + position: relative; | ||
36 | + | ||
37 | + .eps { | ||
38 | + white-space: nowrap; | ||
39 | + overflow: hidden; | ||
40 | + text-overflow: ellipsis; | ||
41 | + } | ||
42 | + | ||
43 | + .edit-title { | ||
44 | + font-size: 24px; | ||
45 | + color: #b0b0b0; | ||
46 | + padding: 0 30px; | ||
47 | + margin: 15px 0; | ||
48 | + } | ||
49 | + | ||
50 | + .vip { | ||
51 | + width: 70px; | ||
52 | + height: 30px; | ||
53 | + display: inline-block; | ||
54 | + } | ||
55 | + | ||
56 | + .vip-1 { | ||
57 | + background-image: url("/activity/store-home/vip1.png"); | ||
58 | + } | ||
59 | + | ||
60 | + .vip-2 { | ||
61 | + background-image: url("/activity/store-home/vip2.png"); | ||
62 | + } | ||
63 | + | ||
64 | + .vip-3 { | ||
65 | + background-image: url("/activity/store-home/vip3.png"); | ||
66 | + } | ||
67 | + | ||
68 | + .list { | ||
69 | + clear: both; | ||
70 | + padding: 0 30px; | ||
71 | + background-color: #fff; | ||
72 | + margin-bottom: 20px; | ||
73 | + | ||
74 | + .list-item { | ||
75 | + line-height: 88px; | ||
76 | + height: 88px; | ||
77 | + background-color: #fff; | ||
78 | + border-bottom: solid 1px #e0e0e0; | ||
79 | + position: relative; | ||
80 | + | ||
81 | + .name { | ||
82 | + font-size: 30px; | ||
83 | + } | ||
84 | + | ||
85 | + .s-title { | ||
86 | + float: right; | ||
87 | + font-size: 28px; | ||
88 | + height: 60px; | ||
89 | + line-height: 60px; | ||
90 | + margin: 14px 15px 14px 0; | ||
91 | + text-align: right; | ||
92 | + color: #b0b0b0; | ||
93 | + border: 0; | ||
94 | + background: none; | ||
95 | + | ||
96 | + option { | ||
97 | + text-align: right; | ||
98 | + } | ||
99 | + | ||
100 | + &.change { | ||
101 | + color: #000; | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + select.s-title { | ||
106 | + direction: rtl; | ||
107 | + } | ||
108 | + | ||
109 | + .iconfont { | ||
110 | + float: right; | ||
111 | + font-size: 28px; | ||
112 | + color: #b0b0b0; | ||
113 | + width: 30px; | ||
114 | + } | ||
115 | + | ||
116 | + .date-c { | ||
117 | + direction: ltr; | ||
118 | + position: absolute; | ||
119 | + top: 0; | ||
120 | + right: 30px; | ||
121 | + height: 88px; | ||
122 | + width: 220px; | ||
123 | + overflow: hidden; | ||
124 | + | ||
125 | + input { | ||
126 | + direction: rtl; | ||
127 | + position: absolute; | ||
128 | + top: 0; | ||
129 | + left: -57px; | ||
130 | + width: 300px; | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + .select-c { | ||
135 | + position: absolute; | ||
136 | + top: 0; | ||
137 | + right: 30px; | ||
138 | + white-space: nowrap; | ||
139 | + overflow: hidden; | ||
140 | + direction: ltr; | ||
141 | + width: 60px; | ||
142 | + height: 88px; | ||
143 | + | ||
144 | + select { | ||
145 | + position: absolute; | ||
146 | + top: 0; | ||
147 | + right: -5px; | ||
148 | + } | ||
149 | + } | ||
150 | + | ||
151 | + &:last-child { | ||
152 | + border-bottom: 0; | ||
153 | + } | ||
154 | + } | ||
155 | + } | ||
156 | + | ||
157 | + .bg-pic { | ||
158 | + position: relative; | ||
159 | + | ||
160 | + .pic { | ||
161 | + width: 100%; | ||
162 | + height: 355px; | ||
163 | + background-size: cover; | ||
164 | + background-repeat: no-repeat; | ||
165 | + background-position: center center; | ||
166 | + | ||
167 | + .cover { | ||
168 | + width: 100%; | ||
169 | + height: 100%; | ||
170 | + background-color: #000; | ||
171 | + opacity: 0.6; | ||
172 | + } | ||
173 | + | ||
174 | + &.photography { | ||
175 | + background-image: resolve("activity/store-home/photography-bg.jpg"); | ||
176 | + } | ||
177 | + | ||
178 | + &.green { | ||
179 | + background-image: resolve("activity/store-home/green-bg.jpg"); | ||
180 | + } | ||
181 | + | ||
182 | + &.coffee { | ||
183 | + background-image: resolve("activity/store-home/coffee-bg.jpg"); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + .base-info { | ||
188 | + padding: 0 30px; | ||
189 | + position: absolute; | ||
190 | + top: 0; | ||
191 | + left: 0; | ||
192 | + color: #fff; | ||
193 | + width: 100%; | ||
194 | + padding-top: 70px; | ||
195 | + line-height: 60px; | ||
196 | + | ||
197 | + .left { | ||
198 | + width: 50%; | ||
199 | + float: left; | ||
200 | + | ||
201 | + .user { | ||
202 | + font-size: 38px; | ||
203 | + } | ||
204 | + | ||
205 | + .tel { | ||
206 | + font-size: 24px; | ||
207 | + } | ||
208 | + } | ||
209 | + | ||
210 | + .right { | ||
211 | + width: 50%; | ||
212 | + float: right; | ||
213 | + text-align: right; | ||
214 | + | ||
215 | + .ewm { | ||
216 | + width: 35px; | ||
217 | + height: 35px; | ||
218 | + background-image: url("/activity/store-home/ewm.png"); | ||
219 | + display: inline-block; | ||
220 | + vertical-align: middle; | ||
221 | + } | ||
222 | + | ||
223 | + .id { | ||
224 | + font-size: 24px; | ||
225 | + } | ||
226 | + } | ||
227 | + | ||
228 | + .name { | ||
229 | + margin-right: 10px; | ||
230 | + } | ||
231 | + } | ||
232 | + } | ||
233 | + | ||
234 | + .user-info { | ||
235 | + width: 690px; | ||
236 | + background-color: #fff; | ||
237 | + margin: -130px auto 0; | ||
238 | + position: relative; | ||
239 | + padding-top: 40px; | ||
240 | + | ||
241 | + .logo { | ||
242 | + &.coffee { | ||
243 | + width: 120px; | ||
244 | + height: 120px; | ||
245 | + background-image: url("/activity/store-home/coffee.png"); | ||
246 | + margin: 0 auto; | ||
247 | + } | ||
248 | + | ||
249 | + &.photography { | ||
250 | + width: 120px; | ||
251 | + height: 120px; | ||
252 | + background-image: url("/activity/store-home/photography.png"); | ||
253 | + margin: 0 auto; | ||
254 | + } | ||
255 | + | ||
256 | + &.green { | ||
257 | + width: 120px; | ||
258 | + height: 120px; | ||
259 | + background-image: url("/activity/store-home/green.png"); | ||
260 | + margin: 0 auto; | ||
261 | + } | ||
262 | + } | ||
263 | + | ||
264 | + .info-list { | ||
265 | + margin-top: 15px; | ||
266 | + font-size: 24px; | ||
267 | + line-height: 60px; | ||
268 | + | ||
269 | + .left { | ||
270 | + width: 50%; | ||
271 | + float: left; | ||
272 | + text-align: right; | ||
273 | + padding: 0 25px; | ||
274 | + } | ||
275 | + | ||
276 | + .right { | ||
277 | + width: 50%; | ||
278 | + float: right; | ||
279 | + padding: 0 25px; | ||
280 | + | ||
281 | + .iconfont { | ||
282 | + color: #b0b0b0; | ||
283 | + font-size: 18px; | ||
284 | + } | ||
285 | + } | ||
286 | + } | ||
287 | + | ||
288 | + .process-c { | ||
289 | + position: relative; | ||
290 | + padding-top: 30px; | ||
291 | + clear: both; | ||
292 | + | ||
293 | + .process-line { | ||
294 | + width: 578px; | ||
295 | + height: 2px; | ||
296 | + background-color: #e0e0e0; | ||
297 | + margin: 0 auto; | ||
298 | + | ||
299 | + div { | ||
300 | + background-color: #000; | ||
301 | + height: 100%; | ||
302 | + } | ||
303 | + } | ||
304 | + | ||
305 | + .level-c { | ||
306 | + width: 598px; | ||
307 | + margin: -9px auto 0; | ||
308 | + | ||
309 | + li { | ||
310 | + float: left; | ||
311 | + width: 289px; | ||
312 | + margin-bottom: 20px; | ||
313 | + } | ||
314 | + | ||
315 | + li:last-child { | ||
316 | + width: 20px; | ||
317 | + } | ||
318 | + | ||
319 | + .dot { | ||
320 | + width: 20px; | ||
321 | + height: 20px; | ||
322 | + background-color: #000; | ||
323 | + border-radius: 50%; | ||
324 | + margin-bottom: 17px; | ||
325 | + } | ||
326 | + | ||
327 | + .vip { | ||
328 | + margin-left: -25px; | ||
329 | + } | ||
330 | + | ||
331 | + .price { | ||
332 | + width: 100px; | ||
333 | + margin-left: -40px; | ||
334 | + text-align: center; | ||
335 | + font-size: 23px; | ||
336 | + line-height: 45px; | ||
337 | + } | ||
338 | + } | ||
339 | + } | ||
340 | + | ||
341 | + .coupon { | ||
342 | + border-top: solid 1px #e0e0e0; | ||
343 | + margin: 0 22px; | ||
344 | + padding: 0; | ||
345 | + | ||
346 | + .list-item { | ||
347 | + padding: 0; | ||
348 | + } | ||
349 | + } | ||
350 | + } | ||
351 | + | ||
352 | + .disable { | ||
353 | + .vip-1 { | ||
354 | + background-image: url("/activity/store-home/vip1-1.png"); | ||
355 | + } | ||
356 | + | ||
357 | + .vip-2 { | ||
358 | + background-image: url("/activity/store-home/vip2-1.png"); | ||
359 | + } | ||
360 | + | ||
361 | + .vip-3 { | ||
362 | + background-image: url("/activity/store-home/vip3-1.png"); | ||
363 | + } | ||
364 | + | ||
365 | + .dot { | ||
366 | + background-color: #e0e0e0 !important; | ||
367 | + } | ||
368 | + | ||
369 | + .price { | ||
370 | + color: #b0b0b0; | ||
371 | + } | ||
372 | + } | ||
373 | + | ||
374 | + .his-ul { | ||
375 | + padding: 0 25px; | ||
376 | + background-color: #fff; | ||
377 | + | ||
378 | + .item { | ||
379 | + height: 100px; | ||
380 | + border-bottom: solid 1px #e0e0e0; | ||
381 | + background-color: #fff; | ||
382 | + padding: 5px 0; | ||
383 | + | ||
384 | + &:last-child { | ||
385 | + border: 0; | ||
386 | + } | ||
387 | + | ||
388 | + .tip { | ||
389 | + width: 500px; | ||
390 | + float: left; | ||
391 | + | ||
392 | + .name { | ||
393 | + font-size: 26px; | ||
394 | + line-height: 50px; | ||
395 | + height: 50px; | ||
396 | + } | ||
397 | + | ||
398 | + .time { | ||
399 | + font-size: 22px; | ||
400 | + color: #b0b0b0; | ||
401 | + line-height: 40px; | ||
402 | + } | ||
403 | + } | ||
404 | + | ||
405 | + .price { | ||
406 | + width: 200px; | ||
407 | + float: left; | ||
408 | + line-height: 90px; | ||
409 | + text-align: right; | ||
410 | + font-size: 30px; | ||
411 | + } | ||
412 | + } | ||
413 | + } | ||
414 | + | ||
415 | + .ewm-bg { | ||
416 | + background-color: #333; | ||
417 | + padding: 132px 0 350px; | ||
418 | + | ||
419 | + .ewm-main { | ||
420 | + width: 600px; | ||
421 | + height: 785px; | ||
422 | + background-color: #fff; | ||
423 | + margin: 0 auto; | ||
424 | + padding-top: 50px; | ||
425 | + | ||
426 | + .user-pic { | ||
427 | + width: 100px; | ||
428 | + height: 100px; | ||
429 | + border-radius: 50%; | ||
430 | + margin: 0 auto; | ||
431 | + } | ||
432 | + | ||
433 | + p { | ||
434 | + line-height: 95px; | ||
435 | + font-size: 34px; | ||
436 | + text-align: center; | ||
437 | + } | ||
438 | + | ||
439 | + .ewm-pic { | ||
440 | + width: 420px; | ||
441 | + height: 420px; | ||
442 | + margin: 40px auto 0; | ||
443 | + | ||
444 | + canvas { | ||
445 | + width: 100%; | ||
446 | + } | ||
447 | + } | ||
448 | + } | ||
449 | + } | ||
450 | + | ||
451 | + .coupon-list { | ||
452 | + .coupon-item { | ||
453 | + margin: 18px auto 33px; | ||
454 | + width: 690px; | ||
455 | + | ||
456 | + .coupon-title { | ||
457 | + width: 690px; | ||
458 | + height: 91px; | ||
459 | + background-image: url("/activity/store-home/coupon-title.png"); | ||
460 | + background-color: #fff; | ||
461 | + font-size: 30px; | ||
462 | + color: #fff; | ||
463 | + line-height: 91px; | ||
464 | + padding: 0 30px; | ||
465 | + } | ||
466 | + | ||
467 | + .coupon-main { | ||
468 | + height: 180px; | ||
469 | + background-color: #fff; | ||
470 | + padding: 25px 0; | ||
471 | + } | ||
472 | + | ||
473 | + .left { | ||
474 | + width: 219px; | ||
475 | + float: left; | ||
476 | + border-right: solid 1px #e0e0e0; | ||
477 | + } | ||
478 | + | ||
479 | + .price { | ||
480 | + font-size: 80px; | ||
481 | + line-height: 80px; | ||
482 | + text-align: center; | ||
483 | + } | ||
484 | + | ||
485 | + .limit { | ||
486 | + font-size: 22px; | ||
487 | + color: #b0b0b0; | ||
488 | + text-align: center; | ||
489 | + line-height: 22px; | ||
490 | + margin-top: 20px; | ||
491 | + } | ||
492 | + | ||
493 | + .right { | ||
494 | + width: 470px; | ||
495 | + float: left; | ||
496 | + padding-left: 25px; | ||
497 | + font-size: 24px; | ||
498 | + line-height: 24px; | ||
499 | + } | ||
500 | + | ||
501 | + .date { | ||
502 | + font-size: 24px; | ||
503 | + margin-bottom: 75px; | ||
504 | + } | ||
505 | + | ||
506 | + .iconfont { | ||
507 | + color: #b0b0b0; | ||
508 | + } | ||
509 | + | ||
510 | + .iconfont.up { | ||
511 | + display: none; | ||
512 | + } | ||
513 | + | ||
514 | + .coupon-foot { | ||
515 | + display: none; | ||
516 | + position: relative; | ||
517 | + padding: 8px 25px; | ||
518 | + line-height: 50px; | ||
519 | + font-size: 24px; | ||
520 | + background-color: #fff; | ||
521 | + } | ||
522 | + | ||
523 | + .dot-line { | ||
524 | + div { | ||
525 | + width: 20px; | ||
526 | + height: 20px; | ||
527 | + background-color: #f0f0f0; | ||
528 | + border-radius: 50%; | ||
529 | + position: absolute; | ||
530 | + top: -20px; | ||
531 | + } | ||
532 | + | ||
533 | + p { | ||
534 | + width: 630px; | ||
535 | + border-bottom: dashed 1px #b4b4b4; | ||
536 | + position: absolute; | ||
537 | + top: -10px; | ||
538 | + } | ||
539 | + | ||
540 | + .left-dot { | ||
541 | + left: -10px; | ||
542 | + } | ||
543 | + | ||
544 | + .right-dot { | ||
545 | + right: -10px; | ||
546 | + } | ||
547 | + } | ||
548 | + } | ||
549 | + } | ||
550 | +} |
-
Please register or login to post a comment