<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/include/taglib.jsp" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link rel="stylesheet" href="/static/weChat/css/public.css">
    <link rel="stylesheet" href="/static/weChat/css/bai_basic.css">
    <link rel="stylesheet" href="/static/weChat/css/SG_area_select.css">
    <link rel="stylesheet" href="/static/weChat/css/new_bai.css">
    <link href="/static/weChat/css/mobiscroll/mobiscroll.2.13.2.css" rel="stylesheet" type="text/css">
    <title>填写订单</title>
    <style>
        #p_tishi{
            position: fixed;
            display: none;
            width: 80%;
            height: 5.78rem;
            background: rgb(255,255,255);
            border-radius: 5px;
            top: 50%;
            left: 10%;
            margin-top: -3.89rem;
            z-index: 109;
        }
        #text_message {
            display: inline-block;
            padding: 0.32rem;
            text-indent: 2em;
            font-size: 14px;
            color: #333;
            line-height: 0.56rem; }
        [data-dpr="2"]  #text_message{
            font-size: 28px; }
        [data-dpr="3"]  #text_message {
            font-size: 42px; }
        #p_tishi h2{
            height: 1.17333rem;
            width: 100%;
            background: linear-gradient(90deg, #ff8b00, #ff6600);
            font-size: 16px;
            color: #fff;
            line-height:  1.17333rem;
            text-align: center;
        }
        [data-dpr="2"]  #p_tishi h2{
            font-size: 32px;
        }
        [data-dpr="3"]  #p_tishi h2{
            font-size: 48px;
        }

        #message_confirm{
            display: block;
            width: 2.5rem;
            height: 0.95rem;
            background: linear-gradient(90deg, #ff8b00, #ff6600);
            margin: 0.15rem auto 0 auto;
            border-radius: 0.08rem;
            font-size: 16px;
            color: #fff;
            line-height: 0.95rem;
            text-align: center;
        }
        [data-dpr="2"]  #message_confirm{
            font-size: 32px;
        }
        [data-dpr="3"]  #message_confirm{
            font-size: 48px;
        }
    </style>
</head>
<body id="container">
<%--过度动画--%>
<div id="mask">
    <div class="main">
        <div class="loading">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </div>
    </div>
    <div class="black-mask-my"></div>
</div>
<div class="arment-head">
    <div class="arment-left">
        <a href="/weixin/order/zzx/zzx_write_order2?ins_insurance_slip_id=${p.ins_insurance_slip_id}">
            <img src="/static/weChat/images/arment-left.png"/>
        </a>
    </div>
    <p>填写订单</p>
</div>
<div class="users-data eeded">
    <h2>投保基本信息</h2>
    <form id="defaultForm">
        <ul class="data">
            <li>
                <p>展会名称</p>
                <div class="dfg">
                    <input placeholder="请填写展会活动名称" id="a1" name="name" class="valid_name myValid" value="${row.special.name}"/>
                    <input type="hidden" name="activity_id" class="valid_activity_id" value="${row.special.activity_id}"/>
                    <b></b>
                </div>
            </li>
            <li>
                <p>所在城市</p>
                <div class="dfg">
                    <input  id="selectBtn" readonly="readonly" class="s-sl valid_ex_area myValid" placeholder="请选择" id="a2" value="${row.ex_area}">
                    <b></b>
                </div>
                <div class="qqq" style="display: none">
                    <input type="text" id="a-province" name="ex_province" value="${row.special.ex_province}">
                    <input type="text" id="a-city" name="ex_city" value="${row.special.ex_city}">
                    <input type="text" id="a-area" name="ex_county" value="${row.special.ex_county}" >
                </div>
            </li>
            <li>
                <p>具体地址</p>
                <div class="dfg">
                    <i id="ert" class="wert">${row.special.ex_address}</i>
                    <input  id="data_s3" style="display: none" class="valid_ex_address myValid" name="ex_address" value="${row.special.ex_address}">
                    <b></b>
                </div>
            </li>
            <li class="wee">
                <p>展位</p>
                <div class="dfg">
                    <textarea placeholder="请填写展位，支持多个展位" name="ex_no"  class="valid_ex_no myValid" id="a3">${row.special.ex_no}</textarea>
                    <c:if test="${not empty ywzc_activity_info.activity_id||not empty row.special.activity_id}">
                        <a href="javascript:;" id="sou">
                            <img src="/static/weChat/images/search-icon.png">
                        </a>
                    </c:if>
                    <b></b>
                    <div class="lmb-content"></div>
                </div>
            </li>
            <li class="text-ti">
                <i style="display: block">多展位用字母小写“,”隔开，或通过检索展位再添加。如：A001,A002</i>
            </li>
            <li>
                <p>展位总面积</p>
                <div class="dfg">
                    <input  placeholder="请填写展位具体面积" class="s-sd valid_ex_acreage myValid" id="a4" name="ex_acreage"  value="${row.special.ex_acreage}">
                    <em class="wed">平米</em>
                    <b></b>
                </div>
            </li>
            <li style="border-bottom: none;">
                <p>雇员数量</p>
                <div class="dfg">
                    <input  placeholder="雇员数量" name="ex_emp_num" class="valid_ex_emp_num myValid" value="${row.special.ex_emp_num}">
                    <b></b>
                </div>
            </li>
        </ul>
        <ul class="data">
            <li>
                <p>是否包含拆搭建</p>
                <div class="dfg" id="wed">
                    <input id="contains" readonly="readonly" class="s-sl" placeholder="请选择">
                    <input  id="contains_val" type="hidden" name="contains" class="valid_contains_val myValid" value="${row.special.contains}">
                    <b></b>
                </div>
            </li>
            <li style="display: none;">
                <p>搭建公司</p>
                <div class="dfg">
                    <input  placeholder="非必填，如有搭建公司请填写" name="build_com_name" class="valid_build_com_name myValid" value="${row.special.build_com_name.trim()}">
                    <b></b>
                </div>
            </li>
            <li style="display: none;">
                <p>转包单位</p>
                <div class="dfg">
                    <input  placeholder="非必填，如有转包单位请填写" name="subcontracting_units" class="valid_subcontracting_units myValid" value="${row.special.subcontracting_units.trim()}">
                    <b></b>
                </div>
            </li>
            <li style="display: none;">
                <p>参展商名称</p>
                <div class="dfg">
                    <input  placeholder="请填写参展商名称" name="exhibitor_name" class="valid_exhibitor_name myValid" value="">
                    <b></b>
                </div>
            </li>
            <li style="display: none;">
                <p>证件类型</p>
                <div class="dfg">
                    <input id="exhibitor_type" name="exhibitor_type" value="" type="hidden">
                    <input id="exhibitor_type_show" readonly="true"  class="s-sl valid_exhibitor_type myValid" placeholder="请选择" >
                    <b></b>
                </div>
            </li>
            <li style="display: none;">
                <p>证件号</p>
                <div class="dfg">
                    <input placeholder="根据证件类型填写证件号" class="valid_exhibitor_code myValid"  id="exhibitor_code" name="exhibitor_code" value=""/>
                    <b></b>
                </div>
            </li>
            <li>
                <p>保障起始时间</p>
                <div class="dfg" style="position: relative">
                    <input id="appDate" readonly="readonly" class="s-sl valid_star_time myValid" placeholder="" name="star_time" value="${row.special.star_time}">
                    <b></b>
                    <div class="xue" style="position: absolute;width: 100%;height: 100%;top: 0;left: 0;background: transparent;z-index: 9;"></div>
                </div>
            </li>
            <li style="border-bottom: none">
                <p>保障结束时间</p>
                <div class="dfg">
                    <input id="appDate_end" readonly="readonly" class="s-sl valid_end_time myValid" placeholder=""  name="end_time" value="${row.special.end_time}">
                    <b></b>
                </div>
            </li>
            <li class="text-ti">
                <i style="display: block">若投保人为参展商时，请填写展会活动时间；若为搭建商时，请填写搭建拆除时间</i>
            </li>
        </ul>
        <ul class="data">
            <li>
                <p>司法管辖</p>
                <div class="dfg">
                    <input  readonly="readonly" placeholder="中华人民共和国司法管辖（港澳台除外）" id="a5"/>
                    <b></b>
                </div>
            </li>
            <li>
                <p>争议处理</p>
                <div class="dfg">
                    <input  id="dispute" readonly="readonly" class="s-sl" placeholder="请选择">
                    <input  id="dispute_val" type="hidden" name="dispute" class="valid_dispute_val myValid" value="${row.special.dispute}">
                    <b></b>
                </div>
            </li>
            <li id="zhong" style="display: none">
                <p>仲裁机构</p>
                <div class="dfg">
                    <input  placeholder="请填写仲裁机构全称" id="a6" name="arbitral_institution" class="valid_arbitral_institution myValid" value="${row.special.arbitral_institution}"/>
                    <b></b>
                </div>
            </li>
        </ul>
    </form>
</div>
<div class="next-step">
    <span id="previous-step">上一步</span>
    <span class="ert">下一步</span>
</div>

<!--具体地址弹窗-->
<div class="business-select" id="address-cont">
    <h2>请填写具体地址</h2>
    <textarea name="ex_address"></textarea>
    <div class="sure">
        <p class="ding">确定</p>
        <p class="xiao">取消</p>
    </div>
</div>

<!--是否包含拆搭建-->
<div class="business-select" id="contains-cont">
    <h2>请选择是否包含拆搭建</h2>
    <ul>
        <li>
            <p val="0">否</p>
        </li>
        <li>
            <p val="1" >是</p>
        </li>
    </ul>
</div>
<!--争议处理弹窗-->
<div class="business-select" id="dispute-cont">
    <h2>请选择争议处理类型</h2>
    <ul>
        <li>
            <p val="0">诉讼</p>
        </li>
        <li>
            <p val="1" >仲裁</p>
        </li>
    </ul>
