{extend name="base"}

{block name="content"}
<div class="row">
	<div class="col-sm-12">
		<div class="card-box">
			<div class="row">
				<div class="col-sm-12">
					<a href="{:url('apply')}" class="btn btn-purple waves-effect waves-light">申请提现</a>
				</div>
			</div>
			<!-- end row -->
			<div class="row">
				<table class="table table-striped m-0">
					<thead>
						<tr>
							<th>ID</th>
							<th>发起提现时间</th>
							<th>提现金额</th>
							<th>手续费</th>
							<th>实际到账</th>
							<th>结算状态</th>
							<th>结算时间</th>
						</tr>
					</thead>
					<tbody>
						{foreach $cashs as $v}
						<tr>
							<td>{$v.id}</td>
							<td>{$v.create_at|date="Y-m-d H:i:s",###}</td>
							<td>{$v.money}</td>
							<td>{$v.fee}</td>
							<td>{$v.actual_money}</td>
							<td>
								{switch name="v.status"}
								{case value="0"}审核中{/case}
								{case value="1"}提现成功{/case}
								{case value="2"}审核未通过{/case}
								{/switch}
							</td>
							<td>{if $v.status==1}{$v.complete_at|date="Y-m-d H:i:s",###}{/if}</td>
						</tr>
						{/foreach}
					</tbody>
				</table>
			</div>
			<!-- end row -->
		</div>
		{$page}
	</div>
</div>
{/block}

{block name="appendJS"}

<script>
	function change_status(obj,id)
	{
		var status=$(obj).prop('checked');
		if(status){
			status=1;
		}else{
			status=0;
		}
		$.post('/merchant/goods/changeStatus',{
			id:id,
			status:status
		},function(res){
			if(res.code!=0){
				alert(res.msg);
			}
		});
	}

	function del(obj,id)
	{
		swal({
			title: "确定删除吗？",
			text: "你将无法恢复该操作！",
			type: "warning",
			showCancelButton: true,
			confirmButtonColor: "#DD6B55",
			confirmButtonText: "确定删除！",
			closeOnConfirm: false
		},
		function(){
			$.post('/merchant/goods/del',{
				id:id
			},function(res){
				if(res.code!=0){
					swal('删除失败', res.msg, "error");
				}else{
					swal('删除成功', '', "success");
					setTimeout(function(){
						location.reload();
					},200);
				}
			});
		});
	}
</script>

{/block}
