www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > chinese/cart_checkout.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../opendb.asp" -->
<!--#include file="../common/md5.asp" -->
<!--#include file="../common/Alipay_Payto.asp" -->
<% 
Call DisableOutSite()
Dim ThisLang
ThisLang=0
dim orderid,action,rsorder
orderid=request.Cookies(cookies_name)("orderid")
action=Request.Form("action")

if request.Cookies(cookies_name)("orderlang")="en" then conn.execute("delete from cnk_orderdetail where orderid='"&orderid&"'")
Response.Cookies(cookies_name)("orderlang")="cn"

if orderid="" then call alertmsgc("请重新添加产品")
set rsorder=conn.execute("select count(*) from cnk_orderdetail where orderid='"&orderid&"'")
if rsorder(0)=0 then  call alertmsgc("询价车里没有产品")

dim thisusername,sex,address,postcode,tel,fax,email,company,baojiafangshi,note,sendway,sendprice,totalprice,alltotalprice
Dim truename,UserFace,idcard,UserIM,mobile
if username<>"" then
	rs.open "select truename,sex,UserFace,idcard,UserIM,address,tel,fax,mobile,email from cnk_users where username='"&username&"'",conn,1,1
	if rs.recordcount>0 then
		truename=rs("truename")
		sex=rs("sex")
		UserIM=rs("UserIM")
		address=rs("address")
		tel=rs("tel")
		fax=rs("fax")
		mobile=rs("mobile")
		email=rs("email")
	end if
	rs.close
end if

if truename<>"" then username=truename
if sex="" then sex=1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>购物车 -<%= sitename %></title>
<meta name="Author" content="Powered by websys.cn - Asean Leung">
<link href="<%=UpDir%>skin/cnk/cnkcss.css" rel="stylesheet" type="text/css" />
<link href="<%=UpDir%>skin/cnk/sys.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript" src="<%=UpDir%>common/com.js"></script>
</head>

<body>
<div style="width:980px; background-color:#FFFFFF; margin-top:20px;">
  <% Select Case action
Case "" %>
  <% Select Case isShop
	Case 0 Response.Write("购物功能已经关闭")
	Case 1 %>
  <div class="articletitle">填写询价资料</div>
  <div class="formlist">
    <form name="chkoutform" method="post" action="cart_checkout.asp" onSubmit="return checkout();">
      <ul>
        <li class="t1"><span class="red">*</span> 姓名:</li>
        <li class="t2">
          <input name="username" type="text" id="username" class="input" value="<%= username %>" size="50" maxlength="20" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> 性别:</li>
        <li class="t2">
          <input name="sex" type="radio" value="1" <% If sex=1 Then Response.Write("checked=""checked""")%> />
          先生
          <input type="radio" name="sex" value="0" <% If sex=0 Then Response.Write("checked=""checked""")%> />
          女士/小姐</li>
      </ul>
      <ul>
        <li class="t1"> 公司名:</li>
        <li class="t2">
          <input name="company" type="text" id="company" class="input" size="50" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> <span class="red">*</span> 地址:</li>
        <li class="t2">
          <input name="address" type="text" id="address" class="input" value="<%= address %>" size="50" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> 邮编:</li>
        <li class="t2">
          <input name="postcode" type="text" id="postcode" class="input" size="50" maxlength="8" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> <span class="red">*</span> 电话:</li>
        <li class="t2">
          <input name="tel" type="text" id="tel" class="input" value="<%= tel %>" size="50" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> 传真:</li>
        <li class="t2">
          <input name="fax" type="text" id="fax" class="input" value="<%= fax %>" size="50" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> <span class="red">*</span> E-mail:</li>
        <li class="t2">
          <input name="email" type="text" id="email" class="input" value="<%= email %>" size="50" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="t1"> 报价方式:</li>
        <li class="t2">
          <input name="baojiafangshi" type="checkbox" id="baojiafangshi" value="传真" />
          传真
          <input name="baojiafangshi" type="checkbox" id="baojiafangshi" value="E-mail" />
          E-mail</li>
      </ul>
      <ul>
        <li class="t1"> 备注说明:</li>
        <li class="t2">
          <input name="note" type="text" id="note" class="input" size="50" maxlength="255">
          255字以内</li>
      </ul>
      <ul>
        <li class="t1">&nbsp;
          <input name="action" type="hidden" id="action" value="submitorder">
        </li>
        <li class="t2">
          <input type="submit" name="Submit" class="button" value="提交">
        </li>
      </ul>
      <div class="clearboth"></div>
    </form>
  </div>
  <% Case 2 %>
  <div class="articletitle">我的购物车</div>
  <div class="cnktable">
    <table border="0" align="center" cellpadding="2" cellspacing="1">
      <tr class="tabletitle">
        <td width="9%"> 编号</td>
        <td width="33%">产品名称</td>
        <td width="17%">数量</td>
        <td width="21%">单价
          <%if weblevel<>"" then Response.Write("("&GetWebLevelName(weblevel)&")") %></td>
        <td width="20%">小计</td>
      </tr>
      <% 
	   dim bh,totalcount,totalone
	   bh=1
	   totalcount=0
	   totalprice=0
	  rs.open "select cnk_orderdetail.id,cnk_orderdetail.orderid,cnk_orderdetail.quantity,cnk_orderdetail.pid,cnk_orderdetail.price,cnk_products.product_model,cnk_products.product_name from cnk_orderdetail,cnk_products where cnk_orderdetail.pid=cnk_products.id and cnk_orderdetail.orderid='"&orderid&"' order by cnk_orderdetail.id",conn,1,1 
	do while not rs.eof
	totalone=rs("price")*rs("quantity")
	%>
      <tr align="center">
        <td><%= bh %></td>
        <td align="left"><a href="product.asp?id=<%= rs("pid") %>" target="_blank"><%= rs("product_name") %></a></td>
        <td><%= rs("quantity") %></td>
        <td>¥ <%= rs("price") %></td>
        <td>¥ <%= totalone %></td>
      </tr>
      <% totalcount=totalcount+rs("quantity")
	  totalprice=totalprice+totalone
	bh=bh+1	
	rs.movenext
	loop
	rs.close %>
      <tr>
        <td height="38" colspan="5" align="center">购物车里有:<font color="#FF0000"><strong><%= totalcount %></strong></font> 个商品, 商品总价: <font color="#FF0000"><strong>¥ <%= totalprice %></strong></font> 元
          <input name="Submit2" type="button" class="button" value="返回修改" onClick="history.go(-1);" /></td>
      </tr>
    </table>
  </div>
  <form name="chkoutform" method="post" action="cart_checkout.asp" onSubmit="return checkout();">
    <div class="cartbox">
      <div class="boxtitle">收货信息</div>
      <ul>
        <li class="tt1"><span class="red">*</span> 收货人:</li>
        <li class="tt2">
          <input name="username" type="text" class="input" id="username" value="<%= username %>" size="40" maxlength="20" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> 性别:</li>
        <li class="tt2">
          <input name="sex" type="radio" value="1" <% If sex=1 Then Response.Write("checked=""checked""")%> />
          先生
          <input type="radio" name="sex" value="0" <% If sex=0 Then Response.Write("checked=""checked""")%> />
          女士/小姐</li>
      </ul>
      <ul>
        <li class="tt1"> 单位(公司)名称:</li>
        <li class="tt2">
          <input name="company" type="text" class="input" id="company" size="40" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> <span class="red">*</span> 地址:</li>
        <li class="tt2">
          <input name="address" type="text" class="input" id="address" value="<%= address %>" size="40" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> 邮编:</li>
        <li class="tt2">
          <input name="postcode" type="text" class="input" id="postcode" size="40" maxlength="8" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> <span class="red">*</span> 电话:</li>
        <li class="tt2">
          <input name="tel" type="text" class="input" id="tel" value="<%= tel %>" size="40" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> <span class="red">*</span> E-mail:</li>
        <li class="tt2">
          <input name="email" type="text" id="email" class="input" value="<%= email %>" size="40" maxlength="50" />
          &nbsp;</li>
      </ul>
      <ul>
        <li class="tt1"> 备注说明:</li>
        <li class="tt2">
          <input name="note" type="text" class="input" id="note" size="40" maxlength="255">
          &nbsp;</li>
      </ul>
      <div class="clearboth"></div>
    </div>
    <div class="cartbox">
      <div class="boxtitle">发货方式</div>
      <ul>
        <li class="tt1"> 选择物流:</li>
        <li class="tt2">
          <% dim xh
		xh=1
		rs.open "select * from cnk_sendway where Lang=0",conn,1,1
		do while not rs.eof %>
          <input type="radio" name="sendway" value="<%= rs("id") %>" id="sendway<%= rs("id") %>" <% If xh=4 Then Response.Write("checked=""checked""")%> />
          <label for="sendway<%= rs("id") %>"><%= rs("sendname") %>,运费:<%= rs("sendprice") %>元</label>
          <br />
          <% rs.movenext
		xh=xh+1
		loop
		rs.close %>
        </li>
      </ul>
    </div>
    <div class="clearboth"></div>
    <div align="center">
      <br />
      <input name="action" type="hidden" id="action" value="submitorder">
      <input name="totalprice" type="hidden" id="totalprice" value="<%= totalprice %>">
      <input type="submit" name="Submit" class="button" value=" 提交订单 ">
    </div>
  </form>
  <% End Select %>
  <% Case "submitorder"
