<?php  
  header("Content-type:text/html;charset=utf-8");
  include("/template/topno.php");?>
<?php  
	$id = intval($_GET['id']);
  if(!$id){
    echo "<script>top.location.href='/login.php';</script>";exit();
  }  
	$sqlsc = "select * from  {$db_prefix}project where id = '".$id."'";
	$rssc = $db->get_one($sqlsc);  
  $Tzmoney = $rssc['qtje'];
  //判断是否会员
  if($rssc['classid'] == 4 && $userConfig['level'] == 1 ){
      echo "<script>javascript:alert('您暂时还不能投放VIP项目,如需了解请洽谈客服');top.location.href='/projectlist.php?type=rt';</script>";exit();
  }
?> 
  <link rel="stylesheet" type="text/css" href="/public/Front2/css/style.css"  />
  <link rel="stylesheet" href="/public/Front/css/common.css" /> 
  <link rel="stylesheet" href="/public/Front/css/login.css" /> 
  <link rel="stylesheet" href="/public/Front/css/service.css" />
  <link rel="stylesheet" href="/public/Front/css/register.css" />
  <link rel="stylesheet" href="/public/Front/css/react.css" />
  <script type="text/javascript" src="/public/Front/js/json-eps.js"></script> 
  <script type="text/javascript" charset="utf-8" src="/public/Front/user/user.js"></script>
  <script type="text/javascript" src="/public/Front/js/jquery-1.7.2.min.js"></script> 
  <link rel="stylesheet" href="/public/Front/css/financing.css" /> 
 	<body id="page-index" u-id="" u-host="" u-currenturl="/">
  <div class="wrap">
    <?php  include("/template/menu.php");?> 
		<style>
		.col-xs-5 {
     width:auto; 
}
		</style>
	<div class="financing-loan">
  <div class="container">
    <div class="financing-loan-wrapper">
      <div class="breadcrumbs clearfix">
        <div class="pull-left">
          <a class="llc">
            投资理财
          </a>
          &gt;
          <span>&gt;项目详情</span>
        </div>
      </div>
      <div class="loan-wrapper">
        <div class="loan-box clearfix">
          <span class="line">
          </span>
          <div class="col-left">
            <div class="loan-box-header clearfix loan-box-header-s">
              <h1>
                <?php echo $rssc['title']; ?>
              </h1>
              <a class="isZqTransfer_wrap">
                <div style="left:421px;" class="isZqTransfer">
                </div>
              </a>
              <a>
                <div class="agency_href">
                  由
                  <span>
                    <?php echo $rssc['bljg']; ?>
                  </span>
                  <span>
                    提供100%本金收益保障
                  </span>
                </div>
              </a>
            </div>
            <div style="height:329px;" class="loan-box-body">
              <div style="padding-top:30px;margin-bottom:0px;padding-bottom: 60px;border-bottom:1px solid #f5f5f5"
              class="l-row row numbers">
                <div class="col-xs-5">
                  <p>
                    交易日化收益
                  </p>
                  <div data="<?php echo $rssc['title']; ?>" class="l-value">
                    <span style="font-size:30px;margin-left: 3px;position: absolute;margin: 16px 10px;" class="number orange">
                      <?php echo $rssc['jyrsy'].'%'; ?>
                    </span>
                  </div>
                </div>
                <div class="col-xs-3">
                  <p>
                    项目期限(天)
                  </p>
                  <div class="l-value">
                    <span style="font-size:30px;margin-left: 3px;position: absolute;margin: 16px 10px;" class="number orange">
                      <?php echo $rssc['shijian'].'天'; ?>
                    </span>
                  </div>
                </div>
                <div class="col-xs-4">
                  <p>
                    起投金额（元）
                  </p>
                  <div class="l-value">
                    <span style="font-size:30px;margin-left: 3px;position: absolute;margin: 16px 10px;" class="number orange">
                      <?php echo $rssc['qtje']; ?>
                      <input type="hidden" id="qtje" value="<?php echo $rssc['qtje']; ?>">
                    </span>
                  </div>
                </div>
              </div>
              <div style="padding-top:30px;" class="l-row row">
                <div class="col-xs-5">
                  <div class="l-label l-label1">
                    项目总金额
                  </div>
                  <div class="pay-method">
                    <span style="font-weight:bold;" class="orange">
                      <?php echo $rssc['xmgm'].'万元'; ?>
                    </span>
                  </div>
                </div>
                <div class="col-xs-7">
                  <div class="l-label l-label1">
                    保障方式
                  </div>
                  <div title="100%本金+分红" class="pay-method1">
                    100%本金+分红
                  </div>
                  <!--a.tips.tips-spe.tips-top(title=gett('RepaymentMethod', loan.method)[1])-->
                </div>
              </div>
              <div style="padding-top:30px;" class="l-row row">
                <div class="col-xs-5"  style="width: 180px;">
                  <div class="l-label l-label1">
                    最 高 金 额 
                  </div>
                  <div class="pay-method">
                    <span style="font-weight:bold;" class="orange">
                      <?php if($rssc['zgje'] == 0) echo '无限制'; else  echo $rssc['zgje']; ?>
                    </span>
                  </div>
                </div> 
		
				
              </div>
              <div class="l-row row no-border">
                <br>
                <div class="col-xs-12">
                  <div class="l-label progress-label">
                    购 买 进 度
                  </div>
                  <div class="l-progress-wrapper green">
                    <div style="width:<?php echo $rssc['xmjd']; ?>%" class="l-progress-bar">
                    </div>
                  </div>
                  <div class="l-percentage green">
                    <?php echo $rssc['xmjd']; ?>%
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="col-right">
            <div class="loan-box-body">
              <div style="padding-top:32px;" class="l-row">
                <p>
                  可买金额（元）
                </p>
                <div class="l-value">
                  <span style="font-weight:normal;font-size:30px" class="number">
                    <?php echo $rssc['ktje']; ?>
                  </span>
                </div>
              </div>
              <div class="row">
                <div class="col-xs-6">
                  账户余额
                  <div class="account-balance-value">
                    <?php echo $userConfig["amount"];?>
                  </div>
                </div>
                <div class="col-xs-6 text-align-right">
                  <a target="_blank" href="/user/recharge.php" style="display:inline-block;width:50px;height:24px;color:#fff;border-radius:2px;text-align:center;line-height:24px;background:#ff6600">
                    充值
                  </a>
                </div>
              </div>




				<?php if($_SESSION["glo_username"]){ ?>
				 <div class="row">
                <div class="col-xs-12">
                  <p class="gray">
                    <?php
                    	if($userConfig["amount"] < $rssc['qtje'] ){
                    		echo "账户余额低于起投".$rssc['qtje']."金额，请先充值";
                    	}
                    ?>
                  </p>
                </div>
              </div> 
              <?php if($rssc['tzzt'] == 1 ){ ?>
              <div class="row">
                <div class="col-xs-12">
                  <div class="space s-20">
                  </div>
                  <p class="gray" style="font-size:16px;">此项目已售完...</p>
                  </div>
               </div> 
              <?php } ?>
              <?php if((int)$userConfig["amount"] >= (int)$rssc['qtje'] && $rssc['tzzt'] == 0){ ?>
              <div>
          		<input type="hidden"value="<?php echo $id;?>" name="idPay" id="idPay" style="border:#9f9f9f solid 1px; width:128px; height:28px; line-height:28px;">
				请填写投资金额：<input type="text" name="amountPay" id="amountPay"  style="border:#9f9f9f solid 1px; width:128px; height:28px; line-height:28px;"><br><br>
				请填写交易密码：<input type="password" name="passwordPay" id="passwordPay" style="border:#9f9f9f solid 1px; width:128px; height:28px; line-height:28px;" title="默认与登录密码相同"> 
             	<br>
             	<p id="terr" style="color:red;"></p>
             	<input type="button"  style="margin-top: 21px;" onclick="javascript:nowToMoney();" value="立即投资" class="btn btn-orange btn-block white">
             	</div>
             	<?php } ?>
				<?php }else{ ?>
				<div class="row">
                <div class="col-xs-12">
                  <div class="space s-20">
                  </div>
                  <p class="gray">登录后可查看余额</p>
              	  </div>
             	 </div> 
				<a href="/login.php" class="btn btn-orange btn-block white">立即登录</a>
				<?php } ?>
            </div>
          </div>
        </div>
        <div class="loan-information">
          <div id="loan-info-tabs" class="f-box clearfix">
            <ul role="tablist" class="nav nav-tabs">
              <li class="active">
                <a href="#detail" role="tab" data-toggle="tab" aria-expanded="true">
                  项目详情
                </a>
              </li>
             <!--  <li class="tab-invest-records">
                <a href="#invests" role="tab" data-toggle="tab" aria-expanded="false">
                  已投产品
                </a>
              </li> -->
            </ul>
          </div>
          <div style="padding-top:10px;min-height: 300px" class="tab-content">
            <div id="detail" class="tab-pane paneshenhe active">
              <div style="width:95%;border-bottom: 1px dashed #E6E6E6;margin-left:30px;padding-left:0;padding-right:0;"
              class="row section">
                <h4 class="row-title">
                  项目介绍
                </h4>
                <div style="line-height:20px;" class="content row">
                  <span>
                    <?php echo $rssc['content']; ?>
                  </span>
                </div>
              </div>
            </div>
            <div id="invests" class="tab-pane">
              <div class="row section invest-records-body">
                <div class="invests-title orange">
                  加入人次
                  <em class="ir-total-num">
                    <?php 
                    	$sqlsc = "select count(*) as count from  {$db_prefix}project_buy where projectId = '".$id."'";
						$rssc = $db->get_one($sqlsc);
						echo $rssc['count']?$rssc['count']:0;
                    ?>
                  </em>
                  人&nbsp;&nbsp;投标总额¥
                  <em class="ir-total-amount">
                    <?php 
                    	$sqlsc = "select sum(amount) as count from  {$db_prefix}project_buy where projectId = '".$id."'";
						$rssc = $db->get_one($sqlsc);
						echo $rssc['count']?$rssc['count']:0;
                    ?>
                  </em>
                </div>
                <div class="checking-table">
                  <div class="thead">
                    <div class="row">
                      <div class="col-xs-3 th">
                        序号
                      </div>
                      <div class="col-xs-3 th">
                        投资时间
                      </div>
                      <div class="col-xs-3 th">
                        投标人
                      </div>
                      <div style="border-right:1px solid #f17420;height:39px;overflow:hidden;"
                      class="col-xs-3 th">
                        投标金额
                      </div> 
                    </div>
                  </div>
                  <div class="tbody invest-records-wp">
                    
                    <?php 
                    	$sqlsc = "select * from  {$db_prefix}project_buy where projectId = '".$id."'";
						$rssc = $db->query($sqlsc);
						$iii = 1;
						if(mysql_num_rows($rssc)>0){
							while($rsleftc = $db->fetch_array($rssc)){
                    ?>
                    <div class="row ie8Row">
                      <div class="col-xs-3 td">
                        <?php echo $iii;
                        		$iii++; 
                		?>
                      </div>
                      <div class="col-xs-3 td">
                        <?php echo $rsleftc['useritem_time']; ?>
                      </div>
                      <div class="col-xs-3 td">
                         <?php echo half_replace($rsleftc['username']); ?>
                      </div>
                      <div class="col-xs-3 td" data-amount="<?php echo $rsleftc['amount']; ?>">
                        ￥ <?php echo $rsleftc['amount']; ?>
                      </div> 
                    </div>
					 <?php 
                    	 }
                    	}else{
                    		echo '暂无数据';
                    	}
                    ?>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
  </div>
  <?php  include("/template/foot.php");?>
  <script>
  $("#amountPay").blur(function(){
    var amountPayc = $("#amountPay").val();
    var touzMc     = $("#qtje").val();
     if(amountPayc == '' && amountPayc == 0 ){
         $("#terr").html("请输入投资金额");
        return false;
     }
   
     if(amountPayc < <?php echo $Tzmoney; ?>){
        $("#terr").html("你输入的小于起投金额");
         return false;
    }
    $("#terr").html("");
});
  </script>
    <script src="/public/Front/js/index.js"></script>
 </body>
</html>