<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"-->


<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%>-商品列表</title>
<%
call logquanxian("c2",1)
%>




<DIV>

<SCRIPT language=javascript>
function ShowDialog(url, width, height, optValidate) {
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
	}
</SCRIPT>
<%
act=request.QueryString("act")
cact=request.QueryString("cact")
page=request.QueryString("page")
uid=request.QueryString("uid")

link="admingoodlist.asp?ct="

if act="del" then
call lognamecode()
id=request.QueryString("id")
uid=request.QueryString("uid")
if id="" or uid="" then call PopErr("获取参数错误")
kamiku=""
sql="select kamiku,aynameid from ayname where aynameid="&clng(uid)&"" 
rs.open sql,conn,1,1
if not(rs.eof) then
kamiku=trim(rs("kamiku"))
end if
rs.close

if kamiku<>"" then
conn.execute("delete from "&kamiku&" where aykagoodid="&clng(id)&"")
end if

conn.execute("delete from aygood where aygoodid="&clng(id)&"")

call logadd(request.Cookies("aynameid"),"管理-商品删除成功"&id,0,0)
response.Redirect("admingoodlist.asp?page="&page&"&uid="&uid)

end if


if cact="tihuan" then
call lognamecode()
con=request.form("con")
tocon=request.form("tocon")

if con="" then call PopErr("获取参数错误")
if trim(tocon)="" then tocon="*"

sql="select aygoodname from aygood where aygoodname like '%"&trim(request.QueryString("con"))&"%'" 
rs.open sql,conn,1,3
if not(rs.eof) then
	do while not rs.eof
	rs("aygoodname")=replace(trim(rs("aygoodname")),trim(con),trim(tocon))
	rs.update
	rs.movenext
	loop
end if
rs.close

sql="select ayshmiaoshu from aygood where ayshmiaoshu like '%"&trim(request.QueryString("con"))&"%'" 
rs.open sql,conn,1,3
if not(rs.eof) then
	do while not rs.eof
	rs("ayshmiaoshu")=replace(trim(rs("ayshmiaoshu")),trim(con),trim(tocon))
	rs.update
	rs.movenext
	loop
end if
rs.close

sql="select goodxx from aygood where goodxx like '%"&trim(request.QueryString("con"))&"%'" 
rs.open sql,conn,1,3
if not(rs.eof) then
	do while not rs.eof
	rs("goodxx")=replace(trim(rs("goodxx")),trim(con),trim(tocon))
	rs.update
	rs.movenext
	loop
end if
rs.close

call logadd(request.Cookies("aynameid"),"管理-商品字符替换成功"&id,0,0)
response.Redirect("admingoodlist.asp?page="&page&"")

end if



if act="sj" then
id=SafeRequest("id")
shangname=request.QueryString("cat2")
sql="select * from aygood where aygoodid="&clng(id)&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.close
PopErr("未找到此商品")
else
rs("issjsuo")=0
rs("aygoodzhuangtai")=0
rs.update
rs.close
call logadd(request.Cookies("aynameid"),"管理-商品上架成功"&id,0,0)
response.Redirect("admingoodlist.asp?page="&page&"&cact=cha&shangname="&shangname&"")
end if
end if


if act="xj" then
id=SafeRequest("id")
shangname=request.QueryString("cat2")
sql="select * from aygood where aygoodid="&clng(id)&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.close
PopErr("未找到此商品")
else
rs("issjsuo")=1
rs("aygoodzhuangtai")=1
rs.update
rs.close
call logadd(request.Cookies("aynameid"),"管理-商品下架成功"&id,0,0)
response.Redirect("admingoodlist.asp?page="&page&"&cact=cha&shangname="&shangname&"")
end if
end if






sql2=""
if cact="cha" then
link="admingoodlist.asp?cact=cha"
houzhui=""
'fenlei=request.form("fenlei")
shangname=request("shangname")
shangid=request("shangid")
'if fenlei=0 and shangname="" and request.Cookies("fenlei")="" then call PopErr("请至少选择或填写一项")
'if fenlei=0 then response.Cookies("fenlei")=""
'if fenlei<>0 then
'response.Cookies("fenlei")=fenlei
'sql2=" and aygoodfl='"&fenlei&"'"
'end if

'if request.Cookies("fenlei")<>"" then
'sql2=" and aygoodfl='"&request.Cookies("fenlei")&"'"
'end if

if shangname<>"" then
sql2=sql2&" and aygoodname like '%"&shangname&"%'"
houzhui=houzhui&"&shangname="&shangname
end if
end if

if uid<>"" then
sql2=sql2&" and aygoodsuoyouid="&uid&""
houzhui=houzhui&"&uid="&uid
end if


link=link&houzhui
%>
<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;商品列表</DIV>
<DIV class=main>
<table border="0">
  <tr>
    <td>
<form action="?cact=cha" method="post" name="chaxun" id="chaxun">
&nbsp;商品名称：
<input name="shangname" type="text" id="shangname" value="<%if shangname<>"" then response.Write shangname%>" maxlength="25">
<input type="submit" name="Submit" value=" 查 询 ">
<br><br>
</form>
    </td>
    <td>
<form action="?cact=tihuan" method="post" name="chaxun" id="chaxun">
&nbsp;将：
<input name="con" type="text" id="con" value="" size="14">替换为<input name="tocon" type="text" id="tocon" value="*" size="14">
<input type="submit" name="Submit" value=" 替 换 ">
<br><br>
</form>
    </td>
    <td>
<form action="?cact=cha" method="post" name="chaxun" id="chaxun">
&nbsp;商品ID：
<input name="shangid" type="text" id="shangid" value="<%if shangid<>"" then response.Write shangid%>" maxlength="25">
<input type="submit" name="Submit" value=" 查 询 ">
<br><br>
</form>
    </td>
  </tr>