thisusername=Trim(Request.Form("username"))
sex=Trim(Request.Form("sex"))
address=Trim(Request.Form("address"))
postcode=Trim(Request.Form("postcode"))
tel=Trim(Request.Form("tel"))
fax=Trim(Request.Form("fax"))
email=Trim(Request.Form("email"))
company=Trim(Request.Form("company"))
baojiafangshi=Trim(Request.Form("baojiafangshi"))
note=Trim(Request.Form("note"))
sendway=Trim(Request.Form("sendway"))
totalprice=Trim(Request.Form("totalprice"))
alltotalprice=totalprice+sendprice

rs.open "select * from cnk_orderform where id is null",conn,1,3
rs.addnew
rs("orderid")=orderid
if userid<>"" then rs("userid")=userid
rs("username")=thisusername
rs("sex")=sex
rs("company")=company
rs("address")=address
rs("postcode")=postcode
rs("tel")=tel
rs("email")=email
rs("note")=note
if isShop=1 then
rs("fax")=fax
rs("baojiafangshi")=baojiafangshi
rs.update
rs.close
conn.execute("update cnk_orderdetail set isorder=1 where orderid='"&orderid&"'")
Response.Cookies(cookies_name)("orderid")=""
call alertmsgc("提交询价成功,我们会尽快回复您,谢谢")
end if
if isShop=2 then
sendprice=GetSentprice(Trim(Request.Form("sendway")))
rs("sendway")=sendway
rs("sendpay")=sendprice
rs("totalprice")=totalprice
rs("alltotalprice")=alltotalprice
rs("bizhong")="RMB¥"
rs.update
rs.close
conn.execute("update cnk_orderdetail set isorder=1 where orderid='"&orderid&"'")
Response.Cookies(cookies_name)("orderid")=""
end if
%>
  <div class="textbox">
    <div class="articletitle">订单完成!(等待付款)</div>
    订单号为 <span class="red"><%= orderid %></span> <br />
    提交时间:<%= zhuan_time(now) %> <br />
    订单状态:买家已下单,等待买家付款<br />
    商品总价:¥<%= totalprice %><br />
    送货运费:¥<%= sendprice %><br />
    总计费用:¥<%= alltotalprice %>
	<% 
	dim buyer_name,buyer_address,buyer_postcode,buyer_tel,buyer_email,buyer_msg
	buyer_name=thisusername
	buyer_address=address
	buyer_postcode=postcode
	buyer_tel=tel
	buyer_email=email
	buyer_msg=note
	
	dim rspid,rspname,product_name
	set rspid=conn.execute("select pid from cnk_orderdetail where orderid='"&orderid&"'")
	set rspname=conn.execute("select product_name from cnk_products where id="&rspid(0))
	product_name=rspname(0)
	 %>
	<!--#include file="pay.asp" -->
  </div>
  <% End Select %>
  <br />
  <br />
</div>
</body>
</html>