|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
num = 0,
|
|
|
phone,
|
|
|
reg,
|
|
|
time;
|
|
|
reg;
|
|
|
|
|
|
var orderCode = $('#orderCode').html();
|
|
|
|
|
|
$('#phone').bind('input propertychange', function() {
|
|
|
if ($(this).val().length === 11) {
|
...
|
...
|
@@ -36,28 +36,38 @@ $('.input-content').on('click', '.verification-code', function() { |
|
|
return;
|
|
|
}
|
|
|
$.ajax({
|
|
|
url: '/activity/cocacola/CocacolaController/sendSms',
|
|
|
url: '/coupon/phone',
|
|
|
data: {
|
|
|
mobile: $('#phone').val()
|
|
|
mobile: $('#phone').val(),
|
|
|
ordercode: orderCode
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
time = setInterval(function() {
|
|
|
num++;
|
|
|
if (num > 60) {
|
|
|
num = 0;
|
|
|
$('.input-content div').eq('0').addClass('verification-code').html('获取验证码');
|
|
|
clearInterval(time);
|
|
|
|
|
|
} else {
|
|
|
$('.input-content div').eq('0').removeClass('verification-code').html('重新发送' + (60 - num));
|
|
|
}
|
|
|
}, 1000);
|
|
|
if (data.result.code === 200) {
|
|
|
if (data.result.ended) {
|
|
|
$('.tip-wrap').removeClass('hidden');
|
|
|
$('.tip-wrap .title').html(data.result.message);
|
|
|
} else if (data.result.geted) {
|
|
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
|
|
$('.page .coupon-centent').addClass('hidden');
|
|
|
} else if (data.result.newUser) {
|
|
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
|
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
|
|
} else if (data.result.wrongNumb) {
|
|
|
$('#dialog').removeClass('hidden');
|
|
|
$('.keep-out').removeClass('hidden');
|
|
|
$('#dialog .content').html('<p class="phone-error">手机号错误,请重新输入。<p>');
|
|
|
setTimeout(function() {
|
|
|
$('.messages').addClass('hidden');
|
|
|
$('.keep-out').addClass('hidden');
|
|
|
$('#dialog .content').html(' ');
|
|
|
}, 1400);
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
$('#dialog').removeClass('hidden');
|
|
|
$('.keep-out').removeClass('hidden');
|
|
|
$('#dialog .content').html('<p class="phone-error">' + data.message + '<p>');
|
|
|
$('#dialog .content').html('<p class="phone-error">' + 网络错误 + '<p>');
|
|
|
setTimeout(function() {
|
|
|
$('.messages').addClass('hidden');
|
|
|
$('.keep-out').addClass('hidden');
|
...
|
...
|
@@ -71,20 +81,39 @@ $('.input-content').on('click', '.get', function() { |
|
|
$('.input-content div').eq('1').removeClass('get');
|
|
|
if ($(this).siblings('input').val().length === 4) {
|
|
|
$.ajax({
|
|
|
url: '/activity/cocacola/CocacolaController/validRegCodeAndSendCode',
|
|
|
url: '/coupon/verify',
|
|
|
data: {
|
|
|
code: $('#verification').val(),
|
|
|
identifycode: $('#verification').val(),
|
|
|
mobile: $('#phone').val(),
|
|
|
client_id: $.cookie('_yasvd')
|
|
|
ordercode: orderCode
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
location.href = 'gain.html?mobile=' + $('#phone').val();
|
|
|
if (data.result.code === 200) {
|
|
|
if (data.result.ended) {
|
|
|
$('.tip-wrap').removeClass('hidden');
|
|
|
$('.tip-wrap .title').html(data.result.message);
|
|
|
} else if (data.result.geted) {
|
|
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
|
|
$('.page .coupon-centent').addClass('hidden');
|
|
|
} else if (data.result.newUser) {
|
|
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
|
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
|
|
} else if (data.result.wrongNumb) {
|
|
|
$('#dialog').removeClass('hidden');
|
|
|
$('.keep-out').removeClass('hidden');
|
|
|
$('#dialog .content').html('<p class="phone-error">手机号错误,请重新输入。<p>');
|
|
|
setTimeout(function() {
|
|
|
$('.messages').addClass('hidden');
|
|
|
$('.keep-out').addClass('hidden');
|
|
|
$('#dialog .content').html(' ');
|
|
|
}, 1400);
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
$('#dialog').removeClass('hidden');
|
|
|
$('.keep-out').removeClass('hidden');
|
|
|
$('#dialog .content').html('<p class="phone-error">' + data.message + '<p>');
|
|
|
$('#dialog .content').html('<p class="phone-error">' + data.result.message + '<p>');
|
|
|
setTimeout(function() {
|
|
|
$('.messages').addClass('hidden');
|
|
|
$('.keep-out').addClass('hidden');
|
...
|
...
|
|