<?php
require_once("../check.php");
require_once("../core/setting.php");
$minpay = $setting['minpay'];
if($moneypay < "0.01"){
    $disabled = "disabled";
    $value = "可提现金额不足";
}elseif($alipay == null){
    $disabled = "disabled";
    $value = "请到个人资料补充信息";
}else{
    $disabled = null;
    $value = "提现";
}
?>
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../jquerymoblie/jquery.mobile-1.4.1.min.js"></script>
<link rel="stylesheet" href="../jquerymoblie/jquery.mobile-1.4.1.min.css"/>
<style>
img{
    max-width:100%;
}
#alert{
    display:none;
    margin-top:100px;
    color:#FFFF00;
    z-index:100;
    position: absolute;
    width:100%;
    font-size:14px;
    height:60px;
    line-height:60px;
    background-color: #FF671E;
    border-radius:10px;
    text-align:center;
}
table tr td{
    font-size:14px;
    color: #8F8F8F;
}
table tr th{
    color: #7B7B7B;
}
</style>
<script>
$(function(){
   $("#submit").click(function(){
    var money = $("#money").val();
    var payname  = $("#payname").val();
    var alipay = $("#alipay").val();
    $.post("6-pay.php",{
        money:money,
        payname:payname,
        alipay:alipay
    },function(a,b){
    if(a=="error"){
        alert('你输入的金额不正确,请重新输入!');
        return false;
    }
    if(a=="e9"){
        alert('请输入正确的数字!');
        return false;
    }
    if(a=="0"){
        alert('提现金额超过可用金额,请重新输入!');
        return false;
    }else{
    $("#alert").fadeToggle(600);
    $("#alert").fadeToggle(3000);
    setTimeout(function(){
    location.href='6.php';
    },3000);

    }
    });
    
    
   }); 
});
</script>
<div id="alert">提现申请已成功提交!</div>
<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>我要提现</h1>
  </div>
  <div data-role="content" style="text-align: center;">
    <div style="color: #666666;text-align:left;">可提现金额:&nbsp;<span style="color: #FF0000;font-weight:bold;"><?php echo $moneypay;?></span>&nbsp;元</div>
   <div style="color: #666666;text-align:left;">单次最少提现:&nbsp;<span style="color: #00A200;font-weight:bold;"><?php echo $minpay;?></span>&nbsp;元</div>
     <input type="text"   id="money" placeholder="请输入提现金额"/>
     <table>
     <tr>
     <td>收款人姓名:</td><td align="left"><?php echo $name;?></td>
     </tr>
    
         <tr>
     <td>支付宝账号:</td><td align="left"><?php echo $alipay;?></td>
     </tr>
     
     </table>
      <input type="hidden" value="<?php echo $name;?>"  id="payname" placeholder="请输入收款姓名"/>
      <input type="hidden" value="<?php echo $alipay;?>"  id="alipay" placeholder="请输入支付宝账号"/>
  

  <div><input id="submit" type="button" value="<?php echo $value;?>" style="color: red;" <?php echo $disabled;?> /></div>
<p></p>
<div data-role="collapsible" data-collapsed="false">
<h1>我的提现记录(最新十条记录)</h1>
<p style="color: #666666;font-size:14px;text-align:left;">
<?php
$paysql = "select * from dunling_pay where username='$username' order by id desc limit 10";
$payery = mysql_query($paysql,$config);
$paynum = mysql_num_rows($payery);
if($paynum=="0"){
        echo '您当前无提现记录!';
}else{
echo '<table width="100%"><tr><th>日期</th><th>提现金额</th><th>状态</th></tr>';
while($pay = mysql_fetch_array($payery)){
    echo '<tr>';
    echo '<td>';
    echo date("m月d日",$pay['time']);
    echo '</td>';
    echo '<td>';
    echo $pay['money'];
    echo '</td>';
    echo '<td>';
    $zt = $pay['zt'];
    switch($zt){
        case '0':
        echo '<span style="color:#1183AE;">待审核</span><br/>';
        break;
        case '1':
        echo '<span style="color:green;">已支付</span><br/>';
        break;
        case '2':
        echo '<span style="color:#FF0000;">已驳回</span><br/>';
        break;
        default:
        echo '未知错误';
        break;
    }

    echo '</td>';
    echo '</tr>';
}
echo '</table>';
}
?>

</table>
</p>
</div>
<div data-role="collapsible" data-collapsed="true">
<h1>提现后未及时到账怎么办?</h1>
<p style="color: #666666;font-size:14px;">
<a href="../chat/index.php" target="_blank">在线联系管理员</a>
</p>
</div>

</div></div>