qihanjiao 7 роки тому
батько
коміт
ac5b58de24
4 змінених файлів з 310 додано та 286 видалено
  1. 7 5
      tooth/css/main.css
  2. 8 8
      tooth/index.html
  3. 89 101
      tooth/my-vip-message.html
  4. 206 172
      tooth/register-vip.html

+ 7 - 5
tooth/css/main.css

@@ -25,8 +25,8 @@ abbr,acronym { border: 0; }
 body{background-color: #fff;font-size: 14px;}
 p{color: #999;}
 #menu-grid-9.mui-grid-view.mui-grid-9{background-color:#fff;border: 0;}
-#menu-grid-9.mui-grid-view.mui-grid-9 .mui-table-view-cell{border: 0;padding: 11px 8px;}
-#menu-grid-9.mui-grid-view.mui-grid-9 .mui-table-view-cell>a:not(.mui-btn){border: 1px solid rgba(0,0,0,.1);border-radius: 10px;}
+#menu-grid-9.mui-grid-view.mui-grid-9 .mui-table-view-cell{border: 0;padding: 11px;}
+#menu-grid-9.mui-grid-view.mui-grid-9 .mui-table-view-cell>a:not(.mui-btn){border: 1px solid rgba(0,0,0,.2);border-radius: 10px;}
 .mui-pull-caption,.mui-pull{font-size: 12px;font-weight: 300;}
 .loading-bg{width: 100%;min-width:100%;height: 100%;min-height:100%; background-color:#F0F0F0;position: fixed;left: 0;top: 0;z-index: 999;}
 .loading-bg .mui-loading{margin-top: 50%;text-align: center;color: #aaa;}
@@ -34,10 +34,11 @@ p{color: #999;}
 .mui-table-view-cell:after{left: 0;}
 .details-content{max-width: 100%;overflow: hidden;word-break: break-all;}
 #grid-view.mui-table-view.mui-grid-view .mui-table-view-cell .mui-media-object{max-width: 75%;min-width: 75%;}
+#grid-view>li{margin: 12px 0;}
 #grid-view:before,#grid-view:after{display: none;}
-#grid-view h6{margin: 5px 0;}
-#grid-view .prices{color: #f16071;}
-#grid-view .mui-btn{width: 55%;display: block;margin:8px auto 0 auto;}
+#grid-view h6{margin: 5px 0;overflow: hidden;text-overflow: ellipsis;}
+#grid-view .prices{color: #f16071;padding-top: 2px;}
+#grid-view .mui-btn{width: 70%;display: block;margin: 8px auto 0 auto;padding: 0.5rem 0;border:1px solid #333;border-radius: 0;color: #333;font-size: 16px;}
 .details-content img{max-width: 100% !important;}
 .mui-content{background-color: #fff;}
 .mui-bar-nav{-webkit-box-shadow: 0 0 0 #fff;box-shadow: 0 0 0 #fff;position: fixed;background-color: #fff; padding: 10px 14px;height: 55px;}
@@ -58,6 +59,7 @@ p{color: #999;}
 #pro-top-menu .mui-control-item.mui-active{background-color: #fff;color: #333;}
 #pro-top-menu .mui-control-item:after{content: '';position: absolute;left: 0;bottom: 0;width: 100%;height: 1px;background-color: #ccc;}
 #pro-top-menu .mui-control-item.mui-active:after{background-color: #333;}
+#menu-grid-9.mui-table-view.mui-grid-view .mui-table-view-cell .mui-media-body{font-size: 12px;}
 .pro-name{font-size: 14px;color: #333;padding: 2px 0;}
 .pro-price{font-size: 14px;color: #f16071;padding: 2px 0;}
 .banner-box{margin: 0;}

+ 8 - 8
tooth/index.html

@@ -180,7 +180,7 @@
 				<div>
 					<img width="100%" src="images/index-content.jpg" />
 				</div>
-				<div>
+				<!--<div>
 					<img width="100%" src="images/banner-2.jpg" />
 				</div>
 				<div>
@@ -190,10 +190,10 @@
 					<a class="color_a" href="pro-details.html?colorId=44">
 						<img width="100%" src="images/index-1.jpg" />
 					</a>
-				</div>
+				</div>-->
 				<!--<div class="mui-text-center mui-content-padded">
 					<span style="color: #f16071;">¥399.00</span>
-				</div>-->
+				</div>
 				<div>
 					<img width="100%" src="images/index_shuatou_2.png" />
 				</div>
@@ -205,9 +205,9 @@
 						<img width="100%" src="images/index_shuatou.png" />
 					</a>
 				</div>
-				<!--<div class="mui-text-center mui-content-padded">
+				<div class="mui-text-center mui-content-padded">
 					<span style="color: #f16071;">¥42.00</span>
-				</div>-->
+				</div>
 
 				<div>
 					<img width="100%" src="images/index-tit-5.jpg" />
@@ -217,7 +217,7 @@
 						<img width="100%" src="images/index_d_shuatou.png" />
 					</a>
 				</div>
-				<!--<div class="mui-text-center mui-content-padded">
+				<div class="mui-text-center mui-content-padded">
 					<span style="color: #f16071;">¥36.00</span>
 				</div>-->
 			</div>
@@ -348,7 +348,7 @@
 						mui.each(dt.data.integralProductList, function(index) {
 							var li = document.createElement('li');//创建li标签
 							li.className='mui-table-view-cell mui-media mui-col-xs-6';
-							li.innerHTML='<a><img class="mui-media-object" src="'+this.integralProductImg+'"><div class="mui-media-body">'+this.integralProductName+'</div><h6>'+this.integralProductDesc+'</h6><div class="prices">'+this.convertDfbi+'朵粉币</div><div><button type="button" class="mui-btn" name="'+this.integralProductId+'">兑换</button></div></a>';
+							li.innerHTML='<a><img class="mui-media-object" name="'+this.integralProductId+'" src="'+this.integralProductImg+'"><div class="mui-media-body">'+this.integralProductName+'</div><h6>'+this.integralProductDesc+'</h6><div class="prices">'+this.convertDfbi+'朵粉币</div><div><button type="button" class="mui-btn" name="'+this.integralProductId+'">兑换</button></div></a>';
 							table.appendChild(li);//将li插入table
 						});
 							} else {
@@ -361,7 +361,7 @@
 						mui.alert("获取数据失败!网络错误");
 					}
 				});
-				$(document).on('tap', '#grid-view .mui-table-view-cell .mui-btn', function() {
+				$(document).on('tap', '#grid-view .mui-table-view-cell .mui-btn,#grid-view .mui-media-object', function() {
 					var th=$(this);
 					console.log(th.attr("name"))
 					if(th.attr("name")!="undefined"){

+ 89 - 101
tooth/my-vip-message.html

@@ -16,12 +16,12 @@
 		<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
 		<script>
 			//屏蔽分享
-//			document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
-//				WeixinJSBridge.call('hideOptionMenu');
-//			});
+			//			document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
+			//				WeixinJSBridge.call('hideOptionMenu');
+			//			});
 		</script>
 	</head>
-	
+
 	<body>
 		<div class="mui-content">
 			<ul class="mui-table-view mui-table-view-chevron my-vip-msg-list">
@@ -40,7 +40,7 @@
 				<li>
 					<div class="mui-input-row">
 						<label>电话</label>
-						<input id="ipt-tel" class="mui-text-right" type="text"  placeholder="请输入电话号码" value="">
+						<input id="ipt-tel" class="mui-text-right" type="tel" placeholder="请输入电话号码" value="">
 					</div>
 				</li>
 			</ul>
@@ -74,7 +74,7 @@
 					location.reload();
 				}
 			});
-			
+
 			mui.ready(function() {
 				if(!window.sessionStorage) {
 					mui.alert("您的浏览器不支持sessionStorage");
@@ -83,33 +83,42 @@
 					user_data = JSON.parse(sessionStorage.getItem('user_data'));
 					if(user_data != null) {
 						$("#ipt-name").val(user_data.userName);
-						$("#btn-sex i").text(user_data.sex==1?"男":"女").attr("name",user_data.sex);
-//						var age='';
-//						switch (user_data.age){
-//							case 1:
-//							age='80后'
-//								break;
-//							case 2:
-//							age='85后'
-//								break;
-//							case 3:
-//							age='90后'
-//								break;
-//							case 4:
-//							age='95后'
-//								break;	
-//							case 5:
-//							age='00后'
-//								break;	
-//							default:
-//							age='其他'
-//								break;
-//						}
-						$("#btn-age i").text(user_data.userBirthDate).attr("name",user_data.userBirthDate);
-						$("#ipt-tel").val(user_data.tel);
-					}else{
-						mui.alert("sessionStorage异常!",function(){
-							location.href="my-center.html";
+						$("#btn-sex i").text(user_data.sex == 1 ? "男" : "女").attr("name", user_data.sex);
+						if(user_data.userBirthDate != null || user_data.userBirthDate != '') {
+							$("#btn-age i").text(user_data.userBirthDate).attr("name", user_data.userBirthDate);
+							$("#btn-age i").attr("disabled", "disabled");
+							$(document).on('tap', '#btn-age', function() {
+								mui.alert("暂不支持修改生日,电话!","温馨提示")
+							});
+						} else {
+							//选择年龄
+							var date = new Date();
+							var y = date.getFullYear();
+							var m = date.getMonth(); //获取当前月份的日期
+							var d = date.getDate();
+							var userPicker1 = new mui.DtPicker({
+								type: "date", //设置日历初始视图模式 
+								beginDate: new Date(1930, 00, 01), //设置开始日期 
+								endDate: new Date(2010, 00, 01) //设置结束日期 
+							});
+							var showUserPickerButton1 = dc('btn-age');
+							showUserPickerButton1.addEventListener('tap', function(event) {
+								userPicker1.show(function(items) {
+									//$("#btn-age i").text(items[0].text).attr("name",items[0].value);
+									$("#btn-age i").text(items.text);
+									userPicker1.dispose();
+									userPicker1 = null;
+									//返回 false 可以阻止选择框的关闭
+									//return false;
+								});
+							}, false);
+						}
+						if(user_data.tel != null || user_data.tel != '') {
+							$("#ipt-tel").val(user_data.tel).attr("disabled", "disabled");
+						}
+					} else {
+						mui.alert("sessionStorage异常!", function() {
+							location.href = "my-center.html";
 						});
 					}
 				}
@@ -125,29 +134,7 @@
 				var showUserPickerButton = dc('btn-sex');
 				showUserPickerButton.addEventListener('tap', function(event) {
 					userPicker.show(function(items) {
-						$("#btn-sex i").text(items[0].text).attr("name",items[0].value);
-						//返回 false 可以阻止选择框的关闭
-						//return false;
-					});
-				}, false);
-				//选择年龄
-				//var userPicker1 = new mui.PopPicker();
-				var date = new Date();
-				var y = date.getFullYear();
-				var m = date.getMonth();//获取当前月份的日期
-				var d = date.getDate();
-				var userPicker1 = new mui.DtPicker({
-					type: "date", //设置日历初始视图模式 
-					beginDate: new Date(1930, 00, 01), //设置开始日期 
-					endDate: new Date(2010,00, 01) //设置结束日期 
-				});
-				var showUserPickerButton1 = dc('btn-age');
-				showUserPickerButton1.addEventListener('tap', function(event) {
-					userPicker1.show(function(items) {
-						//$("#btn-age i").text(items[0].text).attr("name",items[0].value);
-						$("#btn-age i").text(items.text);
-					userPicker1.dispose();
-					userPicker1 = null;	
+						$("#btn-sex i").text(items[0].text).attr("name", items[0].value);
 						//返回 false 可以阻止选择框的关闭
 						//return false;
 					});
@@ -160,41 +147,40 @@
 				validate(); //先校验文本框
 				if(validate_flag) { //判断是否验证通过
 					var parameter = {}; //ajax参数json集合
-					    parameter["userName"] = $("#ipt-name").val().trim(); //姓名
-						parameter["userSex"] = $("#btn-sex i").attr("name"); //性别
-						if(parameter["userAgeStage"] != null && parameter["userAgeStage"] != "" && typeof(parameter["userAgeStage"])) {
-							parameter["userAgeStage"] =6;
-						}else{
-							parameter["userBirthDate"] = $("#btn-age i").attr("name"); //年龄段
-						}
-						
-						parameter["userTel"] = $("#ipt-tel").val().trim(); //电话
-						console.log(parameter);
-						$.ajax(base_path + '/wechat/member/updateMyMember?dates=' + new Date().getTime(), {
-							data: parameter,
-							dataType: 'json',
-							xhrFields: {
-								withCredentials: true
-							},
-							crossDomain: true,
-							type: 'post',
-							timeout: 15000,
-							success: function(dt) {
-								if(dt.isRedirect) {
-									location.href = dt.redirectURL;
+					parameter["userName"] = $("#ipt-name").val().trim(); //姓名
+					parameter["userSex"] = $("#btn-sex i").attr("name"); //性别
+//					parameter["userBirthDate"] = $("#btn-age i").attr("name"); //生日
+//					parameter["userTel"] = $("#ipt-tel").val().trim(); //电话
+					$.ajax(base_path + '/wechat/member/updateMyMember?dates=' + new Date().getTime(), {
+						data: parameter,
+						dataType: 'json',
+						xhrFields: {
+							withCredentials: true
+						},
+						crossDomain: true,
+						type: 'post',
+						timeout: 15000,
+						success: function(dt) {
+							if(dt.isRedirect) {
+								location.href = dt.redirectURL;
+							} else {
+								if(dt.status) {
+									user_data.sex=parameter.userSex;
+									user_data.userName=parameter.userName;
+									var edit = JSON.stringify(user_data);
+									//改,重新赋值
+									sessionStorage.setItem("user_data", edit);
+									mui.alert("保存成功!");
 								} else {
-									if(dt.status) {
-										mui.alert("保存成功!");
-									} else {
-										mui.alert("保存失败!");
-									}
+									mui.alert("保存失败!");
 								}
-							},
-							error: function(xhr, type, errorThrown) {
-								console.log(xhr);
-								mui.alert("保存失败!网络错误");
 							}
-						});
+						},
+						error: function(xhr, type, errorThrown) {
+							console.log(xhr);
+							mui.alert("保存失败!网络错误");
+						}
+					});
 				} else {
 					mui.alert(dalog_msg);
 				}
@@ -206,27 +192,29 @@
 			function validate() {
 				var ch_en_num = /^[A-Za-z_\-\u4e00-\u9fa5]{2,10}$/; //简体中文英文(2-10位)
 				var telCode = /^(0?(13|14|15|17|18)[\d]{9}$|(01|02|03|04|05|06|07|08|09)[\d]{7,10}$|(400|800)[0-9]{7}$)/; //手机号,座机(400-800)
-				var name = $("#ipt-name").val().trim(),tel = $("#ipt-tel").val().trim();
+				var name = $("#ipt-name").val().trim(),
+					tel = $("#ipt-tel").val().trim();
 				var full_date = /^\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}$/; //日期格式 (2016\12\12,2016-12-12,2016.12.12)
-				
+
 				if(ch_en_num.test(name)) {
 					if($("#btn-sex i").text() != '请选择') {
 						//选择性别通过
 						if($("#btn-age i").text() != '请选择日期') {
 							if(full_date.test($("#btn-age i").text())) {
-							//选择生日通过
-							if(telCode.test(tel)) {
-								//电话验证通过
-								validate_flag = true;
-							} else {
-								//电话未通过验证
-								if(tel != '') {
-									dalog_msg = '您的电话号码格式不正确';
+								//选择生日通过
+								if(telCode.test(tel)) {
+									//电话验证通过
+									validate_flag = true;
 								} else {
-									dalog_msg = '请您填写电话号码';
+									//电话未通过验证
+									if(tel != '') {
+										dalog_msg = '您的电话号码格式不正确';
+									} else {
+										dalog_msg = '请您填写电话号码';
+									}
+									validate_flag = false;
 								}
-								validate_flag = false;
-							}}else{
+							} else {
 								dalog_msg = '您的生日格式不正确';
 							}
 						} else {

+ 206 - 172
tooth/register-vip.html

@@ -33,7 +33,7 @@
 				<p style="width: 60%;margin-left: 20%;">“刷头兑换券”请移至上朵公众号【朵粉特供】→【福利社】领取</p>
 			</div>
 			<img width="100%" src="images/youhuiquan.jpg" />
-			<div style="padding: 15px 10px;">
+			<div style="padding: 15px 10px;font-weight: bold;font-size: 15px;">
 				完善信息
 			</div>
 			<form class="mui-input-group">
@@ -47,11 +47,11 @@
 				</div>
 				<div class="mui-input-row line-bottom">
 					<label>手机号码</label>
-					<input type="text" id="ipt-phone" maxlength="11" placeholder="填写您的手机号码">
+					<input type="tel" id="ipt-phone" maxlength="11" placeholder="填写您的手机号码">
 				</div>
 				<div class="mui-input-row line-bottom">
-						<label>验&nbsp;&nbsp;证&nbsp;&nbsp;码</label>
-						<input style="width: 50% !important;float: left;" type="tel" placeholder="请输入验证码" maxlength="4" id="code"><button type="button" class="pull-code" disabled="disabled">获取验证码</button>
+					<label>验&nbsp;&nbsp;证&nbsp;&nbsp;码</label>
+					<input style="width: 50% !important;float: left;" type="tel" placeholder="请输入验证码" maxlength="4" id="code"><button type="button" class="pull-code" disabled="disabled">获取验证码</button>
 				</div>
 				<div class="mui-table my-table" style="padding:15px 10px 0px 10px;">
 					<div class="mui-table-cell mui-col-xs-2">
@@ -134,7 +134,7 @@
 					</div>
 					<div class="mui-table-cell mui-col-xs-3">
 						<div class="mui-input-row mui-radio mui-left">
-							<label class="my-label">JD</label>
+							<label class="my-label">京东</label>
 							<input name="radio2" class="radio2" type="radio" value="3">
 						</div>
 					</div>
@@ -194,7 +194,7 @@
 				var phone = this.value;
 				var mobile = /^(13|14|15|17|18)[0-9]{9}$/; //手机号码
 				if(phone.length == 11) {
-					if(mobile.test(phone) && countdown==60) {
+					if(mobile.test(phone) && countdown == 60) {
 						$(".pull-code").removeAttr("disabled").addClass("active");
 					} else {
 						$(".pull-code").attr("disabled", "disabled").removeClass("active");
@@ -204,23 +204,24 @@
 				}
 			});
 			//发送验证码
-			var validate_flag = false,show_msg = '';
+			var validate_flag = false,
+				show_msg = '';
 			$(document).on('tap', '.pull-code', function() {
-				var th=$(this);
+				var th = $(this);
 				var mobile = /^(13|14|15|17|18)[0-9]{9}$/; //手机号码
 				var phone = $("#ipt-phone").val();
 				if(mobile.test(phone)) {
 					settime(th);
 					if(!window.sessionStorage) {
 						mui.alert("您的浏览器不支持sessionStorage");
-				} else {
-					//自定义json数据
-					var obj = {};
-					obj["phone"] = phone;
-					obj["codetime"] = new Date().getTime();
-					//json格式化插入    
-					sessionStorage.setItem('code_data', JSON.stringify(obj));
-				}
+					} else {
+						//自定义json数据
+						var obj = {};
+						obj["phone"] = phone;
+						obj["codetime"] = new Date().getTime();
+						//json格式化插入    
+						sessionStorage.setItem('code_data', JSON.stringify(obj));
+					}
 					//ajax
 					$.ajax(base_path + '/wechat/apparatus/send_phone?dates=' + new Date().getTime(), {
 						data: {
@@ -247,6 +248,7 @@
 						},
 						error: function(xhr, type, errorThrown) {
 							console.log(xhr);
+							mui.alert("获取短信失败!网络错误");
 						}
 					});
 				} else {
@@ -257,10 +259,11 @@
 					}
 					mui.alert(show_msg);
 				}
-				
+
 			});
-			
+
 			var countdown = 60;
+
 			function settime(obj) {
 				if(countdown <= 0) {
 					obj.addClass("active").removeAttr("disabled");
@@ -280,7 +283,7 @@
 			mui('body').on('tap', '#buyDate', function(event) {
 				var date = new Date();
 				var y = date.getFullYear();
-				var m = date.getMonth();//获取当前月份的日期
+				var m = date.getMonth(); //获取当前月份的日期
 				var d = date.getDate();
 				var picker = new mui.DtPicker({
 					type: "date", //设置日历初始视图模式 
@@ -288,35 +291,35 @@
 					endDate: new Date(y, m, d) //设置结束日期 
 				});
 				picker.show(function(rs) {
-					
+
 					$("#buyDate").val(rs.text);
 					picker.dispose();
 					picker = null;
-					
+
 				});
 			});
 			//选择出生日期
 			mui('body').on('tap', '#newDate', function(event) {
 				var date = new Date();
 				var y = date.getFullYear();
-				var m = date.getMonth();//获取当前月份的日期
+				var m = date.getMonth(); //获取当前月份的日期
 				var d = date.getDate();
 				var picker = new mui.DtPicker({
 					type: "date", //设置日历初始视图模式 
-					beginDate: new Date(1930, 00, 01), //设置开始日期 
-					endDate: new Date(2010,00, 01) //设置结束日期 
+					beginDate: new Date(1949, 9, 01), //设置开始日期 
+					endDate: new Date((y - 8), 00, 01) //设置结束日期 
 				});
-				picker.show(function(rs) {	
+				picker.show(function(rs) {
 					$("#newDate").val(rs.text);
 					picker.dispose();
-					picker = null;	
+					picker = null;
 				});
 			});
 
 			var qrCode = null;
 			var isFocusOn = null;
 			var userIdentity = null;
-			
+
 			mui.ready(function() {
 				console.log("页面加载完毕");
 				$(".loading").hide().css("opacity", "0"); //隐藏(正在加载...)
@@ -325,214 +328,245 @@
 				var code_data = JSON.parse(sessionStorage.getItem('code_data'));
 				if(code_data != null) {
 					$("#ipt-phone").val(code_data.phone);
-					if((new Date().getTime()-code_data.codetime)>59000){
+					if((new Date().getTime() - code_data.codetime) > 59000) {
 						$(".pull-code").addClass("active").removeAttr("disabled");
-					}else{
-						countdown=parseInt(60-((new Date().getTime()-code_data.codetime)/1000));
+					} else {
+						countdown = parseInt(60 - ((new Date().getTime() - code_data.codetime) / 1000));
 						console.log(countdown)
 						settime($(".pull-code"));
 					}
 				}
-				if(qrCode != null){
-					
-					$("#barCodeId").html("("+qrCode+")");
+				if(qrCode != null) {
+
+					$("#barCodeId").html("(" + qrCode + ")");
 					$.ajax(base_path + '/wechat/getActivationAndMember?dates=' + new Date().getTime(), {
-							data: {
-								"qrCode":qrCode//产品类型id
-							},
-							dataType: 'json',
-							xhrFields: {
-								withCredentials: true
-							},
-							crossDomain: true,
-							type: 'get',
-							timeout: 15000,
-							success: function(dt) {
-								if(dt.isRedirect) {
-									location.href = dt.redirectURL;
-								} else {
-									if(dt.status) {//判断接口返回状态status
-										if(dt.data.isActivation){
-											//已激活
-											mui.alert('该产品已被激活!', '提醒', function() {  
-												location.href="my-center.html";
-							               }); 
-										}
-										if(dt.data.memberInfo.userStatus != 2){
-											//未关注
-											mui.alert('请先关注公众号再激活!', '提醒', function() {  
-												location.href="follow-me-tooth.html";
-							               }); 
+						data: {
+							"qrCode": qrCode //产品类型id
+						},
+						dataType: 'json',
+						xhrFields: {
+							withCredentials: true
+						},
+						crossDomain: true,
+						type: 'get',
+						timeout: 15000,
+						success: function(dt) {
+							if(dt.isRedirect) {
+								location.href = dt.redirectURL;
+							} else {
+								if(dt.status) { //判断接口返回状态status
+									if(dt.data.isActivation) {
+										//已激活
+										mui.alert('该产品已被激活!', '提醒', function() {
+											location.href = "my-center.html";
+										});
+									}
+									if(dt.data.memberInfo.userStatus != 2) {
+										//未关注
+										mui.alert('请先关注公众号再激活!', '提醒', function() {
+											location.href = "follow-me-tooth.html";
+										});
 										//填充用户数据
 										$("#ipt-name").val(dt.data.memberInfo.userName);
-										if(dt.data.memberInfo.userSex != null){
-											if(dt.data.memberInfo.userSex == 1){
+										if(dt.data.memberInfo.userSex != null) {
+											if(dt.data.memberInfo.userSex == 1) {
 												$("#maleId").attr("checked", true);
 											}
-											if(dt.data.memberInfo.userSex == 2){
+											if(dt.data.memberInfo.userSex == 2) {
 												$("#femaleId").attr("checked", true);
 											}
 										}
 										var radios = $(".radio1");
-										switch (dt.data.memberInfo.userAgeStage) {
-						                    case (1):
-						                        	radios.eq(0).attr("checked", true);
-						                        break;
-						                    case (2):
-						                     		radios.eq(1).attr("checked", true);
-						                        break;
-						                    case (3):
-						                      		radios.eq(2).attr("checked", true);
-						                        break;
-						                    case (4):
-						                      		radios.eq(3).attr("checked", true);
-						                        break;
-						                    case (5):
-						                     		radios.eq(4).attr("checked", true);
-						                        break;
-						                    case (6):
-						                     	radios.eq(5).attr("checked", true);
-						               }
+										switch(dt.data.memberInfo.userAgeStage) {
+											case(1):
+												radios.eq(0).attr("checked", true);
+												break;
+											case(2):
+												radios.eq(1).attr("checked", true);
+												break;
+											case(3):
+												radios.eq(2).attr("checked", true);
+												break;
+											case(4):
+												radios.eq(3).attr("checked", true);
+												break;
+											case(5):
+												radios.eq(4).attr("checked", true);
+												break;
+											case(6):
+												radios.eq(5).attr("checked", true);
+										}
 										isFocusOn = dt.data.memberInfo.userStatus;
 										userIdentity = dt.data.memberInfo.userIdentity;
 									} else {
 										mui.alert("查询失败!");
 									}
-								}}
-							},
-							error: function(xhr, type, errorThrown) {
-								console.log(xhr);
-								mui.alert("网络错误!");
+								}
 							}
-						});
+						},
+						error: function(xhr, type, errorThrown) {
+							console.log(xhr);
+							mui.alert("网络错误!");
+						}
+					});
 				}
-				
+
 			});
 			$(document).on('tap', '#my-btn-submit', function() {
-				validate();//验证文本框
+				validate(); //验证文本框
 				var userName = $("#ipt-name").val();
 				var userSex = $('input[name="radio0"]:checked ').val();
 				var userBirthDate = $('#newDate').val();
 				var apparatusStore = $('input[name="radio2"]:checked').val();
 				var buyDate = $("#buyDate").val();
 				var tel = $("#ipt-phone").val();
-				var code=$("#code").val();
-				var selectDate = new Date(Date.parse(buyDate));
-				var nowDate = new Date(Date.parse(new Date().toLocaleDateString()));
+				var code = $("#code").val();
+				var  selectDate =  new  Date(Date.parse(buyDate));
+				var  nowDate =  new  Date(Date.parse(new Date().toLocaleDateString()));
 				//if(selectDate>nowDate){
-					//mui.alert("购买日期不能大于当前日期");
-					//return false;
+				//mui.alert("购买日期不能大于当前日期");
+				//return false;
 				//}
-				if(validate_flag){
+				if(validate_flag) {
 					//验证通过
 					$.ajax(base_path + '/wechat/apparatus/add_apparatus?dates=' + new Date().getTime(), {
-							data: {
-								"barCode":qrCode,//条码
-								"userName":userName,//用户姓名
-								"userSex":userSex,//用户姓名
-								"userTel":tel,//手机
-								"code":code,//验证码
-								"userBirthDate":userBirthDate,//出生日期
-								"apparatusStore":apparatusStore,//渠道id 1:天猫 2:淘宝 3:京东 4:微信 5:其他 6:一条 7:小红书
-								"buyDate":buyDate//购买日期
-							},
-							dataType: 'json',
-							xhrFields: {
-								withCredentials: true
-							},
-							crossDomain: true,
-							type: 'get',
-							timeout: 15000,
-							success: function(dt) {
-								if(dt.isRedirect) {
-									location.href = dt.redirectURL;
-								} else {
-									if(dt.status) {//判断接口返回状态status
-										mui.alert('注册成功!', '提醒', function() {  
-											if(userIdentity == 1){//会员
-												if(isFocusOn == 1 || isFocusOn == 0){//未关注
-													location.href="member-follow-me.html";
-												}else{//已关注
-													location.href="welfare-service.html";
-												}
-											}else{//非会员
-												if(isFocusOn == 1 || isFocusOn == 0){//未关注
-													location.href="follow-me.html";
-												}else{//已关注
-													location.href="welfare-service.html";
-												}
+						data: {
+							"barCode": qrCode, //条码
+							"userName": userName, //用户姓名
+							"userSex": userSex, //用户姓名
+							"userTel": tel, //手机
+							"code": code, //验证码
+							"userBirthDate": userBirthDate, //出生日期
+							"apparatusStore": apparatusStore, //渠道id 1:天猫 2:淘宝 3:京东 4:微信 5:其他 6:一条 7:小红书
+							"buyDate": buyDate //购买日期
+						},
+						dataType: 'json',
+						xhrFields: {
+							withCredentials: true
+						},
+						crossDomain: true,
+						type: 'get',
+						timeout: 15000,
+						success: function(dt) {
+							if(dt.isRedirect) {
+								location.href = dt.redirectURL;
+							} else {
+								if(dt.status) { //判断接口返回状态status
+									mui.alert('注册成功!', '温馨提示', function() {
+										if(userIdentity == 1) { //会员
+											if(isFocusOn == 1 || isFocusOn == 0) { //未关注
+												location.href = "member-follow-me.html";
+											} else { //已关注
+												$.ajax(base_path + '/wechat/coupon/getIsReceive?dates=' + new Date().getTime(), {
+													data: {},
+													dataType: 'json',
+													xhrFields: {
+														withCredentials: true
+													},
+													crossDomain: true,
+													type: 'get',
+													timeout: 15000,
+													success: function(dt) {
+														//console.log(dt);
+														if(dt.isRedirect) {
+															location.href = dt.redirectURL;
+														} else {
+															if(dt.status) {
+																console.log("未领取!");
+																location.href = "welfare-service.html";
+															} else {
+																console.log("已领取!");
+																location.href = "my-center.html";
+															}
+														}
+													},
+													error: function(xhr, type, errorThrown) {
+														console.log(xhr);
+													}
+												});
+
 											}
-							                     
-							               }); 
-									} else {
-										mui.alert(dt.message, '提醒', function() {  
-											 location.href="my-center.html";
-							               }); 
-										//mui.alert(dt.message);
-									}
+										} else { //非会员
+											if(isFocusOn == 1 || isFocusOn == 0) { //未关注
+												location.href = "follow-me.html";
+											} else { //已关注
+												location.href = "welfare-service.html";
+											}
+										}
+
+									});
+								} else {
+									mui.alert(dt.message, '温馨提示', function() {
+										location.href = "my-center.html";
+									});
 								}
-							},
-							error: function(xhr, type, errorThrown) {
-								console.log(xhr);
-								mui.alert("网络错误");
 							}
-						});
-				}else{
-					mui.alert(dalog_msg);//弹窗提示
+						},
+						error: function(xhr, type, errorThrown) {
+							console.log(xhr);
+							mui.alert("网络错误");
+						}
+					});
+				} else {
+					mui.alert(dalog_msg); //弹窗提示
 				}
-			});	
-			
+			});
+
 			//正则表达式示例
-			var dalog_msg='',validate_flag=false;
+			var dalog_msg = '',
+				validate_flag = false;
+
 			function validate() {
 				var ch_en_num = /^[A-Za-z_\-\u4e00-\u9fa5]{2,10}$/; //简体中文英文(2-10位)
 				var positive_int = /^[0-9]\d*$/; //正整数0-9
 				var code_int = /^[0-9]{4}$/; //正整数0-9,4位数字
 				var mobile = /^(13|14|15|17|18)[0-9]{9}$/; //手机号码
 				var full_date = /^\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}$/; //日期格式 (2016\12\12,2016-12-12,2016.12.12)
-				var name = $("#ipt-name").val().trim(),tel=$("#ipt-phone").val(),code=$("#code").val();
+				var name = $("#ipt-name").val().trim(),
+					tel = $("#ipt-phone").val(),
+					code = $("#code").val();
 				if(ch_en_num.test(name)) {
 					//验证通过
 					if($("#newDate").val() == null || $("#newDate").val() == "") {
-						validate_flag=false;
-						dalog_msg='请选择出生日期';
-					}else{
+						validate_flag = false;
+						dalog_msg = '请选择出生日期';
+					} else {
 						if(mobile.test(tel)) {
 							console.log(code_int.test(code))
 							if(code_int.test(code)) {
-								if($("#buyDate").val() == null || $("#buyDate").val() == ""){
-									dalog_msg='请选择购买日期';
-									validate_flag=false;
-								}else{
-									validate_flag=true;
+								if($("#buyDate").val() == null || $("#buyDate").val() == "") {
+									dalog_msg = '请选择购买日期';
+									validate_flag = false;
+								} else {
+									validate_flag = true;
 								}
-							}else{
+							} else {
 								if(code != '') {
-									dalog_msg='验证码格式不正确';
-								}else{
-									dalog_msg='请填写验证码';
+									dalog_msg = '验证码格式不正确';
+								} else {
+									dalog_msg = '请填写验证码';
 								}
-								validate_flag=false;
+								validate_flag = false;
 							}
-						}else{
-							validate_flag=false;
+						} else {
+							validate_flag = false;
 							if(tel != '') {
-								dalog_msg='手机格式不正确';
-							}else{
-								dalog_msg='请填写手机号码';
+								dalog_msg = '手机格式不正确';
+							} else {
+								dalog_msg = '请填写手机号码';
 							}
 						}
 					}
 				} else {
 					//未通过验证
 					if(name != '') {
-						dalog_msg='名字格式不正确';
+						dalog_msg = '名字格式不正确';
 					} else {
-						dalog_msg='请填写名字';
+						dalog_msg = '请填写名字';
 					}
-					validate_flag=false;
-				}				
-				return dalog_msg;//返回提示信息
+					validate_flag = false;
+				}
+				return dalog_msg; //返回提示信息
 			}
 		</script>
 	</body>