⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b2b_editproduct.asp

📁 信运网店系统是一套功能完善、简洁美观
💻 ASP
字号:
<!--#include file="conn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
else
if request.cookies("Buy2Buy")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
end if
%>
<title>管理商品</title>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<%
dim selectm,selectkey,selectid
selectkey=trim(request.form(trim("selectkey")))
selectm=trim(request.form("selectm"))
if selectkey="" then
selectkey=FormatSQL(request.QueryString("selectkey"))
end if
if selectm="" then
selectm=FormatSQL(request.QueryString("selectm"))
end if

selectid=request.form("selectid")
if selectid<>"" then
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权管理商品!');history.go(-1);</script>"
response.End
end if
path = "../"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select id,pic from product where id in ("&selectid&")"
	rs.open sql,conn,1
	if not rs.eof then
	response.write "总共删除记录和文件"&rs.recordcount&"个。<br>"
	do while not rs.eof
		
		F_filename=path&rs("pic")
		IF F_filename = "../images/Buy2buylogo.gif" Then
		F_filename = ""
		End If
		if objFSO.fileExists(Server.MapPath(F_filename)) then
		objFSO.DeleteFile(Server.MapPath(F_filename))
		end if
		conn.Execute("delete from product where id="&rs(0))
		response.write "已经删除文件"&F_filename&" !<br>"
	rs.movenext
	loop
	end if
	rs.close
	set rs=nothing
set objFSO=nothing


response.Redirect "b2b_cs.asp"
response.End
end if

downid=request("downid")
if Trim(Request("action")) = "Down" then
	Sql = "Update product set recommend = 3 where id="&downid
	conn.execute(sql)
	response.write "<script>alert('商品下架成功!');window.location.href='b2b_cs.asp';</Script>"
	response.end
end if

CID=Request.QueryString("CID")
If CID<> "" Then
strCat = "Where categoryid= "&CID&" and stock<>0 and recommend <> 3 order by adddate desc"
Else
strCat = "where stock<>0 and recommend <> 3 order by adddate desc"
End if
%>
<style type="text/css">
<!--
.STYLE1 {	color: #000000;
	font-weight: bold;
}
.STYLE2 {color: #FF0000}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<table width="99%" border="5" align="center" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
  <tr>  
    <td height="20" align="right" background="images/topbg.gif" bgcolor="#F2F2F2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="65%"><span class="STYLE1"><img src="images/pic5.gif" width="28" height="22" align="absmiddle" />您现在所在的位置是: <a href="adminhelp.asp">管理首页</a> -&gt; <span class="STYLE2">管理商品 商品列表</span></span></td>
        <td width="35%"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="right">分类过滤
              <select name="state" onchange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}">
                <option value="-1" selected="selected" >--请选择商品分类--</option>
                <%
sort(0)
dim ii
ii=0
sub sort(selec)
	sql="select * from category where ParentID = "&selec&" order by categoryorder"
	Set Rs1=Conn.Execute(sql)
	do while not rs1.eof
if selec=0 then
%>
                <option value="b2b_editproduct.asp?cid=<%=int(rs1("categoryid"))%>" <% if int(rs1("categoryid"))="&CID&" Then Response.write("Selected") %>><%=rs1("category")%></option>
                <%
else
%>
                <option value="b2b_editproduct.asp?cid=<%=int(rs1("categoryid"))%>" <% if int(rs1("categoryid"))="&CID&" Then Response.write("Selected") %>><%=string(ii*2," ")%><%=rs1("category")%></option>
                <%
end if
ii=ii+1
	sort rs1("categoryid")
ii=ii-1
	rs1.movenext
	loop
rs1.close
Set Rs1 = Nothing
end sub

