...
|
...
|
@@ -2,15 +2,21 @@ |
|
|
var $ = require('yoho-jquery'),
|
|
|
phone,
|
|
|
reg,
|
|
|
newCoupon = true,
|
|
|
orderCode = $('#orderCode').html(),
|
|
|
oldUserCouponPic = $('#oldUserCouponPic').html();
|
|
|
oldUserCouponPic = $('#oldUserCouponPic').html(),
|
|
|
newUserCouponPic = $('#newUserCouponPic').html(),
|
|
|
tipMessage = $('#tipMessage').html();
|
|
|
|
|
|
$('#phone').bind('input propertychange', function() {
|
|
|
if ($(this).val().length === 11) {
|
|
|
$('.input-content div').eq('0').addClass('verification-code');
|
|
|
} else {
|
|
|
$('.input-content div').eq('0').removeClass();
|
|
|
if ($(this).val().length >= 1) {
|
|
|
$('.input-content i').eq('0').removeClass('hidden');
|
|
|
} else {
|
|
|
$('.input-content i').eq('0').addClass('hidden');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
$('#verification').bind('input propertychange', function() {
|
...
|
...
|
@@ -18,12 +24,17 @@ $('#verification').bind('input propertychange', function() { |
|
|
$('.input-content div').eq('1').addClass('get');
|
|
|
} else {
|
|
|
$('.input-content div').eq('1').removeClass();
|
|
|
if ($(this).val().length >= 1) {
|
|
|
$('.input-content i').eq('1').removeClass('hidden');
|
|
|
} else {
|
|
|
$('.input-content i').eq('1').addClass('hidden');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if ($('#activityEnded').html()) {
|
|
|
$('.tip-wrap').removeClass('hidden');
|
|
|
$('.tip-wrap .title').html(data.result.message);
|
|
|
$('.tip-wrap .title').html(tipMessage);
|
|
|
}
|
|
|
|
|
|
$('.input-content').on('click', '.verification-code', function() {
|
...
|
...
|
@@ -50,6 +61,11 @@ $('.input-content').on('click', '.verification-code', function() { |
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
if (data.result.code === 200) {
|
|
|
if (!data.result.newUser) {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
} else {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', newUserCouponPic);
|
|
|
}
|
|
|
if (data.result.ended) {
|
|
|
$('.tip-wrap').removeClass('hidden');
|
|
|
$('.tip-wrap .title').html(data.result.message);
|
...
|
...
|
@@ -57,10 +73,6 @@ $('.input-content').on('click', '.verification-code', function() { |
|
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
|
|
$('.page .coupon-centent').addClass('hidden');
|
|
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
|
|
if (!newCoupon) {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
}
|
|
|
newCoupon = false;
|
|
|
} else if (data.result.newUser) {
|
|
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
|
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
...
|
...
|
@@ -101,6 +113,11 @@ $('.input-content').on('click', '.get', function() { |
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
if (data.result.code === 200) {
|
|
|
if (!data.result.newUser) {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
} else {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', newUserCouponPic);
|
|
|
}
|
|
|
if (data.result.ended) {
|
|
|
$('.tip-wrap').removeClass('hidden');
|
|
|
$('.tip-wrap .title').html(data.result.message);
|
...
|
...
|
@@ -108,10 +125,6 @@ $('.input-content').on('click', '.get', function() { |
|
|
$('.page .gain-coupon-centent').removeClass('hidden');
|
|
|
$('.page .coupon-centent').addClass('hidden');
|
|
|
$('#mobile').html('优惠券已发放至账户' + data.result.mobile);
|
|
|
if (!newCoupon) {
|
|
|
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
|
|
|
}
|
|
|
newCoupon = false;
|
|
|
} else if (data.result.newUser) {
|
|
|
$('.coupon-centent .phone-input-content').addClass('hidden');
|
|
|
$('.coupon-centent .vertify-input-content').removeClass('hidden');
|
...
|
...
|
@@ -170,3 +183,15 @@ $('.input-content').on('click', '.get', function() { |
|
|
}, true);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('.input-content .clear-mobile').on('click', function() {
|
|
|
$('.input-content input').eq('0').val('');
|
|
|
$(this).addClass('hidden');
|
|
|
$('.input-content div').eq('0').removeClass();
|
|
|
});
|
|
|
|
|
|
$('.input-content .clear-verify').on('click', function() {
|
|
|
$('.input-content input').eq('1').val('');
|
|
|
$(this).addClass('hidden');
|
|
|
$('.input-content div').eq('1').removeClass();
|
|
|
}); |
...
|
...
|
|