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

📄 admin_shoppingcart.asp

📁 一本关于大学的书
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@language=vbscript codepage=936 %>
<%
Option Explicit
Response.buffer = True
Const PurviewLevel = 0
Const PurviewLevel_Channel = 0
Const PurviewLevel_Others = "ShoppingCart"
%>
<!--#include file="../Conn.asp"-->
<!--#include file="../Inc/Function.asp"-->
<!--#include file="Admin_ChkPurview.asp"-->
<%
Dim PE_DatePart_D, PE_DatePart_Y, PE_DatePart_M, PE_DatePart_W
If SystemDatabaseType = "SQL" Then
    PE_True = "1"
    PE_False = "0"
    PE_Now = "GetDate()"
    PE_DatePart_D = "d"
    PE_DatePart_Y = "yyyy"
    PE_DatePart_M = "m"
    PE_DatePart_W = "ww"
Else
    PE_True = "True"
    PE_False = "False"
    PE_Now = "Now()"
    PE_DatePart_D = "'d'"
    PE_DatePart_Y = "'yyyy'"
    PE_DatePart_M = "'m'"
    PE_DatePart_W = "'ww'"
End If
%>
<html>
<head>
<Title>购物车</Title>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />
<link href='Admin_Style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
  <tr class='topbg'>
    <td height='22' colspan='10'><table width='100%'><tr class='topbg'><td align='center'><b>购物车管理</b></td><td width='60' align='right'><a href='http://go.powereasy.net/go.aspx?UrlID=10047' target='_blank'><img src='images/help.gif' border='0'></a></td></tr></table></td>
  </tr>
  <tr class='tdbg' height='30'>
<form name='form1' action='Admin_ShoppingCart.asp' method='get'><td>快速查找:
<select size=1 name='SearchType' onChange='javascript:submit()'>
<option value='0' selected>所有购物车记录</option>
<option value='1'>今天的购物车记录</option>
<option value='2'>本周的购物车记录</option>
<option value='3'>本月的购物车记录</option>
</select>&nbsp;&nbsp;<a href='Admin_ShoppingCart.asp'>购物车管理首页</a></td></form>
<form name='myform' method='post' action='Admin_ShoppingCart.asp' onSubmit="return confirm('确实要删除指定的购物车记录吗?')"><td>
如果购物车明细记录太多,影响了系统性能,可以删除一定时间段前的记录以加快速度。<br>
时间范围:<input type='radio' name='DatepartType' value='0'>1天前&nbsp;&nbsp;<input type='radio' name='DatepartType' value='1'>1个星期前&nbsp;&nbsp;<input type='radio' name='DatepartType' value='2'>1个月前&nbsp;&nbsp;<input type='radio' name='DatepartType' value='3' checked>3个月前
&nbsp;&nbsp;<input type='submit' name='submit1' value='删除记录'>
<input type='hidden' name='Action' value='Clear'>
</td></form>
  </tr>
</table>
<%
Select Case Action
Case "Clear"
    Call Clear
Case "CartInfo"
    Call CartInfo
Case Else
    Call Main
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If

Sub Main()
    Dim MaxPerPage, TotalPut, CurrentPage, strFileName, i
    Dim sql, Querysql, rsCart
    MaxPerPage = PE_CLng(Trim(Request("MaxPerPage")))
    CurrentPage = PE_CLng(Trim(Request("Page")))
    If MaxPerPage <= 0 Then MaxPerPage = 20
    If CurrentPage <= 0 Then CurrentPage = 1
    strFileName = "Admin_ShoppingCart.asp"
    Querysql = Querysql & " where 1=1 "
    
    sql = "select top " & MaxPerPage & " C.CartID,Sum(P.Price * C.Quantity) as TotalPrice, Max(C.UserName) as UserName,Max(C.UpdateTime) as UpdateTime from PE_ShoppingCarts C inner join PE_Product P on P.ProductID=C.ProductID"
    Response.Write "<br><table width='100%'><tr><td align='left'><img src='images/img_u.gif' align='absmiddle'>您现在的位置:<a href='Admin_ShoppingCart.asp'>购物车管理</a>"
    
    If SystemDatabaseType = "SQL" Then
        TotalPut = PE_CLng(Conn.Execute("Select Count(DISTINCT CartID) from PE_ShoppingCarts")(0))
    Else
        TotalPut = PE_CLng(Conn.Execute("select Count(0) From (Select DISTINCT CartID from PE_ShoppingCarts)")(0))
    End If
    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
        Querysql = Querysql & " and C.CartItemID < (select min(minCartItemID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " Min(C.CartItemID) as minCartItemID from PE_ShoppingCarts C " & Querysql & " group by C.cartID  order by Min(C.CartItemID) desc) as QueryCartItemID)"
    End If
    sql = sql & Querysql & " group by C.cartID order by min(C.CartItemID) desc"

    Response.Write "</td></tr></table>"
    If FoundErr = True Then Exit Sub
    
    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr class='title' height='22' align='center'>"
    Response.Write "    <td width='140'><b>购物车时间</b></td>"
    Response.Write "    <td><b>购物车编号</b></td>"
    Response.Write "    <td width='120'><b>用户名</b></td>"
    Response.Write "    <td width='100'><b>预计金额</b></td>"
    Response.Write "    <td width='90'><b>操作</b></td>"
    Response.Write "  </tr>"
    
    Set rsCart = Server.CreateObject("Adodb.RecordSet")
    rsCart.Open sql, Conn, 1, 1
    If rsCart.BOF And rsCart.EOF Then
        TotalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何记录!</td></tr>"
    Else
        Do While Not rsCart.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "    <td width='140' align='center'>" & rsCart("UpdateTime") & "</td>"
            Response.Write "    <td align='center'><a href='Admin_ShoppingCart.asp?Action=CartInfo&CartID=" & rsCart("CartID") & "'>" & rsCart("CartID") & "</a></td>"
            Response.Write "    <td width='120' align='center'><a href='Admin_User.asp?Action=Show&InfoType=0&UserName=" & rsCart("UserName") & "'>" & rsCart("UserName") & "</a></td>"
            Response.Write "    <td width='100' align=center>" & FormatNumber(rsCart("TotalPrice"), 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "    <td width='90' align='center'><a href='Admin_ShoppingCart.asp?Action=CartInfo&CartID=" & rsCart("CartID") & "'>查看购物车</a></td>"
            Response.Write "  </tr>"
            i = i + 1
            If i >= MaxPerPage Then Exit Do
            rsCart.MoveNext
        Loop
    End If
    rsCart.Close
    Set rsCart = Nothing
    
    Response.Write ShowPage(strFileName, TotalPut, MaxPerPage, CurrentPage, True, True, "条购物车记录", True)

End Sub

Sub CartInfo()
    Dim CartID, UserName
    CartID = ReplaceBadChar(Trim(Request("CartID")))
    If CartID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定CartID!</li>"
        Exit Sub
    End If

    Dim rsCart
    Set rsCart = Conn.Execute("select top 1 * from PE_ShoppingCarts where CartID='" & CartID & "'")
    If rsCart.BOF And rsCart.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的购物车信息!</li>"
        rsCart.Close
        Set rsCart = Nothing
        Exit Sub
    End If
    UserName = rsCart("UserName")

    Dim sqlUser, GroupType, rsUser, UserSetting, Discount_Member
    Dim rsCartItem, dblAmount, dblTruePrice, dblTotal, dblPrice, dblSubtotal, dblTempPrice
    Dim strSaleType, PresentList


    Response.Write "<br><table width='100%'><tr><td align='left'><img src='images/img_u.gif' align='absmiddle'>您现在的位置:<a href='Admin_ShoppingCart.asp'>购物车管理</a>&nbsp;&gt;&gt;&nbsp;购物车信息"
    Response.Write "</td></tr></table>"

    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr align='center' class='title'>"
    Response.Write "    <td height='22'><b>购 物 车 信 息</b>(购物车编号:" & CartID & ")</td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td height='25'>"

    Response.Write "   <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1'>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>用户名:</td>"
    Response.Write "          <td width='38%'><a href='Admin_User.asp?Action=Show&InfoType=0&UserName=" & rsCart("UserName") & "'>" & rsCart("UserName") & "</a> </td>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>购物车时间:</td>"
    Response.Write "          <td width='38%'>" & rsCart("UpdateTime") & "</td>"
    Response.Write "        </tr>"
    Dim ContacterName, Phone, Address, ZipCode, Email, Mobile
    If UserName = "" Then
        ContacterName = ""
        Phone = ""
        Address = ""
        ZipCode = ""
        Email = ""
        Mobile = ""
        GroupType = 0
        UserSetting = Split("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
    Else
        sqlUser = "SELECT U.ContacterID,U.SpecialPermission,U.UserSetting,G.GroupType,G.GroupSetting FROM PE_User U inner join PE_UserGroup G on U.GroupID=G.GroupID WHERE UserName='" & UserName & "'"
        Set rsUser = Conn.Execute(sqlUser)
        If rsUser.BOF And rsUser.EOF Then
            ContacterName = ""
            Phone = ""
            Address = ""
            ZipCode = ""
            Email = ""
            Mobile = ""
            GroupType = 0
            UserSetting = Split("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
        Else
            GroupType = rsUser("GroupType")
            If rsUser("SpecialPermission") = True Then
                UserSetting = Split(rsUser("UserSetting"), ",")
            Else
                UserSetting = Split(rsUser("GroupSetting"), ",")
            End If
            Dim rsContacter
            Set rsContacter = Conn.Execute("select TrueName,HomePhone,Address,ZipCode,Email,Mobile from PE_Contacter where ContacterID=" & rsUser("ContacterID") & "")
            If rsContacter.BOF And rsContacter.EOF Then
                ContacterName = ""
                Phone = ""
                Address = ""
                ZipCode = ""
                Email = ""
                Mobile = ""
            Else
                ContacterName = rsContacter("TrueName")
                Phone = rsContacter("HomePhone")
                Address = rsContacter("Address")
                ZipCode = rsContacter("ZipCode")
                Email = rsContacter("Email")
                Mobile = rsContacter("Mobile")
            End If
            rsContacter.Close
            Set rsContacter = Nothing
        End If
        rsUser.Close
        Set rsUser = Nothing
    End If
    rsCart.Close
    Set rsCart = Nothing

    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>收货人姓名:</td>"
    Response.Write "          <td width='38%'>" & ContacterName & "</td>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>联系电话:</td>"
    Response.Write "          <td width='38%'>" & Phone & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg' valign='top'>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>收货人地址:</td>"
    Response.Write "          <td width='38%'>" & Address & "</td>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>邮政编码:</td>"
    Response.Write "          <td width='38%'>" & ZipCode & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>收货人邮箱:</td>"
    Response.Write "          <td width='38%'>" & Email & "</td>"
    Response.Write "          <td width='12%' class='tdbg5' align='right'>收货人手机:</td>"
    Response.Write "          <td width='38%'>" & Mobile & "</td>"
    Response.Write "        </tr>"
    Response.Write "    </table>"
    Response.Write "    </td>"
    Response.Write "   </tr>"
    

    Response.Write "  <tr>"
    Response.Write "    <td>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' bgcolor='#0099FF'>"
    Response.Write "  <tr align='center' class='tdbg2' height='25'>"
    Response.Write "    <td><b>商 品 名 称</b></td>"
    Response.Write "    <td width='45'><b>单位</b></td>"
    Response.Write "    <td width='55'><b>数量</b></td>"
    Response.Write "    <td width='85'><b>原价</b></td>"
    Response.Write "    <td width='85'><b>实价</b></td>"
    Response.Write "    <td width='85'><b>金 额</b></td>"
    Response.Write "    <td width='65'><b>服务期限</b></td>"
    Response.Write "  </tr>"

    Discount_Member = PE_CDbl(UserSetting(11))
    PresentList = SelectCart(CartID, 1)
        
    Set rsCartItem = Conn.Execute("select P.*,C.Quantity,C.CartItemID from PE_Product P inner join PE_ShoppingCarts C on C.ProductID=P.ProductID where C.CartID='" & CartID & "' and C.PresentID=0 and P.ProductType<>4 order by C.CartItemID desc")

⌨️ 快捷键说明

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