<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | 房佳（专业的新房分销ERP管理系统）
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | Copyright (c) 2008-2019 http://fj.ytsofts.cn/ All rights reserved.
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | 本系统由淮南市银泰软件科技有限公司提供技术支持
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | QQ号：984784483
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Document</title>
        <link rel="stylesheet" type="text/css" href="/Public/lib/layui/css/layui.css">
        <link rel="stylesheet" type="text/css" href="/Public/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    </head>
    <body>
        <div style="position:fixed;top:0;width: 100%; border-top-style: solid;border-top-width: 2px;border-top-color: #009688;z-index: 999;"></div> 
        <form class="layui-form" action="/admin/kyneirong/editKeyuan" method="post">
            <input type="hidden" value="<?php echo ($keyuan['id']); ?>" name="id">
            <input type="hidden" name="kywhr" value="<?php echo ($_GET['kywhr']); ?>">
            <div class="layui-form-item" style="margin-top: 30px;">
                <div class="layui-inline">
                    <label class="layui-form-label" style="color:#f00;">
                        客户姓名
                    </label>
                    <div class="layui-input-inline" style="width:150px;">
                        <input type="text" name="khxingming" lay-verify="required" autocomplete="off" class="layui-input" value="<?php echo ($keyuan['khxingming']); ?>">
                    </div>
                    <div class="layui-input-inline" style="width:120px;">
                        <select name="kehulx" lay-filter="aihao">
                            <?php if(is_array($kehulx)): foreach($kehulx as $key=>$pz): ?><option value="<?php echo ($pz["lxid"]); ?>" <?php if($keyuan["kehulx"] == $pz["lxid"]): ?>selected=""<?php endif; ?>><?php echo ($pz["lxming"]); ?></option><?php endforeach; endif; ?>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="color:#f00;">
                        客户电话一
                    </label>
                    <div class="layui-input-inline">
                        <input type="tel" name="dianhua" lay-verify="shouji1" autocomplete="off" class="layui-input" value="<?php echo ($keyuan['dianhua']); ?>">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="margin-top: 30px;">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        客户电话二
                    </label>
                    <div class="layui-input-inline">
                        <input type="tel" name="dianhua2" lay-verify="shouji2" autocomplete="off" class="layui-input" value="<?php echo ($keyuan['dianhua2']); ?>">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">
                        经纪人
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" name="jingjiren" autocomplete="off" placeholder="" class="layui-input" value="<?php echo ($keyuan['jingjiren']); ?>">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        需求户型
                    </label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqhuxing1" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi1" id="xqhuxing1" value="<?php echo ($keyuan['xqhuxing1']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">室</div>
                    <div class="layui-form-mid">~</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqhuxing2" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi1" id="xqhuxing2" value="<?php echo ($keyuan['xqhuxing2']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">室</div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">
                        价格范围
                    </label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqjiage1" placeholder="￥" autocomplete="off" class="layui-input" lay-verify="shuzi2" id="xqjiage1" value="<?php echo ($keyuan['xqjiage1']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        元
                    </div>
                    <div class="layui-form-mid">~</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqjiage2" placeholder="￥" autocomplete="off" class="layui-input" lay-verify="shuzi2" id="xqjiage2" value="<?php echo ($keyuan['xqjiage2']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        元
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        需求面积
                    </label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqmianji1" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi3" id="xqmianji1" value="<?php echo ($keyuan['xqmianji1']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">m²</div>
                    <div class="layui-form-mid">~</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="xqmianji2" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi3" id="xqmianji2" value="<?php echo ($keyuan['xqmianji2']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">m²</div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">
                        需求楼层
                    </label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="louceng1" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi4" id="louceng1" value="<?php echo ($keyuan['louceng1']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">楼</div>
                    <div class="layui-form-mid">~</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="louceng2" placeholder="" autocomplete="off" class="layui-input" lay-verify="shuzi4" id="louceng2" value="<?php echo ($keyuan['louceng2']); ?>">
                    </div>
                    <div class="layui-form-mid layui-word-aux">楼</div>
                </div>
            </div>
            <?php if($xiaoqu): ?><div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label" style="color:#f00;">
                            需求小区
                        </label>
                        <div class="layui-input-inline" style="width: 666px;">
                            <?php if(is_array($xiaoqu)): foreach($xiaoqu as $key=>$xq): ?><input type="checkbox" name="xiaoqu[<?php echo ($xq["id"]); ?>]" lay-skin="primary" title="<?php echo ($xq["xiaoqum"]); ?>" <?php if (in_array($xq['id'],$xqxiaoquid)) {echo "checked=\"\"";} ?>><?php endforeach; endif; ?>
                        </div>
                    </div>
                </div><?php endif; ?>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block" style="width: 666px;">
                    <textarea placeholder="请输入内容" class="layui-textarea" name="beizhu" lay-verify="beizhu"><?php echo ($keyuan['beizhu']); ?></textarea>
                </div>
            </div>
			<div style="line-height:50PX;">&nbsp;</div>
			<div class="layui-form-item" style="width:100%;height:45px;margin:0 auto;background:#fff;position:fixed;bottom:0;text-align:center;border-top-style: solid;border-top-width: 1px;border-top-color: #009688;padding-top: 5px;" id="submit">
				<div class="layui-input-block">
					<button class="layui-btn layui-btn-radius" lay-submit="" lay-filter="demo1">
						<i class="Hui-iconfont">&#xe603;</i> 立即更新
					</button>
					<button type="reset" class="layui-btn layui-btn-radius layui-btn-primary">
						<i class="Hui-iconfont">&#xe72a;</i> 重置
					</button>
					<button type="button" class="layui-btn layui-btn-radius layui-btn-primary" onclick="parent.location.reload()">
						<i class="Hui-iconfont">&#xe706;</i> 关闭
					</button>
				</div>
			</div>
        </form>
        <!--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-->
        <script type="text/javascript" src="/Public/lib/jquery/1.9.1/jquery.min.js"></script> 
        <script src="/Public/lib/layui/layui.js" charset="utf-8"></script>
        <script>
            //Demo
            layui.use('form', function(){
                var form = layui.form();
                //监听提交
                form.on('submit(demo1)', function(data){
                    $.ajax({
                        url:'<?php echo U('Kyneirong/editKeyuan');?>',
                        type:"post",
                        data:data.field,
                        dataType:"json",
                        success: function(data){
                            if (data.status==1) {
                                $("#submit").hide();
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.msg(data.info);//父级页面提示成功信息
                                parent.location.reload();//刷新父级页面
                                parent.layer.close(index);//关闭弹出的子页面窗口
                            }else{
                                layer.msg(data.info,function(){});//错误提示
                            }
                        },
                        error:function(data) {
                            console.log(data.msg);
                        },
                    });
                    return false;
                });
                form.verify({
                    title: function(value){
                        if(value.length < 5){
                            return '标题至少得5个字符啊';
                        }
                    }
                    ,shuzi1: [/^$|^([0]{1})$|^([1-9]{1})$|^(1[0]{1})$/, '请输入＞0≤10的整数！']
                    ,shuzi2: [/^$|^([0]{1})$|^([1-9][0-9]{0,8})$|^(1[0]{9})$/, '请输入＞0≤十亿的整数！']
                    ,shuzi3: [/^$|^([0]{1})$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/, '请输入＞0≤一万的整数！']
                    ,shuzi4: [/^$|^([0]{1})$|^([1-9]{1})$|^([1-9][0-9]{1})$|^(1[0-9]{2})$|^(2[0]{2})$/, '请输入＞0≤200的整数！']
                    ,beizhu: [/^$|^[\s\S]{0,300}$/, '只能输入300个字符！']
                    ,shouji1: [/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[8-9])\d{8}$|^0\d{2,3}-?\d{7,8}$/, '请输入正确的手机号码或电话号码！']
                    ,shouji2: [/^$|^([0]{1})$|^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[8-9])\d{8}$|^0\d{2,3}-?\d{7,8}$/, '请输入正确的手机号码或电话号码！']
                    ,content: function(value){
                        layedit.sync(editIndex);
                    }
                });
                form.on('checkbox(quanxuan)', function(data){
                    if(data.elem.checked){
                        $(".peitao").prop("checked",true);
                        form.render('checkbox');
                    } else {
                        $(".peitao").prop("checked",false);
                        form.render('checkbox');
                    }
                });
                $("#xqhuxing1,#xqhuxing2").blur(function(){
                    var xqhuxing1=$("#xqhuxing1").val();
                    var xqhuxing2=$("#xqhuxing2").val();
                    if(xqhuxing1.length!=0 && xqhuxing2.length!=0){
                        if (parseInt(xqhuxing1) >parseInt(xqhuxing2) ) {
                            layer.alert('需求户型2小于需求户型1！！！', {icon: 5});
                            $("#submit").hide();
                        }else{
                            $("#submit").show();
                        }
                    }
                });
                $("#xqjiage1,#xqjiage2").blur(function(){
                    var xqjiage1=$("#xqjiage1").val();
                    var xqjiage2=$("#xqjiage2").val();
                    if(xqjiage1.length!=0 && xqjiage2.length!=0){
                        if (parseInt(xqjiage1) >parseInt(xqjiage2) ) {
                            layer.alert('价格范围2小于价格范围1！！！', {icon: 5});
                            $("#submit").hide();
                        }else{
                            $("#submit").show();
                        }
                    }
                });
                $("#xqmianji1,#xqmianji2").blur(function(){
                    var xqmianji1=$("#xqmianji1").val();
                    var xqmianji2=$("#xqmianji2").val();
                    if(xqmianji1.length!=0 && xqmianji2.length!=0){
                        if (parseInt(xqmianji1) >parseInt(xqmianji2) ) {
                            layer.alert('需求面积2小于需求面积1！！！', {icon: 5});
                            $("#submit").hide();
                        }else{
                            $("#submit").show();
                        }
                    }
                });
                $("#louceng1,#louceng2").blur(function(){
                    var louceng1=$("#louceng1").val();
                    var louceng2=$("#louceng2").val();
                    if(louceng1.length!=0 && louceng2.length!=0){
                        if (parseInt(louceng1) >parseInt(louceng2) ) {
                            layer.alert('需求楼层2小于需求楼层1！！！', {icon: 5});
                            $("#submit").hide();
                        }else{
                            $("#submit").show();
                        }
                    }
                });
                $("#fangling1,#fangling2").blur(function(){
                    var fangling1=$("#fangling1").val();
                    var fangling2=$("#fangling2").val();
                    if(fangling1.length!=0 && fangling2.length!=0){
                        if (parseInt(fangling1) >parseInt(fangling2) ) {
                            layer.alert('需求房龄2小于需求房龄1！！！', {icon: 5});
                            $("#submit").hide();
                        }else{
                            $("#submit").show();
                        }
                    }
                });
                $("#sousuo1").click(function(){
                    var display =$('#greetings').css('display');
                    if(display == 'none'){
                        $("#greetings").show();
                    }else{
                        $("#greetings").hide();
                    }
                });
                $("#sousuo").keyup(function(){
                    $("#greetings").show();
                    var txt=$("#sousuo").val();
                    if (txt!="") {
                        $.ajax({
                            url:'<?php echo U('ajax/get_xiaoqu_txt');?>',
                            type:"get",
                            data:"txt="+txt,
                            dataType:"json",
                            success:function(data){
                                var district = data.lists;
                                $("#tcontent li").remove();
                                for(var i in district){
                                    var li=$("<li></li>");
                                    $(li).attr('dataid',district[i]['id']);
                                    $(li).html(district[i]['xiaoqum']);
                                    $("#tcontent").append(li);
                                }
                            }
                        });
                    }
                });
                $("#tcontent").on("click","li", function() {
                    $("#greetings").show();
                    var Uarry=$("#tcontent li");
                    var count=$(this).index();
                    var Tresult=Uarry.eq(count).text();
                    var xiaoquid=Uarry.eq(count).attr('dataid');
                    var bb=$("#sousuo1").val();
                    bb+=Tresult+'；';
                    $("#sousuo1").val(bb);
                    var cc=$("#xiaoqu").val();
                    cc+=xiaoquid+',';
                    $("#xiaoqu").val(cc);
                    $("#sousuo").val("");
                    $("#greetings").hide();
                });
                $("#cz1").click(function(){
                    $("#xiaoqu").val("");
                    $("#sousuo1").val("");
                });
            });
        </script>
    </body>
</html>