<?php require APPPATH_MVC.'views/header.php'; ?>

<!--会员中心主体 Start-->
<div class="w960 clearfix mt10 pepcenterBox">
<?php require APPPATH_MVC.'views/left.php'; ?>
<!--会员左侧 End-->
    <div class="user-main user-main02">
        <div class="hd-bar pos-r"><h2>求购</h2><a class="btnLink" href="<?php echo GB_PUBLISH_URL;?>?kind=3" target="_blank">我要求购</a></div>
        <div class="user-main user-main03">
            <form id="search_form" name="search_form" accept-charset="gbk" method="post" action="/want/buylist">   
            <div class="mod-list for-rent">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-style-a">
                <?php if( is_array($buy_data) && !empty($buy_data) ) { ?>
                    <tr>
                        <th>目标区域</th>
                        <th>要求</th>
                        <th>状态</th>
                        <th width="110">操作</th>
                    </tr>
                    <?php foreach( $buy_data as $key =>$value ){ ?>
                    <?php
                        //背景
                        if($value['esta']==1)
                        {
                           $bg =  $key % 2 == 1 ? 'class="odd"' : 'class=" "' ;
                        }else{
                           $bg =  $key % 2 == 1 ? 'class="odd info2"' : 'class=" info2 "' ;
                        }

                        //建筑年代
                        if( $value['buildyear1'] > 0 && $value['buildyear2'] > 0)
                        {
                            $buildyear = $value['buildyear1'].'-'.$value['buildyear2'].'年<em class="t-line">|</em>';
                        }
                        else if( $value['buildyear'] != '' && $value['buildyear'] != '-' )
                        {
                            $buildyear = $value['buildyear'].'年<em class="t-line">|</em>';
                        }
                        else
                        {
                            $buildyear = '';
                        }

                        //建筑面积
                        if( $value['buildarea1'] > 0 || $value['buildarea2'] > 0)
                        {
                            $buildarea = $value['buildarea1'].'-'.$value['buildarea2'].'平米<em class="t-line">|</em>';
                        }
                        else if( $value['buildarea1'] != '' && $value['buildarea2'] != '-' )
                        {
                            $buildarea = $value['buildarea'].'平米<em class="t-line">|</em>';
                        }
                        else
                        {
                            $buildarea = '';
                        }

                        //价格
                        if( $value['price1'] > 0 || $value['price2'] > 0)
                        {
                            $price = $value['price1'].'-'.$value['price2'].'万<em class="t-line">|</em>';
                        }
                        else if( $value['price'] != '' && $value['buildyear'] != '-' )
                        {
                            $price = $value['price'].'万<em class="t-line">|</em>';
                        }
                        else
                        {
                            $price = '';
                        }

                        //户型
                        if( $value['room'] > 0 && $value['room'] > 0)
                        {
                            $room = $value['room'].'室<em class="t-line">|</em>';
                        }
                        else
                        {
                            $room = '';
                        }

                        //来源
                        if( $value['infofrom'] >= 0 && $value['infofrom'] >= 0)
                        {
                            $infofrom = $value['infofrom'] == 0 ? '不限' : $house['infofrom'][$value['infofrom']];
                        }
                        else
                        {
                            $infofrom = '';
                        }
                   ?>
                    <tr <?=$bg;?>>
                    <td title="<?=$value['address'];?>">
                    <?php if($value['esta']==1){?>
                    <a href="<?php echo GB_SELL_URL;?>/buyinfo.php?id=<?php echo $value['id'];?>" target="_blank"><?=csubstr2($value['address'],38,1);?></a>
                    <?php }else{?>
                    <?=csubstr2($value['address'],38,1);?>
                    <?php }?>
                    </td>
                    <td><?=$buildyear.$buildarea.$price.$room.$infofrom;?></td>

                    <?php if($value['esta'] == 1){?>
                        <?php if($value['allow_match'] == 1 && GB_CITY=='nj'){ ?>
                        <td>有<span class="c-ff8400"><?=$value['new_matched_num'];?></span>条新房源</td>
                        <?php }elseif(GB_CITY=='nj'){?>
                        <td>未参与匹配</td>
                        <?php }else{?>
						<td>已激活</td>
						<?php } ?>
                    <?php }else if( $value['esta'] == 0 || $value['esta'] == '-10' ){?>
                        <td>审核中</td>
                    <?php }else if( $value['esta'] == 2 || $value['esta'] == 3 || $value['esta'] == 4 ){ ?>
                        <td>已删除</td>
                    <?php }else{?>
                        <td>审核未通过</td>
                    <?php }?>

                    <?php if( $value['esta'] == 1 && $value['allow_match'] == 1 && $value['matched_num'] >= 1 && GB_CITY=='nj'){ ?>
                    <td><a href="javascript:void(0)" class="lookFor" want_id='<?=$value['id'];?>'>查看匹配</a><a class="lookFor002" href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
                   <?php }elseif($value['esta']==1 && GB_CITY=='nj'){ ?>
                    <td><span class="lookForNone" style="float:left;line-height:38px;width:70px;">查看匹配</span><a class="lookFor002" href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
                    <?php }elseif(GB_CITY=='nj'){ ?>
                    <td><span class="lookForNone">查看匹配</span></td>
                    <?php }elseif(GB_CITY!='nj' && $value['esta']==1){?>
					 <td><a href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
					<?php }elseif(GB_CITY!='nj' && $value['esta']!=1){?>
					 <td><a class="lookForNone">删除</a></td>
					<?php } ?>
                  </tr>
                <?php } ?>
            <?php }else{ ?>
             <div class="no-result">您还没有发布求购信息，去发布吧。<a href="<?php echo GB_PUBLISH_URL.'?kind=3';?>" target="_blank">立即前往&gt;&gt;</a></div>
            <?php } ?>
            </table>
            <?php if(is_array($buy_data) && !empty($buy_data) ){?>	<div class="solidDiv">&nbsp;</div><?php }?>
            <div class="showBox">
            	<a href="javascript:void(0)" class="showBox-close">关闭</a>
                <iframe frameborder="0"  height="332" id='matched_window' scrolling="no" width="703" src=""></iframe>
            </div>
        </div>
        <?=form_hidden('page', $page);?>
        <input type='hidden' name='want_type' id='want_type' value="<?=$want_type?>" >
        <?php if( !empty($pagination) ): ?>
        <!--分页-->
        <div class="cut-page"><?=$pagination?></div>
        <!--分页-->
        <? endif; ?>

        <?=form_close()?>
				<div style="margin-top:11px; height:1px; overflow:hidden; zoom:1; font-size:0; line-height:normal;">&nbsp;</div>
		<div class="nounExplanation">
						<p>1、求购求租必须为真实、有效的个人房源需求，联系电话为本人电话。</p>
						<p>2、中介冒充个人进行发布，房源将不允许上传。</p>
						<p>3、<strong class="title">待审核：</strong>待审核中的信息除了您自己外，其他人无法看到，不能修改，工作人员会在24小时内为您审核。</p>
						<p>4、<strong class="title">审核未通过：</strong>该房源未经过网站二次房源审核，必要时向网站提供相关材料给网站，验证合格后，方可发布，需要电话客服。</p>
                        <?php if(GB_CITY=='nj'){?>
						<p>5、前台默认勾选“我要参加房源匹配”，房源不在前台展示，进入后台进行匹配。如果您选的是个人，则只收到您的需求相关最新的个人房源，如果您选择中介房源，将定期收到中介发送过来的相关房源。</p>
						<p>6、您每天会收到给您匹配的房源，您可以登陆个人会员中心进行查看。</p>
                        <?php }?>
				</div>
    </div>
    <!--会员右侧 End-->

		</div>
</div>
<!--会员中心主体 End-->
<!--引导-->
<?php if(is_array($buy_data) && !empty($buy_data) ){?>
<script>
function buyListGuidePop(){
	$("#buyListGuidePop").css({
		"display":"block",
		"width":$(window).width() < 960 ? 960 : $(window).width() +"px",
		"height":$(document).height()+"px"
	});
	$("#buyListGuide").css({
		"display":"block",
		"left":$(".table-style-a").offset().left + 483 +"px",
		"top":$(".table-style-a").offset().top - 49 +"px"
	});
};
$(function(){
    var cookieTag = getCookie('buyListGuide');
    if(cookieTag != 1)
	{
	buyListGuidePop()
	$(window).resize(function(event){
			buyListGuidePop()
	});
    }
	$("#buyListGuide .closeGuide").live("click",function(){
            SetCookie('buyListGuide',1);
			$("#buyListGuidePop,#buyListGuide").hide();
            setTimeout("location.reload()",300);
	})
})

function submit_all_del(type,id,mark,code){

    if(id) {
    if(mark==1)
    {
     $("#pop_win_1").hide();
     $.ajax({
     type: 'post',
     url : '<?php echo USER_CENTER;?>want/updatewant',
     data: 'type='+type+'&id='+id+'&code='+code+'&tbl=buy',
     dataType:'html',
     success: function(msg){

              if(type == 'del')
              {
                  switch(msg)
                  {
                   case '1':
                   $("#war-text").html("删除成功");
                   break;

                   case '2':
                   $("#war-text").html("验证不通过，来源不正确");
                   break;

                   case '3':
                   $("#war-text").html("删除失败");
                   break;
                  }
              }
                openWin('warning');

         }
       });

    }else{

        if(type == 'del')
        {
        $("#pop_text").html("确定要删除这条求购信息吗");
        $("#pop_sure").attr("href","javascript:submit_all_del('"+type+"',"+id+",1,'"+code+"')");
        }
        openWin('pop_win_1');
    }

    }
}
</script>
<?php }?>
<style>
#buyListGuidePop{ display:none; background:#000; opacity:0.2; filter:alpha(opacity=20); position:absolute; left:0; top:0; z-index:999998;}
#buyListGuide{ display:none;width:288px; height:126px; overflow:hidden; position:absolute;z-index:999999;}
#buyListGuide .inner{ width:288px; height:126px; overflow:hidden;  background:url(http://www.house365.com/center/images/guide_img/buyListGuide.png) no-repeat 0 0;_background:transparent;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.house365.com/center/images/guide_img/buyListGuide.png');}
#buyListGuide .closeGuide{ width:63px; height:18px; cursor:pointer; overflow:hidden; text-indent:-999px; position:absolute; right:73px; top:55px;}
</style>
<div id="buyListGuidePop">&nbsp;</div>
<div id="buyListGuide">
	<div class="inner">
			<div class="closeGuide" title="我知道了">我知道了</div>
	</div>
