📄 shopchannel.asp
字号:
End If
If DateDiff("D", Rs("HitsTime"), Now) <= 0 Then
Rs("DayHits") = Rs("DayHits") + 1
Else
Rs("DayHits") = 1
Rs("HitsTime") = Now
End If
Rs.Update
End If
Rs.Close
Set Rs = Nothing
If Len(ProductIDList) = 0 Then
ProductIDList = ProductID
Else
If CheckProductID(ProductID) Then
ProductIDList = ProductID & "," & ProductIDList
End If
End If
Call ReformProduct(ProductIDList,MaxProduct)
End If
strProductID = Newasp.CheckRequest(Request.Cookies("ProductIDList")("ProductID"),0)
If Len(strProductID) = 0 Then strProductID = 0
strContent = Newasp.HtmlSetting(2)
If strProductID = "0" Then
strContent = strContent & Newasp.HtmlSetting(5)
ShoppingHint = ""
Else
SQL = "SELECT TOP " & MaxProduct & " shopid,TradeName,NowPrice FROM [NC_ShopList] WHERE ChannelID=" & ChannelID & " And isAccept > 0 And shopid in (" & strProductID & ")"
Set Rs = Newasp.Execute(SQL)
If Rs.BOF And Rs.EOF Then
strContent = strContent & Newasp.HtmlSetting(5)
ShoppingHint = ""
Else
ShoppingHint = Newasp.HtmlSetting(7)
i = 0
Do While Not Rs.EOF
If (i Mod 2) = 0 Then
StyleList = 1
Else
StyleList = 2
End If
i = i + 1
QuantityID = "Quantity_" & Rs("shopid")
Quantity = Newasp.ChkNumeric(Request(QuantityID))
If Quantity = 0 Then Quantity = Newasp.ChkNumeric(Request.Cookies("ProductIDList")(QuantityID))
If Quantity = 0 Then Quantity = 1
Response.Cookies("ProductIDList")(QuantityID) = Quantity
UnitPrice = FormatNumber(Rs("NowPrice"), 2, -1)
TotalPrice = FormatNumber(UnitPrice * Quantity, 2, -1)
strContent = strContent & Newasp.HtmlSetting(3)
strContent = Replace(strContent, "{$ProductID}", Rs("shopid"))
strContent = Replace(strContent, "{$TradeName}", Rs("TradeName"))
strContent = Replace(strContent, "{$QuantityID}", QuantityID)
strContent = Replace(strContent, "{$Quantity}", Quantity)
strContent = Replace(strContent, "{$UnitPrice}", UnitPrice)
strContent = Replace(strContent, "{$TotalPrice}", TotalPrice)
strContent = Replace(strContent, "{$StyleList}", StyleList)
strContent = Replace(strContent, "{$Ordered}", i)
Rs.MoveNext
Loop
End If
Set Rs = Nothing
End If
strContent = strContent & Newasp.HtmlSetting(4)
strContent = Replace(strContent, "{$ShoppingHint}", ShoppingHint)
strContent = Replace(strContent, "{$MaxProduct}", MaxProduct)
HtmlContent = Replace(HtmlContent, "{$PublicContent}", strContent)
ReplaceString
Response.Write HtmlContent
End Sub
'=================================================
'函数名:CheckProductID
'作 用:判断购物车内商品是否重复
'=================================================
Private Function CheckProductID(ProductID)
Dim strProductID,arrProductID,i
On Error Resume Next
ProductID = Newasp.ChkNumeric(ProductID)
If ProductID = 0 Then
CheckProductID = False
Exit Function
End If
strProductID = Newasp.CheckRequest(Request.Cookies("ProductIDList")("ProductID"),0)
If Len(strProductID) = 0 Then
CheckProductID = True
Exit Function
End If
arrProductID = Split(strProductID, ",")
For i = 0 To UBound(arrProductID)
If CLng(arrProductID(i)) = ProductID Then
CheckProductID = False
Exit Function
End If
Next
CheckProductID = True
End Function
'=================================================
'函数名:ReformProduct
'作 用:重组购物车
'=================================================
Private Sub ReformProduct(strProductList,MaxProduct)
Dim AllProductList
Dim ArrayProduct(),arrProductList
Dim i,n
strProductList = Trim(strProductList)
If Len(strProductList) = 0 Then
Response.Cookies("ProductIDList") = ""
Else
arrProductList = Split(strProductList, ",")
If UBound(arrProductList) > 0 Then
n = 0
For i = 0 To UBound(arrProductList)
If i => MaxProduct Then Exit For
If Newasp.ChkNumeric(arrProductList(i)) > 0 Then
ReDim Preserve ArrayProduct(n)
ArrayProduct(n) = arrProductList(i)
n = n + 1
End If
Next
AllProductList = Join(ArrayProduct, ",")
Else
AllProductList = strProductList
End If
Response.Cookies("ProductIDList")("ProductID") = AllProductList
End If
End Sub
'///---购物车过程结束
'///----------------------------------------------
'///---订单提交过程开始
'=================================================
'过程名:BuildPayment
'作 用:订单提交
'=================================================
Public Sub BuildPayment()
Dim strContent,Action,OrderForm,ChineseMoney
Dim ErrorMsg,Surcharge,Consignee,Company
Dim Address,Phone,Postcode,Email,Oicq,Readme
Dim ActualMoney,TotalMoney,Rebate,strRebate
Dim strPayMode,PayMode,curdate,sRnd,userid
Dim PayDone,UserName,UserGrade,strProductID
Dim BuyCode
On Error Resume Next
strProductID = Newasp.CheckRequest(Request.Cookies("ProductIDList")("ProductID"),0)
userid = Clng(Newasp.memberid)
UserName = Newasp.CheckRequest(Newasp.membername,45)
UserGrade = CInt(Newasp.membergrade)
Action = LCase(Newasp.CheckInfuse(Request("action"),8))
skinid = CLng(Newasp.ChannelSkin)
Newasp.LoadTemplates ChannelID, 6, skinid
'--购物权限设置
If CInt(Newasp.GroupSetting(30)) = 0 Then
Call OutAlertScript(Newasp.CheckStr(Newasp.HtmlSetting(8)))
Exit Sub
End If
Rebate = CCur(Newasp.GroupSetting(28))
If Rebate > 0 And Rebate < 10 Then
strRebate = Rebate & " 折"
Else
strRebate = "无"
Rebate = 0
End If
If Len(strProductID) = 0 Then
FoundErr = True
ErrorMsg = "你的购物车为空,请选择商品后再提交!"
Response.Cookies("ProductIDList") = ""
End If
If Trim(Action) = "ok" Or Trim(Action) = "pay" Then
If Trim(Request.Form("surcharge")) = "" Then
FoundErr = True
ErrorMsg = "请选择配送方式!"
Else
Surcharge = Newasp.CheckNumeric(Request.Form("surcharge"))
End if
If Trim(Request.Form("consignee")) = "" Then
FoundErr = True
ErrorMsg = "收货人名称不能为空!"
Else
Consignee = Newasp.CheckInfuse(Request.Form("consignee"),45)
End if
If Trim(Request.Form("company")) = "" Then
Company = Trim(Request.Form("company"))
Else
Company = Newasp.CheckInfuse(Request.Form("company"),180)
End if
If Trim(Request.Form("address")) = "" Then
FoundErr = True
ErrorMsg = "收货人地址不能为空!"
Else
Address = Newasp.CheckInfuse(Request.Form("address"),180)
End if
If Trim(Request.Form("phone")) = "" Then
FoundErr = True
ErrorMsg = "收货人电话不能为空!"
Else
Phone = Newasp.CheckInfuse(Request.Form("phone"),35)
End if
If Trim(Request.Form("postcode")) = "" Then
FoundErr = True
ErrorMsg = "收货人邮政编码不能为空!"
Else
Postcode = Newasp.CheckInfuse(Request.Form("postcode"),35)
End if
If Not CheckEmail(Request.Form("email")) Then
FoundErr = True
ErrorMsg = "收货人Email输入错误!"
Else
Email = Newasp.CheckInfuse(Request.Form("email"),45)
End if
If Trim(Request.Form("oicq")) = "" Then
Oicq = Trim(Request.Form("oicq"))
Else
Oicq = Newasp.CheckInfuse(Request.Form("oicq"),30)
End if
If Trim(Request.Form("Readme")) = "" Then
Readme = Trim(Request.Form("Readme"))
Else
Readme = Newasp.CheckRequest(Request.Form("Readme"),220)
End if
If Trim(Request.Form("OrderID")) = "" Then
FoundErr = True
ErrorMsg = "交易订单号不能为空!"
Else
OrderForm = Newasp.CheckInfuse(Request.Form("OrderID"),45)
End if
End If
HtmlContent = Newasp.HtmlContent
HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
HtmlContent = Replace(HtmlContent, "{$ShopIndex}", strIndexName)
Select Case Trim(Action)
Case "ok" '--订单确认
HtmlContent = Replace(HtmlContent, "{$PageTitle}", "订单确认")
TotalMoney = CountTotalMoney
If Rebate = 0 Then
ActualMoney = TotalMoney + Surcharge
Else
ActualMoney = Newasp.RebateMoney(TotalMoney,Rebate) + Surcharge
End If
If TotalMoney = 0 Then
ErrorMsg ="非法操作,获取交易额错误!!!"
Founderr = True
End If
If ActualMoney = 0 Then
ErrorMsg ="非法操作,获取交易额错误!!!"
Founderr = True
End If
Surcharge = FormatNumber(Surcharge,2,-1)
TotalMoney = FormatNumber(TotalMoney,2,-1)
ActualMoney = FormatNumber(ActualMoney,2,-1)
ChineseMoney = Newasp.ChMoney(CCur(ActualMoney))
If FoundErr = False Then
strContent = Newasp.HtmlSetting(11)
strContent = Replace(strContent, "{$Surcharge}", Surcharge)
strContent = Replace(strContent, "{$Consignee}", Consignee)
strContent = Replace(strContent, "{$Company}", Company)
strContent = Replace(strContent, "{$Address}", Address)
strContent = Replace(strContent, "{$Phone}", Phone)
strContent = Replace(strContent, "{$Postcode}", Postcode)
strContent = Replace(strContent, "{$Email}", Email)
strContent = Replace(strContent, "{$Oicq}", Oicq)
strContent = Replace(strContent, "{$Readme}", Readme)
strContent = Replace(strContent, "{$ActualMoney}", ActualMoney)
strContent = Replace(strContent, "{$TotalMoney}", TotalMoney)
strContent = Replace(strContent, "{$Rebate}", strRebate)
strContent = Replace(strContent, "{$Discount}", Rebate)
strContent = Replace(strContent, "{$OrderID}", OrderForm)
strContent = Replace(strContent, "{$ChineseMoney}", ChineseMoney)
If CInt(Newasp.GroupSetting(37)) = 0 Then
strContent = Replace(strContent, "{$CodeStr}", 9999)
strContent = Replace(strContent, "{$CodeSetting}", " style=""display:none""")
Else
strContent = Replace(strContent, "{$CodeStr}", "")
strContent = Replace(strContent, "{$CodeSetting}", "")
End If
Else
strContent = Newasp.HtmlSetting(14)
strContent = Replace(strContent, "{$ErrorMsg}", ErrorMsg)
End If
Case "pay" '--订单确认成功
HtmlContent = Replace(HtmlContent, "{$PageTitle}", "订单提交成功")
PayMode = Newasp.ChkNumeric(Request("PayMode"))
TotalMoney = CCur(CountTotalMoney)
If TotalMoney = 0 Then
ErrorMsg ="非法操作,获取交易额错误!!!"
Founderr = True
End If
If Rebate = 0 Then
ActualMoney = CCur(TotalMoney + Surcharge)
Else
ActualMoney = Newasp.RebateMoney(TotalMoney,Rebate) + Surcharge
End If
ActualMoney = CCur(FormatNumber(ActualMoney))
ChineseMoney = Newasp.ChMoney(ActualMoney)
PayDone = 0
If ActualMoney = 0 Then
ErrorMsg ="非法操作,获取交易额错误!!!"
Founderr = True
End If
If CInt(Newasp.GroupSetting(37)) = 1 Then
If Not Newasp.CodeIsTrue() Then
ErrorMsg ="验证码校验失败,请返回刷新页面再试。"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -