?? productlist.asp
字號:
<!-- #include file="../include/bkconn.asp "-->
<!--#include file="checkUser.asp"-->
<%
function selectTreeList(i,deep)
dim sql
dim rs
dim tempi
dim rsID
set rs=server.createObject("adodb.recordset")
sql="select * from productSort where fatherID="&i
rs.open sql,conn,1,1
if rs.eof then
exit function
else
do while not rs.eof
rsID=rs("id")
rsName=rs("name")
response.write "<option value="&rsID
if rsID=productSort then response.write " selected"
response.write ">"
for tempi=1 to deep
response.write " "
next
response.write rsName&"</option>"
call selectTreeList(rsID,deep+1)
rs.movenext
loop
end if
end function
function getSort(i) '該函數(shù)獲取類別下的所有子類,符合一般搜索習慣
dim rs,sql
set rs=server.createObject("adodb.recordset")
sql="select * from productSort where fatherID="&i
rs.open sql,conn,1,1
do while not rs.eof
strSort=strSort&","&rs("id") '&rs("name")
call getSort(rs("id"))
rs.movenext
loop
end function
dim productSortDic
'set productSortDic = Server.CreateObject("Scripting.Dictionary")
Set productSortDic = CreateObject("Scripting.Dictionary")
sql="select * from productSort where 1=1"
set productSortRs=conn.Execute (sql)
dim tempName
dim tempID
do while not (productSortRs.eof or err)
tempID=cstr(productSortRs("id"))
tempName=productSortRs("name")
productSortDic.Add tempID,tempName
' response.write " 字典:"&productSortDic.item(cstr(productSortRs("id")))
' response.write " id:"&productSortRs("id")
' response.write " name:"&productSortRs("name")
productSortRs.moveNext
loop
dim rs,sql
dim strSort '保留所選的類的所有子類
dim page,maxPerPage
maxPerPage=10 '每頁顯示的記錄數(shù)
myKeyword=trim(Request("myKeyword"))
itemno=trim(Request("itemno"))
productSort=cint(Request("productSort"))
strSort=productSort
CALL getSort(productSort)
page=Request("page")
if (page="" or isempty(page)) then page=1
thisUrl="productList.asp?productSort="&productSort&"&myKeyword="&myKeyword&"&itemno="&itemno
session("adminOldUrl")=thisUrl&"&page="&page
set rs=server.createobject("adodb.recordset")
sql="select * from product where 1=1"
if not (myKeyword="" or isempty(myKeyword) ) then
sql=sql&" and name like '%"&myKeyword&"%'"
end if
if not (itemno="" or isempty(itemno) ) then
sql=sql&" and itemno like '%"&itemno&"%'"
end if
if productSort>0 then
sql=sql&" and productSort in ("&strSort&")"
end if
sql=sql&" order by id desc"
'response.write sql
'response.End
rs.open sql,conn,1,1
rs.pagesize=MaxPerPage
%>
<html>
<head>
<title>后臺管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../main.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function jumpTo(i){
if(i==1){
this.document.location="<%=thisUrl%>";}
if(i==2){
this.document.location="<%=thisUrl%>&page=<%=page-1%>";}
if(i==3){
this.document.location="<%=thisUrl%>&page=<%=page+1%>";}
if(i==4){
this.document.location="<%=thisUrl%>&page=<%=rs.pageCount%>";}
}
function recommend(i){
if (confirm("確定 推薦/取消推薦 該商品("+i+"號商品)?")==1){
window.location="recommend.asp?id="+i;
}
}
// -->
</script>
<script language=Javascript src="../include/opennew.js"></script>
</head>
<body bgcolor="#9CC7EF" text="#000000" leftmargin="0" topmargin="4">
<div align="center"><br>
商品管理 </div>
<table width="98%" border="1" bordercolordark=#9CC7EF bordercolorlight=#145AA0 cellspacing="0" cellpadding="4" align="center">
<tr>
<form method="post" action="productList.asp" name="form1">
<td colspan="8" bgcolor="#4296E7"> <div align="right"><font color="#FFFFFF">商品編號
<input type="text" name="itemno" size="16" value="<%=itemno%>">
商品名稱</font>
<input type="text" name="myKeyword" size="16" value="<%=myKeyword%>">
<select name="productSort">
<option value="0">全部分類</option>
<%call selectTreeList(0,0)%>
</select>
<input type="submit" name="Submit" value="搜索">
</div></td>
</form>
</tr>
<tr bgcolor="#5EA5E6">
<td width="3%" nowrap> <div align="center"><font color="#FFFFFF">編號</font></div></td>
<td width="24%" nowrap> <div align="center"><font color="#FFFFFF">商品名稱</font></div></td>
<td width="3%" nowrap><div align="center"><font color="#FFFFFF">特價</font></div></td>
<td width="3%" nowrap> <div align="center"><font color="#FFFFFF">推薦</font></div></td>
<td width="7%" nowrap> <div align="center"><font color="#FFFFFF">商品類別</font></div></td>
<td width="5%" nowrap> <div align="center"><font color="#FFFFFF">價格(¥)</font></div></td>
<td width="5%" nowrap> <div align="center"><font color="#FFFFFF">訂購量</font></div></td>
<td width="11%" nowrap bgcolor="#5EA5E6"> <div align="center"><font color="#FFFFFF">商品圖片(小/大)</font></div></td>
</tr>
<%
dim rsID
i=1
if not (rs.eof or err) then rs.move (page-1)*maxPerPage
do while not (rs.eof or err)
rsID=rs("id")
%>
<tr>
<td><%=rsID%> </td>
<td style="cursor:hand" title="點擊查看具體信息" onClick="Javascript:window.location='productMod.asp?id=<%=rs("id")%>'" bgcolor="#63B2FF"><%=rs("name")%> </td>
<td>
<%if rs("tejia")=1 then %>
<div align="center"><font color="#FF0000">√</font></div>
<%else %>
<div align="center">×</div>
<%end if%>
<td>
<%if rs("recommend")=1 then %>
<div align="center"><font color="#FF0000">√</font></div>
<%else %>
<div align="center">×</div>
<%end if%>
<td>
<%
'productSortRs.moveFirst
response.write productSortDic.item(cstr(rs("productSort")))
%>
</td>
<td><%=rs("memberPrice")%> </td>
<td><%=rs("buyNum")%></td>
<td> <div align="center">
<%if rs("smallImg")="nothing" then%>
無
<%else %>
有
<%end if %>
<%if rs("bigImg")="nothing" then%>
無
<%else %>
有
<%end if %>
<br>
<%if rs("smallImg")="nothing" then%>
<img src="../images/smallImgAdd.gif" width="20" height="20" title="添加小圖片" style="cursor:hand" onClick="opennew('addPicture.asp?type=smallImg&id=<%=rsID%>','addPicture',400,80)" align="absmiddle">
<%else %>
<img src="../images/smallImgMod.gif" width="20" height="20" title="修改小圖片" style="cursor:hand" onClick="opennew('addPicture.asp?type=smallImg&id=<%=rsID%>','addPicture',400,80)" align="absmiddle">
<%end if %>
<%if rs("bigImg")="nothing" then%>
<img src="../images/bigImgAdd.gif" width="20" height="20" title="添加大圖片" style="cursor:hand" onClick="opennew('addPicture.asp?type=bigImg&id=<%=rsID%>','addPicture',400,80)" align="absmiddle">
<%else %>
<img src="../images/bigImgMod.gif" width="20" height="20" title="修改大圖片" style="cursor:hand" onClick="opennew('addPicture.asp?type=bigImg&id=<%=rsID%>','addPicture',400,80)" align="absmiddle">
<%end if %>
</div></td>
</tr>
<%
i=i+1
if i>maxPerPage then exit do
rs.moveNext
loop
%>
<tr bgcolor="#4296E7">
<td colspan="8"> <div align="right"><font color=#FFFFFF><%=rs.recordCount%>
項 第<%=page%>/<%=rs.pageCount%> 頁 </font>
<%if page>1 then%>
<input type="button" name="Submit3" value="首頁" onClick="Javascript:jumpTo(1)">
<input type="submit" name="Submit4" value="上頁" onClick="Javascript:jumpTo(2)">
<%else%>
<input type="button" name="Submit3" value="首頁" disabled>
<input type="submit" name="Submit4" value="上頁" disabled>
<%end if
if rs.recordCount>page*maxPerPage then%>
<input type="submit" name="Submit5" value="下頁" onClick="Javascript:jumpTo(3)">
<input type="submit" name="Submit6" value="末頁" onClick="Javascript:jumpTo(4)">
<%else%>
<input type="submit" name="Submit5" value="下頁" disabled>
<input type="submit" name="Submit6" value="末頁" disabled>
<%end if%>
</div></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -