<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 房开源（综合房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2019-2023 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">
			<input type="hidden" name="order">
			<!-- 排序所需要的两个字段 结束 -->
			<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('fyshangpu/addEsfy',array('mmzl'=>'1'))}','950')" style="text-decoration:none;margin-top:5px;">
								添加（出售）房源
							</a>
							<a class="layui-btn" href="javascript:;" id="addEsfy" onclick="motai('添加房源','{:U('fyshangpu/addEsfy',array('mmzl'=>'2'))}','950')" style="text-decoration:none;margin-left:0px;margin-top:5px;">
								添加（出租）房源
							</a>
						</div>
					</if>
					<div class="layui-input-inline" style="width:100px;margin-left:20px;">
						<select lay-filter="fylx">
							<option value="1">写字楼</option>
							<option selected="selected">商铺</option>
							<option value="2">住宅</option>
						</select>
					</div>
					<div class="layui-input-inline" style="width:400px;">
						<input type="text" name="sousuo" list="greetings" autocomplete="off" placeholder="请输入房源编号、楼盘、业主姓名、电话、经纪人..." class="layui-input" id="sousuo" title="请输入房源编号、房源标题、楼盘名、业主姓名、业主电话、维护人">
						<div id="greetings" >
							<ul id="tcontent"></ul>
						</div>
					</div>
				</div>
				<button class="layui-btn k-search" 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="mmzl">
							<option value="">类型</option>
							<option value="1">出售</option>
							<option value="2">出租</option>
						</select>
					</div>
					<div class="layui-input-inline" style="width:100px;">
						<select name="leixing">
							<option value="">商铺类型</option>
							<foreach name="leixing" item="pz">
								<option value="{$pz.lxid}">{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-input-inline" style="width:100px;">
						<select name="yetai">
							<option value="">商铺业态</option>
							<foreach name="yetai" item="pz">
								<option value="{$pz.lxid}">{$pz.lxming}</option>
							</foreach>
						</select>
					</div>
					<div class="layui-input-inline" style="width:100px;">
						<select name="hangye">
							<option value="">商铺行业</option>
							<foreach name="hangye" 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="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="yaoshi" 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="wuxiao" 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="bohui" value="1"/>
				</div>
			</div>
			<div class="layui-form-item" style="margin-top: 5px;">
				<div class="layui-input-inline" style="width:100px;margin-left:20px;">
					<select name="zhuangtai">
						<option value="">状态</option>
						<foreach name="zhuangtai" item="pz">
							<option value="{$pz.lxid}" >{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
				<div class="layui-input-inline" style="width:100px;">
					<select name="zhuangxiu">
						<option value="">装修</option>
						<foreach name="zhuangxiu" item="pz">
							<option value="{$pz.lxid}">{$pz.lxming}</option>
						</foreach>
					</select>
				</div>
				<label class="layui-form-label" style="width: 40px;margin-left:-20px;">价格</label>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="jiage1" placeholder="￥" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">~</div>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="jiage2" placeholder="￥" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label" style="width: 40px;margin-left: -20px;">面积</label>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="mianji1" placeholder="m²" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">~</div>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="mianji2" placeholder="m²" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label" style="width: 40px;margin-left: -20px;">楼层</label>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="louceng1" placeholder="层" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">~</div>
				<div class="layui-input-inline" style="width: 50px;">
					<input type="text" name="louceng2" placeholder="层" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label" style="width: 40px;margin-left: -20px;">时间</label>
				<div class="layui-input-inline" style="width: 100px;">
					<input class="layui-input" placeholder="开始日" id="test1" readonly="" name="shijian1">
				</div>
				<div class="layui-form-mid">~</div>
				<div class="layui-input-inline" style="width: 100px;">
					<input class="layui-input" placeholder="截止日" id="test2" readonly="" name="shijian2">
				</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:'',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:'jzmianji',align: 'center',minWidth: 150,sort: 'true'}">面积</th>
				<th lay-data="{field:'fyjg',align: 'center',minWidth: 150}">价格</th>
				<th lay-data="{field:'danjia',align: 'center',minWidth: 150,sort: 'true'}">单价</th>
				<th lay-data="{field:'fylc',align: 'center'}">楼层</th>
				<th lay-data="{field:'splx',align: 'center'}">类型</th>
				<th lay-data="{field:'spyt',align: 'center'}">业态</th>
				<th lay-data="{field:'sphy',align: 'center'}">行业</th>
				<th lay-data="{field:'fydj',align: 'center'}">等级</th>
				<th lay-data="{field:'syl',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:'ygmingcheng',align: 'center'}">经纪人</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 270,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('fyshangpu/neirong')}?id={{d.id}}" data-title="{{d.bianhao}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)">详情</a>
		{{# } }}
		{{# if(d.rbacsh == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="fysh">审核</a>
		{{# } }}
		{{# if(d.rbachy == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="hyfy">还原</a>
		{{# } }}
		{{# if(d.rbacsc == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-danger" 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.bianhao}}/{{d.img}}" src="/Upload/{{d.gongsiid}}/{{d.bianhao}}/t_{{d.img}}" alt="">
				<div style="display: none;">
					{{# for (var i in d.photo) { }}
						<img width="100%" layer-pid="" layer-src="/Upload/{{d.gongsiid}}/shangpu/{{d.bianhao}}/{{d['photo'][i]['image']}}" src="/Upload/{{d.gongsiid}}/shangpu/{{d.bianhao}}/t_{{d['photo'][i]['image']}}" alt="">
					{{# } }}
				</div>
			</div>
		{{# } else { }}
			<img width="100%" src="/Public/images/default_icon.png" alt="">
		{{# } }}
	</script>
	<script type="text/html" id="fybq">
		{{# if(d.zhgjsj < qitian) { }}
			<span class="layui-badge fybq" style="background-color: rgba(255,0,0,0.15);color: rgb(255,0,0);">
				七天未跟进
			</span>
		{{# } else if(d.zhgjsj < santian) { }}
			<span class="layui-badge fybq" style="background-color: rgba(255,200,0,0.15);color: rgb(255,200,0);">
				三天未跟进
			</span>
		{{# } }}
		{{# if(d.shtype == 3) { }}
			<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.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.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 class="lianjie" title="房源详情" data-href="{:U('fyshangpu/neirong')}?id={{d.id}}" data-title="{{d.bianhao}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)" style="text-decoration:none;">
		{{# } }}
		{{d.bianhao}}
		{{# if(d.rbacxq == 1) { }}
			</a>
		{{# } }}
	</script>
	<script>
		var santian = Date.parse(new Date())/1000-3600*24*3;
		var qitian = Date.parse(new Date())/1000-3600*24*7;
		$(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 === 'fysh'){ //审核
					var id = data.id;
					k_open_leyer('房源审核','{:U('fyshangpu/fyshenhe')}?id='+id,'666','333');
				} else if(layEvent === 'hyfy'){
					layer.confirm('确定要还原吗？', function(index){
						var a = $(tr).find('a[lay-event=del]');
						k_submit_start(a); //开启 按钮锁定 和 loading 显示
						$.ajax({
							url:'{:U('fyshangpu/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('fyshangpu/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+'&fylx=14&mblx='+mblx,'300','540');
				}
			});
			var layer = layui.layer
			,layedit = layui.layedit
			,laydate = layui.laydate;
			laydate.render({
				elem: '#test1'
				,max: '{:date("Y-m-d",time())}'
			});
			laydate.render({
				elem: '#test2'
				,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();
			});
			form.on('select(fylx)', function(data){
				var sousuo = $('#sousuo').val();
				if(data.value == 1){
					window.location.href="{:U('Fyxiezilou/xiezilou')}?txt="+sousuo;
				} else if(data.value == 2){
					window.location.href="{:U('Fangyuan/esfy')}?txt="+sousuo;
				}
			});
			$("#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>