28,409
社区成员




<%
UserName=Request.Cookies("WifeB2C_User")("UserName")
OrdersFrom=Request.Cookies("UnitOfNo1Th")("FromMemberID")
If OrdersFrom="" Then
sql="select UserFrom from UserInfo where UserName='"&UserName&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
If rs.eof or rs.bof then
OrdersFrom=""
else
OrdersFrom=rs("UserFrom")
end if
rs.close
Set rs=nothing
End If
%>
<%
if UserName="" then
Info="操作错误,原因可能是:\n您尚未注册或您还没有登陆!"
Action = "location='/UserInfo/Login.shtml'"
Call ShowMsgBox(Info, Action)
End If
%>
<%
'判断购物车是否为空,为SalesList赋值
SalesList=Session("SalesList")
Quatityt=Session("Quatityt")
If SalesList="" then
Info="操作错误,原因可能是:\n对不起,您的购物车为空请购物后查看!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
end if
'防止用户刷新重新提交订单
If Session("Sum")="0" then
Session("Sum")=""
Info="操作错误,原因可能是:\n对不起,您的订单已经提交过了,请不要重复提交!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
End if
'如果购买金额小于最低购买金额的处理
if Int(Application("WifeB2C_LoyBuy"))-Int(replace(Session("Sum"),",",""))>0 then
Info="操作错误,原因可能是:\n对不起,您现在的购物金额小于本站规定的最低金额无法进行结算!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
End if
%>
<%
'取得公用数据 [Session("sum")是经过处理加","的字串,SUM是没有处理的]
PSum=Replace(Request("Sum"),",","")
DeliMoney=Request("DeliMoney")
DeliID=Request("DeliID")
PayType=Request("PayType")
RealName=Request("RealName")
Phone=Request("Phone")
Mobile=Request("Mobile")
JiFen=Request("JiFen")
PostCode=Request("PostCode")
Email=Request("Email")
ReAddRess=Request("ReAddRess")
MsgContent=replace(request("MsgContent"),">",">")
MsgContent=replace(MsgContent,"<","<")
MsgContent=replace(MsgContent,"'","’")
If PSum="" or DeliMoney="" then
Info="操作错误,原因可能是:\n未知错误,信息丢失,请重新购买!"
Action="history.go(-2)"
Call ShowMsgBox(Info, Action)
End if
If DeliID="" then
Info="操作错误,原因可能是:\n请您选择合适的配送方式!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
If RealName="" or Phone="" or PostCode="" then
Info="操作错误,原因可能是:\n未填写收货人的姓名;\n未填写收货人的联系电话;\n未填写您收货地区的邮政编码。"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
If PayType="0" then
Info="操作错误,原因可能是:\n请您选择合适的结算方式!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
If ReAddRess="" then
Info="操作错误,原因可能是:\n请填写有效的收货地址!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
If Len(MemberName)>300 then
Info="操作错误,原因可能是:\n收货地址及其他要求不能超过300字。"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
%>
<%
'产生订单编号
yy=year(date)
mm=right("00"&month(date),2)
dd=right("00"&day(date),2)
idate=yy & mm & dd
xx=right("00"&hour(time),2)
ff=right("00"&minute(time),2)
mm=right("00"&second(time),2)
itime=xx & ff & mm
BillNo=idate & itime
%>
<%
'初始化用户选择的配送方式,产生对用户的反馈信息
sqlp="select * from DeliVery where ID=" & DeliID
set rsp=server.createobject("adodb.recordset")
rsp.open sqlp,conn,1,1
DeliVery=rsp("DeliVery")
DeliIntro=rsp("DeliIntro")
DeliTime=rsp("DeliTime")
rsp.close
set rsp=nothing
'结束
%>
<%
'初始化用户选择的结算方式,产生对用户的反馈信息
sqlp="select * from PayType where PayName='"&PayType&"'"
set rsp=server.createobject("ADODB.Recordset")
rsp.open sqlp,conn,1,1
If PayType="结算宝" or PayType="在线结算" then
PayIntro="空"
Else
PayIntro=rsp("PayIntro")
End if
rsp.close
set rsp=nothing
'结束
%>
<%
'开始向数据库里写订单信息
AllSum=int(PSum)+int(DeliMoney) '商品费用+配送费[取整]
Conn.execute "Insert into Orders (UserName,Mobile,ReAddRess,RealName,BillNo,JiFen,OrderTime,DeliID,AllSum,PayType,PostCode,Phone,SalesList,Quatityt,Ifpay,MsgContent,OrdersFrom) values ('"&UserName&"','"&Mobile&"','"&ReAddRess&"','"&RealName&"','"&BillNo&"','"&JiFen&"','"&Now()&"','"&DeliID&"','"&AllSum&"','"&PayType&"','"&PostCode&"','"&Phone&"','"&SalesList&"','"&Quatityt&"','"&IfPay&"','"&MsgContent&"','"&OrdersFrom&"')"
Conn.Execute "Update UserInfo Set OrderSum=OrderSum+'"&AllSum&"',OrderNo=OrderNo+1 where UserName='"&UserName&"'"
email2="368316627@qq.com"
mailserver="59.36.100.198"
Set msg = Server.CreateObject("JMail.Message")
Msg.ContentType="text/html"
fNote = "<span style=""FONT-SIZE: 13px;font-family: '宋体,Arial';""><B>你好!</B><BR><BR><B>有新订单需要处理了!</B>:<a href=""http://www.maiwenju.com/mideachen"" target=""_blank"">点击这里去查收</a><BR><BR><B>订单号码:</B>:"&BillNo&"<BR><BR><B>订购总金额:</B>:"&AllSum&" 元</span>"
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.From = "info@maiwenju.com"
msg.MailServerUserName ="info@maiwenju.com"
msg.MailServerPassword ="dddddd"
msg.FromName = "快而优系统自动发送"
msg.AddRecipient (email2)
msg.Subject = "老板!有人下订单了,快看看去吧!"
msg.Body = fNote
msg.Send (mailserver)
msg.close
set msg = nothing
%>
<%
'清空购物车的所有属性
Session("SalesList")=""
Session("Quatityt")=""
Session("ProductList")=""
Session("Sum")="0"
%>
<html>
<head>