<?php
error_reporting(0); 
include("../../config/qiantai.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$username=$_SESSION['username'];
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$dailimoney=$user['money'];
$fgg="select sum(money) from pay where  userid='$userid'   and shijian='$day'";
if ($res=mysql_query($fgg)){
list($dailimoney1)=mysql_fetch_row($res);
mysql_free_result($res);
} 
$sql = mysql_query("SELECT* FROM  pay  where  userid='$userid'   and shijian='$day'");
$cs = mysql_num_rows($sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>申请提现</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="/2019newui/qiantai/css/x-admin.css" media="all">
<script type="text/javascript" src="/2019newui/js/jquery1.9.min.js"></script>
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
<dl class="apps-filter-tr">
<dt><span  class="xb">申请提现</span><span style="font-size:14px;color:#ff0000">(您当前账户余额为：<?php echo $user['money']?> 元)</span></dt>
</dl>
<span class="x-right" style="margin-top:-24px;line-height:10px"><a class="layui-btn-small" style="line-height:10px;margin-top:-2px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="fa fa-refresh"></i></a></span>
</blockquote>
<div class="layui-tab-content" >
<?php if($user['money']=='0'){?>
<blockquote class="layui-elem-quote layui-text">(您当前账户余额为：<?php echo $user['money']?> 元),暂不能提现操作，请推广营业后方可提现&nbsp;&nbsp;</blockquote>
<?php }else{?>
<?php if($user[skm]){?><blockquote class="layui-elem-quote layui-text" ><a class="layui-btn  open_if" id='tip'>修改收款信息</a></blockquote><?php }?>
<div class="layui-tab-item layui-show">
<form class="layui-form layui-form-pane" name="FormInfo" id="FormInfo">
<input type="hidden" name="lx"  value="tx">
<blockquote class="layui-elem-quote layui-text" >单笔最小提款金额：<span style="font-size:14px;color:#ff0000"><?php echo $js?> </span>元&nbsp;&nbsp;&nbsp;&nbsp;每天可提款总金额：<span style="font-size:14px;color:#ff0000"><?php echo $daymoney?> </span>元&nbsp;&nbsp;</blockquote>
<blockquote class="layui-elem-quote layui-text">今日已申请提款总金额：<span style="font-size:14px;color:#ff0000"><?php if($dailimoney1 == null){ ?>￥0<?php }else{  ?>￥<?php $xs4=round($dailimoney1,2);echo $xs4;?><?php } ?></span> 元&nbsp;&nbsp;每天可提现次数 <span style="font-size:14px;color:#ff0000"><?php echo $txcs?> </span>次 &nbsp;&nbsp;当前已经提款 <span style="font-size:14px;color:#ff0000"><?php echo $cs?> </span>次
</blockquote>
<div class="layui-form-item">
<label class="layui-form-label">可用余额</label>
<div class="layui-input-inline" style="width:88%;">
<input type="text" name="kyye" id="kyye" autocomplete="off" placeholder="<?php if($dailimoney == null){ ?>￥ 0<?php }else{  ?>￥<?php $xs4=round($dailimoney,2);echo $xs4;?><?php } ?>" value="<?php if($user['money'] == null){ ?>￥ 0<?php }else{  ?>￥<?php $xs4=round($user['money'],2);echo $xs4;?><?php } ?>" class="layui-input" disabled>
</div>
</div>
<?php if($dailimoney1>=$daymoney){?>
<?php }else{?>
<div class="layui-form-item">
<label class="layui-form-label">提现金额</label>
<div class="layui-input-inline" style="width:88%;">
<input type="text" name="money" id="money" placeholder="请输入提现金额" autocomplete="off" class="layui-input"  lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户密码</label>
<div class="layui-input-inline" style="width:88%;">
<input type="password" name="pass" id="paypassword" placeholder="请输入密码" autocomplete="off" class="layui-input" lay-verify="required">
</div>
<div class="layui-form-mid layui-word-aux"></div>
</div>
<?php }?>
<div class="layui-form-item">
<?php if($dailimoney1>=$daymoney){?>
<input type="submit" value="今日最大提款金额已超限"  class="layui-btn" name="b"  disabled style="width:100%;">
<?php }else{?>
<?php if($user[skm]){?><button class="layui-btn" lay-submit lay-filter="FormInfo" style="width:100%;">申请提现</button><?php }else{?><a class="layui-btn  open_if"   style="width:100%;">请先设置收款信息</a> <?php }?>
<?php }?>
</div>
</div>
</div>
</form>    
<?php }?>
<script src="/layui/layui.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,$= layui.jquery
,laydate = layui.laydate;
<?php if($user[skm]){?>
layer.tips('亲，点这里可以修改收款信息', '#tip', {
tips: [2, '#000'],
area: ['300px', 'auto'],
time: 4000
});
<?php }?>
<?php if($dailimoney1>=$daymoney){?>
<?php }else{?>
form.on('submit(FormInfo)', function (data) {
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type:'POST',
url : "/post<?php echo $dshz?>",
data:$("#FormInfo").serialize(),
dataType:'json',
success:function(result){
if(result.status == 'true'){
layer.closeAll('loading');
layer.open({
type: 1
,offset: 'auto'
,id: 'layerMsg'
,content: '<div style="padding: 20px 100px;">提现成功</div>'
,btn: '确定'
,btnAlign: 'c'
,shade: 0
,closeBtn: 0
,yes: function(index){
location.reload();
}
});
}else{
layer.closeAll('loading');
layer.msg(result.msg);
}
}	
});
return false;
});
<?php }?>
<?php if($user[skm]==null){?>
layer.open({
type: 2,
offset: '100px',
title: '请设置收款信息',
shadeClose: true,
area: ['500px', '530px'],
content: '/skm<?php echo $dshz?>'
});
<?php }?>
$(function() {
$('.open_if').on('click', function () {
layer.open({
type: 2,
offset: '100px',
title: '请设置收款信息',
shadeClose: true,
area: ['500px', '530px'],
content: '/skm<?php echo $dshz?>'
});
});
});
});
</script>
</html>