%>
              </select></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr> 
    <form name="form1" method="post" action="">
      <td height="100" bgcolor="#FFFFFF"> 
        <%
				Const MaxPerPage=10
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    			if Not isempty(SafeRequest("page",1)) then
      				currentPage=Cint(SafeRequest("page",1))
   				else
      				currentPage=1
   				end if 
			set rs=server.CreateObject("adodb.recordset")
			select case selectm
			case ""
            rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product " & strCat & " ",conn,1,1
		    case "0"
			response.write "<center>请返回选择您要查询的方式!<br><br><a href=javascript:history.go(-1)>点击返回上一页</a></center>"
			response.End
			case "name"
			rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product where name like '%"&selectkey&"%' and recommend <> 3 order by adddate desc",conn,1,1
			case "zuozhe"
			rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product where mark like '%"&selectkey&"%' and recommend <> 3 order by adddate desc",conn,1,1
			case "chubanshe"
			rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product where introduce like '%"&selectkey&"%' and recommend <> 3 order by adddate desc",conn,1,1
			case "Supplier"
			rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product where Supplier like '%"&selectkey&"%' and recommend <> 3 order by adddate desc",conn,1,1
			case "code"
			rs.open "select id,name,adddate,introduce,Supplier,Code,Stock from product where code like '%"&selectkey&"%' and recommend <> 3 order by adddate desc",conn,1,1
		  end select
		   	if err.number<>0 then
				response.write "数据库中暂时无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 数据库中暂时无数据!</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"b2b_editproduct.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"b2b_editproduct.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"b2b_editproduct.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0%>
        <br>
        <table width="98%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
          <tr bgcolor="#f7f7f7" align="center" height="20">
            <td width="14%" background="images/topbg.gif"><strong>商品编号</strong></td>
            <td width="28%" background="images/topbg.gif"><strong>商品名称</strong></td>
            <td width="18%" background="images/topbg.gif"><strong>供货商</strong></td>
            <td width="11%" background="images/topbg.gif"><strong>目前库存</strong></td>
            <td width="24%" height="25" background="images/topbg.gif"><strong>相关操作</strong></td>
            <td width="5%" background="images/topbg.gif"><strong>选择</strong></td>
          </tr>
          <%
		  do while not rs.eof%>
          <tr bgcolor="#FFFFFF" align="center">
            <td align="left" bgcolor="#F7F7F7"><%response.write rs("Code")%></td>
            <td align="left" bgcolor="#F7F7F7"><a href="b2b_cs.asp">
              <% if len(trim(rs("name")))>80 then
			response.write left(trim(rs("name")),18)&"..."
			else
			response.write trim(rs("name"))
			end if%>
            </a></td>
            <td height="25" align="center" bgcolor="#FFFFFF"><a href="b2b_cs.asp"><%=rs("Supplier")%></a></td>
            <td height="25" align="center" bgcolor="#FFFFFF"><%response.write rs("stock")%></td>
            <td height="25" nowrap bgcolor="#F7F7F7"><a href="..\b2b_cpinfo.asp?id=<%=rs("id")%>" target="_blank"><img src="images/pic7.gif" width="18" height="15" border="0" align="absmiddle" />预览商品</a> <a href="b2b_editproduct.asp?action=Down&downid=<%=rs("id")%>"><img src="images/pic8.gif" width="18" height="15" border="0" align="absmiddle" />下架</a> <img src="images/pic9.gif" width="18" height="15" align="absmiddle" /><a href="b2b_editproducts.asp?id=<%=rs("id")%>">修改</a></td>
            <td height="25" align="center" bgcolor="#F7F7F7"><input name="selectid" type="checkbox" id="selectid" value="<%=rs("id")%>" /></td>
          </tr>
          <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		  loop
		  rs.close
		  set rs=nothing%>
          <tr bgcolor="#FFFFFF">
            <td height="30" colspan="7" align="right">全选
              <input type="checkbox" name="checkbox2" value="Check All" onclick="mm()" />
              &nbsp;
              <input name="Submit2" type="submit" class="input_bot" onclick="return test();" value="删 除" />
              &nbsp;&nbsp; </td>
          </tr>
        </table>
        <br>
        <%  
				End Sub   
  
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				
				Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" >"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首 页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>首 页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>上一页</a> "  
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 末 页</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>末 页</a>"  
				End If  
					Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"种商品 " 
					Response.Write "<font class='contents'>转到第:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">页"  
					Response.Write "&nbsp;<input type='submit' class='input_bot' value='跳转' name='cndok' ></form>"  
				End Function  
			%></td>
    </form>
  </tr>
</table>
<br>
<table width="99%" border="5" align="center" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
  <tr> 
    <td background="images/topbg.gif"><span class="STYLE1"><img src="images/pic5.gif" width="28" height="22" align="absmiddle" />您现在所在的位置是: <a href="adminhelp.asp">管理首页</a> -&gt; <span class="STYLE2">商品搜索</span></span></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <form name="form2" method="post" action="b2b_editproduct.asp">
      <td>
	    <br>
	    <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
          <tr bgcolor="#F7F7F7" align="center"> 
            <td width="35%" height="25"> <input name="selectkey" type="text" class="input_sr" id="selectkey" onFocus="this.value=''" value="请输入关健字"> 
            </td>
            <td width="45%" height="25"> <select name="selectm" id="select">
                <OPTION VALUE="name">按商品名称</OPTION>
                <OPTION VALUE="zuozhe">按商品品牌</OPTION>
                <OPTION VALUE="chubanshe">按商品简介</OPTION>
				<OPTION VALUE="code">按商品编号</OPTION>
            </select> </td>
            <td width="20%" height="25"><input name="Submit" type="submit" class="input_bot" onClick="return chkkey();" value="查 询"></td>
          </tr>
      </table>
      <br></td>
    </form>
  </tr>
</table>


<script language=javascript>
function test()
{
  if(!confirm('确认删除吗?')) return false;
}

function chkkey()
{
	if(document.form2.selectkey.value.length ==0){
	document.form2.selectkey.focus();
	alert("请输入查询关键字")
	return false;
	}
}
 
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -