<!---->
<div id="centre" class="layout">
		<div class="centreInner ">
				<div class="mainInner radius5 "> 
						<!---->
						
						<div class="titleTabBox">
								<div class="titleTab">
										<div class="titleTabB clearfix">
												<dl class="list">
														<dd class="item itemOn"> <a class="link" href="/my_complain/complain/">竞投房源举报</a> </dd>
														<dd class="item"> <a class="link" href="/my_complain/myList/"> 我的举报 </a></dd>
												</dl>
										</div>
								</div>
						</div>
						<!---->
						<div class="belongBox radius3 belongBox_jub">
								<p class="title"><span class="b">举报规则：</span><span class="tex_fg">1、每个经纪人每天最多只能举报5条房源&nbsp;&nbsp;&nbsp; 2、一条房源最多只能被不同公司的三个不同的经纪人投诉</span></p>
								<p class="title"><span class="b">温馨提示：</span>
								房源举报经核实后可赢取房豆奖励哦!举报虚假房源冻结可获得<span class="f_color"><?=$credit['bid']?>房豆/条</span>,举报虚假房源删除可获得<span class="f_color"><?=$credit['delete']?>房豆/条</span>。				
								<!--竞投房源举报经核实后可赢取房豆奖励哦!举报竞投房源成功可获得<span class="f_color"><?=$credit['bid']?>房豆/条</span>,举报普通房源成功可获得<span class="f_color"><?=$credit['comman']?>房豆/条</span>。-->	&nbsp;&nbsp;&nbsp;<a  style="color:#2280ff" href="<?=$documentation['complain_rule']?>" target="_blank">详细规则>></a></p> 
						</div>
						<!---->
						
						<div class="belongBox radius3 belongBox_jub">
								<div class="forms">
                                    <form action="" id="jsForm_jub" method="post" onsubmit="return false">
												<dl class="list">
														
														<!---->
														
														<dd class="list_item clearfix">
																<label class="label">房源编号：</label>
																<div class="fields">
																		<div class="fgInput jsFgInput">
																				<input id="houseid" type="text" class="input_text w170" name="houseid" value=""  iserror=""/>
																		</div>
																		<div class="textFgErroy" id="houseerror" style="width:370px;"></div>
                                                                        
																</div>
														</dd>
														<!---->
														<dd class="list_item clearfix">
																<label class="label">房东电话：</label>
																<div class="fields">
																		<div class="fgInput jsFgInput">
																				<input id="telno" type="text" class="input_text w170" name="telno" maxlength="20" iserror="" />
																		</div>
																			<div class="textFgErroy" id="telnoerror" style="width:300px;"></div>
																</div>
														</dd>
														<!---->
														<dd class="list_item clearfix">
																<label class="label">房源地址：</label>
																<div class="fields nameInput">
																		<div class="fgInput jsNameInput jsFgInput">
																			<label class="labelPrev labelPrevN jslabelPrev" for="js_fangyuandizhi" >请具体到XX栋XX号</label>
																				<input id="address" type="text" class="input_text w345" name="address"  id="js_fangyuandizhi" iserror="" />
																		</div>
                                                                    <div class="textFgErroy" id="addresserror" style="width:300px;"></div>
																</div>
														</dd>
														<!---->
														<dd class="list_item clearfix">
																<label class="label">投诉原因：</label>
																<div class="fields">
															
																		<div class="fgInput jsFgInput" style="padding-right:25px;">
																				<label class="textFg3 textFg5">
																						<input type="checkbox" style="_margin-top:4px;" class="input_c" name="reason[]" value="1">
																						<span class="tex">&nbsp;面积虚假</span></label>
																		</div>
																		<div class="fgInput jsFgInput" style="padding-right:25px;">
																				<label class="textFg3 textFg5">
																						<input type="checkbox" style="_margin-top:4px;" class="input_c"  name="reason[]" value="2">
																						<span class="tex">&nbsp;价格虚假</span></label>
																		</div>
																		<div class="fgInput jsFgInput" style="padding-right:25px;">
																				<label class="textFg3">
																						<input type="checkbox" style="_margin-top:4px;" class="input_c"  name="reason[]" value="3">
																						<span class="tex">&nbsp;房源已成交</span></label>
																		</div>
																		<div class="fgInput jsFgInput" style="padding-right:25px;">
																				<label class="textFg3">
																						<input type="checkbox" style="_margin-top:4px;" class="input_c"  name="reason[]" value="3">
																						<span class="tex">&nbsp;图片虚假</span></label>
																		</div>
																	
																			<div class="textFgErroy" id="reasonerror"></div>
																		<div class="clear tip_color">备注：可多选，面积误差5平米、总价误差5万、标题违规、毛坯房图片与效果图暂不在虚假举报范围。图片虚假请详细说明，方便网站核实。</div>
																</div>
														</dd>
														<!---->
														<dd class="list_item clearfix">
																<label class="label">投诉说明：</label>
																<div class="fields nameInput ">
																		<div class="fgInput jsNameInput jsFgInput">
																		<label class="labelPrev labelPrevN jslabelPrev" for="js_tousushuoming" >请阐述详细投诉理由，至少20个字哦！</label>
																				<textarea id="description" class="textarea" name="description" id="js_tousushuoming" iserror=""></textarea>
																		</div>
                                                                    <div class="textFgErroy" id="descriptionerror"></div>
																</div>
														</dd>
														<dd>
														<!---->
                                                        <?php if($complain_num<5&&!$join_black){?>
                                                        <div class="btnFBbox"><button class="btnB btnSubmit radius5" style="line-height:30px; " type="submit" can="yes">我要举报</button></div>														
                                                        <?php }elseif(!$join_black){?>
                                                        <div class="btnFBbox"><span class="btnB btnColor_p_no radius5" can="no">我要举报</span></div>
														<div class="btnFBbox_errot">很遗憾，您今日已投诉5次，明天再来参与吧！</div>                                                        
                                                        <?php }else{ ?>
                                                         <div class="btnFBbox"><span class="btnB btnColor_p_no radius5" can="no">我要举报</span></div>
														<div class="btnFBbox_errot">很遗憾，您已经加入举报黑名单，不能参与举报！</div>   
                                                        <?php }?>
														</dd>
                                                </dl>
												
												<!---->
										</form>
								</div>
						</div>
						<!----> 
				</div>
		</div>
</div>

<div id="complainSuccess" class="dialog radius5" style="display:none;">
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p title="关闭" class="close close-win">关闭 </p>
	</div>
	<div class="mod">
		<div class="text text_jub text_jub02">
				提交成功！我们会尽快审核！<br>
				请密切关注<a href="/my_complain/myList/" class="link">我的举报</a>中的状态，<br>
				感谢您的支持！
			</div>
	</div>
</div>

<div class="dialog radius5" style="display:none;">
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p title="关闭" class="close close-win">关闭 </p>
	</div>
	<div class="mod">
		<div class="text text_jub">
				很抱歉，由于您的竞投房源为虚假<br>
				房源，现取消您参与付费推广的资格。<br>
				限制期至：<span class="jub_color">2014年12月12日 12:12:34</span>
		</div>
	</div>
</div>

<div id="complainFailure" class="dialog radius5" style="display:none;">
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p title="关闭" class="close close-win">关闭 </p>
	</div>
	<div class="mod">
		<div class="text text_jub">
				提交失败！可能有以下原因：<br>
				1. 该房源已被举报下架。<br>
				2. 该房源已被您所在公司的小伙伴<br>举报过了。
		</div>
	</div>
</div>


<script>
$(function(){
   var can = $(".btnB").attr("can");
//真实房源验证
$("#houseid").blur(function(){    
	if(can=='no'){
		return false;
	}
    var houseid = $(this).val();
    reg=/^\d{1,10}$/;   
    if(!reg.test(houseid)){        
        var numerror = "<label for=houseid' class='error' >请输入正确的房源编号！</label>";
		$("#houseerror").html(numerror);
        $(this).attr("iserror","1");
        return false;
    }else{
        var numerror = "";
		$("#houseerror").html(numerror);
    }  
    var url = '/my_complain/judgeHouse/';
    var data = {};    
    data.house = houseid;
    $.post(url,data,function(result){ 

        var errorinfo,error;
        if(result==2){
            errorinfo = "该房源已下架，下次一定要手快哦！";
            error = "<label for=houseid' class='error'>"+errorinfo+"</label>";
             $("#houseid").attr("iserror","1");
        }else if(result==3){
            errorinfo = "该房源已被举报三次，下次一定要手快哦！";
            error = "<label for=houseid' class='error'>"+errorinfo+"</label>";
            $("#houseid").attr("iserror","1");
        }else if(result==4){
            errorinfo = "该房源已被您所在公司的小伙伴举报过了，下次一定要手快哦！";
            error = "<label for=houseid' class='error'>"+errorinfo+"</label>";
            $("#houseid").attr("iserror","1");
        }else if(result==1){
            errorinfo = "该房源是当前推广的竞投房源哦！";
            error = "<label for=houseid' class='' style='color: blue;display: block;height: 29px; line-height: 29px;margin-left: 10px;padding-left: 19px;' >"+errorinfo+"</label>";
			$("#houseid").attr("iserror","");
        }else if(result==5){
            errorinfo = "该房源是非竞投房源哦！";
            error = "<label for=houseid' class='' style='color: blue;display: block;height: 29px; line-height: 29px;margin-left: 10px;padding-left: 19px;'>"+errorinfo+"</label>";
			$("#houseid").attr("iserror","");
            
        }

       $("#houseerror").html(error);
                
    },'json');
});

//真实电话认证
$("#telno").blur(function(){
	if(can!='yes'){
		return false;
	}
    var telno = $(this).val(); 
	if(!telno){
		var numerror = "<label for=telno' class='error'>电话不能为空！</label>";
		$("#telnoerror").html(numerror);
        $(this).attr("iserror","1");
        return false;
	}else if(telno.length>21||telno.length<7){        
        var numerror = "<label for=telno' class='error'>请输入真实的电话号码！</label>";
		$("#telnoerror").html(numerror);
        $(this).attr("iserror","1");
        return false;
    }else{
        var numerror = "";
		$("#telnoerror").html(numerror);
        $(this).attr("iserror","");
        //return false;
    }  
})


$("#address").blur(function(){
	if(can!='yes'){
		return false;
	}
  //地址验证
    var address = $("#address").val();
    if(!address){
		var numerror = "<label for=telno' class='error'>地址不能为空！</label>";
		$("#addresserror").html(numerror); 
		$(this).attr("iserror","1");
        return false;		
    }else if(address.length>30||address.length<5){        
        var numerror = "<label for=telno' class='error'>请输入真实的房源地址！</label>";
		$("#addresserror").html(numerror); 
		$(this).attr("iserror","1");
        return false;
    }else{
        var numerror = "";
		$("#addresserror").html(numerror);  
		$(this).attr("iserror","");
    } 
})


//描述验证   
$("#description").blur(function(){
	if(can!='yes'){
		return false;
	}
    var description = $("#description").val(); 
    if(!description){
		var numerror = "<label for=telno' class='error'>理由不能为空！</label>";
        $("#descriptionerror").html(numerror); 
		$(this).attr("iserror","1");
        return false;		
    }else if(description.length<20){        
        var numerror = "<label for=telno' class='error'>您输入的理由字数不够哦！</label>";
        $("#descriptionerror").html(numerror); 
		$(this).attr("iserror","1");
        return false;
    }else{
        var numerror = "";
        $("#descriptionerror").html(numerror); 
		$(this).attr("iserror","");
    } 
})

$(".btnSubmit").click(function(){   
 
    //房源不为空验证
    var houseid = $("#houseid").val();
    var error1 = $("#houseid").attr("iserror")
    if(!houseid){        
        var numerror = "<label for=houseid' class='error'>房源编号不能为空！</label>";
		$("#houseerror").html(numerror);        
        return false;
    }else if(error1==1){
        return false;//test最后撤销
    }  
    
    //电话不为空验证
    var telno = $("#telno").val();
    var error2 = $("#telno").attr("iserror")
    if(!telno){        
        var numerror = "<label for=houseid' class='error'>电话不能为空！</label>";
		$("#telnoerror").html(numerror);        
        return false;
    }else if(error2==1){
        return false;
    }  
    
    //地址验证
    var address = $("#address").val();
	var error2 = $("#address").attr("iserror")
    if(!address){
        var numerror = "<label for=houseid' class='error'>地址不能为空！</label>";
		$("#addresserror").html(numerror);        
        return false;
    }else if(error2==1){
        return false;
    }    
    
  
   //描述验证   
    var description = $("#description").val(); 
	var error2 = $("#description").attr("iserror")
    if(!description){        
        var numerror = "<label for=telno' class='error'>理由不能为空！</label>";
        $("#descriptionerror").html(numerror);        
        return false;
    }else if(error2==1){
        return false;
    } 
    
    
    //原因
    var reason = [];
    var i=0;
    $(".input_c").each(function(){        
        if($(this).attr("checked")=='checked'){
            reason[i] = $(this).val();
            i++;
        }  
    })
    
	if(i===0){
		var numerror = "<label for=telno' class='error'>投诉原因不能为空！</label>";
        $("#reasonerror").html(numerror);        
        return false;

	}
 
    
    var _address = encodeURI(address,"UTF-8");
    var _description = encodeURI(description,"UTF-8");
    var _telno = encodeURI(telno,"UTF-8");;
    $.ajax({ 
        type: 'post',
		url : '/my_complain/ajaxComplain/',
		data: {houseid : houseid,telno :_telno,address : _address,description:_description,reason:reason},
		dataType : 'json',
		success: function(data){    
			if(data.status == 1){
                openWin("complainSuccess");			
               
			}else if(data.status == 2){
				alert("添加数据错误,请重新举报！");
			}else if(data.status == 3){
                openWin("complainFailure");		
            }     
				   
		}
	});
    
})
	
})

$(".close-win").click(function(){
     location.href = "/my_complain/myList/";
})

</script>

</body>
</html>
