ticket-ensure.js
1.27 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
/**
* @description: 订单保存
* @time: 2015/12/21
*/
var $ = require('yoho.jquery');
var dialog = require('../common/dialog');
//立即购买-门票
var TicketCat = {
el: {
$showTicketMobile: $('.show-ticket-mobile'),
$ticketMobile: $('.ticket-mobile'),
$ticketModifyBtn: $('.ticket-modify-btn'),
$setTicketMobile: $('.set-ticket-mobile'),
$ticketMobileBtn: $('.ticket-mobile-btn'),
$ticketMobileInput: $('.ticket-mobile-input')
},
init: function() {
var el = this.el;
//修改手机号按钮
el.$ticketModifyBtn.click(function() {
el.$showTicketMobile.addClass('hide');
el.$setTicketMobile.removeClass('hide');
});
//保存手机号按钮
el.$ticketMobileBtn.click(function() {
var val = el.$ticketMobileInput.val(),
phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
if (!phoneReg.test(val)) {
new dialog.Alert('请输入正确的手机号!').show();
return;
}
el.$showTicketMobile.removeClass('hide');
el.$setTicketMobile.addClass('hide');
el.$ticketMobile.text(val);
});
}
};
TicketCat.init();