<?php
if (!defined('ROOT'))
	exit ;
$uid=session("user_auth.id");
$userconfig=userconfig_get($uid);
//可提现金额
$time=strtotime("-".C('MONEY_JIESUANZHOUQI')." day");
$time=mktime(23,59,59,date('m',$time),date('d',$time),date('Y',$time));
$shouru_ktx=M('money')->where(array('uid'=>$uid,'ctime'=>array('elt',$time)))->sum('price');
?>
<!DOCTYPE html>
<html>

	<head>
		<title>提现明细</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
		include 'Inc_files.php';
		?>
	</head>

	<body data-type="index">
		<script src="<?php echo C('TMPL_PARSE_STRING.__TPL__'); ?>/assets/js/theme.js"></script>
		<div class="am-g tpl-g">
			<?php include 'Inc_head.php'?>
			<!-- 侧边导航栏 -->
			<?php
				include 'Inc_left.php';
			?>

			<!-- 内容区域 -->
			<div class="tpl-content-wrapper">
				<div class="row-content am-cf">
					<div class="row">
						<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
							<div class="widget am-cf">
								<div class="widget-head am-cf">
									<div class="widget-title  am-cf">
										提现明细
									</div>

								</div>
								<div class="widget-body  am-fr">
									<form class="form-horizontal" method="get" role="form" action="/v/lists">
										<input type="hidden" name="model_id" value="33" />
										<input type="hidden" name="uid" value="<?php echo session('user_auth.id');?>" />
										<div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
											<div class="am-form-group">
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<button  <?php if($shouru_ktx<C('CASH_MIN')){echo 'disabled="disabled"';}?> type="button" class="am-btn am-btn-default am-btn-success btn_tixian">
														<span class="am-icon-plus"></span> <?php if($shouru_ktx<C('CASH_MIN')){echo C('CASH_MIN').'元起提';}else{echo '提现';}?>
														</button>
													</div>
												</div>
											</div>
										</div>
										<div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
											<div class="am-form-group tpl-table-list-select">
												<select name="status" data-am-selected="{btnSize: 'sm'}" placeholder="状态">
													<option value="">状态</option>
													<?php
													$status=get_field_attr(33,'status');
													foreach ($status as $k => $v) {
														echo '<option value="'.$v[0].'">'.$v[1].'</option>';
													}
													?>
												</select>
											</div>
										</div>
										<div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
											<div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
												<input type="text" name="no" value="<?php echo I('no','');?>" class="am-form-field" placeholder="订单号">
												<span class="am-input-group-btn">
												<button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="submit"></button> </span>
											</div>
										</div>
									</form>
									<div class="am-u-sm-12">
										<table width="100%" class="am-table am-table-compact tpl-table-black am-table-hover" >
											<thead>
												<tr>
													<th>订单号</th>
													<th>姓名</th>
													<th>提现金额</th>
													<th>提现状态</th>
													<th>收款方式</th>
													<th>提交时间</th>
													<th>支付时间</th>
													<th>备注</th>
												</tr>
											</thead>
											<tbody>
												<?php foreach($list as $k=>$v){?>
												<tr>
													<td><?php echo $v['no'];?></td>
													<td><?php echo $v['truename'];?></td>
													<td><?php echo $v['amount'];?></td>
													<td><?php echo get_status($v['status'], 'status', 33);?></td>
													<td>
														<?php 
															$pay_way=get_status($v['pay_way'], 'pay_way', 33);
															switch ($pay_way) {
																case 'alipay':
																	echo '支付宝';
																	break;
																case 'wxpay':
																	echo '微信';
																	break;
																case 'qqpay':
																	echo 'QQ钱包';
																	break;
																default:
																	echo '其他';
																	break;
															}
														?>
													</td>
													<td><?php echo date('Y-m-d H:i:s',$v['ctime']);?></td>
													<td><?php echo wd_date('Y-m-d H:i:s',$v['pay_time']);?></td>
													<td><?php echo $v['about'];?></td>
												</tr>
												<?php }?>
											</tbody>
										</table>
									</div>
									<div class="am-u-lg-12 am-cf">

										<div class="am-fr">
											<div class="am-pagination tpl-pagination">
												<?php echo $page;?>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="am-modal am-modal-prompt" tabindex="-1" id="tixian">
			<div class="am-modal-dialog">
		    	<div class="am-modal-hd">输入提现金额</div>
		   		<div class="am-modal-bd">
		   			最低<?php echo C('CASH_MIN');?>元起提
		    		<input type="number" id="case_amount" min="<?php echo C('CASH_MIN');?>" max="<?php echo $shouru_ktx;?>" value="<?php echo $shouru_ktx;?>" class="am-modal-prompt-input">
		    	</div>
		    	<div class="am-modal-footer">
			    	<span class="am-modal-btn" data-am-modal-cancel>取消</span>
			    	<span class="am-modal-btn" data-am-modal-confirm>提交</span>
		    	</div>
			</div>
		</div>
		<?php
		include 'Inc_files_boot.php';
		?>
		<script type="text/javascript">
		jQuery(document).on('click','.btn_tixian',function () {
			var the=jQuery(this);
			$('#tixian').modal({
		    	relatedTarget: this,
		    	onconfirm: function(e) {
		    		jQuery.ajax({
		    			url:"/cash/add",
		    		    data:{
		    		    	amount:e.data,
		    		    },
		    		    dataType: "json",
		    		    type: "post",
		    		    timeout: 10000,
		    		    success: function(data) {
		    		    	if (data.status==1) {
		    		    		location.href='/v/lists/model_id/33/uid/<?php echo session('user_auth.id')?>';
		    		    	}else{
		    		    		wd_alert({
			    		    		msg:data.info,
			    		    		background:"#f00",
			    		    		timeout:3000
			    		    	});
		    		    	}
		    		    	
		    		    },
		    		    error: function() {
		    		        mui.toast("网络连接超时");
		    		    }
		    		});
		    	},
		    	onCancel: function(e) {
		    	}
		    });         
		})
		</script>
	</body>

</html>