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

📄 order.asp

📁 线上售货网管理模组
💻 ASP
字号:
<html>
<head><title>查看购物袋</title>
<link REL="stylesheet" HREF="style.css" TYPE="text/css">
</head>
<body bgcolor=cfe3f2>
<%
'*****简体中文版 by 资源搜罗站 [http://www.99ss.net]*****
   '判断Hidden栏位「mytype」
      Select Case LCase(Request("mytype"))
      Case "insert":
        Call Insert_cd  '新增一笔资料到购物袋
      Case "query":
        Call Query_cd   '查看购物袋内容
      Case "update":
        Call Update_cd  '更正购物袋内容
      Case "cancel":
        Call Cancel_cd  '清除购物袋所有内容
   End Select
%>
</body></html>

<script Language="VBScript" RunAt="Server">
Dim arrAreana, arrDatano, arrDatana, arrPrice, arrQty, arrDate

Sub Assign_session(i)
  '目的:Assign responding session variables
  arrAreana = "arrAreana." & i
  arrdatano = "arrDatano." & i
  arrdatana = "arrDatana." & i 
  arrPrice = "arrPrice." & I
  arrQty = "arrQty." & i 
  arrDate = "arrDate." & i
End Sub

Sub Show_footer(msg)
  Response.Write "<center><h2>"
  Response.Write msg
  Response.Write "</h2>"
  Response.Write "<a href=new.asp>看看新卡</a>"
  Response.Write "</center>"
End Sub

Sub Query_cd()
  '目的:查看购物袋内容
  Dim i, dis_price, intPrice, ordprice, allQty
  '购物袋尚未有任何组件
  If Session("purNO") = 0 Then
     Show_footer "尚未挑选任一物至购物袋(或已全部取消)!"
  Else
     Response.Write "<center><font size=6>"
     Response.Write "您目前选购了下列卡片</font><br>"
     Response.Write "<TABLE border='1' cellpadding='2' width='99%'>"
     Response.Write "<tr align='center' bgcolor='lightblue'>"
     Response.Write "<td width='6%'>No</td>"
     Response.Write "<td width='54%'>组件名称</td>"
     Response.Write "<td width='8%'>定价</td>"
     Response.Write "<td width='8%'>数量</td>"
     Response.Write "<td width='8%'>小计</td>"
     Response.Write "<td width='15%'>交易时间</td></tr>"
     Response.Write "<FORM METHOD='POST'>"
     intPrice = 0  '总计金额
     For i = 1 to Session("purNO")
        Assign_session i
        dis_price=Session(arrPrice)
        Response.Write "<TR align=center>"
        '按下「变更」钮後,再呼叫自己更新数量
        Response.Write "<TD>" & i & "</TD>"
        Response.Write "<TD align='left'><a href=show.asp?datano=" & Session(arrDatano) & ">" & Session(arrDatana) & "</a></TD>"
        Response.Write "<TD><strike>" & Session(arrPrice) & "</strike></TD>"
        Response.Write "<TD>"
        Response.Write "<input type='text' name='Qty" & i & "' size='3'"
        Response.Write " value='" & Session(arrQty) & "' maxlength='5'>"
        Response.Write "</TD>"
        Response.Write "<TD><font color='blue'>" & Session(arrPrice) * Session(arrQty) & "</font></TD>"
        Response.Write "<TD><font size=2>" & Session(arrDate) & "</font></TD>"
        Response.Write "</TR>"
        allQty = allQty + Session(arrQty)
        intPrice = intPrice + Session(arrPrice) * Session(arrQty)
        ordprice = ordprice + Session(arrPrice) * Session(arrQty)
     Next
     Response.Write "<tr>"
     Response.Write "<td colspan='7'>订购套数:" & allQty &"套"
     Response.Write "金额<font color='blue'>" & intPrice+100 & "</font>"
     Response.Write "元(加邮局代收费 <font color=red>100</font>元)</td><tr>"
     Response.Write "<td width='100%' colspan='7'>"
     Response.Write "欲更改订购数量,请务必按下<input type='submit'"
     Response.Write " value='更改' name='update'>钮,以便重算总额,数量为0即取消该笔订阅。"
     Response.Write "会员以九折优待,采<font color=blue>邮局代收</font>方式,每次加收邮局代收费100元。"
     Response.Write "到柜抬结帐时,请别忘了加入会员比较划算喔!"
     Response.Write "<input TYPE='HIDDEN' NAME='mytype'"
     Response.Write " VALUE='update'>"
     Response.Write "</td></tr>"
     Response.Write "</form>"
     Response.Write "</table><br>"
     Response.Write "<form method='post'>"
     Response.Write "<table border=0><tr><td valign=top>"
     Response.Write "<input TYPE='HIDDEN' NAME='mytype' VALUE='cancel'>"
     Response.Write "<input type='submit' name='cancel' value='取消所有订单'>"
     Response.Write "</td></form>"
     Response.Write "<td valign=top><a href=new.asp><img src=img/new1.gif border=0 alt=最近新书></a> "
     Response.Write "<a href=register.asp><img src=img/register.gif border=0 alt=结帐></a></td>"
     Response.Write "<td><img src=img/boy.gif></td></tr></table>"
  End If
