|
@@ -2,15 +2,21 @@ |
|
@@ -2,15 +2,21 @@ |
2
|
var $ = require('yoho-jquery'),
|
2
|
var $ = require('yoho-jquery'),
|
3
|
phone,
|
3
|
phone,
|
4
|
reg,
|
4
|
reg,
|
5
|
- newCoupon = true,
|
|
|
6
|
orderCode = $('#orderCode').html(),
|
5
|
orderCode = $('#orderCode').html(),
|
7
|
- oldUserCouponPic = $('#oldUserCouponPic').html();
|
6
|
+ oldUserCouponPic = $('#oldUserCouponPic').html(),
|
|
|
7
|
+ newUserCouponPic = $('#newUserCouponPic').html(),
|
|
|
8
|
+ tipMessage = $('#tipMessage').html();
|
8
|
|
9
|
|
9
|
$('#phone').bind('input propertychange', function() {
|
10
|
$('#phone').bind('input propertychange', function() {
|
10
|
if ($(this).val().length === 11) {
|
11
|
if ($(this).val().length === 11) {
|
11
|
$('.input-content div').eq('0').addClass('verification-code');
|
12
|
$('.input-content div').eq('0').addClass('verification-code');
|
12
|
} else {
|
13
|
} else {
|
13
|
$('.input-content div').eq('0').removeClass();
|
14
|
$('.input-content div').eq('0').removeClass();
|
|
|
15
|
+ if ($(this).val().length >= 1) {
|
|
|
16
|
+ $('.input-content i').eq('0').removeClass('hidden');
|
|
|
17
|
+ } else {
|
|
|
18
|
+ $('.input-content i').eq('0').addClass('hidden');
|
|
|
19
|
+ }
|
14
|
}
|
20
|
}
|
15
|
});
|
21
|
});
|
16
|
$('#verification').bind('input propertychange', function() {
|
22
|
$('#verification').bind('input propertychange', function() {
|
|
@@ -18,12 +24,17 @@ $('#verification').bind('input propertychange', function() { |
|
@@ -18,12 +24,17 @@ $('#verification').bind('input propertychange', function() { |
18
|
$('.input-content div').eq('1').addClass('get');
|
24
|
$('.input-content div').eq('1').addClass('get');
|
19
|
} else {
|
25
|
} else {
|
20
|
$('.input-content div').eq('1').removeClass();
|
26
|
$('.input-content div').eq('1').removeClass();
|
|
|
27
|
+ if ($(this).val().length >= 1) {
|
|
|
28
|
+ $('.input-content i').eq('1').removeClass('hidden');
|
|
|
29
|
+ } else {
|
|
|
30
|
+ $('.input-content i').eq('1').addClass('hidden');
|
|
|
31
|
+ }
|
21
|
}
|
32
|
}
|
22
|
});
|
33
|
});
|
23
|
|
34
|
|
24
|
if ($('#activityEnded').html()) {
|
35
|
if ($('#activityEnded').html()) {
|
25
|
$('.tip-wrap').removeClass('hidden');
|
36
|
$('.tip-wrap').removeClass('hidden');
|
26
|
- $('.tip-wrap .title').html(data.result.message);
|
37
|
+ $('.tip-wrap .title').html(tipMessage);
|
27
|
}
|
38
|
}
|
28
|
|
39
|
|
29
|
$('.input-content').on('click', '.verification-code', function() {
|
40
|
$('.input-content').on('click', '.verification-code', function() {
|
|
@@ -50,6 +61,11 @@ $('.input-content').on('click', '.verification-code', function() { |
|
@@ -50,6 +61,11 @@ $('.input-content').on('click', '.verification-code', function() { |
50
|
dataType: 'json',
|
61
|
dataType: 'json',
|
51
|
success: function(data) {
|
62
|
success: function(data) {
|
52
|
if (data.result.code === 200) {
|
63
|
if (data.result.code === 200) {
|
|
|
64
|
+ if (!data.result.newUser) {
|
|
|
65
|
+ $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
66
|
+ } else {
|
|
|
67
|
+ $('.gain-coupon-centent .coupon img').attr('src', newUserCouponPic);
|
|
|
68
|
+ }
|
53
|
if (data.result.ended) {
|
69
|
if (data.result.ended) {
|
54
|
$('.tip-wrap').removeClass('hidden');
|
70
|
$('.tip-wrap').removeClass('hidden');
|
55
|
$('.tip-wrap .title').html(data.result.message);
|
71
|
$('.tip-wrap .title').html(data.result.message);
|
|
@@ -57,10 +73,6 @@ $('.input-content').on('click', '.verification-code', function() { |
|
@@ -57,10 +73,6 @@ $('.input-content').on('click', '.verification-code', function() { |
57
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
73
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
58
|
$('.page .coupon-centent').addClass('hidden');
|
74
|
$('.page .coupon-centent').addClass('hidden');
|
59
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
75
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
60
|
- if (!newCoupon) {
|
|
|
61
|
- $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
62
|
- }
|
|
|
63
|
- newCoupon = false;
|
|
|
64
|
} else if (data.result.newUser) {
|
76
|
} else if (data.result.newUser) {
|
65
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
77
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
66
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
78
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
|
@@ -101,6 +113,11 @@ $('.input-content').on('click', '.get', function() { |
|
@@ -101,6 +113,11 @@ $('.input-content').on('click', '.get', function() { |
101
|
dataType: 'json',
|
113
|
dataType: 'json',
|
102
|
success: function(data) {
|
114
|
success: function(data) {
|
103
|
if (data.result.code === 200) {
|
115
|
if (data.result.code === 200) {
|
|
|
116
|
+ if (!data.result.newUser) {
|
|
|
117
|
+ $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
118
|
+ } else {
|
|
|
119
|
+ $('.gain-coupon-centent .coupon img').attr('src', newUserCouponPic);
|
|
|
120
|
+ }
|
104
|
if (data.result.ended) {
|
121
|
if (data.result.ended) {
|
105
|
$('.tip-wrap').removeClass('hidden');
|
122
|
$('.tip-wrap').removeClass('hidden');
|
106
|
$('.tip-wrap .title').html(data.result.message);
|
123
|
$('.tip-wrap .title').html(data.result.message);
|
|
@@ -108,10 +125,6 @@ $('.input-content').on('click', '.get', function() { |
|
@@ -108,10 +125,6 @@ $('.input-content').on('click', '.get', function() { |
108
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
125
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
109
|
$('.page .coupon-centent').addClass('hidden');
|
126
|
$('.page .coupon-centent').addClass('hidden');
|
110
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
127
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
111
|
- if (!newCoupon) {
|
|
|
112
|
- $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
113
|
- }
|
|
|
114
|
- newCoupon = false;
|
|
|
115
|
} else if (data.result.newUser) {
|
128
|
} else if (data.result.newUser) {
|
116
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
129
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
117
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
130
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
|
@@ -170,3 +183,15 @@ $('.input-content').on('click', '.get', function() { |
|
@@ -170,3 +183,15 @@ $('.input-content').on('click', '.get', function() { |
170
|
}, true);
|
183
|
}, true);
|
171
|
}
|
184
|
}
|
172
|
});
|
185
|
});
|
|
|
186
|
+
|
|
|
187
|
+$('.input-content .clear-mobile').on('click', function() {
|
|
|
188
|
+ $('.input-content input').eq('0').val('');
|
|
|
189
|
+ $(this).addClass('hidden');
|
|
|
190
|
+ $('.input-content div').eq('0').removeClass();
|
|
|
191
|
+});
|
|
|
192
|
+
|
|
|
193
|
+$('.input-content .clear-verify').on('click', function() {
|
|
|
194
|
+ $('.input-content input').eq('1').val('');
|
|
|
195
|
+ $(this).addClass('hidden');
|
|
|
196
|
+ $('.input-content div').eq('1').removeClass();
|
|
|
197
|
+}); |