</div>
<?php
if($isa_website!=''){
?>
<script type="text/javascript">
	var isa_website = "<?=$isa_website?>";
	var isa_city = "<?=$isa_city?>";
	var isa_addones = "<?=$isa_addones?>";

	var _analyze365 = (('https:' == document.location.protocol) ? ' https://': ' http://');
	document.write(unescape('%3Cscript src="'+ _analyze365 + '<?=$isa_url?>" type="text/javascript"%3E%3C/script%3E'));
</script>
<?php
}
?>
<script type='text/javascript'>
    var ga_city = "<?=$isa_city?>";
    var ga_channel = 'center';
    var ga_page= "/个人中心/求购";
</script>
<script language="javascript" src="http://stat.house365.com/365count.js"></script>
<!--引导结束-->
<?php require APPPATH_MVC.'views/footer.php'; ?>
<div id="warning" class="pop" style=" display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(<?php echo USER_CENTER;?>images/pop-ico.gif)  0 0 no-repeat;"></div>
						<p class="war-text" id="war-text"></p>
				</div>
				<div class="pop-btn-area"><a href="javascript:location.reload();" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>
<div style="display:none;width:390px;height:200px; position:absolute;left:50%;top:300px;margin-left:-85px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca; z-index:9999" id="pop_win_1" class="pop_win">
		<div style="height:40px;background:#FF8400" class="hd">
				<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2>
				<a style="display:block;width:30px;height:30px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" class="close-win" href="javascript:void(0)">关闭</a></div>
		<div style="background:#fff;height:160px" class="bd">
				<div style="width:70px;height:80px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
				<p style="position:absolute;left:140px;top:85px;font-size:14px" id="pop_text">你确定要删除该求购信息吗？</p>
				<div style="text-align:center;position:absolute;top:155px;width:100%;"><a style="*position:relative;background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E" class="refresh-ok" href="javascript:submit_all(1)" date-num="0" id="pop_sure">确定</a><a style="*position:relative;background:#F5F5F5;color:#666;padding:7px 15px;margin:0 5px;border:1px solid #CCCCCC" class="close-win" href="javascript:void(0)">取消</a></div>
		</div>
</div>