Authored by 张丽霞

分享模板

1 -<div class="receive-coupon-page">  
2 - <div class="page">  
3 - <div class="coupon-header">  
4 - <img src="/activity/cocacola/images/cokeBanner.jpg">  
5 - </div>  
6 - <div class="coupon-centent">  
7 - <div class="title">  
8 - </div>  
9 -  
10 - <div>  
11 - <input id="phone" type="text" placeholder="请输入手机号" maxlength="11"/>  
12 - <span>获取红包</span>  
13 - </div>  
14 -  
15 - <div>  
16 - <input id="verification" type="text" placeholder="请输入验证码" maxlength="4"/>  
17 - <span>验证领红包</span>  
18 - </div>  
19 -  
20 - <div class="use-coupon-btn">  
21 - <img src="/activity/cocacola/images/cokefooter.jpg">  
22 - <span></span>  
23 - </div>  
24 - </div>  
25 -  
26 - </div>  
27 - <div class="messages hidden" id="dialog">  
28 - <div class="content"></div>  
29 - </div>  
30 -  
31 - <div class="keep-out hidden"></div>  
32 - <div class="dialog hidden" id="message">  
33 - <span class="close"><img src="/activity/cocacola/images/close.png"></span>  
34 - <div class="activity-message">  
35 - <h3>活动说明</h3>  
36 - <div class="message">  
37 - <P>1、活动时间:2016年4月7日到2016年7月7日</P>  
38 - <P>2、仅限新注册用户以及首次购买用户使用</P>  
39 - <P>3、同一手机号限领一次优惠券</P>  
40 - </div>  
41 - </div>  
42 - </div>  
43 -  
44 - <div class="gain">  
45 - <div class="coupon-centent">  
46 - <div class="coupon">  
47 - <img src="/activity/cocacola/images/cokeCoupon.png">  
48 - </div>  
49 - <p class="phone" id="mobile"></p>  
50 - <p>登录Yoho!Buy有货客户端即可使用</p>  
51 -  
52 - <div class="use-coupon-btn">  
53 - <img src="/activity/cocacola/images/cokeBtn.png">  
54 - </div>  
55 - <span>活动说明</span>  
56 - </div>  
57 -  
58 - </div>  
59 -</div>  
@@ -13,4 +13,5 @@ module.exports = app => { @@ -13,4 +13,5 @@ module.exports = app => {
13 13
14 // 业务模块 14 // 业务模块
15 app.use('/product', require('./apps/product')); 15 app.use('/product', require('./apps/product'));
  16 + app.use('/coupon', require('./apps/coupon'));
16 }; 17 };
1 -  
2 -var $ = require('yoho-jquery'),  
3 - num = 0,  
4 - phone,  
5 - reg,  
6 - time;  
7 -  
8 -$('#phone').bind('input propertychange', function() {  
9 - if ($(this).val().length === 11) {  
10 - $('.centent span').eq('0').addClass('verification-code');  
11 - } else {  
12 - $('.centent span').eq('0').removeClass();  
13 - }  
14 -});  
15 -$('#verification').bind('input propertychange', function() {  
16 - if ($(this).val().length === 4) {  
17 - $('.centent span').eq('1').addClass('get');  
18 - } else {  
19 - $('.centent span').eq('1').removeClass();  
20 - }  
21 -});  
22 -  
23 -$('.centent').on('click', '.verification-code', function() {  
24 - $('.centent span').eq('0').removeClass('verification-code');  
25 - phone = $(this).siblings('input').val();  
26 - reg = /[0-9]{11}/;  
27 - if (!reg.test(phone)) {  
28 - $('#dialog').removeClass('hidden');  
29 - $('.keep-out').removeClass('hidden');  
30 - $('#dialog .content').html('<p class="phone-error">手机号错误,请重新输入。<p>');  
31 - setTimeout(function() {  
32 - $('.messages').addClass('hidden');  
33 - $('.keep-out').addClass('hidden');  
34 - $('#dialog .content').html(' ');  
35 - }, 1400);  
36 - return;  
37 - }  
38 - $.ajax({  
39 - url: '/activity/cocacola/CocacolaController/sendSms',  
40 - data: {  
41 - mobile: $('#phone').val()  
42 - },  
43 - dataType: 'json',  
44 - success: function(data) {  
45 - if (data.code === 200) {  
46 - time = setInterval(function() {  
47 - num++;  
48 - if (num > 60) {  
49 - num = 0;  
50 - $('.centent span').eq('0').addClass('verification-code').html('获取验证码');  
51 - clearInterval(time);  
52 -  
53 - } else {  
54 - $('.centent span').eq('0').removeClass('verification-code').html('重新发送' + (60 - num));  
55 - }  
56 - }, 1000);  
57 - } else {  
58 - $('#dialog').removeClass('hidden');  
59 - $('.keep-out').removeClass('hidden');  
60 - $('#dialog .content').html('<p class="phone-error">' + data.message + '<p>');  
61 - setTimeout(function() {  
62 - $('.messages').addClass('hidden');  
63 - $('.keep-out').addClass('hidden');  
64 - $('#dialog .content').html(' ');  
65 - }, 1400);  
66 - }  
67 - }  
68 - });  
69 -});  
70 -$('.centent').on('click', '.get', function() {  
71 - $('.centent span').eq('1').removeClass('get');  
72 - if ($(this).siblings('input').val().length === 4) {  
73 - $.ajax({  
74 - url: '/activity/cocacola/CocacolaController/validRegCodeAndSendCode',  
75 - data: {  
76 - code: $('#verification').val(),  
77 - mobile: $('#phone').val(),  
78 - client_id: $.cookie('_yasvd')  
79 - },  
80 - dataType: 'json',  
81 - success: function(data) {  
82 - if (data.code === 200) {  
83 - location.href = 'gain.html?mobile=' + $('#phone').val();  
84 - } else {  
85 - $('#dialog').removeClass('hidden');  
86 - $('.keep-out').removeClass('hidden');  
87 - $('#dialog .content').html('<p class="phone-error">' + data.message + '<p>');  
88 - setTimeout(function() {  
89 - $('.messages').addClass('hidden');  
90 - $('.keep-out').addClass('hidden');  
91 - $('#dialog .content').html(' ');  
92 - }, 1400);  
93 - }  
94 - }  
95 - });  
96 - } else {  
97 - $('#dialog').removeClass('hidden');  
98 - $('.keep-out').removeClass('hidden');  
99 - $('#dialog .content').html('<p class="phone-error">验证码错误,请重新输入。<p>');  
100 - setTimeout(function() {  
101 - $('.messages').addClass('hidden');  
102 - $('.keep-out').addClass('hidden');  
103 - $('#dialog .content').html(' ');  
104 - }, 1400);  
105 - }  
106 -});  
107 -$('.close').on('click', function() {  
108 - $('.dialog').addClass('hidden');  
109 - $('.keep-out').addClass('hidden');  
110 - $('#dialog .content').html(' ');  
111 -});  
112 -$('.footer span').on('click', function() {  
113 - $('#message').removeClass('hidden');  
114 - $('.keep-out').removeClass('hidden');  
115 -});  
116 -  
117 -  
118 -$('.centent').on('click', '.get', function() {  
119 - if (window._yas) {  
120 - window._yas.sendCustomInfo({  
121 - receiveCoupon: 'Y'  
122 - }, true);  
123 - }  
124 -});  
@@ -5,93 +5,74 @@ @@ -5,93 +5,74 @@
5 font-size: 14px; 5 font-size: 14px;
6 } 6 }
7 7
8 - html,  
9 - body {  
10 - width: 100%;  
11 - height: 100%;  
12 - background: #e10c1e;  
13 - }  
14 -  
15 .page { 8 .page {
16 width: 100%; 9 width: 100%;
17 height: 100%; 10 height: 100%;
18 - background: #e10c1e; 11 + padding-bottom: 60px;
  12 + background: #c4211a;
19 } 13 }
20 .coupon-header { 14 .coupon-header {
21 width: 100%; 15 width: 100%;
22 - height: auto;  
23 - overflow: hidden; 16 + height: 428px;
  17 + background: url("../img/coupon/header.png");
  18 + background-size: 100%;
24 } 19 }
25 20
26 - .use-coupon-btn {  
27 - width: 100%;  
28 - height: auto;  
29 - overflow: hidden;  
30 - position: relative;  
31 - padding-bottom: 2rem; 21 + .coupon-centent,
  22 + .gain-coupon-centent {
  23 + height: 520px;
  24 + margin: 0 30px;
  25 + background: #9d1a15;
32 } 26 }
33 27
34 - .use-coupon-btn img,  
35 - .coupon-header img { 28 + .coupon-centent .title {
36 width: 100%; 29 width: 100%;
  30 + height: 111px;
  31 + background: url("../img/coupon/coupon-title.png");
37 } 32 }
38 33
39 - .use-coupon-btn span {  
40 - position: absolute;  
41 - bottom: 0;  
42 - left: 40%;  
43 - width: 20%;  
44 - height: 2rem; 34 + .coupon-centent .input-content {
  35 + height: 206px;
  36 + margin: 30px 30px 0;
45 } 37 }
46 38
47 - .coupon-centent { 39 + .coupon-centent .input-content input {
  40 + height: 88px;
48 width: 100%; 41 width: 100%;
49 - height: auto;  
50 - overflow: hidden;  
51 - padding-top: 2.4rem;  
52 - background: #e10c1e;  
53 - }  
54 -  
55 - .coupon-centent div {  
56 - width: 81.25%;  
57 - height: 4rem;  
58 - overflow: hidden;  
59 - margin: 0 auto;  
60 - padding-bottom: 1rem;  
61 - }  
62 -  
63 - .coupon-centent input {  
64 - width: 68%;  
65 - height: 3.6rem;  
66 - overflow: hidden; 42 + margin-bottom: 30px;
67 border: 1px solid #fff; 43 border: 1px solid #fff;
68 - border-right: none;  
69 - background: none;  
70 font-size: 18px; 44 font-size: 18px;
71 color: #fff; 45 color: #fff;
72 - float: left;  
73 - box-sizing: border-box;  
74 - border-radius: 0.3rem 0 0 0.3rem; 46 + background: #9d1a15;
  47 + border-radius: 0.3rem;
75 text-align: center; 48 text-align: center;
76 outline: none; 49 outline: none;
77 } 50 }
78 51
79 - .coupon-centent span {  
80 - width: 30%;  
81 - height: 3.6rem;  
82 - float: left;  
83 - line-height: 3.6rem; 52 + .coupon-centent .input-content div {
  53 + height: 88px;
  54 + width: 100%;
84 text-align: center; 55 text-align: center;
85 - font-size: 1em;  
86 - border-radius: 0 0.3rem 0.3rem 0;  
87 - background: #b0b0b0;  
88 - color: #e0e0e0; 56 + font-size: 18px;
  57 + border-radius: 0.3rem;
  58 + background: #fff;
  59 + color: #444;
  60 + line-height: 88px;
89 } 61 }
90 62
91 - .coupon-centent .verification-code,  
92 - .coupon-centent .get {  
93 - background: #fff;  
94 - color: #000; 63 + .coupon-description {
  64 + width: 100%;
  65 + height: 173px;
  66 + position: relative;
  67 + background: url("../img/coupon/coupon-footer.png");
  68 + }
  69 +
  70 + .coupon-description span {
  71 + position: absolute;
  72 + bottom: 0;
  73 + left: 40%;
  74 + width: 20%;
  75 + height: 2rem;
95 } 76 }
96 77
97 .gain-coupon-centent { 78 .gain-coupon-centent {
@@ -124,6 +105,7 @@ @@ -124,6 +105,7 @@
124 height: auto; 105 height: auto;
125 overflow: hidden; 106 overflow: hidden;
126 margin: 0 auto; 107 margin: 0 auto;
  108 + background: url("../img/coupon/close.png");
127 } 109 }
128 110
129 .coupon img { 111 .coupon img {
@@ -144,24 +126,19 @@ @@ -144,24 +126,19 @@
144 } 126 }
145 127
146 .dialog .close { 128 .dialog .close {
147 - width: 1.4rem;  
148 - height: 1.4rem; 129 + width: 40px;
  130 + height: 40px;
149 overflow: hidden; 131 overflow: hidden;
150 - background: #444; 132 + background: url("../img/coupon/close.png");
151 color: #f1f1f1; 133 color: #f1f1f1;
152 - border-radius: 50%; 134 + border-radius: 20px;
153 position: absolute; 135 position: absolute;
154 - top: -0.5rem;  
155 - right: -0.5rem;  
156 - line-height: 1.4rem; 136 + top: -20px;
  137 + right: -20px;
  138 + line-height: 40px;
157 text-align: center; 139 text-align: center;
158 } 140 }
159 141
160 - .dialog .close img {  
161 - width: 100%;  
162 - height: auto;  
163 - }  
164 -  
165 .use-coupon-btn .btn { 142 .use-coupon-btn .btn {
166 width: 75.25%; 143 width: 75.25%;
167 height: auto; 144 height: auto;
@@ -9,3 +9,4 @@ @@ -9,3 +9,4 @@
9 @import "product/index"; 9 @import "product/index";
10 @import "common/index"; 10 @import "common/index";
11 @import "cart/chose-panel"; 11 @import "cart/chose-panel";
  12 +@import "coupon/index";