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

📄 prod_info_list.asp

📁 网上购物系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="admin_check.asp"-->
<!--#include file="../Conn.asp"-->
<!--#include file="../include/MyRequest.asp"-->
<!--#include file="../include/pages.asp"-->
<%
Search_KeyWord	= my_request("KeyWord",0) 					'商品名称关键字
Search_cid		= my_request("cid",0)						'商品类别id
Search_Detail	= my_request("prod_info_detail",0)		'商品内容关键字
Search_PriceSMin= my_request("prod_info_PriceSMin",1)	'本站价格范围小值
Search_PriceSMax= my_request("prod_info_PriceSMax",1)	'本站价格范围大值
Search_Sort		= my_request("sort",1)						'结果排序

Search=""
if Search_KeyWord<>"" then
    Search=Search & " and prod_info_name like '%"&Search_KeyWord&"%'"
end if

if Search_cid<>"" then
    Search=Search & " and cid="&Search_cid
end if

if Search_Detail<>"" then
    Search=Search & " and prodcut_info_Detail like '%"&Search_Detail&"%'"
end if

if Search_PriceSMin<>"" and Search_PriceSMax<>"" then 
    Search=Search & " and (prod_info_PriceS Between "&Search_PriceSMin&" and "&Search_PriceSMax&")"
end if

if Search_PriceSMin<>"" and Search_PriceSMax="" then 
    Search=Search & " and prod_info_PriceS>"&Search_PriceSMin
end if

if Search_PriceSMin="" and Search_PriceSMax<>"" then 
	Search=Search & " and prod_info_PriceS<"&Search_PriceSMax
end if

if Search_Sort<>"" then
    select case Search_Sort
    case 1
        orderby=" order by addtime desc"
    case 2
        orderby=" order by addtime asc"
    case 3
        orderby=" order by id desc"
    case 4 
        orderby=" order by id asc"
    case 5
        orderby=" order by prod_info_name"
    case 6
        orderby=" order by prod_info_hitnums desc"
    case else
        orderby=" order by addtime desc"
    end select     
else
    orderby=" order by addtime desc"
end if
%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品信息管理</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script language = "JavaScript">   
var imgObj;
function checkImg(theURL,winName){
  // 对象是否已创建
  if (typeof(imgObj) == "object"){
    // 是否已取得了图像的高度和宽度
    if ((imgObj.width != 0) && (imgObj.height != 0))
      // 根据取得的图像高度和宽度设置弹出窗口的高度与宽度,并打开该窗口
      // 其中的增量 20 和 30 是设置的窗口边框与图片间的间隔量
      OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+20) + ",height=" + (imgObj.height+30));
    else
      // 因为通过 Image 对象动态装载图片,不可能立即得到图片的宽度和高度,所以每隔100毫秒重复调用检查
      setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
  }
}

function OpenFullSizeWindow(theURL,winName,features) {
  var aNewWin, sBaseCmd;
  // 弹出窗口外观参数
  sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,";
  // 调用是否来自 checkImg 
  if (features == null || features == ""){
    // 创建图像对象
    imgObj = new Image();
    // 设置图像源
    imgObj.src = theURL;
    // 开始获取图像大小
    checkImg(theURL, winName)
  }
  else{
    // 打开窗口
    aNewWin = window.open(theURL,winName, sBaseCmd + features);
    // 聚焦窗口
    aNewWin.focus();
  }
}

function loaded(myimg,mywidth,myheight)
{
 var tmp_img = new Image();
 tmp_img.src = myimg.src;
 image_x = tmp_img.width;
 image_y=tmp_img.height;

 if(image_x > mywidth)
 {
  tmp_img.height = image_y * mywidth / image_x;
  tmp_img.width = mywidth;

  if(tmp_img.height > myheight)
  {
   tmp_img.width = tmp_img.width * myheight / tmp_img.height;
   tmp_img.height=myheight;
  }
 }
 else if(image_y > myheight)
 {
  tmp_img.width = image_x * myheight / image_y;
  tmp_img.height=myheight;
  
  if(tmp_img.width > mywidth)
  {
   tmp_img.height = tmp_img.height * mywidth / tmp_img.width;
   tmp_img.width=mywidth;
  }
 }
  
 myimg.width = tmp_img.width;
 myimg.height = tmp_img.height;
}

//全选操作    
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>
<%
action=my_request("action",0)
select case action
case "删除"
	Call ProdDel()
case "下架"
	Call ProdOff()
case "上架"
	Call ProdOn()
case "设为新品"
	Call ProdNewY()
case "取消新品"
	Call ProdNewN()
case "设为推荐"
	Call ProdTJY()	
case "取消推荐"
	Call ProdTJN()
case "设为特价"
	Call ProdSpecY()	
case "取消特价"
	Call ProdSpecN()
case "确定"
	Call ProdClass()
end select

'过程:批量删除商品
sub ProdDel()
    id=my_request("id",0)
    if id<>"" then
       pp=ubound(split(id,","))+1 '判断数组id中共有几维
       for v=1 to pp
          id=request("id")(v)
          
          sql="select prod_info_PicB,prod_info_PicS from prod_info where id="&id
          set rs=conn.execute (sql)
          prod_info_PicB  =rs("prod_info_PicB")
          prod_info_PicS=rs("prod_info_PicS")
          rs.close
          set rs=nothing
          
          conn.execute ("delete from [prod_info] where id="&id)
          
          //删除相应商品图片
          Dbpath="../uploadpic/"&prod_info_PicS
          Dbpath=server.mappath(Dbpath)
          bkfolder="../uploadpic"
          Set Fso=server.createobject("scripting.filesystemobject")
          if fso.fileexists(dbpath) then
              If CheckDir(bkfolder) = True Then
                  fso.DeleteFile dbpath
              end if
          end if
          Set fso = nothing

          Dbpath1="../uploadpic/"&prod_info_PicB
          Dbpath1=server.mappath(Dbpath1)
          bkfolder1="../uploadpic"
          Set Fso=server.createobject("scripting.filesystemobject")
          if fso.fileexists(dbpath1) then
              If CheckDir(bkfolder1) = True Then
                  fso.DeleteFile dbpath1
              end if
          end if
          Set fso = nothing

       next

       response.write "<script language='javascript'>"
       response.write "alert('所选商品已经被删除!');"
       response.write "location.href='prod_info_list.asp';"
       response.write "</script>"
    end if
end sub

Function CheckDir(FolderPath)
    folderpath=Server.MapPath(".")&"\"&folderpath
    Set fso1 = CreateObject("Scripting.FileSystemObject")
    If fso1.FolderExists(FolderPath) then
       CheckDir = True
    Else
       CheckDir = False
    End if
    Set fso1 = nothing
End Function

function prodimgdel(id)
    set rs=server.CreateObject("adodb.recordset") '该行代码是设置rs为记录集
    Set fso = Server.CreateObject("Scripting.FileSystemObject") '建立fso对象
    '判断服务器是否支持fos对象
    'if err then 
        'err.clear
        'response.Write("不能建立fso对象,请确保你的空间支持fso:!")
        'response.end
    'end if
    
    //调出商品大小图片地址
    sql="select prod_info_PicB,prod_info_PicS from prod_info where id="&id
    set rs=conn.execute (sql)
    prod_info_PicB=rs("prod_info_PicB")
    prod_info_PicS=rs("prod_info_PicS")
    rs.close
    set rs=nothing

    '判定是否存在小图片文件:
    if fso.FileExists(server.MapPath("uploadpic/"&prod_info_PicS)) then
        '如果存在,删除该文件
        fso.DeleteFile server.MapPath("uploadpic/"&prod_info_PicS),true
        set fso=nothing
    end if
    '判定是否存在大图片文件:
    if fso.FileExists(server.MapPath("uploadpic/"&prod_info_PicB)) then
        '如果存在,删除该文件
        fso.DeleteFile server.MapPath("uploadpic/"&prod_info_PicB),true
        set fso=nothing
        call ok("所选信息已成功删除!","prod_info_list.asp")

    end if
end function

sub ProdOff()
    id=my_request("id",0)
    if id<>"" then
        pp=ubound(split(id,","))+1 '判断数组id中共有几维
        for v=1 to pp
            id=request("id")(v)
            conn.execute ("update prod_info set prod_info_onoff=1 where id="&id)
        next
       	response.write "<script language='javascript'>"
       	response.write "alert('所选商品均已设置为下架!');"
        response.write "location.href='prod_info_list.asp';"
        response.write "</script>"
    end if
end sub

sub ProdOn()
    id=my_request("id",0)
    if id<>"" then
        pp=ubound(split(id,","))+1 '判断数组id中共有几维
        for v=1 to pp
            id=request("id")(v)
            conn.execute ("update prod_info set prod_info_onoff=0 where id="&id)
        next
       	response.write "<script language='javascript'>"
       	response.write "alert('所选商品均已设置为上架!');"
        response.write "location.href='prod_info_list.asp';"
        response.write "</script>"
    end if
end sub

'批量修改分类
sub ProdClass()  
    id=my_request("id",0)
    cid1=my_request("cid1",1)
    if id<>"" then
        pp=ubound(split(id,","))+1 '判断数组id中共有几维
        for v=1 to pp
            id=request("id")(v)
            conn.execute ("update prod_info set cid="&cid1&" where id="&id)
        next
       	response.write "<script language='javascript'>"
       	response.write "alert('所选商品均已移动到指定类别!');"
        response.write "location.href='prod_info_list.asp';"
        response.write "</script>"
    end if
end sub

'批量新品
sub ProdNewY()  
    id=my_request("id",0)
    if id<>"" then
        pp=ubound(split(id,","))+1 '判断数组id中共有几维
        for v=1 to pp
            id=request("id")(v)
    		Set rs= Server.CreateObject("ADODB.Recordset")
    		sql="select prod_info_flag from prod_info where id="&id
    		rs.open sql,conn,1,3
    		prod_info_flag1=rs(0)
    		rs.close
    		set rs=nothing
    
   			prod_info_flag1=prod_info_flag1&",1"	
    		conn.execute ("update prod_info set prod_info_flag='"&prod_info_flag1&"' where id="&id)	
        next
       	response.write "<script language='javascript'>"
       	response.write "alert('所选商品均已设置为新品!');"
        response.write "location.href='prod_info_list.asp';"
        response.write "</script>"
    end if
end sub

'批量非新品
sub ProdNewN()  
    id=my_request("id",0)
    if id<>"" then

⌨️ 快捷键说明

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