{include "header.inc.html"}
{$linksLang = $lang.admin.links.form}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>提现申请</strong><br />
		<span class="english">Withdraw</span> </span> </div>
	</div>
<div class="tool">
{if $smarty.get.act=="list" || $smarty.get.act==""}
<a id="deleteChecked">删除所选</a>
{/if}
&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div class="none" id="dialogCardList">
<form class="form" action="" method="post" id="cardForm">
<input type="hidden" name="act" value="add" /><input type="hidden" name="inajax" value="1" />
<div class="form-line" style="padding:5px;line-height:1.5em;">卡号规则中使用*符号来代替递增数字，几个*即代表数字为几位，*号必需连续且只有一部分。<br/>开始序号对应卡号规则中的*，如*为四个，卡号规则设置为ABC10000****，开始序号可填写，0001，结束序号填写9999，那么将发卡号为ABC100000000至ABC100009999之间的9999个卡号。<br/>如序号中没有*则表示为单个添加</div>
<div class="form-line"><label class="label">卡号规则：</label><div class="element"><input type="text" class="text w200" name="number" value="CARD0000****" maxlength="32" /> 总位数不得超过32位</div></div>
<div class="form-line"><label class="label">开始序号：</label><div class="element"><input type="text" class="text w200" name="start" value="" maxlength="32" />变量中的开始数字</div></div>
<div class="form-line"><label class="label">结束序号：</label><div class="element"><input type="text" class="text w200" name="end" value="" maxlength="32" />变量中的结束数字，必需大于开始数字</div></div>
<div class="form-line"><label class="label">价值金额：</label><div class="element"><input type="text" class="text w80" name="amount" value="" maxlength="24" /> 元</div></div>

<div class="form-line"><label class="label"></label><div class="element"><input class="btn_sub" type="submit" value="{$lang.form.submit}"></div></div>
</form>

</div>
{if $smarty.get.act=="edit" || $smarty.get.act=="add"}
<div class="linksForm">

{else}
<table class="table-ca table_1" id="tInfo">
<tr>
<th class="w30"><input type="checkbox" value="1" name="allid" id="checkall" /></th><th>充值卡号码</th><th class="">充值卡密码</th><th class="w80">价值金额</th><th class="w80">是否可用</th><th class="w80">使用状态</th><th class="">使用用户</th><th class="w130">使用时间</th><th class="w130">使用IP</th><th class="w120">添加时间</th><th class="w40">{$lang.form.operate}</th>
</tr>
{prepaidcard limit=15}
<tr><td><input type="checkbox" name="id[]" value="{$item.id}" /></td><td>{$item.number}</td><td>{$item.password}</td>
<td><img class="smodtoggle" name="iStatus" sid="{$item.id}" src="{$baseUrl}static/images/{if $item.iStatus==1}yes{else}no{/if}.gif"></td>
<td>{$item.amount}</td>
<td>{if $item.userId || $item.useoftime}已使用{else}未使用{/if}</td>
<td{if $item.userId} class="J-user-anchor"{/if} sid="{$item.userId}">{if $item.userId}{$item.userId}{/if}</td><td>{if $item.useoftime}{$item.useoftime|date_format:'Y-m-d H:i:s'}{/if}</td><td>{$item.ip}</td><td>{$item.posttime|date_format:"Y-m-d H:i:s"}</td><td><a href="javascript:void(0)" class="delBtn">{$lang.del}</a></td></tr>
{/prepaidcard}
</table>
<div class="page"><div class="pagin fr">{pager allCount=$allCount url='/qkadmin/links/page' number="false"}</div></div>

<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}prepaidcard",
					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 tr = $(this).parent("td").parent("tr");
			var id = tr.find("td").eq(1).text();
			if(parseInt(id,10)){
				var sdata = "inajax=1&act=del&id="+id;
				$.ajax({
					type:"POST",
					url:"{$adminUrl}prepaidcard",
					data:sdata,
					dataType:"json",
					success:function(data){
						if(data.success){
							tr.fadeOut("slow").remove();
						}else{
							alert(data.message);
						}
					}
				});
			}
		return false;
	});
	$("#addCardList").click(function(){
		var dialogCardList = $('#dialogCardList').dialog({ width:600,height:300,modal:true,resizable:false,title:'批量添加充值卡' });
	});
	//$("#addCardList").trigger('click');
	$('#cardForm').ajaxForm({ dataType:'json',success:function(json){ if(json.success){ qlib.tips({ icon:'success',msg:json.message });$('#dialogCardList').dialog('destroy');location.reload(); }else{ qlib.tips({ icon:'error',msg:json.message }); } } });
})
</script>

{/if}

{include "footer.inc.html"}