Authored by 张丽霞

领券分享

... ... @@ -46,8 +46,10 @@ const getUserStatus = (param) => {
} else {
dest.ended = true;
}
if (param.data.newUser === 1) {
dest.newUser = true;
};
dest.message = param.data.returnMsg;
// 清空变量,释放内存
param = {};
return dest;
... ...
... ... @@ -5,8 +5,10 @@
</div>
<p class="hidden" id="orderCode">{{ordercode}}</p>
<p class="hidden" id="oldUserCouponPic">{{oldUserCouponPic}}</p>
<p class="hidden" id="newUserCouponPic">{{couponPic}}</p>
<p class="hidden" id="activityEnded">{{ended}}</p>
<p class="hidden" id="newUser">{{newUser}}</p>
<p class="hidden" id="tipMessage">{{message}}</p>
<div class="page">
<div class="gain-coupon-centent hidden">
<div class="coupon">
... ... @@ -26,13 +28,16 @@
</div>
<div class="under-title">
<div class="input-content phone-input-content">
<div class="input-content phone-input-content has-clear">
<input id="phone" type="text" placeholder="请输入手机号" maxlength="11"/>
<i class="clear-input iconfont hidden clear-mobile">&#xe626;</i>
<div>获取红包</div>
</div>
<div class="input-content vertify-input-content hidden">
<input id="verification" type="text" placeholder="请输入验证码" maxlength="4"/>
<i class="clear-input iconfont hidden clear-verify">&#xe626;</i>
<div>验证领红包</div>
</div>
... ...
... ... @@ -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();
});
... ...
... ... @@ -64,6 +64,7 @@
.input-content {
height: 206px;
margin: 30px 30px 0;
position: relative;
input {
height: 88px;
... ... @@ -95,6 +96,20 @@
color: #444;
}
}
.has-clear {
padding-right: 30px;
}
.clear-input {
position: absolute;
padding: 10px;
top: 25px;
right: 50px;
font-size: 18px;
color: #666;
z-index: 1;
}
.coupon-description {
width: 100%;
... ...