me-gift.page.js
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
var $ = require('yoho-jquery'),
Hbs = require('yoho-handlebars'),
dialog = require('../common/dialog');
var meGift = {
// 验证邮箱模板
emailTpl: Hbs.compile($('#verify-email-tpl').html()),
// 绑定手机模板
mobileTpl: Hbs.compile($('#verify-mobile-tpl').html()),
// 激活礼品卡模板
giftTpl: Hbs.compile($('#activate-gift-tpl').html()),
// 添加礼品卡按钮
$addGift: $('.add-gift'),
init: function() {
var that = this;
this.$addGift.click(function() {
that.verifyEmailCode();
});
},
// 我的礼品卡列表
getList: function() {
},
// 礼品卡详情列表
detailList: function() {
},
// 获取邮箱验证码
getEmailCode: function() {
},
// 效验邮箱验证码
verifyEmailCode: function() {
var that = this;
var dg = new dialog.Dialog({
content: that.emailTpl({}),
className: 'me-gift-confirm',
btns: [{
id: 'confirm-email-btn',
name: '绑定手机号',
btnClass: ['alert-sure'],
cb: function() {
that.getMobileCode();
dg.close();
}
}]
}).show();
},
// 获取手机验证码
getMobileCode: function() {
var that = this;
var dg = new dialog.Dialog({
content: that.mobileTpl({}),
className: 'me-gift-confirm',
btns: [{
id: 'confirm-mobile-cancel',
name: '取消',
btnClass: ['confirm-cancel'],
cb: function() {
dg.close();
}
}, {
id: 'confirm-mobile-sure',
name: '激活',
btnClass: ['confirm-sure'],
cb: function() {
that.activateGift();
dg.close();
}
}]
}).show();
},
// 效验手机验证码并激活
verifyMobileCode: function() {
},
// 激活礼品卡
activateGift: function() {
var that = this;
var dg = new dialog.Dialog({
content: that.giftTpl({}),
className: 'me-gift-confirm',
btns: [{
id: 'confirm-gift-cancel',
name: '取消',
btnClass: ['confirm-cancel'],
cb: function() {
dg.close();
}
}, {
id: 'confirm-gift-sure',
name: '激活',
btnClass: ['confirm-sure'],
cb: function() {
that.meAlert('<p>您的礼品卡激活成功</p><p>请尽情享用</p>');
dg.close();
}
}]
}).show();
},
// 我的弹框
meAlert: function(content) {
let dg = new dialog.Dialog({
content: content,
className: 'me-gift-alert',
btns: [{
name: '我知道了',
btnClass: ['btn-close', 'alert-sure'],
cb: function() {
dg.close();
}
}]
}).show();
}
};
$(function() {
meGift.init();
});