<?php 

if(isset($_SESSION['username'])){
   $username=$_SESSION['username']; 
}else{
   echo "<script>location=../index.php</script>";
   exit; 
}
$uid_sql="select * from user where username='{$username}'";
$username_row=mysql_fetch_assoc(mysql_query($uid_sql));

$shenhe_sql="select * from tixian_shenhe where shifoutongguo=0 and uid={$username_row['id']}";
$shenhe_num=@mysql_num_rows(mysql_query($shenhe_sql));
$tixian_sql="select * from tb_tot where username='{$username}'";
$tixian_rst=mysql_query($tixian_sql);
$tixian_row=@mysql_fetch_assoc($tixian_rst);

?>
<div style='width:1050px;height:755px;background:#fff;'>
<center>
<br>
<p><?php if($shenhe_num>0){echo "<span style='color:red;'>你有未审核的提现单，请勿再次提交</span>";}else{echo "";}?></p>
<br>
<p style="font-size: 20px;text-align: center;color:#676767;">账户提现<span id="dataid" style="display: none;"><?php echo $tixian_row['jiage']; ?></span></p>
<form id="tixian_form" action="../myadmin/tixian/tixian_add.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="tixian_uid" value="<?php echo $tixian_row['uid']; ?>">
<input type="hidden" name="tixian_hidden_zonger" value="<?php echo $tixian_row['jiage']; ?>">
<br>
<p>账户总额:<input id="tixian_zonger" name="tixian_zonger" type="text" disabled="disabled" style="padding:0px 150px 0px 0px;font-size:20px;color:red;" value="<?php echo $tixian_row['jiage']; ?>"/>&nbsp;元</p>
<p style="height: 20px;"><span id="jiner_error" style="color: red;"></span></p>
<p>提现金额:<input id="tixian_jiner" name="tixian_jiner" type="text" style="padding:0px 150px 0px 0px;font-size:20px;color:red;" />&nbsp;元</p>
<br>
<br>
<input id="tixian_btn" type="button" value="立即提现" <?php if($shenhe_num>0){echo "disabled='disabled'";} ?> style="width:100px;height:30px;color:#676767;" />
<input type="reset" value="重置" style="width:100px;height:30px;color:#676767;" />
<input id="dianji_geshu" type="hidden" name="dianji_geshu">

</form>
</center>
</div>
<script>
var zongjiner=$("#dataid").html();
$("#tixian_jiner").keyup(function(){
var shurujiner=$.trim($(this).val());
if(!$.isNumeric(shurujiner)){
    $(this).val("");
    }
    
var cha=zongjiner-shurujiner;
if(cha<0){
    alert("余额不足");
    $(this).val("");
    $("#tixian_zonger").text(zongjiner);    
}
if($(this).val()==""){
    $("#tixian_zonger").text(zongjiner);
       
}

if((/^(\+|-)?\d+$/.test(shurujiner))){  

        $("#jiner_error").html(""); 
        return true;  
    }else{  
        $("#jiner_error").html("金额必须整数");
        $(this).val("");  
        return false;
         
}

})



$("#tixian_btn").click(function(){
    $("#tixian_jiner").blur();
    if($("#tixian_jiner").val()==""){
        alert("提现金额不能为空！");
    }else{
        $("#tixian_form").submit();  
    }
})
</script>