<extend name="Common/index" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 房开源（综合房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2019-2023 http://www.kaidandashi.com/ All rights reserved.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 本系统由淮南市银泰软件科技有限公司提供技术支持
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| QQ号：984784483
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<block name="css">
	<link rel="stylesheet" href="__PUBLIC__/lib/layui1/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/lib/Hui-iconfont/1.0.8/iconfont.css"/>
	<style type="text/css">
		#greetings{
			position: absolute;
			height: auto;
			border-left: 1px solid rgba(0, 0, 0, 0.11);
			border-right: 1px solid rgba(0, 0, 0, 0.11);
			left: 0px;
			z-index:5555;
			display: none;
		}
		#greetings ul{
			list-style: none;
			box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.44);
			-webkit-margin-before: 0em;
			-webkit-margin-after: 0em;
			-webkit-margin-start: 0px;
			-webkit-margin-end: 0px;
			-webkit-padding-start: 0px;
		}
		#greetings li{
			text-align: left;
			padding: 5px;
			font-family: inherit;
			border-bottom: 1px solid rgba(0, 0, 0, 0.16);
			height: 25px;
			width: 180px;
			line-height: 25px;
			background-color: rgba(255, 255, 255, 0.8);
			cursor: pointer;
		}
		#greetings li:hover{
			background-color: rgba(175, 42, 0, 0.52);
			color: white;
		}
	</style>
