<!--{include file="<!--{$oetplpath}-->widget_header.tpl"}-->
<div class="oemarry_main">
  <!--{include file="<!--{$oetplpath}-->widget_menu.tpl"}-->
  <div class="oem_uright">
  
	<div class="oe_mine_box">
	  <ul>
	    <li><a href="<!--{$oefile}-->&c=profile">个人信息</a></li>
		<li><a href="<!--{$oefile}-->&c=profile&a=edit">修改资料</a></li>
		<li><a href="<!--{$oefile}-->&c=profile&a=editpass">修改密码</a></li>
		<li><a href="<!--{$oefile}-->&c=rz" class="_current">认证中心</a></li>
		<li><a href="<!--{$oefile}-->&c=address">收货地址</a></li>
	  </ul>
	  <div class="clear"></div>
	</div>
	
	<div class="oe_widget_center">
	  
	  <!--{if $a == "run"}-->
	  <div class="oem_user_pro">
	    <ul>
		  <li> 
		    <span class="oem_upro_1">
			  <!--{if $login.user.mobilerz == '1'}-->
			  <i></i>
			  <!--{else}-->
			  <em></em>
			  <!--{/if}-->
			  手机号码
			</span>
		    <span class="oem_upro_2">
			  <!--{if $login.user.mobilerz == '1'}-->
			  已认证
			  <!--{else}-->
			  <span>未认证</span>
			  <!--{/if}-->
			</span>
		    <span class="oem_upro_3">
			  手机号码可以用来登录网站，取回密码，同时方便获取优惠券、订单等信息。
			</span>
		    <span class="oem_upro_4">
			  <!--{if $login.user.mobilerz == '1'}-->
		      <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=mobile">[修改]</a>
			  <!--{else}-->
			  <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=mobile">[立即认证]</a>
			  <!--{/if}-->
			</span>
		  </li>
		  <li> 
		    <span class="oem_upro_1">
			  <!--{if $login.user.emailrz == '1'}-->
			  <i></i>
			  <!--{else}-->
			  <em></em>
			  <!--{/if}-->
			  邮箱地址
			</span>
		    <span class="oem_upro_2">
			  <!--{if $login.user.emailrz == '1'}-->
			  已认证
			  <!--{else}-->
			  <span>未认证</span>
			  <!--{/if}-->
			</span>
		    <span class="oem_upro_3">
			  邮箱地址可以用来登录网站，取回密码，同时方便获取优惠券、订单等信息。
			</span>
		    <span class="oem_upro_4">
			  <!--{if $login.user.emailrz == '1'}-->
		      <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=email">[修改]</a>
			  <!--{else}-->
			  <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=email">[立即认证]</a>
			  <!--{/if}-->
			</span>
		  </li>
	    </ul>
	  </div>
	  <!--{/if}-->


	  <!--{if $a == "mobile"}-->
	  <h3 class="oe_f_title">认证/修改 手机号码<span><i>|</i>请保持手机畅通，能正常接收手机短信</span></h3>
	  <table class="oe_table_info">
	    <!--{if $login.user.mobilerz == '1'}-->
		<tr>
		  <th align="right">已认证号码：</th>
		  <td><!--{$login.user.mobile}--></td>
		</tr>
		<tr>
		  <th align="right" width="15%">新手机号码：<font color="red">*</font></th>
		  <td width="85%">
			<input type="text" name="mobile" id="mobile" class="input-150" value="" />
			<input type="button" name="btn_mobilecode" id="btn_mobilecode" value="获取验证码" />&nbsp;&nbsp;
			<span id="tips_mobile"></span>
		  </td>
		</tr>
		<tr>
		  <th align="right">手机验证码：<font color="red">*</font></th>
		  <td>
			<input type="text" name="checkcode" id="checkcode" class="input-100" maxlength="6" />
			<span id="tips_checkcode">（输入新手机收到的验证码）</span>
		  </td>
		</tr>
		<!--{else}-->
		<tr>
		  <th align="right" width="15%">手机号码：<font color="red">*</font></th>
		  <td width="85%">
			<input type="text" name="mobile" id="mobile" class="input-150" value="<!--{$login.user.mobile}-->" />
			<input type="button" name="btn_mobilecode" id="btn_mobilecode" value="获取验证码" />&nbsp;&nbsp;
			<span id="tips_mobile"></span>
		  </td>
		</tr>
		<tr>
		  <th align="right">手机验证码：<font color="red">*</font></th>
		  <td>
			<input type="text" name="checkcode" id="checkcode" class="input-100" maxlength="6" />
			<span id="tips_checkcode">（输入手机收到的验证码）</span>
		  </td>
		</tr>
		<!--{/if}-->
		<tr>
		  <th></th>
		  <td>
			<input type="button" id="btn_post" class="submit_btn2" value="确定" /> 
		  </td>
		</tr>
	  </table>
	  <script type="text/javascript">
	  $(function(){
		
		$("#btn_mobilecode").bind("click", function(){ //获取验证码
			$val_mobile = $("#mobile").val();
			if ($val_mobile.length != 11) {
				$("#tips_mobile").html("<font color='red'>请输入11位手机号码</font>");
				return false;
			}
			if (!isMobile($val_mobile)) {
				$("#tips_mobile").html("<font color='red'>手机号码格式不正确</font>");
				return false;
			}
			$(this).val("获取中...");
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->&a=sendmobilecode",
				cache: false,
				data: {mobile:$val_mobile, r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("#tips_mobile").html("<font color='green'>发送成功，请查收短信</font>");
					}
					else {
						if ($result.length > 0) {
							$("#tips_mobile").html("<font color='red'>"+$result+"</font>");
						}
						else {
							$("#tips_mobile").html("<font color='red'>发送失败，请检查手机号码是否可用</font>");
						}
						
					}
					$("#btn_mobilecode").val("获取验证码");

				},
				error: function() {
					ToastShow("发送失败，请检查网络！");
					$("#btn_mobilecode").val("获取验证码");
				}
			});

		});

		$("#btn_post").bind("click", function(){ //确定
			
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->&a=checkmobilecode",
				cache: false,
				data: {mobile:$("#mobile").val(), checkcode:$("#checkcode").val(), r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						ToastShow("验证/修改成功");
						setTimeout(function(){
							window.location.href="<!--{$oefile}-->&c=<!--{$c}-->";
						}, 800);
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("验证失败，请检查手机号码和验证码是否正确");
						}
					}

				},
				error: function() {
					ToastShow("验证失败，请检查网络！");
				}
			});

		});

	  });
	  </script>


	  <!--{/if}-->


	  <!--{if $a == "email"}-->
	  <h3 class="oe_f_title">认证/修改 邮箱地址<span><i>|</i>请确保您的邮箱有效，能正常收邮件</span></h3>
	  <table class="oe_table_info">
	    <!--{if $login.user.emailrz == '1'}-->
		<tr>
		  <th align="right">已认证邮箱：</th>
		  <td><!--{$login.user.email}--></td>
		</tr>
		<tr>
		  <th align="right" width="15%">新邮箱地址：<font color="red">*</font></th>
		  <td width="85%">
			<input type="text" name="email" id="email" class="input-200" value="" />
			<input type="button" name="btn_emailcode" id="btn_emailcode" value="获取验证码" />&nbsp;&nbsp;
			<span id="tips_email"></span>
		  </td>
		</tr>
		<tr>
		  <th align="right">邮箱验证码：<font color="red">*</font></th>
		  <td>
			<input type="text" name="checkcode" id="checkcode" class="input-100" maxlength="6" />
			<span id="tips_checkcode">（输入新邮箱收到的验证码）</span>
		  </td>
		</tr>
		<!--{else}-->
		<tr>
		  <th align="right" width="15%">邮箱地址：<font color="red">*</font></th>
		  <td width="85%">
			<input type="text" name="email" id="email" class="input-200" value="<!--{$login.user.email}-->" />
			<input type="button" name="btn_emailcode" id="btn_emailcode" value="获取验证码" />&nbsp;&nbsp;
			<span id="tips_email"></span>
		  </td>
		</tr>
		<tr>
		  <th align="right">邮箱验证码：<font color="red">*</font></th>
		  <td>
			<input type="text" name="checkcode" id="checkcode" class="input-100" maxlength="6" />
			<span id="tips_checkcode">（输入邮箱收到的验证码）</span>
		  </td>
		</tr>
		<!--{/if}-->
		<tr>
		  <th></th>
		  <td>
			<input type="button" id="btn_post" class="submit_btn2" value="确定" /> 
		  </td>
		</tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){

		$("#btn_emailcode").bind("click", function(){ //获取验证码
		
			$val_email = $("#email").val();
			if ($val_email.length == 0) {
				$("#tips_email").html("<font color='red'>请输入邮箱地址</font>");
				return false;
			}
			$(this).val("获取中...");
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->&a=sendemailcode",
				cache: false,
				data: {email:$val_email, r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("#tips_email").html("<font color='green'>发送成功，请查收邮件</font>");
					}
					else {
						if ($result.length > 0) {
							$("#tips_email").html("<font color='red'>"+$result+"</font>");
						}
						else {
							$("#tips_email").html("<font color='red'>发送失败，请检查邮箱是否可用</font>");
						}
						
					}
					$("#btn_emailcode").val("获取验证码");

				},
				error: function() {
					ToastShow("发送失败，请检查网络！");
					$("#btn_emailcode").val("获取验证码");
				}
			});


		});


		$("#btn_post").bind("click", function(){ //确定
			
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->&a=checkemailcode",
				cache: false,
				data: {email:$("#email").val(), checkcode:$("#checkcode").val(), r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						ToastShow("验证/修改成功");
						setTimeout(function(){
							window.location.href="<!--{$oefile}-->&c=<!--{$c}-->";
						}, 800);
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("验证失败，请检查邮箱和验证码是否正确");
						}
					}

				},
				error: function() {
					ToastShow("验证失败，请检查网络！");
				}
			});

		});

	  });
	  </script>
	  <!--{/if}-->


	</div>
	<!--//oe_widget_center End-->

  </div>
  <!--//oem_uright End-->
  <div class="clear"></div>

</div>
<!--{include file="<!--{$oetplpath}-->widget_footer.tpl"}-->
</body>
</html>