<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 开单大师（专业的房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2019 http://www.kaidandashi.com 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;
		}
		#tianjiafy1{
			position: absolute;
			width: 132px;
			left: 0px;
			z-index:5555; 
		}
		.layui-form-checkbox span {
			font-size: 15px;
			color: black !important;
		}
		.fybq {
			margin-left: 5px;
		}
	</style>
</block>
<block name="content">
	<form class="layui-form">
		<blockquote class="layui-elem-quote" style="padding: 5px;">
			<!-- 排序所需要的两个字段 开始 -->
			<input type="hidden" name="field" value="lurusj">
			<input type="hidden" name="order" value="desc">
			<!-- 排序所需要的两个字段 结束 -->
			<div class="layui-form-item" style="margin-top: 5px;">
				<div class="layui-inline" style="float:left;margin-left: 20px;" id="tianjiafy3">
					<if condition="_rbac_btn_show(42,0)"> 
						<a class="layui-btn" id="tianjiafy" style="float:left;">
							添加房源
						</a>
						<div id="tianjiafy1" style="display: none;margin-top: 36px;">
							<a class="layui-btn" href="javascript:;" id="addEsfy" onclick="motai('添加房源','{:U('Fangyuan/addEsfy',array('jylx'=>'1'))}','950')" style="text-decoration:none;margin-top:5px;">
								添加（出售）房源
							</a>
							<a class="layui-btn" href="javascript:;" id="addEsfy" onclick="motai('添加房源','{:U('Fangyuan/addEsfy',array('jylx'=>'2'))}','950')" style="text-decoration:none;margin-left:0px;margin-top:5px;">
								添加（出租）房源
							</a>
						</div>
					</if>
					<div class="layui-input-inline" style="width:400px;margin-left: 20px;">
						<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>
				<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">
					<div class="layui-input-inline" style="width:100px;margin-left:20px;">
						<select name="leixing" >
							<option value="1">出售</option>
							<option value="2">出租</option>
							<option value="">全部</option>
						</select>
					</div>
					<div class="layui-input-inline" style="width:100px;">
						<select name="zhuangtai" >
							<option value="0">全部</option>
							<foreach name="zhuangtai" item="pz">
								<option value="{$pz.lxid}" >{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-input-inline" style="width:80px;">
						<select name="zhuangxiu" >
							<option value="">装修</option>
								<foreach name="zhuangxiu" item="pz">
							<option value="{$pz.lxid}">{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-input-inline" style="width:80px;">
						<select name="chaoxiang" >
							<option value="">朝向</option>
							<foreach name="chaoxiang" item="pz">
								<option value="{$pz.lxid}">{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-input-inline" style="width:100px;">
						<select name="yongtu" >
							<option value="">物业类型</option>
							<foreach name="yongtu" item="pz">
								<option value="{$pz.lxid}">{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-inline">
						<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="我的房源" name="myfy" value="1"/>
						<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="我的收藏" name="mysc" value="1"/>
						<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="无效" name="fengpan" value="1"/>
						<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="待审核" name="dshenhe" value="1"/>
						<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="房源回收站" name="isdel" value="1"/>
					</div>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline" style="margin-left: 20px;">
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="今日浏览" name="jrll" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="图片" name="tupian" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="视频" name="shipin" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="新上" name="xinshang" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="核验" name="heyan" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="急售" name="jishou" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="学区房" name="xuequ" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="无税" name="wushui" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="新证" name="xinzheng" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有贷款" name="youdaikuan" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="外网同步" name="waiwangtb" value="1"/>
					<input type="checkbox" lay-filter="checkbox" lay-skin="primary" title="有钥匙" name="yaoshi" value="1"/>
				</div>
			</div>
			<div class="layui-form-item" style="margin-top: 5px;">
				<div class="layui-input-inline" style="width: 250px;margin-left: 6px;">
					<label class="layui-form-label" style="width: 30px;margin-top: 1px;">时间</label>
					<div class="layui-input-inline" style="width: 180px;margin-top: 7px;">
						<input class="layui-input" placeholder="录入时间" id="test1" name="shijian" style="height: 27px;line-height: 27px;">
					</div>
				</div>
				<div class="layui-input-inline" style="width: 200px;margin-left: -25px;">
					<label class="layui-form-label" style="width: 30px;margin-top: 1px;">价格</label>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="jiage1" placeholder="￥" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
					<div class="layui-form-mid">~</div>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="jiage2" placeholder="￥" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
				</div>
				<div class="layui-input-inline" style="width: 200px;margin-left: -25px;">
					<label class="layui-form-label" style="width: 30px;margin-top: 1px;">面积</label>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="mianji1" placeholder="" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
					<div class="layui-form-mid">~</div>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="mianji2" placeholder="" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
				</div>
				<div class="layui-input-inline" style="width: 200px;margin-left: -25px;">
					<label class="layui-form-label" style="width: 30px;margin-top: 1px;">户型</label>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="huxing1" placeholder="室" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
					<div class="layui-form-mid">~</div>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="huxing2" placeholder="室" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
				</div>
				<div class="layui-input-inline" style="width: 200px;margin-left: -25px;">
					<label class="layui-form-label" style="width: 30px;margin-top: 1px;">楼层</label>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="louceng1" placeholder="" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
					<div class="layui-form-mid">~</div>
					<div class="layui-input-inline" style="width: 50px;margin-top: 7px;">
						<input type="text" name="louceng2" placeholder="" autocomplete="off" class="layui-input" style="height: 27px;line-height: 27px;">
					</div>
				</div>
			</div>
		</blockquote>
	</form>
	<table id="table" lay-filter="table" class="layui-table" lay-data="{height:'full-200', 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',width: 100,templet: '#img', unresize: true}">图片</th>
				<th lay-data="{field:'',align: 'center',minWidth: 150, templet: '#fybq'}">标签</th>
				<th lay-data="{field:'bianhao',align: 'center',minWidth: 100, templet: '#fybh',sort: 'true'}">编号</th>
				<th lay-data="{field:'fyzt',align: 'center'}">状态</th>
				<th lay-data="{field:'xqm',align: 'center'}">地址</th>
				<th lay-data="{field:'mianji',align: 'center',minWidth: 150, templet: '#fymj',sort: 'true'}">面积</th>
				<th lay-data="{field:'fyjg',align: 'center',minWidth: 150}">价格</th>
				<th lay-data="{field:'danjia',align: 'center',minWidth: 150, templet: '#fydj',sort: 'true'}">单价</th>
				<th lay-data="{field:'fyhx',align: 'center'}">户型</th>
				<th lay-data="{field:'fylc',align: 'center'}">楼层</th>
				<th lay-data="{field:'fycx',align: 'center'}">朝向</th>
				<th lay-data="{field:'jznd',align: 'center'}">房龄</th>
				<th lay-data="{field:'fydj',align: 'center'}">等级</th>
				<th lay-data="{field:'fyyt',align: 'center'}">物业类型</th>
				<th lay-data="{field:'fyzx',align: 'center'}">装修</th>
				<th lay-data="{field:'lurusj',align: 'center',sort: 'true'}">录入时间</th>
				<th lay-data="{field:'whr',align: 'center'}">经纪人</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 200,templet: '#btn',unresize: true}">操作</th>
			</tr>
		</thead>
	</table>
	<input type="hidden" id="zifujiyemian">
</block>
<block name="js">
	<script type="text/html" id="btn">
		{{# if(d.rbacxq == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" title="房源详情" data-href="{:U('Fangyuan/neirong')}?id={{d.id}}" data-title="{{d.fybh}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)">详情</a>
		{{# } }}
		{{# if(d.rbachy == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="hyfy">还原</a>
		{{# } }}
		{{# if(d.rbacsc == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="yjsc">永久删除</a>
		{{# } }}
		{{# if(d.rbacdy == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="fydy">打印</a>
		{{# } }}
	</script>
	<script type="text/html" id="img">
		{{# if(d.img) { }}
			<div class="layer-photos-demo">
				<img width="100%" height="100%" layer-pid="" layer-src="/Upload/{{d.gongsiid}}/{{d.fybh}}/{{d.img}}" src="/Upload/{{d.gongsiid}}/{{d.fybh}}/t_{{d.img}}" alt="">
				<div style="display: none;">
					{{# for (var i in d.photo) { }}
						<img width="100%" layer-pid="" layer-src="/Upload/{{d.gongsiid}}/{{d.fybh}}/{{d['photo'][i]['image']}}" src="/Upload/{{d.gongsiid}}/{{d.fybh}}/t_{{d['photo'][i]['image']}}" alt="">
					{{# } }}
				</div>
			</div>
		{{# } else { }}
			<img width="100%" src="/Public/img/default_icon.png" alt="">
		{{# } }}
	</script>
	<script type="text/html" id="fybq">
		{{# if(d.zhuangtai == 0) { }}
			<span class="layui-badge fybq" style="background-color: rgba(240,128,128,0.15);color: rgb(240,128,128);">
				待审核
			</span>
		{{# } }}
		{{# if(d.img) { }}
			<span class="layui-badge fybq" style="background-color: rgba(100,142,249,0.15);color: rgb(100,142,249);">
				图片
			</span>
		{{# } }}
		{{# if(d.xuequ == 1) { }}
			<span class="layui-badge fybq" style="background-color: rgba(107,190,26,0.15);color: rgb(107,190,26);">
				学区
			</span>
		{{# } }}
		{{# if(d.shouyaobm != 0 || d.shouyaoren != 0) { }}
			<span class="layui-badge fybq" style="background-color: rgba(32,178,170,0.15);color: rgb(32,178,170);">
				钥匙
			</span>
		{{# } }}
		{{# if(d.heyan == 1) { }}
			<span class="layui-badge fybq" style="background: rgba(219,112,147,0.15);color: rgb(219,112,147);">
				核验
			</span>
		{{# } }}
		{{# if(d.jishou == 1) { }}
			<span class="layui-badge fybq" style="background: rgba(255,99,71,0.15);color: rgb(255,99,71);">
				急售
			</span>
		{{# } }}
		{{# if(d.dqshu > 9) { }}
			<span class="layui-badge fybq" style="background-color: rgba(51,190,133,0.15);color: rgb(51,190,133);">
				精品
			</span>
		{{# } }}
		{{# if(d.isshikan) { }}
			<span class="layui-badge fybq" style="background: rgba(38,156,255,0.15);color: rgb(38,156,255);">
				已实勘
			</span>
		{{# } }}
		{{# if(d.wushui == 1) { }}
			<span class="layui-badge fybq" style="background: rgba(0,174,102,0.15);color: rgb(0,174,102);">
				无税
			</span>
		{{# } }}
		{{# if(d.man2 == 1) { }}
			<span class="layui-badge fybq" style="background-color: rgba(95,158,160,0.15);color: rgb(95,158,160);">
				满两年
			</span>
		{{# } }}
		{{# if(d.man5 == 1) { }}
			<span class="layui-badge fybq" style="background-color: rgba(242,161,47,0.15);color: rgb(242,161,47);">
				满五年
			</span>
		{{# } }}
		{{# if(d.shoujia > 0) { }}
			<a class="layui-badge fybq" href="javascript:;" onclick="motai('计算器','{:U('Index/tool',array('shoujia'=>d.shoujia,'mianji'=>d.mianji))}','1060','500')" style="text-decoration: none;background: rgba(184,134,11,0.15);color: rgb(184,134,11);">
				计算器
			</a>
		{{# } }}
	</script>
	<script type="text/html" id="fybh">
		{{# if(d.rbacxq == 1) { }}
			<a title="房源详情" data-href="{:U('Fangyuan/neirong')}?id={{d.id}}" data-title="{{d.fybh}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)" style="text-decoration:none;color:red;">
		{{# } }}
		{{d.fybh}}
		{{# if(d.rbacxq == 1) { }}
			</a>
		{{# } }}
	</script>
	<script type="text/html" id="fymj">
		{{# if(d.mianji) { }}
			{{d.mianji}}m²
		{{# } else { }}
			——
		{{# } }}
	</script>
	<script type="text/html" id="fydj">
		{{# if(d.danjia) { }}
			{{d.danjia}}元/m²
		{{# } else { }}
			——
		{{# } }}
	</script>
	<script>
		$(document).ready(function(){
			$(document).bind("contextmenu",function(e){
				return false;
			});
			//监听工具条
			table.on('tool(table)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
				var data = obj.data; //获得当前行数据
				var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
				var tr = obj.tr; //获得当前行 tr 的DOM对象
				if(layEvent === 'hyfy'){
					layer.confirm('确定要还原吗？', function(index){
						var a = $(tr).find('a[lay-event=del]');
						k_submit_start(a); //开启 按钮锁定 和 loading 显示
						$.ajax({
							url:'{:U('fyneirong/huifufy')}',
							type:"post",
							data:{id:data.id},
							dataType:"json",
							success:function(r){
								k_submit_end(a); //取消按钮锁定 和 loading 显示
								if (r.status==1) {
									layer.msg(r.info); //父级页面提示成功信息
									obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
									layer.close(index); //关闭弹出的子页面窗口
								}else{
									layer.msg(r.info,{anim: 6}); //错误提示
								}
							},
							error:function(){
								k_submit_end(a); //取消 按钮锁定 和 loading 显示
								layer.msg('网络错误！',{anim: 6}); //错误提示
							}
						});
					});
				} else if(layEvent === 'yjsc'){ //删除
					layer.confirm('确定要删除吗？', function(index){
						var a = $(tr).find('a[lay-event=del]');
						k_submit_start(a); //开启 按钮锁定 和 loading 显示
						$.ajax({
							url:'{:U('fyneirong/yjdelfy')}',
							type:"post",
							data:{id:data.id},
							dataType:"json",
							success:function(r){
								k_submit_end(a); //取消按钮锁定 和 loading 显示
								if (r.status==1) {
									layer.msg(r.info); //父级页面提示成功信息
									obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
									layer.close(index); //关闭弹出的子页面窗口
								}else{
									layer.msg(r.info,{anim: 6}); //错误提示
								}
							},
							error:function(){
								k_submit_end(a); //取消 按钮锁定 和 loading 显示
								layer.msg('网络错误！',{anim: 6}); //错误提示
							}
						});
					});
				} else if(layEvent === 'fydy'){
					var fybh = data.bianhao;
					var mblx = data.leixing;
					k_open_leyer('选择打印模板','{:U('Fydayin/mblist')}?fybh='+fybh+'&mblx='+mblx,'300','540');
				}
			});
			var layer = layui.layer
			,layedit = layui.layedit
			,laydate = layui.laydate;
			laydate.render({
				elem: '#test1'
				,range: true
				,max: '{:date("Y-m-d",time())}'
			});
			$('body').on("click",".layer-photos-demo",function(){
				layer.photos({
					photos: this
					,anim: 0 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
				});
			});
			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();
			});
			$("body").click(function(){
				$("#greetings").hide();
			});
			$("#tianjiafy").mouseenter(function(){
				$("#tianjiafy1").css("display","block");
			});
			$("#tianjiafy3").mouseleave(function(){
				$("#tianjiafy1").css("display","none");
			});
			var istxt ='{$_GET['txt']}';
			if(istxt){
				$("#sousuo").val('{$_GET['txt']}');
				$('#submit_one').click();
			}
		});
		function motai(title,url,w,h){
			layer_show(title,url,w,h);
		}
		function layer_show(title,url,w,h){
			if (title == null || title == '') {
				title=false;
			};
			if (url == null || url == '') {
				url="404.html";
			};
			if (w == null || w == '') {
				w=800;
			};
			if (h == null || h == '') {
				h=($(window).height() - 50);
			};
			layer.open({
				type: 2,
				area: [w+'px', h +'px'],
				fix: false, //不固定
				maxmin: true,
				skin: 'layui-layer-rim',
				shade:0.4,
				title: title,
				content: url,
			});
		}
	</script>
</block>