?? cart_ordersave.asp
字號(hào):
<%
dim dbpath
dbpath=""
%>
<!--#include file="Conn.asp"-->
<!--#include file="include/MyRequest.asp" -->
<!--#include file="include/nosql.asp" -->
<!--#include file="include/base64.asp"-->
<!--#include file="alipay/alipay_md5.asp"-->
<!--#include file="alipay/alipay_payto.asp"-->
<!--#include file="include/pay.asp"-->
<%
Sub PutToShopBag( x, y )
If Len(y) = 0 Then
y = x
ElseIf InStr(y, x ) <= 0 Then
y = y & ","& x
End If
End Sub
ProdIds=Session("ProdIds")
ProdNums=Session("ProdNums")
if ProdIds<>"" then
Products = Split(ProdIds,",")
For i=0 To UBound(Products)
sql="select Product_info_name,product_info_PriceS from product_info where id="&Products(i)
Set rs=conn.Execute( sql )
Product_info_name = rs(0)
product_info_PriceS = rs(1)
PutToShopBag Product_info_name, ProdNames
PutToShopBag product_info_PriceS, ProdPrices
Next
end if
//購(gòu)物車狀態(tài)判斷
If Len(ProdIds) = 0 Then
response.write "<script language=javascript>alert('對(duì)不起,您的購(gòu)物車為空!');location.href=""index.asp"";</script>"
response.End
end if
'交易日期,格式:YYYYMMDD
yy=year(date)
mm=right("00"&month(date),2)
dd=right("00"&day(date),2)
'生成訂單號(hào)所有所需元素,格式為:小時(shí),分鐘,秒
xiaoshi=right("00"&hour(time),2)
fenzhong=right("00"&minute(time),2)
miao=right("00"&second(time),2)
order_info_no =yy & mm & dd & xiaoshi & fenzhong & miao
order_info_RealName =my_request("order_info_RealName",0)
order_info_mobile =my_request("order_info_mobile",0)
order_info_tel =my_request("order_info_tel",0)
order_info_email =my_request("order_info_email",0)
order_info_address =my_request("order_info_address",0)
order_info_zip =my_request("order_info_zip",0)
order_info_pay =my_request("order_info_pay",0)
order_info_ProdCost =session("sum")
order_info_BuyNote =my_request("order_info_BuyNote",0)
order_info_BuyIP =Request.servervariables("REMOTE_ADDR")
order_info_pay =my_request("order_info_pay",0)
order_info_deliver =my_request("order_info_deliver",0)
order_info_up =my_request("order_info_up",1)
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select root_deliver_cost from root_deliver where root_deliver_name='"&order_info_deliver&"'"
rs.open sql,conn,1,1
order_info_DeliverCost=rs(0)
rs.close
set rs=nothing
order_info_AllCost =order_info_DeliverCost+order_info_ProdCost
if order_info_no="" or order_info_RealName="" or (order_info_mobile="" and order_info_tel="") or order_info_address="" or order_info_pay="" or order_info_deliver="" then
response.write "<script language='javascript'>"
response.write "alert('信息填寫不完整!');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
else
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from Order_info"
rs.open sql,conn,1,3
rs.addnew
rs("order_info_no") =order_info_no
rs("order_info_RealName") =order_info_RealName
rs("order_info_mobile") =order_info_mobile
rs("order_info_tel") =order_info_tel
rs("order_info_email") =order_info_email
rs("order_info_address") =order_info_address
rs("order_info_zip") =order_info_zip
rs("order_info_pay") =order_info_pay
rs("order_info_deliver") =order_info_deliver
rs("order_info_DeliverCost")=order_info_DeliverCost
rs("order_info_ProdCost") =order_info_ProdCost
rs("order_info_AllCost") =order_info_AllCost
rs("order_info_BuyNote") =order_info_BuyNote
rs("order_info_BuyIP") =order_info_BuyIP
rs("order_info_BuyTime") =now()
rs("order_info_ProdIds") =ProdIds '訂單所有商品id集合
rs("order_info_ProdNums") =ProdNums '訂單所有商品數(shù)量集合
rs("order_info_ProdNames") =ProdNames '訂單所有商品名稱集合
rs("order_info_ProdPrices") =ProdPrices '訂單所有商品單價(jià)集合
rs.update
rs.close
set rs=nothing
'刪除購(gòu)物車的商品id與數(shù)量的會(huì)話值
Session.Contents.Remove("ProdIds")
Session.Contents.Remove("ProdNums")
Session.Contents.Remove("ProdPrices")
'Session.Contents.Remove("ProdNames")
Session.Contents.Remove("sum")
Session.Contents.Remove("y")
%>
<script LANGUAGE="JavaScript">
window.open ("Cart_OrderOk.asp?Order_info_no=<%=order_info_no%>&order_info_AllCost=<%=order_info_AllCost%>", "newwindow", "height=200, width=400, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
</script>
<% //付款方式處理
if order_info_pay=1 then '支付寶
sql="select root_AliPay_Email,root_AliPay_SafeCode,root_AliPay_ParterId from root_AliPay where id=1"
set rs=conn.execute (sql)
root_AliPay_Email =rs(0)
root_AliPay_SafeCode=rs(1)
root_AliPay_ParterId=rs(2)
rs.close
set rs=nothing
v_mid=replace(strAnsi2Unicode(Base64decode(strUnicode2Ansi(root_AliPay_Email))),chr(13)&chr(10),"<br>")
key1 =replace(strAnsi2Unicode(Base64decode(strUnicode2Ansi(root_AliPay_SafeCode))),chr(13)&chr(10),"<br>")
parterid=replace(strAnsi2Unicode(Base64decode(strUnicode2Ansi(root_AliPay_ParterId))),chr(13)&chr(10),"<br>")
call pay_AliPay()
Session.Contents.Remove("ProdNames")
else
response.redirect "Cart_OrderOk.asp?order_info_no="&order_info_no&"&order_info_AllCost="&order_info_AllCost&""
response.end
end if
end if
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -