<?php
if (!defined('ROOT'))
	exit ;
?>
<!DOCTYPE html>
<html>

	<head>
		<title>修改个人资料</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
		include 'Inc_files.php';
		?>
		<link rel="stylesheet" type="text/css" href="/static/member/css/wap.1.0.0.css?v=20171117">
	</head>

	<body data-type="index">
		<script src="<?php echo C('TMPL_PARSE_STRING.__TPL__'); ?>/assets/js/theme.js"></script>
		<div class="am-g tpl-g">
			<?php include 'Inc_head.php'?>
			<!-- 侧边导航栏 -->
			<?php
				include 'Inc_left.php';
			?>
			<!-- 内容区域 -->
			<div class="tpl-content-wrapper">
				<div class="row-content am-cf">
					<div class="row">
	                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
	                        <div class="widget am-cf">
	                            <div class="widget-head am-cf">
	                                <div class="widget-title am-fl">修改个人资料</div>
	                            </div>
	                            <div class="widget-body am-fr">
	                            	<?php $modval = M('member')->find(session('user_auth.id'));?>
	                                <form  class="am-form tpl-form-border-form tpl-form-border-br">
	                                	<input type="hidden" name="model_id" value="27" />
	                                	<input type="hidden" name="id" value="<?php echo session('user_auth.id');?>" />
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">昵称 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" name="nickname" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['nickname'];?>">
	                                            <small></small>
	                                        </div>
	                                    </div>
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">姓名 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" <?php if(trim($modval['truename'])){echo 'disabled="disabled"';}?> name="truename" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['truename'];?>">
	                                            <small>一经设定，不可修改</small>
	                                        </div>
	                                    </div>
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">身份证 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" maxlength="18" <?php if(trim($modval['idcard'])){echo 'disabled="disabled"';}?> name="idcard" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['idcard'];?>">
	                                            <small>一经设定，不可修改</small>
	                                        </div>
	                                    </div>
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">支付宝 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" name="alipay" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['alipay'];?>">
	                                            <small>一经设定，不可修改；必须和上面输入的身份信息一致</small>
	                                        </div>
	                                    </div> 
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">手机 </label>
	                                        <div class="am-u-sm-9">
	                                            <input disabled="disabled" type="text" name="mobile" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['mobile'];?>">
	                                            <small></small>
	                                        </div>
	                                    </div>
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">微信 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" name="weixin" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['weixin'];?>">
	                                            <small></small>
	                                        </div>
	                                    </div> 
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">邮箱 </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" name="email" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['email'];?>">
	                                            <small></small>
	                                        </div>
	                                    </div> 
	                                    <div class="am-form-group">
	                                        <label for="user-name" class="am-u-sm-3 am-form-label">QQ </label>
	                                        <div class="am-u-sm-9">
	                                            <input type="text" name="qq" style="width: 300px;" class="tpl-form-input" value="<?php echo $modval['qq'];?>">
	                                            <small></small>
	                                        </div>
	                                    </div>
	                                    <div class="am-form-group">
	                                        <div class="am-u-sm-9 am-u-sm-push-3">
	                                            <button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success btn_submit">
	                                            	提交
	                                            </button>
	                                        </div>
	                                    </div>
	                                </form>
	                            </div>
	                        </div>
	                    </div>
	                </div>
				</div>
			</div>
		</div>
		<?php
		include 'Inc_files_boot.php';
		?>
		<script src="/static/public/js/idard.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
		jQuery(document).on('click','.btn_submit',function () {
		    var the=jQuery(this);
		    jQuery.ajax({
		    	url:"/member/mod",
		        data:the.closest('form').serializeArray(),
		        dataType: "json",
		        type: "post",
		        timeout: 10000,
		        success: function(data) {
		        	if (data.statua==1) {
		        		wd_alert({msg:data.info})
		        	}else{
		        		wd_alert({msg:data.info,background:'#f00'})
		        	}
		        },
		        error: function() {
		        }
		    });          
		});
		jQuery(document).on('blur','[name="idcard"]',function () {
		    var the=jQuery(this);
		    var checkFlag = new clsIDCard(the.val());
		    if (!checkFlag.IsValid() && the.val()!='') {
		    	wd_alert({msg:'身份证号码有误，请检查',background:'#f00'});
		    	jQuery('.btn_submit').prop('disabled',true);
		    }else{
		    	jQuery('.btn_submit').prop('disabled',false);
		    }         
		})
		
		</script>
	</body>

</html>