<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 房佳（专业的新房分销ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2019 http://fj.ytsofts.cn/ All rights reserved.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 本系统由淮南市银泰软件科技有限公司提供技术支持
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| QQ号：984784483
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<block name="title">
	<title>{$title}</title>
</block>
<block name="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; 
		}
		#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;
		}
		#greetings1{
			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; 
		}
		#greetings1 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;
		}
		#greetings1 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;
		}
		#greetings1 li:hover{
			background-color: rgba(175, 42, 0, 0.52);
			color: white;
		}
		#greetings2{
			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; 
		}
		#greetings2 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;
		}
		#greetings2 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;
		}
		#greetings2 li:hover{
			background-color: rgba(175, 42, 0, 0.52);
			color: white;
		}
		#tianjiaky1{
			position: absolute;
			width: 132px;
			left: 0px;
			z-index:5555;
		}
		.layui-form-checkbox span {
			font-size: 15px;
			color: black !important;
		}
	</style>
</block>
<block name="content">
	<form class="layui-form">
		<blockquote class="layui-elem-quote" style="padding: 5px;">
			<!-- 排序所需要的两个字段 开始 -->
			<input type="hidden" name="field">
			<input type="hidden" name="order">
			<!-- 排序所需要的两个字段 结束 -->
			<div class="layui-form-item">
				<if condition="_rbac_node_show(68)">
					<div class="layui-inline" style="margin-left: 20px;">
						<a class="layui-btn" href="javascript:;" onclick="k_open_leyer('添加客户','{:U('Keyuan1/addKeyuan')}','950','500')">
							添加
						</a>
					</div>
				</if>
				<if condition="_rbac_node_show(931)">
					<div class="layui-inline">
						<a class="layui-btn" href="javascript:;" onclick="k_open_leyer('导出','{:U('Keyuan1/kydaochu')}','950','500')">
							导出
						</a>
					</div>
				</if>
				<div class="layui-inline">
					<div class="layui-input-inline" style="width: 240px;">
						<input type="text" name="sousuo" list="greetings" autocomplete="off" placeholder="请输入客户电话、姓名、需求小区" class="layui-input" id="sousuo">
						<div id="greetings">
							<ul id="tcontent"></ul>
						</div>
					</div>
					<div class="layui-input-inline" style="width: 120px;">
						<input type="text" name="sousuo1" list="greetings" autocomplete="off" placeholder="请输入经办人" class="layui-input" id="sousuo1">
						<div id="greetings1">
							<ul id="tcontent1"></ul>
						</div>
					</div>
					<div class="layui-input-inline" style="width: 120px;">
						<input type="text" name="sousuo2" list="greetings" autocomplete="off" placeholder="请输入录入人" class="layui-input" id="sousuo2">
						<div id="greetings2">
							<ul id="tcontent2"></ul>
						</div>
					</div>
					<div class="layui-input-inline" style="width: 180px;">
						<select name="bumen" lay-verify="">
							<option value="">部门</option>
							{$select_categorys}
						</select>
					</div>
					<div class="layui-input-inline" style="width: 120px;">
						<select name="kydengji" lay-verify="">
							<option value="">客户等级</option>
							<volist name="kydengji" id="pz">
								<option value="{$pz['lxid']}">{$pz['lxming']}</option>
							</volist>
						</select>
					</div>
				</div>
				<button class="layui-btn k-search layui-btn-primary" lay-submit="" lay-filter="search" type="submit" id="submit_one">
					搜索
				</button>
				<button class="" style="display: none;" lay-submit="" lay-filter="search_hidden" type="button" id="submit_two">
					搜索
				</button>
				<button class="layui-btn layui-btn-primary" type="reset">
					重置
				</button>
				<a class="layui-btn pull-right layui-btn-primary" href="javascript:;" onClick="parent.removeIframe()" style="text-decoration: none;">
					关闭
				</a>
				<a class="layui-btn pull-right layui-btn-primary" href="javascript:location.replace(location.href);" title="刷新" style="text-decoration: none;">
					刷新
				</a>
			</div>
			<div class="layui-form-item" style="margin-top: 5px;">
				<div class="layui-inline" style="margin-left:20px;">
					<div class="layui-input-inline" style="width: 210px;">
						<input class="layui-input" placeholder="录入时间" id="test1" name="shijian1" readonly="">
					</div>
					<div class="layui-input-inline" style="width: 210px;">
						<input class="layui-input" placeholder="回/来访时间" id="test2" name="shijian2" readonly="">
					</div>
				</div>
				<div class="layui-inline">
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有来访" name="daikan" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有回访" name="genjin" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="无来访" name="wdaikan" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="无回访" name="wgenjin" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="无经纪人" name="jingjiren" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="意向客源" name="yxky" value="1"/>
				</div>
			</div>
		</blockquote>
	</form>
	<table id="table" lay-filter="table" class="layui-table" lay-data="{height:'full-126', url:'__ACTION__?is_ajax=1',limit:30,limits:[30,60,90],page:true, id:'table',request: {pageName: 'p'}}" >
		<thead>
			<tr>
				<th lay-data="{type:'numbers',align: 'center'}">序号</th>
				<th lay-data="{field:'',align: 'center',minWidth: 120,templet: '#kybh'}">客户编号</th>
				<th lay-data="{field:'khzt',align: 'center',width: 90}">客户状态</th>
				<th lay-data="{field:'khxm',align: 'center',width: 100}">客户名称</th>
				<th lay-data="{field:'khdj',align: 'center',width: 90}">客户等级</th>
				<th lay-data="{field:'xqxiaoqu',align: 'center',minWidth: 150}">需求小区</th>
				<th lay-data="{field:'weihuren',align: 'center',width: 90}">经办人</th>
				<th lay-data="{field:'jingjiren',align: 'center',width: 90}">经纪人</th>
				<th lay-data="{field:'lururen',align: 'center',width: 90}">录入人</th>
				<th lay-data="{field:'dianhua',align: 'center',width: 120}">客户电话1</th>
				<th lay-data="{field:'dianhua2',align: 'center',width: 120}">客户电话2</th>
				<th lay-data="{field:'lurusj',align: 'center',sort: 'true',width: 160}">录入时间</th>
				<th lay-data="{field:'',align: 'center',width: 72,templet: '#lrs'}">录入数</th>
				<th lay-data="{field:'kygjs',align: 'center',width: 72}">回访数</th>
				<th lay-data="{field:'zxgjnr',align: 'center',minWidth: 150}">最新回访</th>
				<th lay-data="{field:'zhgjsj',align: 'center',sort: 'true',width: 160}">最新回访时间</th>
				<th lay-data="{field:'kydks',align: 'center',width: 72}">来访数</th>
				<th lay-data="{field:'zxdknr',align: 'center',minWidth: 150}">最新来访</th>
				<th lay-data="{field:'zhdkshijian',align: 'center',sort: 'true',width: 160}">最新来访时间</th>
				<th lay-data="{field:'beizhu',align: 'center',minWidth: 150}">备注</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 100,templet: '#btn',unresize: true}">操作</th>
			</tr>
		</thead>
	</table>
	<input type="hidden" id="zifujiyemian">
</block>
<block name="js">
	<script type="text/html" id="kybh">
		{{# if(d.kyiszd == 1) { }}
			<span style="color: red;">【置顶】</span>
		{{# } }}
		{{# if(d.rbacxq == 1) { }}
			<a title="客源详情" data-href="{:U('Keyuan1/neirong1')}?id={{d.id}}&kywhr={{d.kywhr}}" data-title="{{d.xqbianhao}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)" style="color: red;">
		{{# } }}
		{{d.xqbianhao}}
		{{# if(d.rbacxq == 1) { }}
			</a>
		{{# } }}
	</script>
	<script type="text/html" id="lrs">
		{{# if(d.kyiszd == 1) { }}
			<span style="color: red;">
		{{# } }}
		{{d.kylrs}}
		{{# if(d.kyiszd == 1) { }}
			</span>
		{{# } }}
	</script>
	<script type="text/html" id="btn">
		{{# if(d.rbacxq == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" title="客源详情" data-href="{:U('Keyuan1/neirong1')}?id={{d.id}}&kywhr={{d.kywhr}}" data-title="{{d.xqbianhao}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)">详情</a>
		{{# } }}
	</script>
	<script>
		$(document).ready(function(){
			$(document).bind("contextmenu",function(e){
				return false;
			});
			var laydate = layui.laydate;
			laydate.render({
				elem: '#test1'
				,range: true
				,max: '{:date("Y-m-d",time())}'
			});
			laydate.render({
				elem: '#test2'
				,range: true
				,max: '{:date("Y-m-d",time())}'
			});
			form.on('checkbox(checkbox)', function(data){
				$('#submit_one').click();
			});
			$("#sousuo").keyup(function(){
				$("#greetings").show();
				var txt=$("#sousuo").val();
				if (txt!="") {
					$.ajax({
						url:'{: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).html(district[i]['xiaoqum']);
								$("#tcontent").append(li);
							}
						}
					});
				}
			});
			$("#tcontent").on("click","li", function() {  
				$("#greetings").show();
				var Uarry=$("#tcontent li");  
				var count=$(this).index();//获取li的下标  
				var Tresult=Uarry.eq(count).text();  
				$("#sousuo").val(Tresult); 
				$("#greetings").hide(); 
			})
			$("#sousuo1").keyup(function(){
				$("#greetings1").show();
				var txt=$("#sousuo1").val();
				if (txt!="") {
					$.ajax({
						url:'{:U('ajax/get_rsyonghu')}',
						type:"get",
						data:"txt="+txt,
						dataType:"json",
						success:function(data){
							var district = data.district;
							$("#tcontent1 li").remove();
							for(var i in district){
								var li=$("<li></li>");
								$(li).html(district[i]['ygmingcheng']);
								$("#tcontent1").append(li);
							}
						}
					});
				}
			});
			$("#tcontent1").on("click","li", function() {
				$("#greetings1").show();
				var Uarry=$("#tcontent1 li");
				var count=$(this).index();//获取li的下标
				var Tresult=Uarry.eq(count).text();
				$("#sousuo1").val(Tresult);
				$("#greetings1").hide();
			});
			$("#sousuo2").keyup(function(){
				$("#greetings2").show();
				var txt=$("#sousuo2").val();
				if (txt!="") {
					$.ajax({
						url:'{:U('ajax/get_rsyonghu')}',
						type:"get",
						data:"txt="+txt,
						dataType:"json",
						success:function(data){
							var district = data.district;
							$("#tcontent2 li").remove();
							for(var i in district){
								var li=$("<li></li>");
								$(li).html(district[i]['ygmingcheng']);
								$("#tcontent2").append(li);
							}
						}
					});
				}
			});
			$("#tcontent2").on("click","li", function() {
				$("#greetings2").show();
				var Uarry=$("#tcontent2 li");
				var count=$(this).index();//获取li的下标
				var Tresult=Uarry.eq(count).text();
				$("#sousuo2").val(Tresult);
				$("#greetings2").hide();
			});
			$("body").click(function(){
				$("#greetings").hide();
				$("#greetings1").hide();
				$("#greetings2").hide();
			});
		});
	</script>
</block>