Authored by 张丽霞

领券分享

@@ -46,8 +46,10 @@ const getUserStatus = (param) => { @@ -46,8 +46,10 @@ const getUserStatus = (param) => {
46 } else { 46 } else {
47 dest.ended = true; 47 dest.ended = true;
48 } 48 }
  49 + if (param.data.newUser === 1) {
  50 + dest.newUser = true;
  51 + };
49 dest.message = param.data.returnMsg; 52 dest.message = param.data.returnMsg;
50 -  
51 // 清空变量,释放内存 53 // 清空变量,释放内存
52 param = {}; 54 param = {};
53 return dest; 55 return dest;
@@ -5,8 +5,10 @@ @@ -5,8 +5,10 @@
5 </div> 5 </div>
6 <p class="hidden" id="orderCode">{{ordercode}}</p> 6 <p class="hidden" id="orderCode">{{ordercode}}</p>
7 <p class="hidden" id="oldUserCouponPic">{{oldUserCouponPic}}</p> 7 <p class="hidden" id="oldUserCouponPic">{{oldUserCouponPic}}</p>
  8 + <p class="hidden" id="newUserCouponPic">{{couponPic}}</p>
8 <p class="hidden" id="activityEnded">{{ended}}</p> 9 <p class="hidden" id="activityEnded">{{ended}}</p>
9 - 10 + <p class="hidden" id="newUser">{{newUser}}</p>
  11 + <p class="hidden" id="tipMessage">{{message}}</p>
10 <div class="page"> 12 <div class="page">
11 <div class="gain-coupon-centent hidden"> 13 <div class="gain-coupon-centent hidden">
12 <div class="coupon"> 14 <div class="coupon">
@@ -26,13 +28,16 @@ @@ -26,13 +28,16 @@
26 </div> 28 </div>
27 29
28 <div class="under-title"> 30 <div class="under-title">
29 - <div class="input-content phone-input-content"> 31 + <div class="input-content phone-input-content has-clear">
30 <input id="phone" type="text" placeholder="请输入手机号" maxlength="11"/> 32 <input id="phone" type="text" placeholder="请输入手机号" maxlength="11"/>
  33 + <i class="clear-input iconfont hidden clear-mobile">&#xe626;</i>
  34 +
31 <div>获取红包</div> 35 <div>获取红包</div>
32 </div> 36 </div>
33 37
34 <div class="input-content vertify-input-content hidden"> 38 <div class="input-content vertify-input-content hidden">
35 <input id="verification" type="text" placeholder="请输入验证码" maxlength="4"/> 39 <input id="verification" type="text" placeholder="请输入验证码" maxlength="4"/>
  40 + <i class="clear-input iconfont hidden clear-verify">&#xe626;</i>
36 <div>验证领红包</div> 41 <div>验证领红包</div>
37 </div> 42 </div>
38 43
@@ -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 +});
@@ -64,6 +64,7 @@ @@ -64,6 +64,7 @@
64 .input-content { 64 .input-content {
65 height: 206px; 65 height: 206px;
66 margin: 30px 30px 0; 66 margin: 30px 30px 0;
  67 + position: relative;
67 68
68 input { 69 input {
69 height: 88px; 70 height: 88px;
@@ -95,6 +96,20 @@ @@ -95,6 +96,20 @@
95 color: #444; 96 color: #444;
96 } 97 }
97 } 98 }
  99 +
  100 + .has-clear {
  101 + padding-right: 30px;
  102 + }
  103 +
  104 + .clear-input {
  105 + position: absolute;
  106 + padding: 10px;
  107 + top: 25px;
  108 + right: 50px;
  109 + font-size: 18px;
  110 + color: #666;
  111 + z-index: 1;
  112 + }
98 113
99 .coupon-description { 114 .coupon-description {
100 width: 100%; 115 width: 100%;