<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>订单管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">订单管理</a></li>	
		</ul>
	</div>
	<div class="main">
		<div class="search">
			<form action="?" method="get" name="search">
				<input type="hidden" name="file" value="<?php echo $file;?>"> 
				<input type="hidden" name="action" value="<?php echo $action;?>">
				<fieldset>
				<legend>搜索订单</legend>
				&nbsp;订单号：
				<input type="text" name="k" size="35" value="<?php echo $k?htmlspecialchars(stripslashes($k)):'';?>" />
				<input type="submit" class="button" value="开始查找" />
				</fieldset>
			</form>
		</div>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="6%" class="firstcol">反选</th>
			<th width="17%">订单号</th>
			<th width="16%">产品名称</th>
            <th width="12%">付款金额</th> 
			<th width="18%">下单时间</th>
            <th width="12%">买家</th>
			<th width="9%">状态</th>
			<th width="10%">管理</th>  
		</tr>
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<?php if($result){foreach($result as $val){?>
		<tr>
			<td align="center"><input type="checkbox" class="checkbox" name="id[]" value="<?php echo $val['id'];?>" /></td>
            <td align="center" style="padding-left:5px"><?php echo $val['orderid'];?></td>
            <td align="center"><a href="<?php echo $val['goodsurl'];?>" target="_blank"><?php echo $val['goodsname'];?></a></td>
			<td align="center"><?php echo $val['amount'];?> 元</td>
            <td align="center"><?php echo date('Y-m-d H:i:s',$val['time']);?></td>
			<td align="center"><?php echo $val['username'];?></td>
            <td align="center">
			<?php 
				if($val['status']==0)
				{
					echo '待付款<br /><a href="?file=order&action=cancel&id='.$val['id'].'"><font color="#FF3300">取消订单</font></a>';
				}
				elseif($val['status']==1)
				{
					echo '已付款<br /><a href="?file=order&action=deliver&id='.$val['id'].'"><font color="#FF3300">确认发货</font></a>';
				}
				elseif($val['status']==2)
				{
					echo '已发货';
				}
				elseif($val['status']==3)
				{
					echo '交易成功';
				}
				elseif($val['status']==4)
				{
					echo '交易关闭';
				}
			?>
			</td>
			<td align="center"><a href="?file=<?php echo $file;?>&action=view&id=<?php echo $val['id'];?>">查看</a>  <a href="javascript:confirmUrl('您确定要删除订单【<?php echo $val['orderid'];?>】吗？','?file=<?php echo $file;?>&action=delete&id=<?php echo $val['id'];?>')">删除</a></td>
		</tr>
		<tr>
			<td width="6%" align="center">
			<input type="checkbox" name="chkall2" value="1" class="checkbox" onclick="check_all(this)" /></td>
			<td colspan="7" align="left">
			<input type="button" onfocus="blur();" class="button" onclick="if(confirm('确实要删除所选订单?删除后不可恢复!')){this.form.action='?file=<?php echo $file;?>&action=delete';this.form.submit();}"  value="删除订单" />
			</td>
		</tr>
		<?php }?>
		</form>
		<?php }else{?>
		<tr><td colspan="8">尚未发现任何订单...</td></tr>	
		<?php }?>
		<tr>
			<td colspan="8"><?php echo $pages;?></td>
		</tr>
		</table>
	</div>
</div>
</body>
</html>