<?php include $this->admin_tpl('meta', 'admin');?>
<title>订单管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 订单管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <div> 
    <form action="<?php echo U('order_search');?>" method="get" id="search">
	 <input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
	 <input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
	 <input type="hidden" value="search" name="a">
     下单时间：<input type="text" class="input-text laydate-icon" style="width:170px;height:30px;" id="start" name="start" <?php if(isset($_GET['start']) && $_GET['start'] != '') echo 'value="'.$_GET['start'].'"'; ?>>
     至 <input type="text" class="input-text laydate-icon" style="width:170px;height:30px;" id="end" name="end" value="<?php if(isset($_GET['end']) &&  $_GET['end'] != '') echo $_GET['end']; else echo date('Y-m-d H:i:s'); ?>">
     <span class="select-box inline">
		<select name="status" class="select">
		<option <?php if(isset($_GET['status']) && $_GET['status']=='99'){?> selected <?php }?> value="99">全部</option>
		<option <?php if(isset($_GET['status']) && $_GET['status']=='0'){?> selected <?php }?> value="0">未付款</option>
		<option <?php if(isset($_GET['status']) && $_GET['status']=='1'){?> selected <?php }?> value="1">已付款</option>	
		</select>
	  </span>
       <span class="select-box inline">
  		<select name="t_type" class="select">
  		<option value="0">充值类型</option>
  		<option <?php if(isset($_GET['t_type']) && $_GET['t_type']=='1'){?> selected <?php }?> value="1">积分</option>
  		<option <?php if(isset($_GET['t_type']) && $_GET['t_type']=='2'){?> selected <?php }?> value="2">金钱</option>	
  		</select>
  	  </span>
     <span class="select-box inline">
		<select name="type" class="select">
		<option <?php if(isset($_GET['type']) && $_GET['type']=='1'){?> selected <?php }?> value="1">用户名</option>
		<option <?php if(isset($_GET['type']) && $_GET['type']=='2'){?> selected <?php }?> value="2">订单号</option>	
		</select>
	  </span>
      <input type="text" name="searinfo" class="input-text" style="width:170px" value="<?php if(isset($_GET['searinfo'])) echo $_GET['searinfo'];?>"><button name="dosubmit" class="btn btn-success" type="submit" value="1"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	 </form>	
  </div>
  <div class="cl pd-10 bg-1 bk-gray mt-20"> 
  	总计 <span class="c-red"><?php echo $total?></span> 笔交易(金钱：<?php echo $money_total;?>笔，积分：<?php echo $point_total;?>笔)，金钱总金额：<span class="c-red"><?php echo floatval($money_sum);?></span> 元 ,成功交易：<span class="c-green"><?php echo floatval($money_success);?></span> 元 ，积分总点数：<span class="c-red"><?php echo intval($point_sum)?></span> 点 ,成功交易：<?php echo intval($point_success);?> 点
   </div>
  <form method="post" action="<?php echo U('pay_del');?>" id="myform">
  <table class="table table-border table-bordered table-bg table-hover yzm-table-sort">
    <thead>
      <tr class="text-c">
		<th>订单ID<?php echo field_order('id');?></th>
		<th>用户名<?php echo field_order('username');?></th>
		<th>订单号</th>
		<th>支付金额<?php echo field_order('money');?></th>
		<th>下单时间<?php echo field_order('addtime');?></th>
		<th>支付时间<?php echo field_order('paytime');?></th>
		<th>订单状态<?php echo field_order('status');?></th>
		<th>支付方式<?php echo field_order('paytype');?></th>
		<th>充值类型</th>
		<th>操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
			<td><?php echo $val['id']?></td>
			<td><?php echo $val['username'];?></td>
			<td><?php echo $val['order_sn']?></td>
			<td><?php echo $val['money']?>元</td>
			<td><?php echo date("Y-m-d H:i:s",$val['addtime']) ?></td>
			<td><?php echo $val['paytime'] ? date("Y-m-d H:i:s",$val['paytime']) : '<span class="c-red">未支付</span>' ?></td>
			<td><?php echo $this->order_status[$val['status']]?></td>
			<td><?php echo $this->paytype[$val['paytype']]?></td>
			<td><?php echo $val['type']==1 ? '积分' : '<span class="c-red">金钱</span>';?></td>
			<td><?php if($val['status'] == 0) { ?>
			<a href="javascript:;" onclick="yzm_open('订单改价', '<?php echo U('change_price', array('id'=>$val['id']));?>', 550, 350)">改价</a> 
			<?php }else{ ?>
			<a href="javascript:;" onclick="yzm_open('订单详情', '<?php echo U('order_details', array('id'=>$val['id']));?>', 550, 350)">详情</a> 
			<?php } ?>
			<a href="javascript:;" onclick="yzm_del('<?php echo U('del', array('id'=>$val['id']));?>')">删除</a></td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">
var start = {
	elem: '#start',
	format: 'YYYY-MM-DD hh:mm:ss',
	min: '1999-01-01', //设定最小日期
	max: '2099-01-01', //最大日期
	istime: true,
	istoday: false,
	choose: function(datas){
		 end.min = datas; //开始日选好后，重置结束日的最小日期
		 end.start = datas //将结束日的初始值设定为开始日
	}
};

var end = {
	elem: '#end',
	format: 'YYYY-MM-DD hh:mm:ss',
	min: '1999-01-01',
	max: '2099-01-01',
	istime: true,
	istoday: false,
	choose: function(datas){
		start.max = datas; //结束日选好后，充值开始日的最大日期
	}
};
laydate(start);
laydate(end);
</script>

</body>
</html>