Authored by wangxin

活动内容修改

@@ -208,5 +208,25 @@ public class OrderShareActivityBO extends BaseModel{ @@ -208,5 +208,25 @@ public class OrderShareActivityBO extends BaseModel{
208 public void setOldUserCouponPic(String oldUserCouponPic) { 208 public void setOldUserCouponPic(String oldUserCouponPic) {
209 this.oldUserCouponPic = oldUserCouponPic; 209 this.oldUserCouponPic = oldUserCouponPic;
210 } 210 }
211 - 211 +
  212 + public String getFormatActivityDesc() {
  213 + if (null == activityDesc) {
  214 + return "";
  215 + }
  216 +
  217 + String[] array = activityDesc.split("(\\r\\n|\\r|\\n|\\n\\r)");
  218 + if (array.length > 0) {
  219 + StringBuffer sb = new StringBuffer();
  220 +
  221 + for(String s : array) {
  222 + sb.append("<P>");
  223 + sb.append(s);
  224 + sb.append("</P>");
  225 + }
  226 +
  227 + return sb.toString();
  228 + }
  229 +
  230 + return "";
  231 + }
212 } 232 }
@@ -33,4 +33,26 @@ public class TencentMktBO extends TencentMktActivityBO{ @@ -33,4 +33,26 @@ public class TencentMktBO extends TencentMktActivityBO{
33 public void setShareUrl(String shareUrl) { 33 public void setShareUrl(String shareUrl) {
34 this.shareUrl = shareUrl; 34 this.shareUrl = shareUrl;
35 } 35 }
  36 +
  37 + public String getFormatActivityDesc() {
  38 + String activityDesc = getActivityDesc();
  39 + if (null == activityDesc) {
  40 + return "";
  41 + }
  42 +
  43 + String[] array = activityDesc.split("(\\r\\n|\\r|\\n|\\n\\r)");
  44 + if (array.length > 0) {
  45 + StringBuffer sb = new StringBuffer();
  46 +
  47 + for(String s : array) {
  48 + sb.append("<P>");
  49 + sb.append(s);
  50 + sb.append("</P>");
  51 + }
  52 +
  53 + return sb.toString();
  54 + }
  55 +
  56 + return "";
  57 + }
36 } 58 }
@@ -17,5 +17,5 @@ public interface IOrderShareCouponDAO { @@ -17,5 +17,5 @@ public interface IOrderShareCouponDAO {
17 17
18 int updateByPrimaryKey(OrderShareCoupon record); 18 int updateByPrimaryKey(OrderShareCoupon record);
19 19
20 - OrderShareCoupon selectCouponByDateAndType(@Param("useDate") String useDate, @Param("couponType") int couponType); 20 + OrderShareCoupon selectCouponByDateAndType(@Param("useDate") String useDate, @Param("couponType") int couponType, @Param("activityId") int activityId);
21 } 21 }
@@ -2,7 +2,7 @@ package com.yoho.coupon.dal.model; @@ -2,7 +2,7 @@ package com.yoho.coupon.dal.model;
2 2
3 import com.yoho.queue.dal.model.BaseModel; 3 import com.yoho.queue.dal.model.BaseModel;
4 4
5 -public class OrderShareCoupon extends BaseModel { 5 + public class OrderShareCoupon extends BaseModel {
6 /** 6 /**
7 * 7 *
8 */ 8 */
@@ -18,6 +18,10 @@ public class OrderShareCoupon extends BaseModel { @@ -18,6 +18,10 @@ public class OrderShareCoupon extends BaseModel {
18 18
19 private Integer couponType; 19 private Integer couponType;
20 20
  21 + private Integer activityId;
  22 +
  23 + private String couponPic;
  24 +
21 public Integer getId() { 25 public Integer getId() {
22 return id; 26 return id;
23 } 27 }
@@ -57,4 +61,20 @@ public class OrderShareCoupon extends BaseModel { @@ -57,4 +61,20 @@ public class OrderShareCoupon extends BaseModel {
57 public void setCouponType(Integer couponType) { 61 public void setCouponType(Integer couponType) {
58 this.couponType = couponType; 62 this.couponType = couponType;
59 } 63 }
  64 +
  65 + public Integer getActivityId() {
  66 + return activityId;
  67 + }
  68 +
  69 + public void setActivityId(Integer activityId) {
  70 + this.activityId = activityId;
  71 + }
  72 +
  73 + public String getCouponPic() {
  74 + return couponPic;
  75 + }
  76 +
  77 + public void setCouponPic(String couponPic) {
  78 + this.couponPic = couponPic;
  79 + }
60 } 80 }
@@ -7,9 +7,11 @@ @@ -7,9 +7,11 @@
7 <result column="coupon_name" property="couponName" jdbcType="VARCHAR" /> 7 <result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
8 <result column="use_date" property="useDate" jdbcType="VARCHAR" /> 8 <result column="use_date" property="useDate" jdbcType="VARCHAR" />
9 <result column="coupon_type" property="couponType" jdbcType="TINYINT" /> 9 <result column="coupon_type" property="couponType" jdbcType="TINYINT" />
  10 + <result column="activity_id" property="activityId" jdbcType="INTEGER" />
  11 + <result column="coupon_pic" property="couponPic" jdbcType="VARCHAR" />
10 </resultMap> 12 </resultMap>
11 <sql id="Base_Column_List"> 13 <sql id="Base_Column_List">
12 - id, coupon_id, coupon_name, use_date, coupon_type 14 + id, coupon_id, coupon_name, use_date, coupon_type,activity_id,coupon_pic
13 </sql> 15 </sql>
14 <select id="selectByPrimaryKey" resultMap="BaseResultMap" 16 <select id="selectByPrimaryKey" resultMap="BaseResultMap"
15 parameterType="java.lang.Integer"> 17 parameterType="java.lang.Integer">
@@ -19,7 +21,7 @@ @@ -19,7 +21,7 @@
19 where id = #{id,jdbcType=INTEGER} 21 where id = #{id,jdbcType=INTEGER}
20 </select> 22 </select>
21 <select id="selectCouponByDateAndType" resultMap="BaseResultMap"> 23 <select id="selectCouponByDateAndType" resultMap="BaseResultMap">
22 - select * from order_share_coupon where 1=1 24 + select * from order_share_coupon where activity_id=#{activityId}
23 <if test="useDate != null"> 25 <if test="useDate != null">
24 and use_date=#{useDate} 26 and use_date=#{useDate}
25 </if> 27 </if>
@@ -105,6 +105,16 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -105,6 +105,16 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
105 } 105 }
106 106
107 activityBO = OrderShareActivityConvert.db2bo(db); 107 activityBO = OrderShareActivityConvert.db2bo(db);
  108 + //重新设置新老用户券
  109 + OrderShareCoupon newCoupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW, activityBO.getId());
  110 + if (null != newCoupon) {
  111 + activityBO.setCouponPic(newCoupon.getCouponPic());
  112 + }
  113 + OrderShareCoupon oldCoupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD, activityBO.getId());
  114 + if (null != oldCoupon) {
  115 + activityBO.setOldUserCouponPic(oldCoupon.getCouponPic());
  116 + }
  117 +
108 yhValueOperations.set(ORDER_SHARE_ACTIVITY_CACHEKEY, CacheKeyHelper.value2String(activityBO)); 118 yhValueOperations.set(ORDER_SHARE_ACTIVITY_CACHEKEY, CacheKeyHelper.value2String(activityBO));
109 yHRedisTemplate.longExpire(ORDER_SHARE_ACTIVITY_CACHEKEY, 1, TimeUnit.MINUTES); 119 yHRedisTemplate.longExpire(ORDER_SHARE_ACTIVITY_CACHEKEY, 1, TimeUnit.MINUTES);
110 120
@@ -306,7 +316,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -306,7 +316,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
306 316
307 // 发送优惠券 317 // 发送优惠券
308 // 获取老人优惠券 318 // 获取老人优惠券
309 - OrderShareCouponVO couponVO = drawCoupon(profileInfo.getUid(), Constant.ORDER_SHARE_USERTYPE_OLD); 319 + OrderShareCouponVO couponVO = drawCoupon(profileInfo.getUid(), Constant.ORDER_SHARE_USERTYPE_OLD, activityInfo.getId());
310 if (!couponVO.isDrawCouponSuccess()) { 320 if (!couponVO.isDrawCouponSuccess()) {
311 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR); 321 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR);
312 respBO.setReturnMsg("优惠券已被抢光"); 322 respBO.setReturnMsg("优惠券已被抢光");
@@ -364,7 +374,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -364,7 +374,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
364 374
365 // 3、发送优惠券 375 // 3、发送优惠券
366 // 获取新人优惠券 376 // 获取新人优惠券
367 - OrderShareCouponVO couponVO = drawCoupon(model.getUid(), Constant.ORDER_SHARE_USERTYPE_NEW); 377 + OrderShareCouponVO couponVO = drawCoupon(model.getUid(), Constant.ORDER_SHARE_USERTYPE_NEW, activityInfo.getId());
368 if (!couponVO.isDrawCouponSuccess()) { 378 if (!couponVO.isDrawCouponSuccess()) {
369 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR); 379 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR);
370 respBO.setReturnMsg("优惠券已被抢光"); 380 respBO.setReturnMsg("优惠券已被抢光");
@@ -507,17 +517,17 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -507,17 +517,17 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
507 * @param userType 517 * @param userType
508 * @return 518 * @return
509 */ 519 */
510 - private OrderShareCouponVO drawCoupon(int uid, int userType) { 520 + private OrderShareCouponVO drawCoupon(int uid, int userType, int activityId) {
511 log.info("draw orderShare coupon: uid: {}, userType: {}", uid, userType); 521 log.info("draw orderShare coupon: uid: {}, userType: {}", uid, userType);
512 OrderShareCouponVO couponVO = new OrderShareCouponVO(); 522 OrderShareCouponVO couponVO = new OrderShareCouponVO();
513 523
514 //新人券、老人全不一样 524 //新人券、老人全不一样
515 OrderShareCoupon coupon = null; 525 OrderShareCoupon coupon = null;
516 if(userType == Constant.ORDER_SHARE_USERTYPE_OLD) { 526 if(userType == Constant.ORDER_SHARE_USERTYPE_OLD) {
517 - coupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD); 527 + coupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD, activityId);
518 } 528 }
519 else if(userType == Constant.ORDER_SHARE_USERTYPE_NEW) { 529 else if(userType == Constant.ORDER_SHARE_USERTYPE_NEW) {
520 - coupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW); 530 + coupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW, activityId);
521 } 531 }
522 532
523 if(coupon == null) { 533 if(coupon == null) {
@@ -84,7 +84,8 @@ @@ -84,7 +84,8 @@
84 84
85 <div class="receive-coupon-page"> 85 <div class="receive-coupon-page">
86 <div class="bg-contain"> 86 <div class="bg-contain">
87 - <img src="http://img11.static.yhbimg.com/yhb-img01/2016/06/17/16/019b5b887d2e78098f9448927df3427da4.png"> 87 + <img class="img1" src="http://img11.static.yhbimg.com/yhb-img01/2016/06/17/16/019b5b887d2e78098f9448927df3427da4.png">
  88 + <img class="img2">
88 </div> 89 </div>
89 <p class="hidden" id="activityEnded"></p> 90 <p class="hidden" id="activityEnded"></p>
90 <p class="hidden" id="newUser"></p> 91 <p class="hidden" id="newUser"></p>
@@ -164,7 +165,13 @@ @@ -164,7 +165,13 @@
164 <div class="mask hidden"></div> 165 <div class="mask hidden"></div>
165 <div class="dialog hidden" id="message"> 166 <div class="dialog hidden" id="message">
166 <span class="close"></span> 167 <span class="close"></span>
167 - <span id="activityDesc"></span> 168 + <span id="activityDesc">
  169 + <div class="activity-message">
  170 + <h3>活动说明</h3>
  171 + <div class="message">
  172 + </div>
  173 + </div>
  174 + </span>
168 </div> 175 </div>
169 176
170 177
1 -  
2 -  
3 - var tipMessage = $('#tipMessage').html();  
4 - var activityID = $('#activityID').html();  
5 - $('#phone').bind('input propertychange', function() {  
6 - if ($(this).val().length === 11) {  
7 - $('.input-content div').eq('0').addClass('verification-code');  
8 - } else {  
9 - $('.input-content div').eq('0').removeClass();  
10 - if ($(this).val().length >= 1) {  
11 - $('.input-content i').eq('0').removeClass('hidden');  
12 - } else {  
13 - $('.input-content i').eq('0').addClass('hidden');  
14 - }  
15 - }  
16 - });  
17 - $('#verification').bind('input propertychange', function() {  
18 - if ($(this).val().length === 4) {  
19 - $('.input-content div').eq('1').addClass('get');  
20 - } else {  
21 - $('.input-content div').eq('1').removeClass();  
22 - if ($(this).val().length >= 1) {  
23 - $('.input-content i').eq('1').removeClass('hidden');  
24 - } else {  
25 - $('.input-content i').eq('1').addClass('hidden');  
26 - }  
27 - }  
28 - });  
29 -  
30 - if ($('#activityEnded').html()) {  
31 - $('.tip-wrap').removeClass('hidden');  
32 - $('.tip-wrap .title').html(tipMessage); 1 +var tipMessage = $('#tipMessage').html();
  2 +var activityID = $('#activityID').html();
  3 +$('#phone').bind('input propertychange', function() {
  4 + if ($(this).val().length === 11) {
  5 + $('.input-content div').eq('0').addClass('verification-code');
  6 + } else {
  7 + $('.input-content div').eq('0').removeClass();
  8 + if ($(this).val().length >= 1) {
  9 + $('.input-content i').eq('0').removeClass('hidden');
  10 + } else {
  11 + $('.input-content i').eq('0').addClass('hidden');
33 } 12 }
34 -  
35 -  
36 - function showToast(messages, time) {  
37 - $('#dialog').removeClass('hidden');  
38 - $('.mask').removeClass('hidden');  
39 - $('#dialog .content').html('<p class="phone-error">' + messages + '<p>');  
40 - setTimeout(function() {  
41 - $('.messages').addClass('hidden');  
42 - $('.mask').addClass('hidden');  
43 - $('#dialog .content').html(' ');  
44 - }, time); 13 + }
  14 +});
  15 +$('#verification').bind('input propertychange', function() {
  16 + if ($(this).val().length === 4) {
  17 + $('.input-content div').eq('1').addClass('get');
  18 + } else {
  19 + $('.input-content div').eq('1').removeClass();
  20 + if ($(this).val().length >= 1) {
  21 + $('.input-content i').eq('1').removeClass('hidden');
  22 + } else {
  23 + $('.input-content i').eq('1').addClass('hidden');
45 } 24 }
46 -  
47 - $(function(){  
48 -  
49 - $.ajax({  
50 - url: '/activity/tencentMkt/TencentMktController/getActivityInfo',  
51 - data: {  
52 - activityCode: activityCode  
53 - },  
54 - success: function(data) {  
55 - data = getPageInfo(data);  
56 -  
57 - if (data.code === 200 || data.code === 502 || data.code === 503) {  
58 - /*if (window._yas) {  
59 - window._yas.sendCustomInfo({  
60 - activityID: activityID,  
61 - returnCode: data.returnCode  
62 - }, false);  
63 - }*/  
64 - if (data.code === 200) {  
65 - $('.receive-coupon-page .bg-contain img').attr('src', data.bgImg);  
66 - $('.gain-coupon-centent .coupon img').attr('src', data.couponPic);  
67 - $('#activityEnded').text(data.ended);  
68 - $('#newUser').text(data.newUser);  
69 - $('#tipMessage').text(data.message);  
70 - $('#activityID').text(data.activityID);  
71 - $('#shareTitle').val(data.shareTitle);  
72 - $('#shareDesc').val(data.shareDesc);  
73 - $('#shareImg').val(data.shareImg);  
74 - $('#shareLink').val(data.shareLink);  
75 - $('#activityCode').val(data.activityCode);  
76 - $('.gain-coupon-centent .use-coupon-btn .use-coupon').attr('href', data.buttonLink);  
77 - $('.gain-coupon-centent .go-wep').attr('href', data.pcLink);  
78 - $('.tip .title').html(data.message);  
79 - $('#activityDesc').html(data.activityDesc);  
80 - if(data.ended) {  
81 - $('.tip-wrap').removeClass('hidden');  
82 - $('.tip-wrap .title').html(data.message);  
83 - }  
84 - } else {  
85 - showToast(data.message, 1400);  
86 - } 25 + }
  26 +});
  27 +
  28 +if ($('#activityEnded').html()) {
  29 + $('.tip-wrap').removeClass('hidden');
  30 + $('.tip-wrap .title').html(tipMessage);
  31 +}
  32 +
  33 +
  34 +function showToast(messages, time) {
  35 + $('#dialog').removeClass('hidden');
  36 + $('.mask').removeClass('hidden');
  37 + $('#dialog .content').html('<p class="phone-error">' + messages + '<p>');
  38 + setTimeout(function() {
  39 + $('.messages').addClass('hidden');
  40 + $('.mask').addClass('hidden');
  41 + $('#dialog .content').html(' ');
  42 + }, time);
  43 +}
  44 +
  45 +$(function() {
  46 +
  47 + $.ajax({
  48 + url: '/activity/tencentMkt/TencentMktController/getActivityInfo',
  49 + data: {
  50 + activityCode: activityCode
  51 + },
  52 + success: function(data) {
  53 + data = getPageInfo(data);
  54 +
  55 + if (data.code === 200 || data.code === 502 || data.code === 503) {
  56 + /*if (window._yas) {
  57 + window._yas.sendCustomInfo({
  58 + activityID: activityID,
  59 + returnCode: data.returnCode
  60 + }, false);
  61 + }*/
  62 + if (data.code === 200) {
  63 + $('.receive-coupon-page .bg-contain .img1').attr('src', data.bgImg);
  64 + if (data.secondScreenPic) {
  65 + $('.receive-coupon-page .bg-contain .img2').attr('src', data.secondScreenPic);
87 } else { 66 } else {
88 - showToast('网络错误,稍后再试!', 1400); 67 + $('.receive-coupon-page .bg-contain .img2').addClass('hidden');
89 } 68 }
90 - },  
91 - error: function() {  
92 - showToast('网络错误,稍后再试!', 1400);  
93 - },  
94 - dataType : "json"  
95 - });  
96 - });  
97 -  
98 - $('#getCoupon').on('click', function() {  
99 - phone = $(this).siblings('input').val();  
100 - reg = /[0-9]{11}/;  
101 - if (!reg.test(phone)) {  
102 - showToast('手机号错误,请重新输入。', 1400);  
103 - return;  
104 - }  
105 - $.ajax({  
106 - url: '/activity/tencentMkt/TencentMktController/sendSms',  
107 - data: {  
108 - mobile: $('#phone').val(),  
109 - activityCode: activityCode  
110 - },  
111 - success: function(data) {  
112 - if (data.code === 200 || data.code === 502 || data.code === 503 || data.code === 404) {  
113 - if (window._yas) {  
114 - window._yas.sendCustomInfo({  
115 - activityID: activityID,  
116 - returnCode: data.returnCode  
117 - }, false);  
118 - }  
119 - if (data.code === 200) {  
120 -  
121 - $('.coupon-centent .phone-input-content').addClass('hidden');  
122 - $('.coupon-centent .vertify-input-content').removeClass('hidden');  
123 -  
124 - } else {  
125 - showToast(data.message, 1400);  
126 - }  
127 - } else {  
128 - showToast('网络错误,稍后再试!', 1400); 69 + $('.gain-coupon-centent .coupon img').attr('src', data.couponPic);
  70 + $('#activityEnded').text(data.ended);
  71 + $('#newUser').text(data.newUser);
  72 + $('#tipMessage').text(data.message);
  73 + $('#activityID').text(data.activityID);
  74 + $('#shareTitle').val(data.shareTitle);
  75 + $('#shareDesc').val(data.shareDesc);
  76 + $('#shareImg').val(data.shareImg);
  77 + $('#shareLink').val(data.shareLink);
  78 + $('#activityCode').val(data.activityCode);
  79 + $('.gain-coupon-centent .use-coupon-btn .use-coupon').attr('href', data.buttonLink);
  80 + $('.gain-coupon-centent .go-wep').attr('href', data.pcLink);
  81 + $('.tip .title').html(data.message);
  82 + $('#activityDesc .message').html(data.formatActivityDesc);
  83 + if (data.ended) {
  84 + $('.tip-wrap').removeClass('hidden');
  85 + $('.tip-wrap .title').html(data.message);
129 } 86 }
130 - },  
131 - error: function() {  
132 - showToast('网络错误,稍后再试!', 1400);  
133 - },  
134 - dataType : "json"  
135 - });  
136 - });  
137 - $('.input-content').on('click', '.get', function() {  
138 - $('.input-content div').eq('1').removeClass('get');  
139 - if ($(this).siblings('input').val().length === 4) {  
140 - $.ajax({  
141 - url: '/activity/tencentMkt/TencentMktController/validRegCodeAndSendCode',  
142 - data: {  
143 - code: $('#verification').val(),  
144 - mobile: $('#phone').val(),  
145 - activityCode: activityCode  
146 - },  
147 - dataType: 'json',  
148 - success: function(data) {  
149 - if (data.code === 200) {  
150 - if (window._yas) {  
151 - window._yas.sendCustomInfo({  
152 - activityID: activityID,  
153 - returnCode: data.returnCode  
154 - }, false);  
155 - }  
156 - $('.coupon-centent').addClass('hidden');  
157 - $('.gain-coupon-centent').removeClass('hidden');  
158 -  
159 - } else {  
160 - showToast(data.message, 1400);  
161 - }  
162 - },  
163 - error: function() {  
164 - showToast('网络错误,稍后再试!', 1400);  
165 - },  
166 - dataType : "json"  
167 - }); 87 + } else {
  88 + showToast(data.message, 1400);
  89 + }
168 } else { 90 } else {
169 showToast('网络错误,稍后再试!', 1400); 91 showToast('网络错误,稍后再试!', 1400);
170 } 92 }
171 - });  
172 - $('.close').on('click', function() {  
173 - $('.dialog').addClass('hidden');  
174 - $('.mask').addClass('hidden');  
175 - $('#dialog .content').html(' ');  
176 - });  
177 - $('.description-btn').on('click', function() {  
178 - $('#message').removeClass('hidden');  
179 - $('.mask').removeClass('hidden');  
180 - });  
181 -  
182 - $('.gain-description-btn').on('click', function() {  
183 - $('#message').removeClass('hidden');  
184 - $('.mask').removeClass('hidden');  
185 - });  
186 - $('.description').on('click', function() {  
187 - $('#message').removeClass('hidden');  
188 - $('.mask').removeClass('hidden');  
189 - }); 93 + },
  94 + error: function() {
  95 + showToast('网络错误,稍后再试!', 1400);
  96 + },
  97 + dataType: "json"
  98 + });
  99 +});
  100 +
  101 +$('#getCoupon').on('click', function() {
  102 + phone = $(this).siblings('input').val();
  103 + reg = /[0-9]{11}/;
  104 + if (!reg.test(phone)) {
  105 + showToast('手机号错误,请重新输入。', 1400);
  106 + return;
  107 + }
  108 + $.ajax({
  109 + url: '/activity/tencentMkt/TencentMktController/sendSms',
  110 + data: {
  111 + mobile: $('#phone').val(),
  112 + activityCode: activityCode
  113 + },
  114 + success: function(data) {
  115 + if (data.code === 200 || data.code === 502 || data.code === 503 || data.code === 404) {
  116 + if (window._yas) {
  117 + window._yas.sendCustomInfo({
  118 + activityID: activityID,
  119 + returnCode: data.returnCode
  120 + }, false);
  121 + }
  122 + if (data.code === 200) {
190 123
191 - $('.use-coupon-btn').on('click', function() {  
192 - if (window._yas) {  
193 - window._yas.sendCustomInfo({  
194 - activityID: activityID  
195 - }, true);  
196 - }  
197 - }); 124 + $('.coupon-centent .phone-input-content').addClass('hidden');
  125 + $('.coupon-centent .vertify-input-content').removeClass('hidden');
198 126
199 - $('.input-content .clear-mobile').on('click', function() {  
200 - $('.input-content input').eq('0').val('');  
201 - $(this).addClass('hidden');  
202 - $('.input-content div').eq('0').removeClass();  
203 - });  
204 -  
205 - $('.input-content .clear-verify').on('click', function() {  
206 - $('.input-content input').eq('1').val('');  
207 - $(this).addClass('hidden');  
208 - $('.input-content div').eq('1').removeClass();  
209 - });  
210 -  
211 - /**  
212 - * 分享页面基础参数  
213 - * @param {object} sizeInfo [接口原始数据]  
214 - * @return {object} [description]  
215 - */  
216 - function getPageInfo(pageInfo) {  
217 - var dest = {};  
218 -  
219 - dest.shareTitle = pageInfo.data.shareTitle;  
220 - dest.shareDesc = pageInfo.data.shareContent;  
221 - dest.shareImg = pageInfo.data.shareImgUrl;  
222 - dest.shareLink = pageInfo.data.shareUrl;  
223 - dest.code = pageInfo.code;  
224 - dest.activityID = pageInfo.id;  
225 - dest.title = pageInfo.data.h5Title;  
226 - dest.activityDesc = pageInfo.data.activityDesc;  
227 - dest.couponPic = pageInfo.data.couponPic;  
228 - dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic;  
229 - dest.mobile = pageInfo.data.mobile;  
230 - dest.pcLink = pageInfo.data.pcLink;  
231 - dest.buttonLink = pageInfo.data.buttonLink;  
232 -  
233 - if (pageInfo.data.flag === 1) {  
234 - dest.bgImg = pageInfo.data.activityNormalPic; 127 + } else {
  128 + showToast(data.message, 1400);
  129 + }
235 } else { 130 } else {
236 - dest.bgImg = pageInfo.data.activityEndPic;  
237 - dest.ended = true; 131 + showToast('网络错误,稍后再试!', 1400);
238 } 132 }
239 - dest.message = pageInfo.data.returnMsg; 133 + },
  134 + error: function() {
  135 + showToast('网络错误,稍后再试!', 1400);
  136 + },
  137 + dataType: "json"
  138 + });
  139 +});
  140 +$('.input-content').on('click', '.get', function() {
  141 + $('.input-content div').eq('1').removeClass('get');
  142 + if ($(this).siblings('input').val().length === 4) {
  143 + $.ajax({
  144 + url: '/activity/tencentMkt/TencentMktController/validRegCodeAndSendCode',
  145 + data: {
  146 + code: $('#verification').val(),
  147 + mobile: $('#phone').val(),
  148 + activityCode: activityCode
  149 + },
  150 + dataType: 'json',
  151 + success: function(data) {
  152 + if (data.code === 200) {
  153 + if (window._yas) {
  154 + window._yas.sendCustomInfo({
  155 + activityID: activityID,
  156 + returnCode: data.returnCode
  157 + }, false);
  158 + }
  159 + $('.coupon-centent').addClass('hidden');
  160 + $('.gain-coupon-centent').removeClass('hidden');
240 161
241 - // 清空变量,释放内存  
242 - pageInfo = {};  
243 - return dest;  
244 - };  
  162 + } else {
  163 + showToast(data.message, 1400);
  164 + }
  165 + },
  166 + error: function() {
  167 + showToast('网络错误,稍后再试!', 1400);
  168 + },
  169 + dataType: "json"
  170 + });
  171 + } else {
  172 + showToast('网络错误,稍后再试!', 1400);
  173 + }
  174 +});
  175 +$('.close').on('click', function() {
  176 + $('.dialog').addClass('hidden');
  177 + $('.mask').addClass('hidden');
  178 + $('#dialog .content').html(' ');
  179 +});
  180 +$('.description-btn').on('click', function() {
  181 + $('#message').removeClass('hidden');
  182 + $('.mask').removeClass('hidden');
  183 +});
  184 +
  185 +$('.gain-description-btn').on('click', function() {
  186 + $('#message').removeClass('hidden');
  187 + $('.mask').removeClass('hidden');
  188 +});
  189 +$('.description').on('click', function() {
  190 + $('#message').removeClass('hidden');
  191 + $('.mask').removeClass('hidden');
  192 +});
  193 +
  194 +$('.use-coupon-btn').on('click', function() {
  195 + if (window._yas) {
  196 + window._yas.sendCustomInfo({
  197 + activityID: activityID
  198 + }, true);
  199 + }
  200 +});
  201 +
  202 +$('.input-content .clear-mobile').on('click', function() {
  203 + $('.input-content input').eq('0').val('');
  204 + $(this).addClass('hidden');
  205 + $('.input-content div').eq('0').removeClass();
  206 +});
  207 +
  208 +$('.input-content .clear-verify').on('click', function() {
  209 + $('.input-content input').eq('1').val('');
  210 + $(this).addClass('hidden');
  211 + $('.input-content div').eq('1').removeClass();
  212 +});
  213 +
  214 +/**
  215 + * 分享页面基础参数
  216 + * @param {object} sizeInfo [接口原始数据]
  217 + * @return {object} [description]
  218 + */
  219 +function getPageInfo(pageInfo) {
  220 + var dest = {};
  221 +
  222 + dest.shareTitle = pageInfo.data.shareTitle;
  223 + dest.shareDesc = pageInfo.data.shareContent;
  224 + dest.shareImg = pageInfo.data.shareImgUrl;
  225 + dest.shareLink = pageInfo.data.shareUrl;
  226 + dest.code = pageInfo.code;
  227 + dest.activityID = pageInfo.id;
  228 + dest.title = pageInfo.data.h5Title;
  229 + dest.activityDesc = pageInfo.data.activityDesc;
  230 + dest.couponPic = pageInfo.data.couponPic;
  231 + dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic;
  232 + dest.mobile = pageInfo.data.mobile;
  233 + dest.pcLink = pageInfo.data.pcLink;
  234 + dest.buttonLink = pageInfo.data.buttonLink;
  235 + dest.secondScreenPic = pageInfo.data.secondScreenPic;
  236 + dest.formatActivityDesc = pageInfo.data.formatActivityDesc;
  237 +
  238 + if (pageInfo.data.flag === 1) {
  239 + dest.bgImg = pageInfo.data.activityNormalPic;
  240 + } else {
  241 + dest.bgImg = pageInfo.data.activityEndPic;
  242 + dest.ended = true;
  243 + }
  244 + dest.message = pageInfo.data.returnMsg;
  245 +
  246 + // 清空变量,释放内存
  247 + pageInfo = {};
  248 + return dest;
  249 +};