<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim NCheck:NCheck=true
%>
<!--#include file="cgi/Config.asp"-->
<%

Dim rs
Dim eStr:eStr=""
Dim act
act=request("act")

select case act
	case "del"
	u_id=request("u_id")
	if Session("master")  then
		if mobj.testreg(u_id,"^\d{1,10}$") then
		mobj.cexe "delete from b2c_admin where a_type=0 and  a_id="&u_id
		end if
	end if
end select



 listSql="select * from b2c_admin where a_type=0 "


%>

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>管理页面</title>
<meta http-equiv="Expires" Content="0"/>
<meta http-equiv="Cache-Control" Content="no-cache"/>
<meta http-equiv="Pragma" Content="no-cache"/>
<link href="/images/skin_1/style.css" type="text/css" rel="stylesheet"/>
<script language=javascript type="text/javascript" src="/calendar/calendar.js"></script>
<script language=javascript type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>

<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">  
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">  
<script type="text/javascript" src="easyui/jquery-1.7.2.min.js"></script>  
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script language="javascript" src="js/comm.js"></script>

<script language="javascript">
function cleardate(){
	  $("#qstime").val("");
	  $("#qetime").val("");
		
}

function adduser(){
	$( "#adduser" ).show();	
	$( "#adduser" ).dialog({
		border:false,
		noheader:false,
		modal:true,  
		title:"新增登录用户",
		onClose:function(){$( "#adduser" ).hide();},
		onOpen:function(){},
		shadow:false
	});	
	
}



function SureCHongzhi(){
	if($("#chongzhimoney").val()==""){alert("充值数量不能为空");return;}
	if($("#chongzhiType").val()=="2"){
		//alert($("#chongzhimoney").val());
		//return;
		if(parseInt($("#chongzhimoney").val())>(21-parseInt($("#u_fudaiHis").val()))){alert("该用户最多可以购买"+(21-parseInt($("#u_fudaiHis").val()))+"个福袋");return;}
	}
	$.getJSON("act.asp?act=houtaichongzhi&u="+$("#u_id").val()+"&t="+$("#chongzhiType").val()+"&m="+$("#chongzhimoney").val(),function(json){	
	if(json.s==1){$( "#chongzhidiag" ).dialog("close");alert("充值成功");}
	else{alert(json.m);}	
	});
	
}

function ResetPass(uid){
	$( "#resetpassdiag" ).show();
	$("#newpassword").val("12345678");	
	$("#reset_u_id").val(uid);
	$( "#resetpassdiag" ).dialog({
		border:false,
		noheader:false,
		modal:true,  
		title:"密码重置",
		onClose:function(){$( "#resetpassdiag" ).hide();$("#newpassword").val("");},
		
		shadow:false
	});	
	$("#newpassword").focus();		
}

function SureResetpass(){
	if($("#newpassword").val().length<6){alert("密码长度必须大于等于6");return false;}
	
	$.getJSON("act.asp?act=resetpass&u="+$("#reset_u_id").val()+"&p="+$("#newpassword").val(),function(json){	
	if(json.s==1){$( "#resetpassdiag" ).dialog("close");alert("密码修改成功");}
	else{alert(json.m);}	
	});
}

function Jinyong(id){
	if(confirm("确定禁用此账户!")){
		$.getJSON("act.asp?act=jinyong&u="+id,function(json){	
			if(json.s==1){window.location.reload(); }
			else{alert(json.m);}	
		});	
	}	
}
</script>
<base target="_self"/>
</head>
<body class="htmlbody">

<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
	  <td class="tableline linetitle" width="200" align="left">用户管理</td>
		<td class="tableline" width="*" align="right">
			<a href="admin_user_list.asp">用户列表</a>
			 - <a href="javascript:adduser();">添加用户</a>
         


	  </td>
	</tr>
</table>

<table id="tablehovered" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	
	<th width="80">账号</th>
    <th width="80">状态</th>
	<th width="150" >类型</th>
    <th width="150" >最后登录IP</th>
    
	<th width="250" >最后登录时间</th>
	
	
	<th >管理操作</th>
  </tr>


<%

Dim kkk:kkk=1
Dim lindex:lindex=1
mobj.crs rs
rs.open listSql,dStr,1,1
do while not rs.eof