</div>
<!--证件类型选择弹窗-->
<div class="business-select" id="card">
    <h2>请选择证件类型</h2>
    <ul>
        <li>
            <p val="1">组织机构代码证</p>
        </li>
        <li>
            <p val="2">统一社会信用代码</p>
        </li>
        <li>
            <p val="7">营业执照</p>
        </li>
        <li>
            <p val="6">税务登记证</p>
        </li>
    </ul>
</div>
<!--是否返回弹窗-->
<div class="problem-popr">
    <img src="/static/weChat/images/problem.png" />
    <p>该订单未保存是否确认返回？</p>
    <div class="problem-bottom">
        <a href="javascript:;" id="problem-sure">确认</a>
        <a href="javascript:;" id="problem-cancel">取消</a>
    </div>
</div>

<!--搜索弹窗-->
<div class="lm-sousu">
    <div class="lian-search">
        <div class="search">
            <div class="search-back">
                <a href="javascript:;">
                    <img src="/static/weChat/images/yellow-back.png" />
                </a>
            </div>
            <input type="text" placeholder="请输入关键词搜索" id="serachText" value=""/>
            <div class="serach-error">
                <img src="/static/weChat/images/remove-error.png" />
            </div>
        </div>
        <div class="lian-cancel">
            <a href="javascript:listExNum($('#serachText').val());">搜索</a>
        </div>
    </div>
    <!--根据关键字搜索出来的内容-->
    <div class="lm-search-content">
        <ul id="searchResult">

        </ul>
    </div>


    <div class="lm-que">
        <button id="qu">取消</button>
        <button class="que">确认选择</button>
    </div>
</div>

<div id="p_tishi">
    <h2>提示</h2>
    <p id="text_message"></p>
    <span id="message_confirm" onclick="javascript:$('#p_tishi').hide();$('.black-mask').hide();">确定</span>
</div>

<!--黑色蒙版-->
<div class="black-mask"></div>

</body>
<script src="/static/weChat/js/jquery-1.8.3.min.js"></script>
<script src="/static/weChat/js/flexible.js"></script>
<script src="/static/weChat/js/basic.js"></script>
<script src="/static/weChat/js/iscroll.js"></script>

<script src="/static/weChat/js/jquery.formHelper.js"></script>
<script src="/static/weChat/common/layer_mobile/layer.js"></script>
<link rel="stylesheet" href="/static/weChat/common/layer_mobile/need/right.css"/>
<script src="/static/weChat/js/weixin_g.js"></script>

<script src="/static/weChat/js/SG_area_select-two.js"></script>
<script src="/static/weChat/js/mobiscroll/mobiscroll.2.13.2.js" type="text/javascript"></script>
<script src="/static/weChat/js/autosize.js" type="text/javascript"></script>
<script>
//    autosize(document.querySelectorAll('textarea'));
autosize($('.valid_ex_no'));
</script>
<script>
    function card(){
        sr_height = parseInt($('#card').height()/2);
        $('#card').css({"margin-top":-sr_height+'px'});
        $('#exhibitor_type_show').click(function () {
            $('#card').show();
            $('.black-mask').show();
        });
        $('#card ul li p').click(function () {
            $('#card ul li p').removeClass('on');
            $(this).addClass('on');
            var sd = $(this).text();
            $('#exhibitor_type_show').val(sd); //显示值
            $('#exhibitor_type').val($(this).attr("val")); //实际值
            $('#card').hide();
            $('.black-mask').hide();
            $(".valid_exhibitor_type").trigger("change");
        });
    }
    var isDispute=false;
    $(function () {

        var s_height = parseInt($('#dispute-cont').height()/2);
        $('#dispute-cont').css({"margin-top":-s_height+'px'});
        $('#dispute').click(function () {
            $('#dispute-cont').show();
            $('.black-mask').show();
        });
        $('#dispute-cont ul li p').click(function () {
            $('#dispute-cont ul li p').removeClass('on');
            $(this).addClass('on');
            var sd = $(this).text();
            $('#dispute').val(sd);
            $('#dispute_val').val($(this).attr("val"));
            if($(this).text() == '仲裁'){
                $('#zhong').show();
                isDispute=true;
            }else{
                $('#zhong').hide();
                isDispute=false;
            }
            $('#dispute-cont').hide();
            $('.black-mask').hide();
            $(".valid_dispute_val").trigger("change");
        });

        var se_height = parseInt($('#address-cont').height()/2);
        $('#address-cont').css({"margin-top":-se_height+'px'});

        $('#ert').click(function () {
            var df = $('#ert').text();
            $('#address-cont').show();
            $('#address-cont textarea').val(df).focus();
            $('.black-mask').show();
        });
        $('#address-cont .sure p.xiao').click(function () {
            $('#address-cont').hide();
            $('.black-mask').hide();
        });
        $('#address-cont .sure p.ding').click(function () {
            $('#address-cont').hide();
            var ert = $('#address-cont textarea').val();
            $('#ert').text(ert);
            $('#data_s3').val(ert);
            $('.black-mask').hide();
            $(".valid_ex_address").trigger("change");
        });

        var co_height = parseInt($('#contains-cont').height()/2);
        $('#contains-cont').css({"margin-top":-co_height+'px'});

        $('#wed').click(function () {
            $('#contains-cont').show();
            $('.black-mask').show();
        });

        $('#contains-cont ul li p').click(function () {
            $('#contains-cont ul li p').removeClass('on');
            $(this).addClass('on');
            var sd = $(this).text();
            var _val = $(this).attr("val");
            $('#contains').val(sd);
            $('#contains_val').val(_val);
            $('#contains-cont').hide();
            $('.black-mask').hide();
            $(".valid_contains_val").trigger("change");
            if(_val == '1'){
                $('.valid_ex_emp_num').parent().parent().attr('style','');
                $('.valid_build_com_name').parent().parent().show();
                $('.valid_subcontracting_units').parent().parent().show();
                openShow('1');
            }else{
                $('.valid_ex_emp_num').parent().parent().attr('style','border-bottom: none;');
                $('.valid_build_com_name').parent().parent().hide();
                $('.valid_subcontracting_units').parent().parent().hide();
                $('.valid_build_com_name').val('');
                $('.valid_subcontracting_units').val('');
                openShow('0');
            }
            $('.dfg .xue').hide();
        });

        //定位input、textarea
        function po_Last(obj) {
            obj.focus();//解决ff不获取焦点无法定位问题
            if (window.getSelection) {//ie11 10 9 ff safari
                var max_Len=obj.value.length;//text字符数
                obj.setSelectionRange(max_Len, max_Len);
            }
            else if (document.selection) {//ie10 9 8 7 6 5
                var range = obj.createTextRange();//创建range
                range.collapse(false);//光标移至最后
                range.select();//避免产生空格
            }
        }
        //选择地区
        $('#selectBtn').on('click', function () {
            $.areaSelect();
            $('.title-min .query').on('click',function(){
//                $('#selectBtn').val('');
                $(".popups-box").show().animate({bottom:'-500px'},function(){
                    $('.sg-mask').css('display','none');
                    $('.sg-mask').remove();
                });

            })

            /*移动端确定操作响应*/
            $('.title-min .submit').on('click',function(){
                if($('#wrapper2 ul li').hasClass('minISClick')){
                    $('#selectBtn').val($('#hasCheck').val());
                    $(".valid_ex_area").trigger("change");
                    $(".popups-box").show().animate({bottom:'-500px'},function(){
                        $('.sg-mask').css('display','none');
                        $('.sg-mask').remove();
                    })
                }
                $('#a-province').val($('#wrapper0 ul li.minISClick input').val());
                $('#a-city').val($('#wrapper1 ul li.minISClick input').val());
                $('#a-area').val($('#wrapper2 ul li.minISClick input').val());
            })
        });

        var currYear = (new Date()).getFullYear();
        var currDay = (new Date()).getDate()+1;
        var opt={};
        opt.date = {preset : 'date'};
        opt.datetime = {preset : 'datetime'};
        opt.time = {preset : 'time'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'modal', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yy-mm-dd',
            lang: 'zh',
            showNow: false,
//            nowText: "今天",
            startYear: currYear, //开始年份
//            startDay: currDay,
            endYear: currYear + 2, //结束年份
            minDate: Gdate.addDateTypeBySeconds(new Date(),24*60*60),
            maxDate: '${row.product_code}'.indexOf('ZZX-ZA')==-1?Gdate.addDateTypeBySeconds(new Date(),60*24*60*60):Gdate.addDateTypeBySeconds(new Date(),90*24*60*60),
            onSelect: function (valueText, inst) {
                var id = $(this)[0].id;
                var validity = valueText.split("-");
                if (id === "appDate") {
                    if (opt.default.maxDate) {
                        opt.default.maxDate = null;
                    }
                    opt.default.maxDate = Gdate.addDateBySeconds(valueText,14*24*60*60);
                    opt.default.minDate = Gdate.addDateBySeconds(valueText,0*24*60*60);
                    if('${row.product_code}'.indexOf('ZZX-YA')==-1){//永安保障结束日期为固定30天，插件不可选
                        $("#appDate_end").mobiscroll($.extend(opt['date'], opt['default']));
                        $('#appDate_end').val('');
                    }else{
                        $('#appDate_end').val(Gdate.format(Gdate.addDateBySeconds(valueText,29*24*60*60), 'yyyy-MM-dd'));
                    }
                }
            }
        };

        $('.dfg .xue').click(function () {
            layer.open({content:"请先完善“是否包含拆搭建”选项",btn: '我知道了'});
            return;
        });
//        var c_v = $('#contains_val').val();
//        if(c_v == ''){
//            layer.open({content:"请先完善“是否包含拆搭建”选项",btn: '我知道了'}); return;
//            return;
//        }
        $("#appDate").mobiscroll($.extend(opt['date'], opt['default']));

        //如果star_time不为空，那么初始化结束时间的限制
        if("${row.special.star_time}"!=""){
            $('.dfg .xue').hide();
            opt.default.minDate = Gdate.addDateBySeconds("${row.special.star_time}",0*24*60*60);
            opt.default.maxDate = Gdate.addDateBySeconds("${row.special.star_time}",14*24*60*60),
            $("#appDate").mobiscroll($.extend(opt['date'], opt['default']));
            if('${row.product_code}'.indexOf('ZZX-YA')==-1){
                $("#appDate_end").mobiscroll($.extend(opt['date'], opt['default']));
            }
        }

        //点击返回是否确认返回
        p_height = parseInt($('.problem-popr').height()/2);
        $('.problem-popr').css({"margin-top":-p_height+'px'});

        $('#previous-step').click(function () {
            $('.problem-popr').show();
            $('.black-mask').show();
        });

        $('#problem-sure').click(function () {
            $('.problem-popr').hide();
            $('.black-mask').hide();
            location.href="/weixin/order/zzx/zzx_write_order2?ins_insurance_slip_id=${p.ins_insurance_slip_id}";
        });
        $('#problem-cancel').click(function () {
            $('.problem-popr').hide();
            $('.black-mask').hide();
        });
    })

</script>
<script>
    $("#a5").click(function(){
        layer.open({content:$(this).attr("placeholder"),btn: '我知道了'})
    })

    var allright=true;
    function isWrong(el,obj, msg){
        if(el){
            $(obj).nextAll("b").remove();
            if(msg!="") $(obj).after("<b style='display:block'>"+msg+"</b>");
            allright=false;
//            console.log(obj)
            return false;
        }else{
            $(obj).nextAll("b").remove();
            return true;
        }
    }
    function clearErr(obj){
        $(obj).nextAll("b").remove();
    }

    $(".valid_name").bind("blur keyup",function(){ //展会名称
        var r1 = isWrong($(this).val().trim()=="",this,"请输入展会名称"); if(!r1) return r1;
        var r2 = isWrong( !($(this).val().length<=24 && $(this).val().length>=1),this,"请输入1-24个字符长度");
//        var r2 = isWrong(!/^[\u4e00-\u9fa5a-zA-Z]{1,24}$/.test($(this).val()),this,"要求1-24个中英文字母");
    });
    $(".valid_ex_area").bind("change",function(){ //所在城市
        var r1 = isWrong($(this).val().trim()=="",this,"请选择所在城市"); if(!r1) return r1;
    });
    $(".valid_ex_address").bind("change",function(){ //具体地址
        var r1 = isWrong($(this).val().trim()=="",this,"请输入具体地址"); if(!r1) return r1;
        var r2 = isWrong( !($(this).val().length<=50 && $(this).val().length>=5),this,"要求5-50个字符长度");
    });
    $(".valid_star_time").bind("change",function(){ //保障起始时间
        var r1 = isWrong($(this).val().trim()=="",this,"请选择保障起始时间"); if(!r1) return r1;
    });
    $(".valid_end_time").bind("change",function(){ //保障结束时间
        var r1 = isWrong($(this).val().trim()=="",this,"请选择保障结束时间"); if(!r1) return r1;
    });
    $(".valid_ex_no").bind("blur",function(){ //展位号
        var r1 = isWrong($(this).val().trim()=="",this,"请输入展位"); if(!r1) return r1;
        var r3 = isWrong(!/^[\u4e00-\u9fa5\s,a-zA-Z0-9,\,\，\-\_]{2,300}$/.test($(this).val()),this,"展位信息格式有误"); if(!r3) return r3;
        var flag = true;
        var msg = '展位信息格式有误';
        var _no = $(this).val();
        if(_no.indexOf(',,')!=-1||_no.indexOf('，，')!=-1||_no.indexOf(',，')!=-1||_no.indexOf('，,')!=-1||_no.substring(_no.length-1,_no.length).indexOf(',')!=-1||_no.substring(_no.length-1,_no.length).indexOf('，')!=-1||_no.substring(0,1).indexOf(',')!=-1||_no.substring(0,1).indexOf('，')!=-1){

        }else{
            flag = false;
        }
        var r2 = isWrong(flag,this,msg);
    });
    $(".valid_ex_acreage").bind("blur keyup",function(){ //展会面积
        var r1 = isWrong($(this).val().trim()=="",this,"请输入展位总面积"); if(!r1) return r1;
        var pCode = '${row.product_code}';
        if(pCode == '' ? false : pCode.indexOf('ZZX-ZA') > -1 ? true : false){
            var r2 = isWrong(!/^\d{1,3}$/.test($(this).val()),this,"请输入1-108区间的数值");   //108  雇员数量20
            var r3 = isWrong(!($(this).val()>=1 && $(this).val()<=108),this,"请输入1-108区间的数值");   //108  雇员数量20
        }
        if(pCode == '' ? false : pCode.indexOf('ZZX-YA') > -1 ? true : false){
            var r2 = isWrong(!/^\d{1,3}$/.test($(this).val()),this,"请输入1以上的数值");   //108  雇员数量20
            var r3 = isWrong(!($(this).val()>=1),this,"请输入1以上的数值");
        }
        if(pCode == '' ? false : pCode.indexOf('ZZX-PAC') > -1 ? true : false){
            if(pCode.indexOf('ZZX-PAC-1') > -1){
                var r2 = isWrong(!/^\d{1,3}$/.test($(this).val()),this,"请输入1-36区间的数值");   //36  雇员数量20
                var r3 = isWrong(!($(this).val()>=1 && $(this).val()<=36),this,"请输入1-36区间的数值");   //36  雇员数量20
            }
            if(pCode.indexOf('ZZX-PAC-2') > -1){
                var r2 = isWrong(!/^\d{1,3}$/.test($(this).val()),this,"请输入1-100区间的数值");   //100  雇员数量20
                var r3 = isWrong(!($(this).val()>=1 && $(this).val()<=100),this,"请输入1-100区间的数值");   //100  雇员数量20
            }
            if(pCode.indexOf('ZZX-PAC-3') > -1){
                var r2 = isWrong(!/^\d{1,3}$/.test($(this).val()),this,"请输入1-36区间的数值");   //1  雇员数量20
                var r3 = isWrong(!($(this).val()>=1),this,"请输入1以上的数值");   //1  雇员数量20
            }
        }
    });
    $(".valid_ex_emp_num").bind("blur keyup",function(){ //雇员数量
        var r1 = isWrong($(this).val().trim()=="",this,"请输入雇员数量"); if(!r1) return r1;
        var r2,r3;
        var pCode = '${row.product_code}';
        if(pCode.indexOf('ZZX-PAC') > -1||pCode.indexOf('ZZX-YA') > -1){
            r2 = isWrong(!/^\+?[1-9]\d*$/.test($(this).val()),this,"请输入数值必须大于1");   //108  雇员数量20
            r3 = isWrong(!($(this).val()>=1),this,"请输入数值必须大于1");   //108  雇员数量20
        }else{
            r2 = isWrong(!/^\d{1,2}$/.test($(this).val()),this,"请输入1-20区间的数值");   //108  雇员数量20
            r3 = isWrong(!($(this).val()>=1 && $(this).val()<=20),this,"请输入1-20区间的数值");   //108  雇员数量20
        }

    });
    $(".valid_build_com_name").bind("blur keyup",function(){ //搭建公司
        if($(this).val().trim()=="") { clearErr(this); return;} //允许为空
        var r2 = isWrong(!/^[\u4e00-\u9fa5a-zA-Z0-9\(\)\（\）]{1,24}$/.test($(this).val()),this,"请输入1-24个中英文数字括号");
    });
    $(".valid_subcontracting_units").bind("blur keyup",function(){ // 转包单位
        if($(this).val().trim()=="") { clearErr(this); return;} //允许为空
        var r2 = isWrong(!/^[\u4e00-\u9fa5a-zA-Z0-9\(\)\（\）]{1,24}$/.test($(this).val()),this,"请输入1-24个中英文数字括号");
    });
    $(".valid_dispute_val").bind("change",function(){ // 仲裁
        var r1 = isWrong($(this).val().trim()=="",this,"请选择争议处理类型"); if(!r1) return r1;
    });
    $(".valid_contains_val").bind("change",function(){ // 是否包含拆搭建
        var r1 = isWrong($(this).val().trim()=="",this,"请选择是否包含拆搭建"); if(!r1) return r1;
    });
    $(".valid_arbitral_institution").bind("blur keyup",function(){ //投保人名称
        if(isDispute){ //如果选择了仲裁，这个仲裁机构必须要填写
            var r1 = isWrong($(this).val().trim()=="",this,"请输入仲裁机构"); if(!r1) return r1;
            var r2 = isWrong(!/^[\u4e00-\u9fa5a-zA-Z]{1,24}$/.test($(this).val()),this,"请输入1-24个中英文字母");
        }
    });

    $('.next-step .ert').click(function () {
        var p  = $("#defaultForm").serializeJson();
        allright=true;
        $(".myValid").each(function(){
            if($(this).attr("id")=="appDate") return;
            $(this).trigger("blur"); $(this).trigger("change");
        }); //校验表单
        //开始时间不能比当前时间早
        if(Gdate.getDaysDiff(p.star_time, Gdate.curtime())<=0){
            layer.open({content:"保障开始时间必须是今天以后,不能包含今天",btn: '我知道了'}); return;
        }
        //保障结束时间不能比开始时间早
        if(Gdate.getDaysDiff(p.end_time ,p.star_time )<=-1){
            layer.open({content:"保障结束时间必须要比开始时间晚",btn: '我知道了'}); return;
        }
        if('${row.product_code}'.indexOf('ZZX-YA')==-1){
            if(Gdate.getDaysDiff(p.end_time ,p.star_time )>14){
                layer.open({content:"保障结束时间只能比开始时间大15天",btn: '我知道了'}); return;
            }
        }

        if(allright){
            if("${row.order_status}"!=""){
                if("${row.order_status}"!="1" && "${row.order_status}"!="2"){
                    layer.open({content:"订单已生效不可以修改",btn: '我知道了'}); return;
                }
            }
            p.special_exhibition_id = "${row.special.special_exhibition_id}";
            p.ins_mail_policy_id = "${row.ins_mail_policy.ins_mail_policy_id}";
            p.ins_insurance_slip_id = "${p.ins_insurance_slip_id}";
            p.product_code = '${row.product_code}';
            $("#mask").show();
            g_ajax("/weixin/order/save/special",p,function(json){
                if (json.success == true) {
                    window.location.href="/weixin/order/zzx/zzx_order_make_sure?ins_insurance_slip_id="+json.msg;
                } else {
                    $("#mask").hide();
                    layer.open({content:json.msg,btn: '我知道了'})
                }
            },true);
        }else{
            layer.open({content:"请认真填写表单，再点击下一步",btn: '我知道了'})
        }
    });

    var dispute={"1":"仲裁","0":"诉讼"}, show="";
    if('${row.special.dispute}'!='') show=dispute['${row.special.dispute}'];
    $("#dispute").val(show);
    if('${row.special.dispute}'=='1') $('#zhong').show();


    if('${row.special.contains}'!='') {
        var contains={"1":"是","0":"否"}, co_show="";
        co_show=contains['${row.special.contains}'];
        $("#contains_val").val('${row.special.contains}');
        $("#contains").val(co_show);
    }

    if('${row.special.contains}'=='1') $('.valid_ex_emp_num').parent().parent().attr('style','');$('.valid_build_com_name').parent().parent().show();$('.valid_subcontracting_units').parent().parent().show();
    if('${row.special.contains}'=='0') $('.valid_build_com_name').parent().parent().hide();$('.valid_subcontracting_units').parent().parent().hide();

    $(document).ready(function () {
        g_ajax("/weixin/order/detail/debug/",{ins_insurance_slip_id:'${p.ins_insurance_slip_id}'},function(json){
            console.log(json);
        },true);
        //展会名称
        if($(".valid_name").val()=="") $(".valid_name").val('${ywzc_activity_info.name}');
        //活动id如果请求业支有返回活动信息
        if($(".valid_activity_id").val()=="") $(".valid_activity_id").val('${ywzc_activity_info.activity_id}');
        if('${row.special.star_time}' != ''){
            if(Gdate.getDaysDiff('${row.special.star_time}', Gdate.curtime())<=0){
                $(".valid_star_time").val('');
                $(".valid_end_time").val('');
            }
        }else{
            //开始和结束时间
            if($(".valid_star_time").val()=="") $(".valid_star_time").val('${ywzc_activity_info.star_time}');
            if($(".valid_end_time").val()=="") $(".valid_end_time").val('${ywzc_activity_info.end_time}');
        }


        //展会地址
        if($(".valid_ex_area").val()=="") $(".valid_ex_area").val('${ywzc_activity_info.ex_area}');
        if($("#a-province").val()=="") $("#a-province").val('${ywzc_activity_info.ex_province}');
        if($("#a-city").val()=="") $("#a-city").val('${ywzc_activity_info.ex_city}');
        if($("#a-area").val()=="") $("#a-area").val('${ywzc_activity_info.ex_county}');
        if($(".valid_ex_address").val()==""){ $(".valid_ex_address").val('${ywzc_activity_info.ex_address}'); $("#ert").text("${ywzc_activity_info.ex_address}");  }

        //投保人为搭建商时，设置
        if('${row.applicant.role_type}'=='2'){
            //触发是否拆搭建 是
            if('${row.special.contains}'!='0') {//只要拆搭建不是已经选择了否，那么就执行
                $('#contains-cont ul li p').last().click();
            }
            //填充搭建公司名称
            $('.valid_build_com_name').val('${row.applicant.name_cn}');
            //判断是否是平安产品，如果是，显示参展商
            if('${row.product_code}'.indexOf('ZZX-PAC')>-1||'${row.product_code}'.indexOf('ZZX-YA')>-1){
                var e_type={"7":"营业执照","6":"税务登记证","1":"组织机构代码证","2":"统一社会信用代码"}, show="请选择";
                var it = '${row.special.exhibitor_type.trim()}';
                var ec = '${row.special.exhibitor_code.trim()}'; if(ec != '') $('.valid_exhibitor_code').val(ec);
                var en = '${row.special.exhibitor_name.trim()}'; if(en != '') $('.valid_exhibitor_name').val(en);
                if(it!='') show=e_type[it];
                $("#exhibitor_type_show").val(show);
                $("#exhibitor_type").val(it);

                $('.valid_exhibitor_name').parent().parent().show();
                $('.valid_exhibitor_type').parent().parent().show();
                $('.valid_exhibitor_code').parent().parent().show();
                card();
                $(".valid_exhibitor_name").bind("blur keyup",function(){ //参展商必填校验
                    var r1 = isWrong($(this).val().trim()=="",this,"请输入参展商名称"); if(!r1) return r1;
                    var r2 = isWrong(!/^[\u4e00-\u9fa5\s,a-zA-Z,\（\）]{2,50}$/.test($(this).val()),this,"请输入2-50个中英文字母");
                });
                $(".valid_exhibitor_type").bind("change",function(){ //证件类型
                    var r1 = isWrong($(this).val().trim()=="",this,"请选择证件类型"); if(!r1) return r1;
                });
                $(".valid_exhibitor_code").bind("blur keyup",function(){ //证件号码
                    var r1 = isWrong($(this).val().trim()=="",this,"请输入证件号码"); if(!r1) return r1;
                    var exhibitor_type = $('#exhibitor_type').val();
                    var flag = false;
                    if(exhibitor_type == '7'){//营业执照
                        flag = !/^[a-zA-Z0-9]{15,18}$/.test($(this).val());
                    }else if(exhibitor_type == '6'){//税务登记证
                        flag = !/^[a-zA-Z0-9]{15,18}$/.test($(this).val());
                    }else if(exhibitor_type == '2'){//统一社会信用代码
                        flag = !/^[a-zA-Z0-9]{18}$/.test($(this).val());
                    }else {//组织机构代码证
                        flag = !/^[a-zA-Z0-9]{9}$/.test($(this).val());
                    }
                    var r2 = isWrong(flag,this,"请根据实际证件填写正确的号码"); if(!r2) return r2;
                });
            }
            $('#contains').unbind();
        }
        $("#mask").hide();
    })
    function listExNum(_text){
        var aid = $('.valid_activity_id').val();
        var ven = $('.valid_ex_no').val();
        if(aid != ''){
            var exArr = ${not empty ywzc_activity_info ? ywzc_activity_info.exhibitions : []};
            var _ex_html = '';
            for(var i=0;i<exArr.length;i++){
                var ehp = exArr[i].exhibition_pos_name;
                var _cla = '';
                if(ven != ''){
                    if(ven.indexOf(ehp)>-1){
                        _cla = 'class="active"';
                    }
                }
                if(_text != ''){
                    if(ehp.indexOf(_text)>-1){
                        _ex_html = _ex_html + '<li '+_cla+'><p>'+ehp+'</p><span></span></li>';
                    }
                }else{
                    _ex_html = _ex_html + '<li '+_cla+'><p>'+ehp+'</p><span></span></li>';
                }
            }
            $('#searchResult').html(_ex_html);

            $('.lm-search-content ul li').click(function () {
                if($(this).hasClass('active')){
                    $(this).removeClass('active');
                    if(!$(this).siblings('li').hasClass('active')){
                        $('.lm-que button.que').removeClass('on');
                    }
                }else{
                    $(this).addClass('active');
                    $('.lm-que button.que').addClass('on');
                }
            });
        }
    }
    function openShow(_n){
        var detail = '';
        if(_n == '0'){
            detail = '本产品保障时间可覆盖整个展会活动期间，保障起期可填写本展会活动开始第一天，保障止期可填写本展会活动结束日。';
        }else if(_n == '1'){
            detail = '本产品保障时间可覆盖展位拆搭建期间，保障起期可填写本展位搭建日第一天，保障止期可填写本展位拆除日最后一天。';
        }
        $('#text_message').html(detail);
        $('.black-mask').show();
        $('#p_tishi').show();
    }
