<!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">
	</head>
	<body>
		<form name="form2" method="get" action="member_operations.php">
			<table cellpadding="1" cellspacing="1" align="center" class="table maintable my-3">
				<tr bgcolor="#f5f5f5">
					<td>
						<input type="text" name="buyid" id="buyid" placeholder="请输入订单号" class="admin-input-lg mr-3">
						<button type="submit" class="btn btn-success btn-sm">搜索</button>
						<button type="button" onclick="location='member_operations.php?sta=0';" class="btn btn-success btn-sm">未付款</button>
						<button type="button" onclick="location='member_operations.php?sta=1';" class="btn btn-success btn-sm">已付款</button>
						<button type="button" onclick="location='member_operations.php?sta=2';" class="btn btn-success btn-sm">已完成</button>
						<button type="button" onclick="location='member_operations.php';" class="btn btn-success btn-sm">全部</button>
					</td>
				</tr>
			</table>
		</form>
		<form name="form1">
			<table cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3">
				<tr>
					<td bgcolor="#f5f5f5" colspan="8">会员消费记录</td>
				</tr>
				<tr bgcolor="#e9ecef" align="center">
					<td width="6%">选择</td>
					<td width="16%">订单号</td>
					<td>产品名称</td>
					<td width="10%">产品类型</td>
					<td width="16%">生成日期</td>
					<td width="6%">金额</td>
					<td width="6%">状态</td>
					<td width="10%">会员</td>
				</tr>
				{dede:datalist empty='<tr><td colspan="8" align="center">暂无文档</td></tr>'}
				<tr align="center">
					<td><input type="checkbox" name="aids" value="<?php echo $fields['aid']?>"></td>
					<td><?php echo $fields['buyid']?></td>
					<td><?php echo $fields['pname'].'（'.$fields['oldinfo'].'）';?></td>
					<td><?php echo GetPType($fields['product'])?></td>
					<td><?php echo GetDateTimeMk($fields['mtime'])?>（{dede:field.mtime function="floorTime(time()-@me,@me)"/}）</td>
					<td><?php echo $fields['money']?></td>
					<td><?php echo GetSta($fields['sta'])?></td>
					<td><?php echo GetMemberID($fields['mid'])?></td>
				</tr>
				{/dede:datalist}
				<tr>
					<td colspan="8">
						<button type="button" onclick="ReSel();" class="btn btn-success btn-sm">反选</button>
						<button type="button" onclick="UpSel();" class="btn btn-success btn-sm">设为已付款</button>
						<button type="button" onclick="OkSel();" class="btn btn-success btn-sm">设为已完成</button>
						<button type="button" onclick="DelSel();" class="btn btn-danger btn-sm">删除</button>
					</td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="8" align="center">{dede:pagelist listitem='info,index,end,pre,next,pageno' listsize='6'/}</td>
				</tr>
			</table>
		</form>
		<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 = "member_do.php?dopost=deoperations&nid=" + nid;
			}
			function UpSel() {
				var nid = getCheckboxItem();
				if (nid == "") {
					alert("请选择要修改消费记录");
					return;
				}
				location.href = "member_do.php?dopost=upoperations&nid=" + nid;
			}
			function OkSel() {
				var nid = getCheckboxItem();
				if (nid == "") {
					alert("请选择要修改消费记录");
					return;
				}
				location.href = "member_do.php?dopost=okoperations&nid=" + nid;
			}
		</script>
	</body>
</html>