%>
<tr align="center">

	<td class="tablerow2 hovered" align="left"><%=rs("a_username")%>
	
	</td>
    <td class="tablerow2 hovered" align="left"><%
	if rs("a_active")=1 then
		 response.Write("<font color='green'>启用<font>")
	else
		response.Write("<font color='red'>禁用<font>")
	end if
	%></td>
	<td class="tablerow2 hovered" >
    <%
	select case rs("a_type")
		case 1:response.Write("系统管理员")
		case 0:response.Write("客服人员")
		case else
	end select 
	%>
    </td>
	<td class="tablerow2 hovered" ><%=rs("a_lastIp")%></td>
	<td class="tablerow2 hovered"  title=""><%=rs("a_lastTime")%></td>
	
	<td class="tablerow2 hovered" ><%if rs("a_type")=0 then %><%if rs("a_active")=1 then %><a href="javascript:Jinyong(<%=rs("a_id")%>);">禁用此账户</a><%else%><a href="javascript:Jinyong(<%=rs("a_id")%>);">启用此账户</a><%end if%> | <a href="javascript:ResetPass(<%=rs("a_id")%>)">重置密码</a> | <a href="admin_user_list.asp?act=del&amp;u_id=<%=rs("a_id")%>" onclick="return confirm('删除后将不能恢复，您确定要删除吗?')">删除</a><%end if%></td>
  </tr>
<%
					rs.movenext
					loop
					mobj.drs rs

	
	%>
<tr>
	<td class="tablerow1" colspan="6">&nbsp;</td>
</tr>


</table>

<div id="adduser" style="width:450px; background-color:#FFF; display:none;">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<form method="post" id="adduser_form">
  <tr>
    <td width="110" height="35" align="right" valign="middle">登录帐号:</td>
    <td align="left" valign="middle"><label>
      <input name="a_username" type="text" id="a_username" maxlength="20" />
    </label></td>
  </tr>
  <tr>
    <td height="35" align="right" valign="middle">登录密码:</td>
    <td align="left" valign="middle"><input name="a_userpass" type="text" id="a_userpass" maxlength="20" /></td>
  </tr>
  <tr>
    <td height="35" align="right" valign="middle">是否启用:</td>
    <td align="left" valign="middle"><label>
      <select name="a_active" id="a_active" style="padding:3px;">
        <option value="1">启用</option>
        <option value="0">不启用</option>
      </select>
    </label></td>
  </tr>
  <tr>
    <td height="35" align="right" valign="middle">&nbsp;<input name="" id="resetButton" type="reset" value="重置" style="display:none;" /></td>
    <td align="left" valign="middle"><a id="adduserButton" class="easyui-linkbutton" href="javascript:void(0)">确定新增用户</a></td>
  </tr></form>
</table>

</div>
<div id="resetpassdiag" style="background-color:#FFF; width:320px; display:none;"><table width="300" border="0" cellspacing="5" cellpadding="5">
  <tr>
    <td width="80" height="40" align="right" bgcolor="#FFFFFF">新密码：</td>
    <td bgcolor="#FFFFFF"><label for="textfield"></label>
    <input name="textfield" type="text" id="newpassword" size="20" /></td>
  </tr>
  <tr>
    <td height="40" align="center" bgcolor="#FFFFFF"><input name="u_id" type="hidden" value="" id="reset_u_id" /></td>
    <td height="40" align="left" bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="确认重置" onclick="SureResetpass();" /></td>
  </tr>
</table>
</div>

<!--#include file="end.asp"-->
</body></html>
<script language="javascript">
$(function(){
		   
	$("#adduserButton").bind('click',function(){
		if($("#a_username").val()==""){alert("登录帐号不能为空!");$("#a_username").focus();return;}
		if($("#a_userpass").val()==""){alert("登录密码不能为空!");$("#a_userpass").focus();return;}
		//s
		
		$.getJSON("act.asp?act=adduser&n="+escape($("#a_username").val())+"&p="+escape($("#a_userpass").val())+"&t="+$("#a_active").val(),function(json){		
			if(json.s==1){
				$("#resetButton").trigger("click");	
				window.location.reload(); 
				}
			else{alert(json.m);}
		});		
	
		//e
											  
	});
	
	
});
</script>
