<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
$js .= "<script src='".$conf_basedir."script/My97DatePicker/WdatePicker.js'></script>";
$title = '贷款申请记录';

$request  = new Request();
$zsbLoanRecord = new ZsbLoanRecord();

$settingType = array('0'=>'全部','1'=>'待审核','2'=>'办理成功','3'=>'未办理成功','4'=>'信息虚假驳回');//状态
$productType = array('0'=>'全部','1'=>'二手房贷款','2'=>'抵押贷款','3'=>'信用贷款','4'=>'租房贷款');//产品类型
$settingSearch = array(0=>'请选择','loanname'=>'贷款人姓名','brokername'=>'经纪人帐号');//查询条件
$settingOrderBy = array('ctime'=>'按交易时间排序');
$settingAscDesc = array('desc'=>'倒序排列','asc'=>'正序排列',);
$settingDispRows = array(20=>'20',30=>'30',40=>'40');



//查询条件，关键字
if($search_type&&$keyword) {
   
    if ($search_type == 'loanname') {
        $conf_sql['loan_user'] = $keyword;
    } elseif($search_type == 'brokername') {
        $conf_sql['broker_name'] = $keyword;
    } 
}
//状态
if($status){
    $conf_sql['status'] = $status;
}

//类别
if($type){   
   $conf_sql['tid'] = $type;
}

//排序
$asc_desc_order = $asc_desc ? " create_time ".$asc_desc : " create_time ".'desc';

//条数
$page_now = intval($page_now)==0?1:intval($page_now);
$disp_rows = intval($disp_rows)==0?20:intval($disp_rows);
$startRow = ($page_now-1)*$disp_rows;

//条件组装
if(CommonBase::isFullArray($conf_sql)){
    $conf_num = count($conf_sql);
    foreach ($conf_sql as $key=>$value){
        $sql_where .= $key."='".$value."'"; 
        $sql_where .= $conf_num != 1 ? ' and ' : ''; 
        $conf_num--;        
    }    
}



$recordList = $zsbLoanRecord->findBy($sql_where,$asc_desc_order,$startRow,$disp_rows);


$total_num = $zsbLoanRecord->findNumberBy($sql_where);
$page_total = ceil($total_num/$disp_rows);
$new_pagenavi = new_pagenavi2($page_now,$page_total,$total_num);




function getStatus($status){
    switch ($status){
        case '1': $return = '待审核';
            break;
        case '2': $return = "<span style='color:green;'>审核成功</span>";
            break;
        case '3': $return = "<span style='color:red;'>未审核成功</span>";
            break;
        case '4': $return ="<span style='color:red;'>虚假信息驳回</span>";
            break;
        default : $return = "";
    }
    return $return;
}

function getProductType($type){    
    switch ($type){
    case '1': $returnType = '二手房贷款';
        break;
    case '2': $returnType = '抵押贷款';
        break;
    case '3': $returnType = '信用贷款';
        break;
    case '4': $returnType = '租房贷款';
        break;  
    default : $returnType = '';
    }
    return $returnType;
}

    
include_once(Template("header"));
include_once(Template("loan/loan_record"));
include_once(Template("footer"));














