<!--{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=<!--{$c}-->"<!--{if $a == 'run'}--> class="_current"<!--{/if}-->>个人信息</a></li>
		<li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit"<!--{if $a == 'edit'}--> class="_current"<!--{/if}-->>修改资料</a></li>
		<li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass"<!--{if $a == 'editpass'}--> class="_current"<!--{/if}-->>修改密码</a></li>
        <!--{if empty($login.user.payword)}-->
        <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=setpaypass"<!--{if $a == 'setpaypass'}--> class="_current"<!--{/if}-->>设置支付密码</a></li>
        <!--{else}-->
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpaypass"<!--{if $a == 'editpaypass'}--> class="_current"<!--{/if}-->>修改支付密码</a></li>
        <!--{/if}-->
        <!--{if $config.oeinterface.flag == "1"}-->
		<li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=bind"<!--{if $a == 'bind'}--> class="_current"<!--{/if}-->>绑定<!--{$config.oeinterface.apiname}-->帐号</a></li>
		<!--{/if}-->

		<li><a href="<!--{$oefile}-->&c=rz">认证中心</a></li>
		<li><a href="<!--{$oefile}-->&c=address">收货地址</a></li>
		
	  </ul>
	  <div class="clear"></div>
	</div>
	
	<div class="oe_widget_center">
	  
	  <!--{if $a == "run"}-->
	  <table class="oe_table_wrap">
	    <tr>
	      <th width="20%">手机号码：</th>
		  <td><!--{$login.user.mobile}--></td>
	    </tr>
	    <tr>
	      <th>邮箱地址：</th>
		  <td><!--{$login.user.email}--></td>
	    </tr>
	    <tr>
	      <th>用户ID：</th>
		  <td><!--{$login.user.userid}--></td>
	    </tr>
	    <tr>
	      <th>用户名：</th>
		  <td><!--{$login.user.username}--></td>
	    </tr>
		<tr>
	      <th>性别：</th>
		  <td>
		  <!--{if $login.user.gender == '1'}-->
		  男
		  <!--{elseif $login.user.gender == '2'}-->
		  女
		  <!--{else}-->
		  ~
		  <!--{/if}-->
		  </td>
	    </tr>
		<tr>
	      <th>所在城市：</th>
		  <td>
		  <!--{area type="text" value=$login.user.area1}--> <!--{area type="text" value=$login.user.area2}-->
		  <!--{area type="text" value=$login.user.area4}--> <!--{area type="text" value=$login.user.area4}-->
		  </td>
	    </tr>
		<tr>
	      <th>所在地址：</th>
		  <td><!--{$login.user.address}--></td>
	    </tr>
		<tr>
	      <th>注册时间：</th>
		  <td><!--{$login.user.regtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
	    </tr>
		<tr>
	      <th>登录时间：</th>
		  <td><!--{$login.user.logintime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
	    </tr>
	  </table>
	  <!--{/if}-->

	  <!--{if $a == "edit"}-->
	  <div class="oe_user_edit">

		<div class="_edit_lt">
		  <h3><!--{$login.user.username}--></h3>
		  <h4>
		    <!--{if empty($login.user.headimg)}-->
		    <img src="<!--{$urlpath}-->tpl/static/images/nopic.jpg" id="img_preview" />
			<!--{else}-->
			<img src="<!--{$urlpath}--><!--{$login.user.headimg}-->" id="img_preview" />
			<!--{/if}-->
		  </h4>
		  <h5>
			<label class="_uploadbtn">上传头像<input type="file" name="img" id="img" value="" /></label>
			<label class="_uploading" id="img_loading">
			  <img src="<!--{$urlpath}-->tpl/static/images/loading.gif" />
			</label>
			<input type="hidden" id="img_thumb" name="headimg" value="<!--{$user.headimg}-->" />
			<input type="hidden" id="img_url" name="drawimg" value="" />
		  </h5>
		  <p>支持JPG，JPEG，GIF，PNG 且大于<!--{$config.uploadmaxsize}-->M</p>

		  <script type="text/javascript">
		  $(function(){
			  $("#img").live("change", function(){
				oemarryUploadImg("img", "<!--{$oefile}-->&c=<!--{$c}-->&a=uploadavatar&module=avatar&thumbfiles=1&forbidwater=1");
			  });
		  });
		  </script>
		</div>

		<div class="_edit_rt">
		  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
		  <input type="hidden" name="a" id="a" value="saveedit" />
		  <table class="oe_table_info">
		    <tr>
			  <th width="20%" align="right">性别：</th>
			  <td width="80%">
			    <input type="radio" name="gender" id="gender" value="1"<!--{if $login.user.gender == '1'}--> checked<!--{/if}--> />男 
				<input type="radio" name="gender" id="gender" value="2"<!--{if $login.user.gender == '2'}--> checked<!--{/if}--> />女
			  </td>
			</tr>
			<tr>
			  <th align="right">所在地区：</th>
			  <td>
				<!--{area type='select' name='area' depth='1' child='1' text='=请选择=' value=$login.user.area1}-->
				<span id="json_area2">
				  <!--{if $login.user.area1 > 0}-->
				  <!--{area type='select' name='area' depth='2' child='1' text='=请选择=' parentid=$login.user.area1 value=$login.user.area2}-->
				  <!--{else}-->
				  <select name="area2" id="area2"><option value="">=请选择=</option></select>
				  <!--{/if}-->
				</span>
				<span id="json_area3">
				  <!--{if $login.user.area2 > 0}-->
				  <!--{area type='select' name='area' depth='3' child='1' text='=请选择=' parentid=$login.user.area2 value=$login.user.area3}-->
				  <!--{else}-->
				  <select name="area3" id="area3"><option value="">=请选择=</option></select>
				  <!--{/if}-->
				</span>
				<span id="json_area4">
				  <!--{if $login.user.area3 > 0}-->
				  <!--{area type='select' name='area' depth='4' text='=请选择=' parentid=$login.user.area3 value=$login.user.area4}-->
				  <!--{/if}-->
				</span>
			  </td>
			</tr>
			<tr>
			  <th align="right">所在地址：</th>
			  <td>
			    <input type="text" name="address" id="address" class="input-200" value="<!--{$login.user.address}-->" />
			  </td>
			</tr>
			<tr>
			  <th align="right">联系人：</th>
			  <td>
			    <input type="text" name="realname" id="realname" class="input-200" value="<!--{$login.user.realname}-->" />
			  </td>
			</tr>
			<tr>
			  <th align="right">个人签名：</th>
			  <td>
			    <textarea name="intro" id="intro" style="width:80%;height:100px;"><!--{$login.user.intro}--></textarea>
			  </td>
			</tr>
			<tr>
			  <th></th>
			  <td>
			    <input type="button" id="btn_post" class="submit_btn1" value="编辑保存" />
			  </td>
			</tr>
		  </table>
		  </form>
		  <script type="text/javascript">
		  $(function(){
			$("#btn_post").bind("click", function(){
				$("#myform").submit();
			});
		  });
		  </script>

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

	  </div>
	  <!--{/if}-->

	  <!--{if $a == "editpass"}-->
	  <h3 class="oe_f_title">修改密码  <span><i>|</i>设置6~16个字符的密码</span></h3>
	  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	  <input type="hidden" name="a" id="a" value="savepass" />
	  <table class="oe_table_info">
	    <tr>
	      <th width="20%">原密码：<font color="red">*</font></th>
		  <td><input type="password" name="oldpassword" id="oldpassword" class="input-200" maxlength="16" /></td>
	    </tr>
	    <tr>
	      <th>新密码：<font color="red">*</font></th>
		  <td><input type="password" name="newpassword" id="newpassword" class="input-200" maxlength="16" /></td>
	    </tr>
	    <tr>
	      <th>确认密码：<font color="red">*</font></th>
		  <td><input type="password" name="confirmpassword" id="confirmpassword" class="input-200" maxlength="16" /></td>
	    </tr>
		<tr>
	      <td></td>
		  <td><input type="button" id="btn_post" class="submit_btn2" value="编辑保存" /></td>
	    </tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){
		$("#btn_post").bind("click", function(){
			if ($("#oldpassword").val().length == 0) {
				ToastShow("请输入原密码");
				return false;
			}
			if ($("#newpassword").val().length <6 || $("#newpassword").val().length>16) {
				ToastShow("请输入6~16位的新密码");
				return false;
			}
			if ($("#confirmpassword").val() != $("#newpassword").val()) {
				ToastShow("确认密码不正确");
				return false;
			}
			$("#myform").submit();
		});
	  });
	  </script>
	  <!--{/if}-->

      <!--{if $a == "setpaypass"}-->
      <h3 class="oe_f_title">设置支付密码  <span><i>|</i>设置6~16个字符的密码</span></h3>
      <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
      <input type="hidden" name="a" id="a" value="savesetpay" />
      <table class="oe_table_info">
          <tr>
              <th width="20%">支付密码：<font color="red">*</font></th>
              <td><input type="password" name="payword" id="payword" class="input-200" maxlength="16" /></td>
          </tr>
          <tr>
              <th>确认密码：<font color="red">*</font></th>
              <td><input type="password" name="confirmpayword" id="confirmpayword" class="input-200" maxlength="16" /></td>
          </tr>
          <tr>
              <td></td>
              <td><input type="button" id="btn_post" class="submit_btn2" value="编辑保存" /></td>
          </tr>
      </table>
      </form>
      <script type="text/javascript">
          $(function(){
              $("#btn_post").bind("click", function(){
                  if ($("#payword").val().length == 0) {
                      ToastShow("请输入支付密码");
                      return false;
                  }
                  if ($("#payword").val().length <6 || $("#payword").val().length>16) {
                      ToastShow("请输入6~16位的支付密码");
                      return false;
                  }
                  if ($("#confirmpayword").val() != $("#payword").val()) {
                      ToastShow("确认密码不正确");
                      return false;
                  }
                  $("#myform").submit();
              });
          });
      </script>
      <!--{/if}-->


      <!--{if $a == "editpaypass"}-->
      <h3 class="oe_f_title">设置支付密码  <span><i>|</i>设置6~16个字符的密码</span></h3>
      <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
      <input type="hidden" name="a" id="a" value="savepay" />
      <table class="oe_table_info">
          <tr>
              <th width="20%">原支付密码：<font color="red">*</font></th>
              <td><input type="password" name="oldpayword" id="oldpayword" class="input-200" maxlength="16" /></td>
          </tr>
          <tr>
              <th width="20%">新支付密码：<font color="red">*</font></th>
              <td><input type="password" name="payword" id="payword" class="input-200" maxlength="16" /></td>
          </tr>
          <tr>
              <th>确认密码：<font color="red">*</font></th>
              <td><input type="password" name="confirmpayword" id="confirmpayword" class="input-200" maxlength="16" /></td>
          </tr>
          <tr>
              <td></td>
              <td><input type="button" id="btn_post" class="submit_btn2" value="编辑保存" /></td>
          </tr>
      </table>
      </form>
      <script type="text/javascript">
          $(function(){
              $("#btn_post").bind("click", function(){
                  if ($("#oldpayword").val().length == 0) {
                      ToastShow("请输入原密码");
                      return false;
                  }
                  if ($("#payword").val().length == 0) {
                      ToastShow("请输入支付密码");
                      return false;
                  }
                  if ($("#payword").val().length <6 || $("#payword").val().length>16) {
                      ToastShow("请输入6~16位的支付密码");
                      return false;
                  }
                  if ($("#confirmpayword").val() != $("#payword").val()) {
                      ToastShow("确认密码不正确");
                      return false;
                  }
                  $("#myform").submit();
              });
          });
      </script>
      <!--{/if}-->

	  <!--{if $a == "bind"}-->

	  <h3 class="oe_f_title">绑定<!--{$config.oeinterface.apiname}-->帐号  <span><i>|</i>（输入<!--{$config.oeinterface.apiname}-->的用户名和密码进行绑定，绑定之后帐号可同步登录）</span></h3>
	  <!--{if !empty($login.user.oeopenid)}-->
      <table class="oe_table_info">
		<tr>
		  <td>已绑定登录</td>
		</tr>
		
      </table>
	  <!--{else}-->
	  <table class="oe_table_info">
	    
		<tr>
		  <th width="20%">用户名：<font color="red">*</font></th>
		  <td><input type="text" name="username" id="username" class="input-200" maxlength="16" /></td>
		</tr>
		<tr>
		  <th>密码：<font color="red">*</font></th>
		  <td><input type="password" name="password" id="password" class="input-200" maxlength="16" /></td>
		</tr>
		<tr>
		  <td></td>
		  <td><input type="button" id="btn_post" class="submit_btn2" value="绑定" /></td>
		</tr>
		
      </table>
	   <script type="text/javascript">
          $(function(){

              $("#btn_post").bind("click", function(){
                  $_username = $("#username").val();
                  $_password = $("#password").val();

                  if ($_username.length == 0) {
                      ToastShow("请输入用户名");
                      return false;
                  }
                  if ($_password.length == 0) {
                      ToastShow("请输入密码");
                      return false;
                  }

                  $.ajax({
					type: "POST",
					url: _ROOT_PATH + "index.php?m=index",
					cache: false,
					data: {c:"interface", a:"sendbind", username:$_username, password:$_password, 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.reload();
							}, 800);
						}
						else {
							if ($result.length > 0) {
								ToastShow($result);
							}
							else {
								ToastShow("绑定失败，请检查用户名和密码");
							}
							
						}

					},
					error: function() {
						ToastShow("绑定失败，请检查用户名和密码");
					}
				  });
     
              });
          });
      </script>
	  <!--{/if}-->

	  <!--{/if}-->


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

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

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