<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>点卡业务管理</title>
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
		<script>
			//获得选中项
			function getCheckboxItem() {
				var allSel = "";
				if (document.form1.aids.value) return document.form1.aids.value;
				for (i = 0; i < document.form1.aids.length; i++) {
					if (document.form1.aids[i].checked) {
						if (allSel == "")
							allSel = document.form1.aids[i].value;
						else
							allSel = allSel + "`" + document.form1.aids[i].value;
					}
				}
				return allSel;
			}
			function ReSel() {
				for (i = 0; i < document.form1.aids.length; i++) {
					if (document.form1.aids[i].checked) document.form1.aids[i].checked = false;
					else document.form1.aids[i].checked = true;
				}
			}
			function DelSel() {
				var nid = getCheckboxItem();
				if (nid == "") {
					alert("请选择要删除的卡");
					return;
				}
				 location.href = "cards_manage.php?dopost=delete&aids=" + nid;
			}
		</script>
	</head>
	<body>
		<table cellpadding="1" cellspacing="1" align="center" class="table maintable my-3">
			<tr>
				<td bgcolor="#f5f5f5" colspan="7">
					<table width="98%" cellspacing="0" cellpadding="0" class="table table-borderless w-100">
						<tr>
							<td width="30%">点卡业务管理</td>
							<td width="70%" align="right">
								<button type="button" onClick="location='cards_manage.php?isexp=0';" class="btn btn-success btn-sm">未使用</button>
								<button type="button" onClick="location='cards_manage.php?isexp=1';" class="btn btn-success btn-sm">已售出</button>
								<button type="button" onClick="location='cards_manage.php?isexp=-1';" class="btn btn-success btn-sm">已使用</button>
								<button type="button" onClick="location='cards_manage.php';" class="btn btn-success btn-sm">全部</button>
								<button type="button" onClick="location='cards_make.php';" class="btn btn-success btn-sm">生成点卡</button>
								<button type="button" onClick="location='cards_type.php';" class="btn btn-success btn-sm">点卡产品分类</button>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr bgcolor="#e9ecef" align="center">
				<td width="6%">选择</td>
				<td width="28%">卡号</td>
				<td width="18%">点卡类型</td>
				<td width="12%">生成日期</td>
				<td width="12%">使用日期</td>
				<td width="6%">状态</td>
				<td>使用会员</td>
			</tr>
			<form name="form1">
				{dede:datalist empty='<tr><td colspan="7" align="center">暂无文档</td></tr>'}
				<tr align="center">
					<td><input type="checkbox" name="aids" value="{dede:field.aid/}"></td>
					<td>{dede:field.cardid/}</td>
					<td><?php echo $TypeNames[$fields['ctid']]?></td>
					<td>{dede:field.mtime function='GetDateMk(@me)'/}</td>
					<td>{dede:field.utime function='GetUseDate(@me)'/}</td>
					<td>{dede:field.isexp function='GetSta(@me)'/}</td>
					<td>{dede:field.uid function='GetMemberID(@me)'/}</td>
				</tr>
				{/dede:datalist}
			</form>
			<tr>
				<td colspan="7">
					<button type="button" onClick="ReSel();" class="btn btn-success btn-sm">反选</button>
					<button type="button" onClick="DelSel();" class="btn btn-danger btn-sm">删除</button>
				</td>
			</tr>
			<tr>
				<td colspan="7" bgcolor="#f5f5f5" align="center">{dede:pagelist listitem='info,index,end,pre,next,pageno' listsize='6'/}</td>
			</tr>
		</table>
	</body>
</html>