</script>
<script>
    l_length = $('.search input').val().length;
    if(l_length >= 1){
        $('.serach-error').show();
    }

    //搜索框的变化
    $(".lian-search").find('input').on('input propertychange',function(){
        var re_length = $(this).val().length;
        if(re_length >=1 ){
            $('.serach-error').show();
            $('.search-content').show();
        }else{
            $('.serach-error').hide();
            $('.search-content').hide();
        }
    });

    $('.serach-error').click(function () {
        $(".lian-search input").val('');
        $(this).hide();
        $('.search-content').hide();
    });

    $('#serach-histroy h2 span').click(function () {
        $('#serach-histroy ul').remove();
    });
</script>
<script>
    $(function(){

    });
    $('a#sou').click(function () {
        $('#serachText').val('');
        listExNum('');
        $('.lm-sousu').show();
        $('.black-mask').show();
    });

    $('#qu').click(function () {
        $('.lm-sousu').hide();
        $('.black-mask').hide();
    });

    $('.lian-search .search-back').click(function () {
        $('.lm-sousu').hide();
        $('.black-mask').hide();
    });

    $('.lm-search-content ul li').click(function () {
        if($(this).hasClass('active')){
            $(this).removeClass('active');
            if(!$(this).siblings('li').hasClass('active')){
                $('.lm-que button.que').removeClass('on');
            }
        }else{
            $(this).addClass('active');
            $('.lm-que button.que').addClass('on');
        }
    });

    //点击确认选择时，判断上面选项是否选中，未选中则不能点击
    $('.lm-que button.que').click(function () {
        if($(this).hasClass('on')){
            wed = [];
            $('.lm-search-content ul li').each(function () {
                if($(this).hasClass('active')){
                    wed.push($(this).find('p').text());
                }
            });
//            console.log('选中的值',wed);
            $('#a3').val(wed).focus();
            $('.dfg .lmb-content').text(wed);
            $('#a3').css({'height':$('.dfg .lmb-content').height()});
            $('.lm-sousu').hide();
            $('.black-mask').hide();
        }else{
        }
    });
</script>
</html>