📄 shopcart.asp
字号:
<!--#include file="menkan2.asp"-->
<!--#include file="OrderFunction.asp"-->
<%
id=request.querystring("id")
action=request.querystring("action")
select case action
case"list"
call list()
case"add"
call AddProduct(id,1)
response.Redirect "?"
case"del"
call DelProduct(id)
response.Redirect "?"
case"delall"
Session("Products")=""
Session("ProductsNum")=""
response.Redirect "?"
case"checkout"
strSql="Select UID,Udian From Users Where UId="&Session("UserId")
Set rs=conn.Execute(strSql)
Udian=rs("Udian")
if Udian>GetTotalMoney() then
response.Write "<br><br><br><br><div align=center>货款已扣除!订单编号:"
call checkout()
response.Write "<br><br><br>【<A href='javascript:window.close()'>关闭</a>】</div>"
else
response.write "<META http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
response.write "<script language='javascript'>"
response.write "alert('系统提示:帐户余额不足!');history.go(-1);"
response.write "</script>"
response.end
end if
case else
call list()
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="Image/Main.css" rel="stylesheet" type="text/css" />
<title>购物车</title>
</head>
<body>
<%sub list%>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
<tr>
<td colspan="5" align="center" bgcolor="#eeeeee">购物车</td>
</tr>
<tr>
<td width="5%"> </td>
<td width="50%" align="center">商品名称</td>
<td width="15%" align="center">数量</td>
<td width="15%" align="center">单价</td>
<td width="15%" align="center">操作</td>
</tr>
<%
arry=Session("Products")
Num=Session("ProductsNum")
If IsArray(arry)=true Then
for i=LBound(arry) to UBound(arry)
set rs=server.CreateObject("adodb.recordset")
sql="select * from product where productid="&arry(i)&""
rs.open sql,conn,1,1
%>
<tr>
<td align="center">
<%
ii=i+1
if len(ii)=1 then
response.Write "0"&ii
else
response.Write ii
end if
%>.
</td>
<td><%=rs("productname")%></td>
<td align="center"><%=Num(i)%></td>
<td align="center"><%=rs("productprice")%></td>
<td align="center"><a href="?action=del&id=<%=rs("productid")%>">删除</a></td>
</tr>
<%
rs.close
set rs=nothing
next
%>
<tr>
<td colspan="2">帐户余额:
<%
strSql="Select UID,Udian From Users Where UId="&Session("UserId")
Set rs=conn.Execute(strSql)
response.Write rs("Udian")&"元"
%>
</td>
<td align="center">共计:<%=GetTotalNum()%>件</td>
<td align="center">总价:<%=GetTotalMoney()%>元</td>
<td align="center">【<a href="?action=checkout">结账</a>】【<a href="?action=delall">清空</a>】</td>
</tr>
</table>
<%
end if
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -