<!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" />
<link href="../../images/admin/public.css" rel="stylesheet" type="text/css" />
<link href="../../images/admin/style.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->basedir;?>js/datepicker.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->basedir;?>js/jquery.js" language="javascript"></script>
<script src="<?php echo $this->basedir;?>js/ui.datepicker.js"></script>
<script language="javascript">
$(document).ready(function() {
     $("#ta tr").mouseover(function(){
      $(this).addClass("over");
     });
     $("#ta tr").mouseout(function(){
      $(this).removeClass("over");
     });
	 $("#ta tr:even").addClass("double");
	 $('#mostrar').click(function(){$('#sh').toggle();});
	 /*全选*/
	 $("#checkall").click(function() {
	 	$("input[@name='id[]']").each(function() {
			$(this).attr("checked", $('#checkall').attr('checked'));
		});
	});
	 $("#all").click(function() {
	 	$("input[@name='id[]']").each(function() {
			$(this).attr("checked", $('#all').attr('checked'));
		});
	});
    $('#stime').datepicker();
	$('#etime').datepicker()
});
</script>
<script language="javascript">
function checkSubmit(){
	var obj = document.form1;
	if (obj.keyword.value == ''){
		alert('请填写搜索关键词!')
		obj.keyword.focus();
		return false;
	}
	document.getElementById('btn').disabled=true;
	return true;
}
</script>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr align="center" valign="top">
    <td width="*" align="center" valign="top">
	<!-- ######### begin ######### -->
      <div class="Block">
        <div class="BlockBar">定单查找</div>
        <table cellspacing="1" cellpadding="4" class="tab">
		<form id="form1" name="form1" method="post" action="" onsubmit="return checkSubmit();">
			   <tr class="row">
			     <td width="14%" class="align-right">权限组：</td>
			     <td><select name="usergroup" id="usergroup">
			       <option value="all">全部</option>
				   <?php echo $this->usergroup;?>
			       </select>			     </td>
	        </tr>
			   <tr class="row">
			     <td class="align-right">消费类型：</td>
			     <td><select name="usertype" id="usertype">
			       <option value="all">全部</option>
			       <option value="1" <?php if($_REQUEST['usertype'] == 1) echo 'selected';?>>包月</option>
			       <option value="0" <?php if(is_numeric($_REQUEST['usertype']) && $_REQUEST['usertype']==0) echo 'selected';?>>计点</option>
			       </select>			     </td>
	        </tr>
			   <tr class="row">
			     <td class="align-right">定单时间：</td>
			     <td><input name="stime" type="text" class="time" id="stime" value="<?php echo $_REQUEST['stime'];?>" />
			       至
		           <input name="etime" type="text" class="time" id="etime" value="<?php echo $_REQUEST['etime'];?>" /></td>
	        </tr>
			   <tr class="row">
			     <td class="align-right">订单状态：</td>
			     <td><select name="state" id="state">
				   <option value="all">全部</option>
			       <option value="1" <?php if($_REQUEST['state'] == 1) echo 'selected';?>>已审核</option>
			       <option value="0" <?php if($_REQUEST['state'] == 0) echo 'selected';?>>未成功</option>
			       </select>
			     </td>
	        </tr>
			   <tr class="row">
			     <td class="align-right">关键词：</td>
			     <td><label>
			       <input name="keyword" type="text" id="keyword" value="<?php echo urldecode($_REQUEST['keyword']);?>" />
			       <input name="type" type="radio" class="radio" value="username" checked="checked" />
			       用户名
			       <input name="type" type="radio" class="radio" value="payvia" />
			       支付方式
			       <input name="type" type="radio" class="radio" value="orderno" />
			       订单号
			       <input name="type" type="radio" class="radio" value="userip" />
			       用户IP(不匹配任何关键词请填写“*”)</label></td>
	        </tr>
			   <tr class="row">
			     <td class="align-right">&nbsp;</td>
			     <td><input name="提交" type="submit" class="btn" id="btn" value=" 搜 索 " />&nbsp;<input type="button" class="btn" value=" 返回上一页 " onclick="history.back()" /></td>
	        </tr>
        </form>
        </table>
		<?php
		if ($this->search){?>
        <div class="BlockBar">搜索定单结果</div>
        <form id="form2" name="form2" method="post" action="<?php echo $this->installdir;?>case/delete/">
          <table cellspacing="1" cellpadding="4" class="tab">
            <tr class="sub">
              <td width="15%" class="align-center">定单编号</td>
              <td width="11%" class="align-center">购买人</td>
              <td width="13%" class="align-center">购买服务</td>
              <td width="17%" class="align-center">时间</td>
              <td width="7%" class="align-center">金额</td>
              <td width="13%" class="align-center">支付方式</td>
              <td width="9%" class="align-center">状态</td>
              <td width="15%" class="align-center">管理</td>
            </tr>
			<tbody id="ta">
			<?php
			if (count($this->search)>0){
			foreach($this->search as $row){?>
            <tr class="row align-center">
              <td ><?php echo $row['orderno'];?></td>
              <td><a href="<?php echo $this->installdir;?>user/modify/username/<?php echo $row['username'];?>/"><?php echo $row['username'];?></a></td>
              <td><?php echo $row['groupname'];?>会员<?php echo $row['point'];?><?php echo $row['usertype'] ? '天' : '点';?></td>
              <td><?php echo date('Y-m-d H:i:s', $row['addtime']);?></td>
              <td><?php echo $row['price'];?>元</td>
              <td><?php echo $row['payvia'];?></td>
              <td><?php echo $row['state'] ? '已成功': '未成功';?></td>
              <td><input name="id[]" type="checkbox" value="<?php echo $row['id'];?>" class="checkbox" />
              <a href="<?php echo $this->installdir;?>case/delete/id/<?php echo $row['id'];?>/" onclick="return confirm('确认删除吗?')">删除</a>&nbsp;<?php
			  if ($row['state']==0){?><a href="<?php echo $this->installdir;?>case/state/id/<?php echo $row['id'];?>/" onclick="return confirm('确认审核吗?审核后将开通用户购买的服务')">审核订单</a><?php }?></td>
            </tr>
			<?php }
			}else{echo '<tr><td colspan="6"></td></tr>';}?>
			</tbody>
          </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><?php echo $this->printpage;?>
             <div class="form-handle"><input name="all" type="checkbox" class="checkbox" id="all" value="checkbox" />全选 <input name="Submit" type="submit" value=" 删 除 " class="button" /> 
             </div></td>
          </tr>
        </table>
        </form>
		<?php
		}?>
      </div>
    </td>
  </tr>
</table>
<?php
echo $this->render('copyright');
?>
</body>
</html>

