<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/fns.tld" prefix="fns" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" /><meta http-equiv="X-UA-Compatible" content="IE=9" />
	<meta name="keywords" content="保险保函、电子保函、保证保险、保函开具、工程投标保证保险、建设合同履约保证保险、业主合同款支付保证保险、建设工程质量保证保险、建筑业企业人工工资支付保证保险、海关税保险、诉讼财产保全责任保险">
	<meta name="description" content="百联保是百川信（厦门）网络信息服务有限公司基于金融创新并响应“互联网＋”计划搭建的第三方金融服务平台。 ">
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<title>百联保-我的账户</title>
</head>

<body>
<jsp:include page="../index/multi_h.jsp"/>
<%--<link rel="stylesheet" href="<c:url value='/resources/version_new/css/reset.css'/>" />--%>
<%--<link rel="stylesheet" href="<c:url value='/resources/version_new/css/applicant.css'/>" />--%>
<style>
	.error{
		/*color:red;*/
		padding-left: 15px;
		border: 1px solid #ed0000 !important; ;
	}
</style>
<div class="container">
	<%--<div class="addr">
		<span>当前位置：</span>
		<span class="current">首页 > </span>
		<a class="active" href="#">我的账户</a>
	</div>--%>
	<jsp:include page="../index/multi_pc_l.jsp"/>

	<!--右边内容区开始-->
	<form id="defaultForm">
		<div class="enter-info email-addr">
			<div class="title">
				<h2 class="tit-name">
					邮寄地址
				</h2>
			</div>
			<ul class="form-list" style="padding-top: 0;height: 100px;">
				<li>
					<div class="list-input">
						<div class="col-sm-12 col-xs-12 reminder" style="margin: 16px;width: 97%;line-height: 20px;">
							<label style="margin-top: 10px;width: 500px">温馨提示：                                                        </label>
							<label style="text-indent: 18px;">1.投保时系统会默认带入此处已添加的邮寄地址，但邮寄地址还是以投保时保险信息填写页面内容为主，投保完成无法变更；</label>
							<label style="margin-bottom: 10px;text-indent: 18px;">2.若有紧急情况需要修改邮寄地址，请联系客服处理。</label>
						</div>
					</div>
				</li>
			</ul>
			<ul class="form-list">
				<li>
					<div class="list-name">
						<label>姓名</label>
					</div>
					<div class="list-input">
						<input type="text" class="inp myValid" id="user_name" name="user_name"  placeholder="请输入姓名">
					</div>
				</li>
				<li>
					<div class="list-name">
						<label>收件人手机</label>
					</div>
					<div class="list-input">
						<input type="text" class="inp myValid" id="telephone" name="telephone" placeholder="请输入11位手机号">
					</div>
				</li>
				<li>
					<div class="list-name">
						<label>居住地</label>
					</div>
					<div class="list-input picker_area_div" >
						<div class="sel-choice">
							<i class="down-icon"></i>
							<select class="default picker_province myValid" id="picker_province" name="province" style="height: 45px;width: 150px">
								<option value="0" selected>请选择省</option>
							</select>
						</div>
						<div class="sel-choice">
							<i class="down-icon"></i>
							<select class="default picker_city myValid" id="picker_city" name="city" style="height: 45px;width: 150px">
								<option value="0" selected>请选择市</option>
							</select>
						</div>
						<div class="sel-choice">
							<i class="down-icon"></i>
							<select class="default picker_district myValid" id="picker_district" name="district" style="height: 45px;width: 150px">
								<option value="0" selected>请选择区</option>
							</select>
						</div>
					</div>
				</li>
				<li>
					<div class="list-name">
						<label>详细地址</label>
					</div>
					<div class="list-input">
						<input type="text" class="inp myValid" id="address" name="address" placeholder="请输入详细地址">
						<%--<span class="list-msg"></span>--%>
					</div>
				</li>
				<li>
					<div class="list-name">
						<label>邮编</label>
					</div>
					<div class="list-input">
						<input type="text" class="inp myValid" id="post_code" name="post_code" placeholder="请输入居住地邮编">
					</div>
				</li>
				<li>
					<div class="list-name"></div>
					<div class="list-input">
						<button class="btn ma_save save" type="button">提交</button>
						<button class="btn ma_back back" type="button">返回</button>
					</div>
				</li>
			</ul>
			<div class="no-email">
				<p class="email-text">没有邮寄地址</p>
				<button type="button" class="btn add-email">+增加邮寄地址</button>
			</div>
		</div>
	</form>
	<!--右边内容区结束-->

