📄 admin_prod.asp
字号:
<!--#include file="../Comm/subconn.asp"-->
<%
dim cls
if session("admin")="" then
Response.Redirect("admin.asp")
else
if session("flag")<>"0" then
cls = Instr(session("flag"), "prod")
if cls <= 0 then
%>
<script language="javascript">
if (confirm("您的操作权限不够,系统拒绝你的访问,请点确定返回,或者点取消退出重新登录"))
location.href="admin.asp";
else
location.href="quit.asp";
</script>
<%
end if
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="admin.css" type="text/css">
<title>产品管理</title>
<style type="text/css"><!--
a:link {color: #FFFFFF;text-decoration: none;}
a:visited {color: #FFFFFF;text-decoration: none;}
a:hover {color: #FFFF99;text-decoration: underline;}
.b{color:#cccc99;font-size:10pt;border:dotted 1px}
--></style>
<script language="JavaScript" type="text/JavaScript">
function JM_wu(ob){
ob.style.display="none";
}
function JM_you(ob){
ob.style.display="";
}
function uppic(model,frmname) {
id=document.prodtable.ProdId.value;
if (id=='') {
alert("请先填写编号");
document.prodtable.ProdId.focus();
return false;}
window.open("upload.asp?uppath=digi&ProdId="+id+model+"&frmname="+frmname,"upload", "left=12, top=12, width=500, height=550, resizable=1,menubar=1,scrollbars=1")
}
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
</script>
<SCRIPT language=javascript src="/jsroot/hugpic.js"></SCRIPT>
</head>
<body bgcolor="#336699" background="../images/bggreen.gif" text=#ffffff topmargin="0">
<!--#include file="top.asp"-->
<table border="0" cellpadding="2" cellspacing="5" style="border-collapse: collapse" bordercolor="#222222" width="772" height="150" bgcolor="#336699" align="center">
<tr><td width=125 valign="top">
<!--#include file="admin_left.asp"-->
</td><td valign="top" width=647>
<table border="1" cellpadding="2" cellspacing="4" style="border-collapse: collapse" bordercolor="#222222" width="100%">
<tr><td>当前位置: <a href="admin.asp">网站管理中心</a>--产品管理</td><td align="right" ><b><a href="admin_prod.asp">产品</a> | <a href="admin_prod.asp?action=cls">类别</a> | <a href="admin_prod.asp?action=SearchType">搜索类别</a></b></td></tr>
<tr><td width="100%" colspan=2>
<%
action = request("action")
if request("search") = "ok" then
if request("online") <> "" then
session("online") = request("online")
else
session("online") = ""
end if
if request("keyword") <> "" then
session("keyword") = request("keyword")
else
session("keyword") = ""
end if
if request("midclass")<>"" then
session("midclass")= request("midclass")
else
session("midclass") = ""
end if
else
end if
if action="" then
%>
<br>
<table width=100% border=0 cellpadding=2 cellspacing=2>
<form action="admin_prod.asp" name="search" method=get><tr><td>类别 <select name="midclass">
<option value="" selected>---所有类别---</option>
<% Dim a,b,c
'显示产品类别表
set rscls=server.createobject("adodb.recordset")
sqllar="select distinct LarCode,LarSeq,MidCode,midSeq from ProdClass order by LarSeq,MIdSeq "
rscls.Open sqllar,conn,1,1
if rscls.bof and rscls.eof then
response.write "<option selected>-暂无分类-</option>"
else
Do While Not rscls.eof
response.write "<option value='"&rscls("MidCode")&"'>"&rscls("LarCode")&"-"&rscls("MidCode")&"</option>"
rscls.movenext
if rscls.eof then
exit do
end if
loop
end if
rscls.close
set rscls=nothing
%>
</select></td>
<td>关键字 <input type="text" name="keyword" size="10" maxlength="20"></td>
<td><input type="radio" name="online" value="false">offline
<input type="radio" name="online" value="true">online
<input type="radio" name="online" value="" checked>all
</td><input type="hidden" name="search" value="ok">
<td><input type="submit" value="搜索"></td></tr>
</form></table>
<hr width="100%" size="1" noshade color=white><br>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkdel(delid){
if(confirm('删除选定的产品'))
{location.href="admin_prod.asp?action=del&id="+delid;}
}
//-->
</SCRIPT>
<table border="1" style="border-collapse: collapse;border:dotted 1px" bordercolor="#333333" cellpadding=3 width=100%>
<form name=Prodlist action=admin_prod.asp method=post><tr bgcolor="#003366">
<td width=1>选</td>
<td nowrap>编号(编辑)</td>
<td nowrap>名称(预览)</td>
<td nowrap>产品型号</td>
<td nowrap>大类</td>
<td nowrap>中类</td>
<td nowrap>上线日期</td>
<td width=16>删</td>
<td width=16>关</td></tr>
<%'默认显示产品列表
midclass = session("midclass")
keyword = session("keyword")
online = session("online")
dim rs,msg_per_page
dim sql
msg_per_page = 20 '定义每页显示记录条数
set rs = server.createobject("adodb.recordset")
sql = "select * from ProdMain where ProdId is not null"
if online<>"" then sql = sql + " and online="&online
if midclass<>"" then sql = sql + " and MidCode='"&midclass&"'"
if keyword<>"" then sql= sql+ " and ProdName like '%"&keyword&"%' or Model like '%"&keyword&"%'"
sql= sql+" order by AddDate desc" '按照添加日期显示
rs.cursorlocation = 3 '使用客户端游标,可以使效率提高
rs.pagesize = msg_per_page '定义分页记录集每页显示记录数
rs.open sql,conn,1,1
if err.number<>0 then '错误处理
response.write "<br><br><br>数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
totalrec = RS.RecordCount 'totalrec:总记录条数
if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
n = rs.recordcount\msg_per_page 'n:总页数
else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page") 'currentpage:当前页
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage 'absolutepage:设置指针指向某页开头
rowcount = rs.pagesize 'pagesize:设置每一页的数据记录数
dim i
dim k
%>
<%
do while not rs.eof and rowcount>0
response.write "<tr><td class=b><input type='checkbox' value='"&rs("ProdNum")&"' name=id></td><td class=b><a href=""admin_prod.asp?action=detail&id="&rs("ProdId")&""">"&_
rs("ProdId")&"</a></td><td class=b><a href='../prodshow.asp?ProdId="&rs("ProdId")&"' target='blank_'>"&rs("ProdName")&"</a></td><td class=b>"&_
rs("Model")&"</td><td class=b>"&rs("LarCode")&"</td><td class=b>"&rs("MidCode")&"</td><td class=b>"&rs("AddDate")&_
"</td><td class=b align=center>"&_
"<a href=javascript:checkdel('"&rs("ProdNum")&"')>删</a></td>"
if rs("online")=true then
response.write "<td class=b align=center><a href='admin_prod.asp?action=close&id="&rs("ProdNum")&"'>关</a></td></tr>"
else
response.write "<td class=b align=center><a href='admin_prod.asp?action=open&id="&rs("ProdNum")&"'><font color=yellow>开</font></a></td></tr>"
end if
rowcount=rowcount-1
rs.movenext
loop
else
response.write "<tr><td colspan=9 align=center class=b><BR>无满足条件商品<BR><BR></td></tr>"
end if
end if
rs.close
conn.close
set rs=nothing
set coon=nothing
%>
<tr><td colspan=7 class=b>
<input type='checkbox' name=chkall onclick='CheckAll(this.form)'>全选
<input type="submit" name="action" value="删除" onclick="{if(confirm('该操作不可恢复!\n\n确定删除选定的产品?')){this.document.Prodlist.submit();return true;}return false;}">
<input type="submit" name="action" value="关闭" onclick="{if(confirm('确定关闭选定的产品在线?')){this.document.Prodlist.submit();return true;}return false;}"> <input type="submit" name="action" value="打开" onclick="{if(confirm('确定打开选定的产品在线?')){this.document.Prodlist.submit();return true;}return false;}">
</td><td class=b colspan=3>
<input type="button" name="action" onclick="javascript:location.href='admin_prod.asp?action=加商品';" value="加商品">
</td></tr></form></table>
<%call listPages()
else
end if
if action="cls" then
'类别管理
call manageclass()
end if
if action="detail" then
'产品详细资料
id=request("id")
call proddetail()
end if
if action="del" then
'删除产品
delid=replace(request("id"),"'","")
call proddel()
end if
if action="close" then
'关闭产品
ProdNum=replace(request("id")," ","")
call prodclose()
end if
if action="open" then
'打开产品
ProdNum=replace(request("id")," ","")
call prodopen()
end if
if action="editclass" then
'编辑类别名字
call editclass()
end if
if action="delMidclass" then
'删除中类
call delmidclass()
end if
if action="addMidclass" then
'增加中类
call addmidclass()
end if
if action="addLarclass" then
'增加大类
call addlarclass()
end if
if action="delLarclass" then
'删除大类
call dellarclass()
end if
if action="加商品" then
call prodadd()
end if
if action="关闭" then
ProdNum=replace(request("id")," ","")
call prodclose()
end if
if action="打开" then
ProdNum=replace(request("id")," ","")
call prodopen()
end if
if action="删除" then
delid=replace(request("id")," ","")
call proddel()
end if
if action="delother" then
call delother()
end if
if action="SearchType" then
call SearchType()
end if
if action="searchtypedel" then
call searchtypedel()
end if
if action="SearchTypeModify" then
call SearchTypeModify()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -