<!--#include file="top.asp" -->
<%
'禁止网页缓存及涮新
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"
'禁止网页涮新
if session("userid")=userid and datediff("s",session("sj"),now())<30 then
Response.Write("<script>alert(""本购物系统启用了防涮新机制，不能重复提交该订单或涮新该网页。"");location.href=""index.asp?userid="&userid&";</script>")
response.end 
end if
'程序开始
if session("huiyuan")="" then 
response.write "<script>alert(""操作超时，请重新购买！给您造成的不便请您谅解。"");location.href=""index.asp?userid="&userid&";</script>"
response.end 
end if
if request("name")="" then 
response.write "<br><br><br><div align='center'>请留下您的真实姓名，谢谢！</div>"
response.end
end if
if request("dz")="" then 
response.write "<br><br><br><div align='center'>请留下您的联系地址，谢谢！</div>"
response.end
end if
if request("tel")="" then 
response.write "<br><br><br><div align='center'>请留下您的联系电话，谢谢！</div>"
response.end
end if
if Len(request("bz"))>500 then 
response.write "<br><br><br><div align='center'>错误提示:备注的内容不能大于500字!</div><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div align='center'><a href=# onclick='history.back()'>返回修改</a></div>"
response.end
end if

huiyuan= session("huiyuan")
user_name=rsuser("name")
name = Request("name")
yb = Request("yb")
tel = Request("tel")
mail = Request("mail")
dz=request("dz")
fk = Request("fk")
fs = Request("fs")
set rs = conn.execute("select * from fukuan where userid="&userid&" and fs='"&fs&"'")
if rs.eof then
rmb=0
peisong_fs="上门提货"
else
peisong_fs=rs("fs")
set rs1 = conn.execute("select sum(jg2) as rmb from ls_cart where userid="&userid&" and sessionid="&session.sessionid&"")
if rs1.eof then
Response.Write("<script>alert(""本购物系统启用了防涮新机制，不能重复提交该订单或涮新该网页。"");history.back();</script>")
response.end 
end if
jg=rs1("rmb")
rs1.close
Select case rs("rmb_fs")
   case "1"
     rmb=rs("rmb1")
   case "2"
	rmb="0"
   case "3"
   rmb2=rs("rmb2")
	if jg>=rmb2 then
	rmb=rs("rmb4")
	else
	rmb=rs("rmb3")
	end if
End Select
end if
rs.close
tx = Request.Form("tx")
'取得订单总金额
set rs = conn.execute("select * from ls_cart where userid="&userid&" and sessionid="&session.sessionid&"")
if rs.eof then
Response.Write("<script>alert(""本购物系统启用了防涮新机制，不能重复提交该订单或涮新该网页。"");history.back();</script>")
response.end 
end if
For I = 1 To rs.RecordCount
je1 = je1 + rs("jg1") * rs("sl")
je2 = je2 + rs("jg2") * rs("sl")
rs.MoveNext
Next
rs.close
'生成订单
zj=je2+rmb
conn.execute("Insert into cart(name,yb,tel,mail,dz,fk,peisong_fs,peisong_rmb,bz,tx,je,user_name,huiyuan)values('"&name&"','"&yb&"','"&tel&"','"&mail&"','"&dz&"','"&fk&"','"&peisong_fs&"',"&rmb&",'"&bz&"','"&tx&"',"&zj&",'"&user_name&"','"&huiyuan&"')")
'更新会员信息
conn.execute("Update huiyuan set name='"&name&"',yb ='"&yb&"',tel ='"&tel&"',mail='"&mail&"',dz ='"&dz&"' where huiyuan='"&huiyuan&"'")
'取得订单号
set rs = conn.execute("select id from cart where user_name='"&user_name&"' and huiyuan='"&huiyuan&"' order by sj desc")
cartid=rs("id")
rs.close
'取得订单信息
set rs = conn.execute("select * from ls_cart where userid="&userid&" and sessionid="&session.sessionid&" order by id")
'循环保存订单信息
do while not rs.eof
conn.execute("Insert into list(cartid,cpid,mc,sl,jg1,jg2)values("&cartid&","&rs("cpid")&",'"&rs("mc")&"',"&rs("sl")&","&rs("jg1")&","&rs("jg2")&")")
rs.movenext
loop
rs.close
'将本订单金额加入会员总消费
conn.execute("Update huiyuan set je = je+"&je2&" where huiyuan='"&huiyuan&"'")
'删除临时购物表
conn.execute("Delete ls_cart where userid="&userid&" and sessionid="&session.sessionid&"")
conn.execute("Delete ls_userid where userid="&userid&" and sessionid="&session.sessionid&"")
'生成防止页面涮新验证
session("sj")=now()
session("userid")=userid
%>
<table width="760" bgcolor="#ffffff" border="0" align="center" cellpadding="0" cellspacing="0" class="table-zuoyou">
  <tr>
    <td width="170" valign="top" bgcolor="#FFFFFF" class="table-you"> 
    <!--#include file="conn/logininc.asp" -->
	<!--#include file="conn/searchinc.asp" -->
	<!--#include file="conn/fenleiinc.asp" -->
    </TD>
    <td width="590" height="350" align="center" valign="top">
	 <!--#include file="conn/bannerinc.asp" --> 
	 <table width="590" border="0" align="center" cellpadding="0" cellspacing="0" class="table-shang">
         <tr>
          <td height="40" align="center" valign="middle"><img src="../image/lc3.gif" width="496" height="22"></td>
        </tr>
     <tr><td>
      <table width="90%" align="center" cellpadding="5">
        <tr> 
          <td valign="middle"> <%if len(cartid)<6 then
    for i=1 to 6-len(cartid)
    zero=0&zero
    next
     cartid2=zero&cartid
     else
    cartid2=right(cartid,6)
    end if
    BillNo=cartid2
    nian=Year(now())
    yue=Month(now())
    ri=Day(now())
    if len(yue)=1 then
    yue=0&yue
    end if
    if len(ri)=1 then
    ri=0&ri
    end if
   riqi=nian&yue&ri
'选择显示
 Select case fk 
   case "货到付款"
        response.write "您的订单号码是:<font color=ff3333>"
        response.write cartid&"</font>号，请住记您的订单号以便查询，谢谢！"
   case "邮局汇款"
       response.write "您的订单号码是:<font color=ff3333>"
       response.write cartid&"</font>号，请按页面下方的联系地址汇款，谢谢！"
	response.write  "<br>请在汇款人简短留言中注明您的订单号/用户名（非常重要）<br><br>"

   case "招商银行一网通"
	BranchID="0000"
    CoNo="000000"
    Amount=zj
   url="https://www.cmbchina.com/netpayment/BaseHttp.dll?PrePayC?BranchID="&BranchID&"&CoNo="&CoNo&"&BillNo="&BillNo&"&Amount="&Amount&"&Date="&riqi&""
   response.write "您的订单号码是:<font color=ff3333>"
   response.write cartid2&"<form name=form action=https://pay.chinabank.com.cn/zhilianxingjiekou.jsp method=post><input type=hidden name=productname value=商城安全支付中心><input type=hidden name=v_amount value="&Amount&"><input type=hidden name=v_url value=https://pay.chinabank.com.cn/zhilianxingjiekouresult.jsp><input type=hidden name=v_mid value=6493><input type=hidden name=SCompany value=网上商城><input type=hidden name=SAddress value=广东省东莞市清溪镇长山头半月弯旅社对面二楼><input type=hidden name=STel value=13723558747><input type=hidden name=SEmail value=zhu-137@126.com><input type=hidden name=beizhu value=null><input type=image name=PayBtnUrl src=../images/zifu.gif></form>"
End Select
%> </td>
        </tr>
      </table>
      <table width="530" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FF9900">
        <tr align="center" valign="middle" bgcolor="#FFFFE6"> 
          <td width="230" height="20">商品名称</td>
          <td width="75" height="20">市场价</td>
          <td width="75" height="20">会员价</td>
          <td width="75" height="20">订购数量</td>
          <td width="75">小计</td>
        </tr>
        <%set rs = conn.execute("select * from list where cartid="&cartid&" order by id desc")
		do while not rs.eof%>
        <tr valign="middle" bgcolor="#FFFFE6"> 
          <td width="230" height="20"><%=rs("mc")%></td>
          <td width="75" height="20" align="center"><%=rs("jg1")%></td>
          <td width="75" height="20" align="center"><%=rs("jg2")%></td>
          <td width="75" height="20" align="center"><%=rs("sl")%></td>
          <td width="75" align="center"><%=FormatNumber(csng(rs("jg2"))*rs("sl"),2)%></td>
        </tr>
        <%rs.movenext
loop
rs.close
%>
        <tr align="right" valign="middle"> 
          <td height="20" colspan="5" bgcolor="#FFFFFF">运费：<%=rmb%>元&nbsp; 合计总付款金额：<%=zj%>元（本次购物您节省了<%=je1-je2%>元)&nbsp;&nbsp; </td>
        </tr>
      </table>
      <br>
      <table width="530" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
        <tr>
          <td align="center" valign="top" bgcolor="#FFFFFF">
		  <%set rs = conn.execute("select * from ls_userid where sessionid="&session.sessionid&"")
if not rs.eof then
Response.Write("您的此次购物，同时选有多个商户的商品，您先结算其中一个商户的商品，您在购物车中仍然保留着其他商户的商品。请注意返回结算！<br>")
Response.write("<br><input name=Submit type=button class=go-wenbenkuang value=返回购物车继续结算 onclick=window.location='/cart.asp'><br><br>")
Response.Write("<SCRIPT LANGUAGE=javascript>alert('您的此次购物，同时选有多个商户的商品，您先结算其中一个商户的商品， 您在购物车中仍然保留着其他商户的商品。请注意继续结算其他商户的商品！')</SCRIPT>")
end if
rs.close
set rs=nothing%>
            如果您想知道自己的订单被处理的情况，<br>
            可随时进入“<a href="huiyuan-1.asp?userid=<%=userid%>">我的账户</a>”查询</td>
        </tr>
      </table> 
      </td>
  </tr>
</table></td>
  </tr>
</table>
<!--#include file="bd.asp" -->