<extend name="Public:base" />

<block name="content">
	
<div class="page-header">
	
</div>		
	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="name" type="text" placeholder="输入用户名" value="{:I('name')}" /></th>
		<th><input name="tel" type="text" placeholder="输入手机号码" value="{:I('tel')}" /></th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Member/commissapply')}">查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>		 									
						<th>用户名</th>
						<th>手机号码</th>  
						<th>上级</th>
						<th>状态</th>
						<th>提现金额</th>
						<th>转账银行</th>
						<th>卡号</th>
						<th>持卡人姓名</th>
						<th>申请时间</th>
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="m" empty="$empty">
						<tr>							
							<td>{$m.uname}</td>
							<td>{$m.telephone}</td>
							<td>
								<?php if($m['share_id'] == 0){ ?>
									平台推荐
								<?php }else { ?>
									<?php $member_info = M('member')->field('name')->where( array('member_id' => $m['share_id']) )->find(); ?>
									<span class="blue"><?php echo $member_info['name']; ?></span>
								<?php } ?>
							</td>
							<td>
								<?php if($m['state'] ==0){ ?>
								<span class="red">提现中</span>
								<?php }else if($m['state'] == 1){ ?>
								<span class="blue">已打款</span>
								<?php }else{ ?>
								<span class="green">已拒绝</span>
								<?php } ?>
							</td>
							<td><?php echo $m['money']; ?>元</td>
							<?php $member_commiss = M('member_commiss')->where( array('member_id' => $m['member_id']) )->find(); ?>
							<td><?php echo $member_commiss['bankname']; ?></td>
							<td><?php echo $member_commiss['bankaccount']; ?></td>
							<td><?php echo $member_commiss['bankusername']; ?></td>
							
							<td><?php echo empty($m['addtime'])?'无':date('Y-m-d H:i:s',$m['addtime']); ?></td>
							
							<td>
								<?php if($m['state'] ==0){ ?>
								<a  class="btn btn-xs btn-info btn-danger" href='{:U("Member/commissmoneyapply",array("id"=>$m["member_id"],"aid" => $m["id"],"state" => 2))}'>
									<i class="icon-eye-open bigger-120"></i>拒绝提现
								</a> 
								<a class="delete btn btn-xs btn-danger" href='{:U("Member/commissmoneyapply",array("id"=>$m["member_id"],"aid" => $m["id"], "state" => 1))}' >
									确认提现
								</a>
								<?php }else{ ?>
								-----
								<?php } ?>
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
<script>
$(function(){
	$("#export").click(function(){
		 var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.open(url);
	})
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
	
	
});		
</script>
</block>