<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />



<title><%=webname%>-最高权限-代理商</title>
<%
call logquanxian("b8",1)
%>

<DIV>

<%
function FillZero(str)
	if len(str)=1 then
	FillZero = "0"&str
	else
	FillZero=str
	end if
end function
time_start=year(now)&FillZero(month(now))&FillZero(day(now))&FillZero(hour(now))&FillZero(minute(now))&FillZero(second(now))

link="adminuserdl.asp?act="

if SafeRequest("act")="tooff" then
id=trim(SafeRequest("id"))
page=trim(SafeRequest("page"))

sql="select * from aydailishang where aydlid="&id&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
rs("aydlistongguo")=2
rs.update
end if
rs.close

call PopErr2("操作成功","adminuserdl.asp?page="&page&"")
end if


if SafeRequest("act")="toon" then
id=trim(SafeRequest("id"))
page=trim(SafeRequest("page"))

sql="select * from aydailishang where aydlid="&id&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
rs("aydlistongguo")=1
rs.update
end if
rs.close

call PopErr2("操作成功","adminuserdl.asp?page="&page&"")
end if



if SafeRequest("act")="del" then
id=trim(SafeRequest("id"))
page=trim(SafeRequest("page"))
if id="" then call PopErr("出现错误")
if len(id)>5 then call PopErr("出现错误")
if isNumeric(id)=false then call PopErr("出现错误")
sql="select * from aydailishang where aydlid="&id&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
uid=rs("aydluserid")
sid=rs("aydlsjuserid")
rs.delete
rs.close

sql="select * from aykafenlei where aykanamesuoyou="&clng(uid)&" and ayfenleidlid="&clng(sid)&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
do while not rs.eof
rs.delete
rs.movenext 
loop
end if
rs.close

sql="select * from aygood where aygoodsuoyouid="&clng(uid)&" and aygooddlid="&clng(sid)&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
do while not rs.eof
rs.delete
rs.movenext 
loop
end if
rs.close

sql="select * from aydailishang where aydluserid='"&clng(uid)&"'" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then
	set rsu=server.CreateObject("adodb.recordset")
	sqlu="select * from ayname where aynameid="&clng(uid)&"" 
	rsu.open sqlu,conn,1,3
	if not(rsu.bof and rsu.eof) then
	rsu("ayisdaili")=0
	rsu.update
	end if
	rsu.close
end if
rs.close

'站内信通知
set rst=server.CreateObject("adodb.recordset")
sqlt="select * from aytongzhi" 
rst.open sqlt,conn,1,3
rst.addnew
rst("aytongzhilei")=3
rst("aytongzhiuser")=uid
rst("aytongzhidate")=now()
rst("aytongzhibiao")="您的代理关系已被管理员删除"
rst("aytongzhicon")="您的代理关系已被管理员删除，有疑问请联系管理员"
rst("suijiid")=trim(uid)&time_start
rst("t4")=1
rst.update
rst.addnew
rst("aytongzhilei")=3
rst("aytongzhiuser")=sid
rst("aytongzhidate")=now()
rst("aytongzhibiao")="您的代理关系已被管理员删除"
rst("aytongzhicon")="您的代理关系已被管理员删除，有疑问请联系管理员"
rst("suijiid")=trim(sid)&time_start
rst("t4")=1
rst.update
rst.close

call PopErr2("操作成功","adminuserdl.asp?page="&page&"")
else
call PopErr("未找到该代理关系")
end if
rs.close
end if

%>
<DIV id=main1200> 
<%call webleft()%>

<DIV id=main_right>
<DIV id=main_right_content>
<STYLE>.apply_style {
	POSITION: absolute
}
.right_title A {
	LINE-HEIGHT: 27px; WIDTH: 126px; DISPLAY: inline-block; BACKGROUND: url(<%=ossurl%>images/bg22.gif) no-repeat; HEIGHT: 27px
}
.right_title A.current {
	BACKGROUND: url(<%=ossurl%>images/main_right_title_bg.gif) no-repeat; COLOR: #fff; FONT-WEIGHT: bold
}
.table_style_1 TD {
	HEIGHT: 38px
}
.table_style_home_info TD {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; HEIGHT: 30px; PADDING-TOP: 0px
}
</STYLE>
<DIV class=right_titleadmin>&nbsp;&nbsp;代理商管理 <a href="admindailicha.asp" target="_blank">【代理商品价格检测】</a></DIV>
<DIV class=main><br>
	<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?act=alldel&page=<%=page%>" method="post" name="myform" id="myform"> 
       <tr>
        <th align="center" class="border_right border_bottom" >代理ID
        <th align="center" class="border_right border_bottom" >上级ID        
        <th align="center" class="border_right border_bottom" >上级姓名
        <th align="center" class="border_right border_bottom" >VIP        
        <th align="center" class="border_right border_bottom">下级ID
        <th align="center" class="border_right border_bottom">下级姓名
        <th align="center" class="border_right border_bottom">下级销量<th align="center" class="border_right border_bottom">代理状态
        <th align="center" class="border_right border_bottom">卡密可见        
        <th align="center" class="border_right border_bottom">申请时间
        <th align="center" class="border_right border_bottom">通过时间
        <th align="center" class="border_bottom">操作               </tr>
<%
set rsu=server.CreateObject("adodb.recordset")
sql="select * from aydailishang order by aydlid desc" 
rs.open sql,conn,1,1
rs.pagesize=30
pagecount=rs.pagecount 
if request("page")="" then 
page=1
else
page=int(request("page")) 
end if
if page<=0 then page=1 
if request("page")="" then page=1
if not(rs.bof and rs.eof) then
rs.absolutepage=page
do while not rs.eof
%>

	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom"><%=rs("aydlid")%></td>
        <td align="center" class="border_right border_bottom"><a target="_blank" href="adminuseredit.asp?id=<%=rs("aydlsjuserid")%>"><%=rs("aydlsjuserid")%></a></td>
        <td align="center" class="border_right border_bottom">
		<%
		rsu.open "select aynameid,aytrueuser,ayisxiaojin from ayname where aynameid="&rs("aydlsjuserid")&"",conn,1,1
		if not(rsu.bof and rsu.eof) then
		response.Write trim(rsu("aytrueuser"))
		bzj=rsu("ayisxiaojin")
		else
		response.Write "-"
		bzj=0
		end if
		rsu.close
		%>
        </td>
        <td align="center" class="border_right border_bottom"><%=bzj%></td>
        <td align="center" class="border_right border_bottom">
          <a target="_blank" href="adminuseredit.asp?id=<%=rs("aydluserid")%>"><%=rs("aydluserid")%></a>
        </td>
        <td align="center" class="border_right border_bottom">
		<%
		rsu.open "select aynameid,aytrueuser,aychengjiao from ayname where aynameid="&rs("aydluserid")&"",conn,1,1
		if not(rsu.bof and rsu.eof) then
		response.Write trim(rsu("aytrueuser"))
		else
		response.Write "-"
		end if
		
		%>
        </td>
        <td align="center" class="border_right border_bottom">
		<%
		if not(rsu.bof and rsu.eof) then
		response.Write rsu("aychengjiao")&"笔"
		else
		response.Write "-"
		end if
		rsu.close
		%>
        </td>
        
        <td align="center" class="border_right border_bottom">
          <%
		  if rs("aydlistongguo")=0 then response.Write("<span style='color:#F90'>等待确认</span>")
		  if rs("aydlistongguo")=1 then response.Write("<a style='color:#090' href='?act=tooff&id="&rs("aydlid")&"&page="&page&"'>正常</a>")
		  if rs("aydlistongguo")=2 then response.Write("<a style='color:#F00' href='?act=toon&id="&rs("aydlid")&"&page="&page&"'>关闭</a>")
		  if rs("aydlistongguo")=3 then response.Write("<span style='color:#F00'>拒绝申请</span>")
		  %></td>
        <td align="center" class="border_right border_bottom">
          <%if cint(rs("aydliska"))=0 then response.Write("否")
		if cint(rs("aydliska"))=1 then response.Write("是")
		%></td>
        <td align="center" class="border_right border_bottom"><%=rs("aydlsdate")%></td>
        <td align="center" class="border_right border_bottom">
		<%
		if trim(rs("aydltdate"))<>"" and isnull(trim(rs("aydltdate")))=false then
		response.Write rs("aydltdate")
		else
		response.Write "-"
		end if
		%>
		</td>
        <td align="center" class="border_bottom"><a onClick="javascript:return confirm('您确定要删除吗？');" href="?act=del&id=<%=rs("aydlid")%>&page=<%=page%>">删除</a></td>
	  </tr>
<%
n=n+1
rs.movenext  '指针向下移动
if n>=rs.pagesize then exit do  
loop
end if
zongshu=rs.RecordCount
rs.close%>
      </form>
	         <tr>
               <td colspan="12" class="border_right border_bottom" >
			   &nbsp;&nbsp;<%if pagecount=0 then   
response.write("首页 ")
elseif page=1 then       
response.write("首页 ")
else%>
                 <a href="<%=link%>&page=1">首页</a>
                 <%end if

if pagecount=0 then   
response.write("上页&nbsp;")
elseif page=1 then       
response.write("上页&nbsp;")
else%>
                 <a href="<%=link%>&page=<%=page-1%>">上页</a>&nbsp;
                 <%end if

if pagecount>20 then
if page<=10 then 
aa=1
bb=20
aabu=""
bbbu=" … "
elseif page>=11 then 
aa=page-9
bb=page+10
aabu=" …"
bbbu=" … "
	if bb>=pagecount then 
	aa=pagecount-20
	bb=pagecount
	aabu=" … "
	bbbu=""
	end if
end if
response.Write aabu
for aa=aa to bb
if page=aa then
response.Write("<a href="&link&"&page="&aa&"><strong>"&aa&"</strong></a>&nbsp;")
else
response.Write("<a href="&link&"&page="&aa&">"&aa&"</a>&nbsp;")
end if
next
response.Write bbbu

else

for i=1 to pagecount
if page=i then
response.Write("<a href="&link&"&page="&i&"><strong>"&i&"</a></strong>&nbsp;")
else
response.Write("<a href="&link&"&page="&i&">"&i&"</a>&nbsp;")
end if
next

end if

if pagecount=0 then 
response.write("下页&nbsp;")
elseif page=pagecount then 
response.write("下页&nbsp;")
else%>
                 <a href="<%=link%>&page=<%=page+1%>">下页</a>
                 <%end if%>
                 <%if pagecount=0 then  '总页数为0 显示空
response.write("尾页 ") 
elseif page=pagecount then 
response.write("尾页 ")
else%>
                 <a href="<%=link%>&page=<%=pagecount %>">尾页</a>
                 <%end if

if pagecount<>0 then 
response.Write page&"/"&pagecount
end if
response.Write "&nbsp;共"&zongshu&"条"
%></td>
            </tr>
    </table>
</DIV>


</DIV></DIV>
<DIV class=clear></DIV></DIV>
</DIV>
<SCRIPT>
$(function(){
$('.left_title').each(function(){
   $(this).click(function(){
	   var index=$('.left_title').index(this);
	   if($(this).next().hasClass('hide_m')){
		   $(this).next().removeClass('hide_m');
           $(this).next().show();		 
		   $(this).find('img').attr('src','<%=ossurl%>images/expansion.gif');
		   $.cookie('m_index_'+index,'',{expires:0});
	   } else {
	       $(this).next().hide();
		   $(this).next().addClass('hide_m');
		   $(this).find('img').attr('src','<%=ossurl%>images/shrank.gif');		   
		   $.cookie('m_index_'+index,'none',{expires:365});
	   }
   })
})

$('.left_title').each(function(){
	var index=$('.left_title').index(this);
    $(this).next().css('display',$.cookie('m_index_'+index) ? $.cookie('m_index_'+index) : '');
	if($.cookie('m_index_'+index)){
	    $(this).next().addClass('hide_m');
	}
	$(this).find('img').attr('src',$.cookie('m_index_'+index) ? '<%=ossurl%>images/shrank.gif' : '<%=ossurl%>images/expansion.gif');
})
})

</SCRIPT>


<!--#include virtual="/show/footadmin.asp"-->