</table>



<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form method="post" name="form" id="form"> 
       <tr>
        <th align="center" class="border_right border_bottom" style="font-weight: bold" >商品名称</td>
        <th align="center" class="border_right border_bottom" style="font-weight: bold" >代售        
        <th align="center" class="border_right border_bottom" style="font-weight: bold" >商户ID        
        <th align="center" class="border_right border_bottom" style="font-weight: bold" >姓名        
        <th align="center" class="border_right border_bottom" style="font-weight: bold" >商户级别        
        <th align="center" class="border_right border_bottom" style="font-weight: bold">商品价格
        <th align="center" class="border_right border_bottom" style="font-weight: bold">库存卡                  
        <th align="center" class="border_right border_bottom" style="font-weight: bold">已出卡
        <th align="center" class="border_bottom" style="font-weight: bold">商品管理     </tr>
        
        
<%
if shangid<>"" then
sql="select isptdx,aygoodid,aygoodsuoyouid,aygoodname,ayjiage,aygoodzhuangtai from aygood where aygoodid="&shangid&" order by aygoodid desc" 
else
sql="select isptdx,aygoodid,aygoodsuoyouid,aygoodname,ayjiage,aygoodzhuangtai from aygood where aygoodid<>0 "&sql2&" order by aygoodid desc" 
end if
'response.Write sql
'response.End()
rs.open sql,conn,1,1
rs.pagesize=50
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
zongshu=rs.RecordCount
do while not rs.eof%>

	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom"><%=rs("aygoodname")%></td>
        <td align="center" class="border_right border_bottom" style="color:#090">
        <%
		if cint(rs("isptdx"))=1 then response.Write "代售"
		%>
        </td>
        <td align="center" class="border_right border_bottom"><a href="adminuseredit.asp?id=<%=rs("aygoodsuoyouid")%>&page=<%=page%>" target="_blank"><%=rs("aygoodsuoyouid")%></a></td>
        <td align="center" class="border_right border_bottom"> 
		<%
		set rsn=server.CreateObject("adodb.recordset")
		sqln="select ayjibie,aynameid,ayusername,aytel,aymail,kamiku,aytrueuser from ayname where aynameid="&rs("aygoodsuoyouid")&""
		rsn.open sqln,conn,1,1
		if not(rsn.eof) then
		aytel=rsn("aytel")
		aymail=trim(rsn("aymail"))
		kamiku=trim(rsn("kamiku"))
		%>
		<a href="adminuseredit.asp?id=<%=rs("aygoodsuoyouid")%>&page=<%=page%>" target="_blank"><%=rsn("aytrueuser")%></a>
		</td>
        <td align="center" class="border_right border_bottom"><%=rsn("ayjibie")%></td>
		<%
		end if
		rsn.close
		%>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("ayjiage"),2,true,-1,0)%></td>
        <td align="center" class="border_right border_bottom">
		<%
		set rsnum=conn.execute("select count(*) as num from "&kamiku&" where aykagoodid="&clng(rs("aygoodid"))&" and aykayesno=0")
		rskucunka=rsnum("num")
		%>
		<a target="_blank" href="ik_adminkucunka.asp?cact=cha&shangid=<%=rs("aygoodid")%>&ku=<%=kamiku%>"><%=rskucunka%></a>
		</td>
        <td align="center" class="border_right border_bottom">
		<%
		set rsnum=conn.execute("select count(*) as num from "&kamiku&" where aykagoodid="&clng(rs("aygoodid"))&" and aykayesno=1")
		rskucunchu=rsnum("num")
		%>
		<a target="_blank" href="adminfeika.asp?cact=cha&shangid=<%=rs("aygoodid")%>&ku=<%=kamiku%>"><%=rskucunchu%></a>
		</td>
        <td align="center" class="border_bottom">
        <a style="color:#F30" href="admingoodedit.asp?act=adddaishou&id=<%=rs("aygoodid")%>">【加入平台代售系统】</a>
		<%if cint(rs("aygoodzhuangtai"))=0 then%>
		<a href="?act=xj&id=<%=rs("aygoodid")%>&cat2=<%=shangname%>&page=<%=page%>" title="点击下架">上架中</a> 
		<%elseif cint(rs("aygoodzhuangtai"))=1 then%>
		<a href="?act=sj&id=<%=rs("aygoodid")%>&cat2=<%=shangname%>&page=<%=page%>" title="点击上架"><font color=red>下架中</font></a>
		<%end if%>
		<a href="javascript:" style="color: #FF0000" onClick="ShowDialog('link.asp?id=<%=rs("aygoodid")%>', 320, 165, true)">链接</a> 
		<a href="admingoodedit.asp?id=<%=rs("aygoodid")%>&uid=<%=uid%>">编辑</a>  <a href="adminbuhuo.asp?sname=<%=trim(rs("aygoodname"))%>&aytel=<%=aytel%>&aymail=<%=aymail%>&kucun=<%=kkuncun%>" target="_blank" style="color: #FF0000">补货通知</a> <a href="?act=del&id=<%=rs("aygoodid")%>&page=<%=page%>&uid=<%=rs("aygoodsuoyouid")%>" onClick="javascript:return confirm('您确定要删除商品以及名下卡密吗？');"><img src="<%=ossurl%>images/ico_del.gif" alt="删除分类" border="0"></a></td>
	  </tr>
<%n=n+1
rs.movenext  '指针向下移动
if n>=rs.pagesize then exit do  
loop
end if
rs.close%>
	  

      <tr>
        <td colspan="9">&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></form>
    </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"-->

