{include "header.inc.html"}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.onlinepay.name}</strong><br />
		<span class="english">{$lang.admin.onlinepay.name_en}</span> </span> </div>
	</div>
	<div class="tool">
{if $smarty.get.act=="list" || $smarty.get.act==""}<a id="deleteChecked" class="ui-btn">删除所选</a>{/if}
		<form action="{$adminUrl}onlinepay/" method="get" class="form" style="width:600px;display:inline;">
		会员ID：<input type="text" name="userId" class="checkUserId w80" value="{$smarty.get.userId}" /> 关键字：<input type="text" name="key" value="{$smarty.get.key}" /><input type="submit" class="btn_sub" value="{$lang.form.search}" /> {if $smarty.get.userId}用户 {$smarty.get.userId} 当前余额：{useramount id=$smarty.get.userId}{/if}
		</form>
	</div>
{if $smarty.get.act=="edit" || $smarty.get.act=="add"}
 {else}
 <table class="table-ca table_1" id="tInfo">
 <tr>
<th class="w30"><input type="checkbox" value="1" name="allid" id="checkall" /></th><th class="w60">编号</th><th class="w200">交易号</th><th class="w100">用户</th><th class="w100">金额</th><th class="w100">支付方式</th><th class="w100">订单状态</th><th>流水号</th><th class="w150">提交时间</th><th class="w60">操作</th>
 </tr>
{onlinepay limit=15}
<tr sid="{$item.id}">
<td><input type="checkbox" name="id[]" value="{$item.id}" /></td><td>{$item.id}</td><td>{$item.outTradeNo}</td><td sid="{$item.userId}">{$item.userId}</td><td>{$item.amount}</td><td><div class="nowrap w90">{$item.paymentInfo.name}</div></td><td>{$item.status}</td><td>{$item.transactionId}</td><td>{$item.posttime|date_format:"Y-m-d H:i:s"}</td><td><a href="javascript:void(0)" class="delBtn" sid="{$item.id}">删除</a> {if $item.query===true}<a href="javascript:void(0)" class="query">查单</a>{/if}</td>
</tr>
{/onlinepay}
</table>
<div class="page">
	<div class="pagin fr">{pager allCount=$allCount url='/qkadmin/onlinepay/page/' number="false"}</div>
</div>
{/if}
<script type="text/javascript">
$(function(){
	$("a#deleteChecked").button().click(function(){
		if(!confirm(lang[4])){ return false; }		
		var id = [];
		$("input[name='id[]']:checkbox:checked").each(function(index){
			id[index] = $(this).val();
			var sid = $(this).val();
			if(sid){
				var tr = $(this).parent("td").parent("tr");
				var sdata = "inajax=1&act=del&id="+sid;
				$.ajax({
					type:"POST",
					url:"{$adminUrl}onlinepay",
					data:sdata,
					dataType:"json",
					success:function(data){
						if(data.success){
							tr.fadeOut("slow").remove();
						}else{
							alert(data.message);
						}
					}
				});			
			}
		});
	});
	$(".delBtn").click(function(){
		if(!confirm(lang[4])){ return false; }
		var id = $(this).attr("sid");
		var tr = $(this).parent("td").parent("tr");
		if(!id || !parseInt(id)){ return false; }
		$.ajax({ type:"POST",url:"{$adminUrl}onlinepay",data:"inajax=1&act=del&id="+id,dataType:"json",success:function(json){
				if(json.success){
					tr.slideUp().remove();
				}else{
					qlib.tips(json.message);
				}
			}
		})
	});
	$(".query").click(function(){
		var tr = $(this).parent("td").parent("tr");
		var id = tr.attr("sid");
		if(!id || !parseInt(id)){ return false; }
		$.ajax({ type:"POST",url:"{$adminUrl}onlinepay",data:"inajax=1&act=query&id="+id,dataType:"json",success:function(json){ 
				alert(json.message);
			}
		});
	});
});
</script>
{include "footer.inc.html"}