<?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('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 value="99">状态</option>
			<option value="1" <?php if(isset($_GET['status']) && $_GET['status']=='1'){?> selected <?php }?>>正常</option>
			<option value="2" <?php if(isset($_GET['status']) && $_GET['status']=='2'){?> selected <?php }?>>锁定</option>
		</select>
	</span>
     <span class="select-box inline">
		<select name="groupid" class="select">
			<option value="0">会员组</option>
			<?php 
				foreach($member_group as $val){
					$str = $val['groupid']==$groupid ? 'selected' : '';
					echo '<option value="'.$val['groupid'].'" '.$str.'>'.$val['name'].'</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">用户ID</option>	
		<option <?php if(isset($_GET['type']) && $_GET['type']=='3'){?> selected <?php }?> value="3">邮箱</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-5 bg-1 bk-gray mt-20"> <span class="l">
  <a href="javascript:;" onclick="yzm_dels('ids')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> 
  <a href="javascript:;" onclick="yzm_open('添加用户','<?php echo U('add');?>','700','450')" class="btn btn-success radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a>
  <a href="javascript:;" onclick="lock()" class="btn btn-warning radius"><i class="Hui-iconfont">&#xe60e;</i> 锁定用户</a>
  <a href="javascript:;" onclick="unlock()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe605;</i> 解锁用户</a>
  </span> <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> </div>
  <form method="post" action="<?php echo U('del');?>" id="myform">
  <table class="table table-border table-bordered table-bg table-hover yzm-table-sort">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th>用户ID<?php echo field_order('userid');?></th>
		<th>用户名<?php echo field_order('username');?></th>
		<th>邮箱<?php echo field_order('email');?></th>
		<th>用户组<?php echo field_order('groupid');?></th>
		<th>最后登录时间<?php echo field_order('lastdate');?></th>
		<th>登录次数<?php echo field_order('loginnum');?></th>
		<th>账户余额<?php echo field_order('amount');?></th>
		<th>积分<?php echo field_order('point');?></th>
		<th width="100">操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['userid']?>" name="ids[]"></td>
			<td><?php echo $val['userid']?></td>
			<td><?php if($val['vip']) echo '<img src="'.STATIC_URL.'images/vip.gif" title="vip会员"> ';?><?php if($val['status'] == 2) echo '<img src="'.STATIC_URL.'images/icon_padlock.gif" title="用户已锁定"> '; echo '<a href="'.U('edit',array('userid'=>$val['userid'])).'" style="text-decoration:none"><img src="'.get_memberavatar($val['userid']).'" height="25" class="radius"> '.$val['username'];?></a> <?php if($val['status'] == 0) echo '<span style="color:#c7254e;text-shadow:1px 1px 3px rgba(0, 0, 0, 0.3);" title="待审核">「审」</span>'; ?></td>
			<td><?php echo $val['email_status'] ? $val['email'].' <span style="color:green;text-shadow:1px 1px 3px rgba(0, 0, 0, 0.3);" title="已验证">「验」</span>' : $val['email'];?></td>
			<td><?php echo get_groupname($val['groupid']);?></td>
			<td><?php echo $val['lastdate'] ? date("Y-m-d H:i:s",$val['lastdate']) : '从未登录';?></td>
			<td><?php echo $val['loginnum']?></td>
			<td><?php echo $val['amount']?></td>
			<td><?php echo $val['point']?></td>
			<td>
			<a title="修改资料" href="<?php echo U('edit',array('userid'=>$val['userid']));?>" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
			<a title="修改密码" href="javascript:;" onclick="yzm_open('修改密码','<?php echo U('password',array('userid'=>$val['userid']));?>',600,280)"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe63f;</i></a>
			<a title="预览主页" href="<?php echo U('member/myhome/init', array('userid'=>$val['userid']));?>" class="ml-5" target="_blank" style="text-decoration:none"><i class="Hui-iconfont">&#xe695;</i></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">

function lock(){
	if ($("input[name='ids[]']:checked").length<1){
	   layer.alert('请勾选信息！');
	   return false;
	}	
	document.getElementById('myform').action='<?php echo U('lock')?>';
	document.getElementById('myform').submit();
}

function unlock(){
	if ($("input[name='ids[]']:checked").length<1){
	   layer.alert('请勾选信息！');
	   return false;
	}	
	document.getElementById('myform').action='<?php echo U('unlock')?>';
	document.getElementById('myform').submit();
}


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>