</div>
<jsp:include page="../index/multi_f.jsp"/>
<script src="<c:url value='/resources/version_new/js/jquery-1.8.3.min.js' />"></script>
<script src="<c:url value='/resources/version_new/js/jquery.formHelper.js' />"></script>
<script src="<c:url value='/resources/version_new/js/layer/layer.js' />"></script>
<script src="<c:url value='/resources/version_new/js/account.js' />"></script>
<script src="<c:url value='/resources/public/g.js' />"></script>
<script type="text/javascript" src="<c:url value='/resources/commonJS/con-common.js' />"></script>
<script type="text/javascript">
$(document).ready(function(){

	function isWrong(el,obj, msg){
        if(el){
			$(obj).nextAll("span").remove();
			if(msg!="") $(obj).after("<span class='list-msg'>"+msg+"</span>");
			$(obj).addClass("err");
			allright=false;
			return false;
        }else{
            $(obj).nextAll("span").remove();
            $(obj).removeClass("err");
            return true;
        }
	}
	var allright=true,msg="";
	$("#user_name").bind("blur keyup",function(){
        var r1 = isWrong($(this).val().trim()=="",this,"姓名必填");
        if(!r1) return r1;
        var r2 = isWrong(!/^[0-9A-Za-z\u4e00-\u9fa5]{2,30}$/.test($(this).val()),this,"姓名必须是2-30个字符长度");
	});
	$("#telephone").bind("blur keyup",function(){
        var r1 = isWrong($(this).val().trim()=="",this,"手机必填");
        if(!r1) return r1;
        var r2 = isWrong(!/^[0-9]{11}$/.test($(this).val()),this,"手机必须是11位数字");
	});
	$("#address").bind("blur keyup",function(){
        var r1 = isWrong($(this).val().trim()=="",this,"详细地址必填");
        if(!r1) return r1;
        var r2 = isWrong(!/^[\u4e00-\u9fa5_a-zA-Z0-9_\(\)]{1,20}$/.test($(this).val()),this,"请输入最多20个字符长度的详细地址");
	});
	$("#post_code").bind("blur keyup",function(){
        var r1 = isWrong($(this).val().trim()=="",this,"邮编必填");
        if(!r1) return r1;
        var r2 = isWrong(!/^[1-9][0-9]{5}$/.test($(this).val()),this,"请输入正确的邮编");
	});
	$("#picker_province").bind("blur",function(){ isWrong($(this).val().trim()=="",this,""); });
    $("#picker_city").bind("blur",function(){ isWrong($(this).val().trim()=="",this,""); });
    $("#picker_district").bind("blur",function(){ isWrong($(this).val().trim()=="",this,""); });


    // 邮箱保存
    $('.ma_save').click(function () {
         allright=true;
        $(".myValid").each(function(){
            $(this).trigger("blur");
        	if($(this).hasClass("err")) $(this).focus();
        }); //校验表单
		if(allright){
            var data = $("#defaultForm").serializeJson();
            data.sys_client_user_id = '${userdetail.oid}';
            if(obj) data.sys_client_user_post_id = obj.sys_client_user_post_id; //设置主键
            //配套js(/resources/commonJS/con-common.js)1.表单参数，2.请求地址，3.是否同步，4.是否遮盖，5.返回处理
            setParamDatas(data,'/pc/mailAddress/save',false,true,function(json){
                if (json.success == true) {
                    $('.ma_back').hide();
                }
                g_comm_back(json);

            });
		    /*g_ajax("/pc/mailAddress/save",data,function(json){  g_comm_back(json); });  //提交代码*/
		}
    });

    //初始化
    var obj  = JSON.parse('${fns:toJson(row)}')[0];
    if(obj){
        $('.form-list').css('display', 'block');
        $('.no-email').css('display', 'none');
        $(".ma_back").hide();
        $("#defaultForm").setForm(obj);
        if(obj.district!=undefined) {
            $(".picker_province").change();
            $(".picker_city").val(obj.city);
            $(".picker_city").change();
            $(".picker_district").val(obj.district);
//                    districtObj.init(obj);//初始化联动控件{province:140000,city:140100,district:140423}
        }
    }


});
</script>
</body>

</html>
<script>
	$('ul.aside-list li').removeClass('on');
	$("#mailAddress").addClass('on');
</script>