End Sub

Sub Update_cd()
  '目的:更正订购数量
  Dim i, fldQty, intQty, recno
  Dim sndDatano(), sndDatana(), sndPrice(), sndQty(), sndDate()
  i = Session("purNO")
  ReDim sndDatano(i), sndDatana(i), sndPrice(i), sndQty(i), sndDate(i)
  recno = 0
  For i = 1 to Session("purNO")
     fldQty = "Qty" & i
     intQty = CInt(Request.Form(fldQty))
     'Response.Write "intQty = " & intQty & "<br>"
     If intQty > 0 Then  '存到Stack(堆叠)中
        recno = recno + 1
        Assign_session i
        sndDatano(recno) = Session(arrDatano)
        sndDataNa(recno) = Session(arrDatana)
        sndPrice(recno) = Session(arrPrice)
        sndQty(recno) = intQty
        sndDate(recno) = Session(arrDate)
     End If  '120
  Next
  If recno > 0 Then
     Session("purNO") = recno
     For i = 1 to recno  '从stack存回Session阵列变数
        Assign_session i
        Session(arrDatano) = snddatano(i)
        Session(arrDatana) = sndDatana(i)
        Session(arrPrice) = sndPrice(i)
        Session(arrQty) = sndQty(i)
        Session(arrDate) = sndDate(i)
     Next
  End If
  Call Query_cd   '显示购物袋内容
End Sub

Sub Cancel_cd
  '目的:取消所有订单
  '实№上不清除阵列资料,只要reset Session变数即可
  Session("purNO") = 0
  Show_footer "订单已全部取消!"
End Sub

Sub Ins_to_Arr(areana, datano, datana, ordprice)
  '目的:新增一笔书籍至阵列中
  Dim j
  Session("purNO") = Session("purNO") + 1
  j = Session("purNO")
  Assign_session j
  Session(arrAreana) = areana 
  Session(arrDatano) = datano
  Session(arrDatana) = datana
  'Response.Write "Session(arrName) = " & Session(arrName) & "<br>"
  Session(arrPrice) = ordprice
  Session(arrQty) = 1
  Session(arrDate) = Now
End Sub

Sub Insert_cd()
  '目的:新增购物袋内容
  Dim i, chk_exist
  '书籍编号、书名与售¤
  Dim Areana, Datano, Datana, ordprice
  Areana = Request("Areana")
  Datano = Request("Datano")
  Datana = Request("Datana")
  ordprice = CInt(Request("ordprice"))
  '先检查是否有订阅的CD,若无,新增一笔书籍资料到阵列中
  If Session("purNO") = 0 Then
     Ins_to_Arr Areana, Datano, Datana, ordprice
  Else  '否则检查是否与现有CD编号重覆
     chk_exist = False
     For i = 1 to Session("purNO")
        Assign_session i  
        If Session(arrDatano) = datano Then
           chk_exist = True
           Session(arrQty) = Session(arrQty) + 1
           Exit For
        End If
     Next
     If Not chk_exist Then
        Ins_to_Arr areana, datano, datana, ordprice
     End If
  End If
  Call Query_cd   '显示购物袋内容
End Sub
</script>

⌨️ 快捷键说明

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