</block>
<block name="content">
	<div style="position:fixed;top:0;width: 100%; border-top-style: solid;border-top-width: 2px;border-top-color: #FFA800;z-index: 999;"></div>
	<form class="layui-form" action="__URL__/editkeyuan" method="post" id="myForm">
		<input type="hidden" value="{$keyuan['id']}" name="id">
		<div style="line-height:30px;">&nbsp;</div>
		<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:150px;">
					<input type="text" name="khxingming" lay-verify="required" autocomplete="off" class="layui-input" value="{$keyuan['khxingming']}">
				</div>
				<div class="layui-input-inline" style="width:120px;">
					<select name="kehulx" lay-filter="aihao" lay-verify="required">
						<foreach name="kehulx" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["kehulx"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
		</div>
		<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: 333px;">
					<input type="text" name="xqquyu" placeholder="" autocomplete="off" class="layui-input" lay-verify="required" value="{$keyuan['xqquyu']}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label" style="color:#f00;">
					需求新房
				</label>
				<div class="layui-input-inline">
					<a class="layui-btn layui-btn-primary" id="cz1">重置</a>
					<div style="line-height:15PX;">&nbsp;</div>
					<textarea type="text" name="xqxinfang" autocomplete="off" placeholder="点击搜索" class="layui-textarea" id="sousuo1" style="width: 666px;" readonly="readonly" lay-verify="required" value="{$keyuan['xqxinfang']}"></textarea>
					<div id="greetings">
						<input type="text" name="" autocomplete="off" placeholder="请搜索新房并选择" class="layui-input" id="sousuo">
						<ul id="tcontent"></ul>
					</div>
				</div>
			</div>
		</div>
		<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: 100px;">
					<input type="text" name="xqjiage1" placeholder="￥" autocomplete="off" class="layui-input" id="xqjiage1" lay-verify="shuzi1" value="{$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" id="xqjiage2" lay-verify="shuzi1" value="{$keyuan['xqjiage2']}">
				</div>
				<div class="layui-form-mid layui-word-aux">万</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label" style="color:#f00;">客户来源</label>
				<div class="layui-input-inline">
					<select name="khlaiyuan" lay-filter="aihao" lay-verify="required">
						<option style="display:none"></option>
						<foreach name="laiyuan" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["khlaiyuan"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
				<div class="layui-input-inline">
					<input type="checkbox" name="jiqie" title="急切" value="1" <if condition='$keyuan["jiqie"]'>checked=""</if>>
				</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" id="xqmianji1" lay-verify="shuzi2" value="{$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" id="xqmianji2" lay-verify="shuzi2" value="{$keyuan['xqmianji2']}">
				</div>
				<div class="layui-form-mid layui-word-aux">m²</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label" style="color:#f00;">
					需求类型
				</label>
				<div class="layui-input-inline">
					<select name="xqleixing" lay-filter="aihao" lay-verify="required">
						<option value="">新房物业类型</option>
						<foreach name="xqleixing" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["xqleixing"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</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" id="xqhuxing1" lay-verify="shuzi3" value="{$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" id="xqhuxing2" lay-verify="shuzi3" value="{$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="xqlouceng1" placeholder="" autocomplete="off" class="layui-input" id="xqlouceng1" lay-verify="shuzi4" value="{$keyuan['xqlouceng1']}">
				</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="xqlouceng2" placeholder="" autocomplete="off" class="layui-input" id="xqlouceng2" lay-verify="shuzi4" value="{$keyuan['xqlouceng2']}">
				</div>
				<div class="layui-form-mid layui-word-aux">层</div>
			</div>
		</div>
		<div class="layui-form-item" pane="">
			<label class="layui-form-label">朝向</label>
			<div class="layui-input-block">
				<foreach name="chaoxiang" item="pz">
					<input type="checkbox" name="chaoxiang[{$pz.lxid}]" <?php if (in_array($pz['lxid'],$chaoxiang2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="{$pz.lxming}">
				</foreach>
			</div>
		</div>
		<div class="layui-form-item" pane="">
			<label class="layui-form-label">特色</label>
			<div class="layui-input-block">
				<foreach name="xftese" item="pz">
					<input type="checkbox" name="xftese[{$pz.lxid}]" <?php if (in_array($pz['lxid'],$xftese2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="{$pz.lxming}">
				</foreach>
			</div>
		</div>
		<div class="layui-form-item" pane="">
			<label class="layui-form-label">周边</label>
			<div class="layui-input-block">
				<input type="checkbox" name="zhoubian[1]" <?php if (in_array(1,$zhoubian2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="地铁">
				<input type="checkbox" name="zhoubian[2]" <?php if (in_array(2,$zhoubian2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="教育设施">
				<input type="checkbox" name="zhoubian[3]" <?php if (in_array(3,$zhoubian2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="医院">
				<input type="checkbox" name="zhoubian[4]" <?php if (in_array(4,$zhoubian2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="购物">
				<input type="checkbox" name="zhoubian[5]" <?php if (in_array(5,$zhoubian2)) {echo "checked=\"\"";} ?> lay-skin="primary" title="公园">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">需求原因</label>
			<div class="layui-input-block" style="width: 666px;">
				<input type="text" name="xqyuanyin" lay-verify="beizhu" autocomplete="off" placeholder="" class="layui-input" value="{$keyuan['xqyuanyin']}">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">需求付款</label>
				<div class="layui-input-block">
					<select name="fukuan" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="fukuan" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["fukuan"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">沟通阶段</label>
				<div class="layui-input-block">
					<select name="gtjieduan" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="gtjieduan" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["gtjieduan"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">国籍</label>
				<div class="layui-input-block">
					<select name="guoji" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="guoji" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["guoji"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">民族</label>
				<div class="layui-input-block">
					<select name="minzu" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="minzu" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["minzu"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">消费理念</label>
				<div class="layui-input-block">
					<select name="xflinian" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="xflinian" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["xflinian"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">客源等级</label>
				<div class="layui-input-block">
					<select name="kydengji" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="kydengji" item="pz">
							<option value="{$pz.lxid}" <if condition='$keyuan["kydengji"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">身份证</label>
			<div class="layui-input-block" style="width: 666px;">
				<input type="text" name="sfzheng" lay-verify="sfzheng1" placeholder="" autocomplete="off" class="layui-input" value="{$keyuan['sfzheng']}">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">QQ</label>
				<div class="layui-input-inline">
					<input type="text" name="qqhao" lay-verify="qqhao1" autocomplete="off" class="layui-input" value="{$keyuan['qqhao']}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-inline">
					<input type="text" name="youxiang" lay-verify="youxiang1" autocomplete="off" class="layui-input" value="{$keyuan['youxiang']}">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">微信</label>
				<div class="layui-input-inline">
					<input type="text" name="weixin" autocomplete="off" class="layui-input" value="{$keyuan['weixin']}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">交通工具</label>
				<div class="layui-input-block">
					<select name="jtgongju" lay-filter="aihao">
						<option style="display:none"></option>
						<foreach name="jtgongju" item="pz">
							<option value="{$pz.lxid}" <if condition='$jtgongju["jtgongju"] eq $pz["lxid"]'>selected=""</if>>{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">车型</label>
				<div class="layui-input-inline">
					<input type="text" name="chexing" autocomplete="off" class="layui-input" value="{$keyuan['chexing']}">
				</div>
			</div>
		</div>
		<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">{$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: #FFA800;padding-top: 5px;" id="submit">
			<div class="layui-input-block" style="margin-left: 15px;">
				<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.layer.close(parent.layer.getFrameIndex(window.name));">
					<i class="Hui-iconfont">&#xe706;</i> 关闭
				</button>
			</div>
		</div>
	</form>
</block>
<block name="js">
	<script src="__PUBLIC__/lib/layui1/layui.js" charset="utf-8"></script>
	<script>
		layui.use(['form', 'layedit', 'laydate'], function(){
			var form = layui.form
			,layer = layui.layer
			,layedit = layui.layedit
			,laydate = layui.laydate;
			form.verify({
				title: function(value){
					if(value.length < 5){
						return '标题至少得5个字符啊';
					}
				}
				,shuzi1: [/^([1-9][0-9]{0,4})$|^(1[0]{5})$/, '价格请输入＞0≤十亿的整数！']
				,shuzi2: [/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/, '面积请输入＞0≤一万的整数！']
				,shuzi3: [/^$|^([1-9]{1})$|^(1[0]{1})$/, '户型请输入＞0≤10的整数！']
				,shuzi4: [/^$|^([1-9]{1})$|^([1-9][0-9]{1})$|^(1[0-9]{2})$|^(2[0]{2})$/, '楼层请输入＞0≤200的整数！']
				,beizhu: [/^$|^[\s\S]{0,300}$/, '只能输入300个字符！']
				,qqhao1: [/^$|^[1-9][0-9]{4,}$/, '请输入正确的QQ号！']
				,youxiang1: [/^$|^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/, '请输入正确的邮箱！']
				,sfzheng1: [/^$|^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$|^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, '请输入正确的身份证号！']
				,content: function(value){
					layedit.sync(editIndex);
				}
			});
			$("#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();
					}
				}
			});
			$("#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();
					}
				}
			});
			$("#xqlouceng1,#xqlouceng2").blur(function(){
				var xqlouceng1=$("#xqlouceng1").val();
				var xqlouceng2=$("#xqlouceng2").val();
				if(xqlouceng1.length!=0 && xqlouceng2.length!=0){
					if (parseInt(xqlouceng1) >parseInt(xqlouceng2) ) {
						layer.alert('楼层范围2小于楼层范围1！！！', {icon: 5});
						$("#submit").hide();
					}else{
						$("#submit").show();
					}
				}
			});
			//监听提交
			form.on('submit(demo1)', function(data){
				$.ajax({
					url:'{:U('kyxinfang/editkeyuan')}',
					type:"post",
					data:data.field,
					dataType:"json",
					success:function(data){
						if (data.status==1) {
							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
							parent.layer.msg(data.info);//父级页面提示成功信息
							parent.$('#submit_two').click(); //刷新父级页面
							parent.layer.close(index);//关闭弹出的子页面窗口
						} else {
							layer.msg(data.info,{anim: 6});//错误提示
						}
					},
					error:function(data) {
						console.log(data.msg);
					},
				});
				return false;
			});
			$("#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:'{:U('ajax/get_ysfang')}',
						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('ysbh',district[i]['ysbianhao']);
								$(li).html(district[i]['ysbianhao']+"（"+district[i]['xmbiaoti']+"）");
								$("#tcontent").append(li);
							}
						}
					});
				}
			});
			$("#tcontent").on("click","li", function() {
				$("#greetings").show();
				var Uarry=$("#tcontent li");
				var count=$(this).index();
				var Tresult=Uarry.eq(count).attr('ysbh');
				var bb=$("#sousuo1").val();
				bb+=Tresult+'；';
				$("#sousuo1").val(bb);
				$("#sousuo").val("");
				$("#greetings").hide();
			});
			$("#cz1").click(function(){
				$("#sousuo1").val("");
			});
		});
	</script>
</block>