<div class="headbar">
	<div class="position"><span>会员</span><span>></span><span>会员管理</span><span>></span><span>会员列表</span></div>

	<div class="operating">
		<div class="search f_r">
			<form name="searchuser" action="{url:/}" method="get">
				<input type='hidden' name='controller' value='member' />
				<input type='hidden' name='action' value='member_list' />
				<select class="auto" name="search">
					<option value="u.username">用户名</option>
					<option value="m.true_name">姓名</option>
					<option value="m.mobile">手机</option>
					<option value="m.email">Email</option>
				</select>
				<input class="small" name="keywords" type="text" value="{$keywords}" />
				<button class="btn" type="submit"><span class="sch">搜 索</span></button>
			</form>
		</div>

		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="window.location='{url:/member/member_edit}'"><span class="addition">添加会员</span></button></a>
		<a href="javascript:void(0);" onclick="selectAll('check[]')"><button class="operating_btn" type="button"><span class="sel_all">全选</span></button></a>
		<a href="javascript:void(0);" onclick="delModel({form:'member_list',msg:'确定要删除所选中的会员吗？<br />删除的会员可以从回收站找回。'})"><button class="operating_btn" type="button"><span class="delete">批量删除</span></button></a>
		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="window.location='{url:/member/recycling}'"><span class="recycle">回收站</span></button></a>
		<a href="javascript:void(0);" onclick="balance_add()"><button class="operating_btn" type="button"><span class="recharge">预付款管理</span></button></a>
	</div>
</div>

<form action="{url:/member/member_reclaim}" method="post" name="member_list" onsubmit="return checkboxCheck('check[]','尚未选中任何记录！')">
	<div class="content">
		<table id="list_table" class="list_table">
			<colgroup>
				<col width="30px" />
				<col width="120px" />
				<col width="80px" />
				<col width="80px" />
				<!-- <!-- add by Scott Chen on 2017-11-03  -->
				<col width="70px" />
				<col width="140px" />

				<col width="50px" />
				<!--<col width="140px"/>-->
				<col width="80px" />
				<col width="70px" />
				<col width="50px" />
				<col width="125px" />
				<col width="120px" />
				<col width="120px" />
			</colgroup>

			<thead>
				<tr>
					<th>选择</th>
					<th>用户名</th>
					<th>会员等级</th>
					<th>姓名</th>
					<!-- <!-- add by Scott Chen on 2017-11-03  -->
					<th>证件类型</th>
					<th>证件号码</th>

					<th>性别</th>
					<!--<th>Email</th>-->
					<th>余额</th>
					<th>积分</th>
					<th>状态</th>
					<th>注册日期</th>
					<th>手机</th>
					<th>操作</th>
				</tr>
			</thead>

			<tbody>
				{set:$page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;}
				{query: name=user as u join=left join member as m on m.user_id eq u.id fields=m.*,u.username where=m.status neq 2 and $where order=m.user_id desc page=$page}
				<tr>
					<td><input name="check[]" type="checkbox" value="{$item['user_id']}" /></td>
					<td title="{echo:htmlspecialchars($item['username'])}">{$item['username']}</td>
					<td title="{$group[$item['group_id']]}">{$group[$item['group_id']]}</td>
					<td title="{echo:htmlspecialchars($item['true_name'])}">{$item['true_name']}</td>

					<!-- <!-- add by Scott Chen on 2017-11-03  -->
					<td>{if:$item['id_type']=='1'}身份证{elseif:$item['id_type']==null || empty($item['id_type'])}-{else:}其它{/if}</td>
					<td title="{echo:htmlspecialchars($item['id_code'])}">{$item['id_code']}</td>
					<td>{if:$item['sex']=='1'}男{else:}女{/if}</td>
					<!--<td title="{echo:htmlspecialchars($item['email'])}">{$item['email']}</td>-->
					<td title="{$item['balance']}">{$item['balance']}</td>
					<td title="{$item['point']}">{$item['point']}</td>
					<td title="{echo:Common::userStatusText($item['status'])}">{echo:Common::userStatusText($item['status'])}</td>
					<td title="{$item['time']}">{$item['time']}</td>
					<td title="{echo:htmlspecialchars($item['mobile'])}">{$item['mobile']}</td>
					<td>
						<a href="{url:/member/member_edit/uid/$item[user_id]}"><img class="operator" src="{skin:images/admin/icon_edit.gif}" alt="修改" /></a>
						<a href="javascript:void(0)" onclick="delModel({link:'{url:/member/member_reclaim/check/$item[user_id]}'})"><img class="operator" src="{skin:images/admin/icon_del.gif}" alt="删除" /></a>
					</td>
				</tr>
				{/query}
			</tbody>
		</table>
	</div>
	{$query->getPageBar()}
</form>

<script language="javascript">
//预加载
$(function(){
	var formObj = new Form('searchuser');
	formObj.init({'search':'{$search}'});
})

//预付款管理入口
function balance_add()
{
	if(!checkboxCheck('check[]','请选择要进行预付款操作的用户！'))
	{
		return;
	}

	art.dialog.open("{url:/member/member_balance}",{
	    title: '预付款管理',
	    ok:function(iframeWin, topWin)
	    {
	    	var formObject = iframeWin.document.forms['balanceForm'];
	    	if(formObject.onsubmit() == false)
	    	{
	    		return false;
	    	}

	    	//进行post提交
	    	var postData = $('[name="member_list"]').serialize()+'&'+$(formObject).serialize();
	    	$.post('{url:/member/member_recharge}',postData,function(json){
	    		if(json.flag == 'success')
	    		{
	    			tips('操作成功');
	    			window.location.reload();
	    			return false;
	    		}
	    		else
	    		{
	    			alert(json.message);
	    			return false;
	    		}
	    	},'json');
	    	return false;
		}
	});
}
</script>
