<!--#include file="Include/Iheeo_Conn.asp"-->
<!--#include file="Include/Iheeo_config.asp"-->
<%
if request.Cookies("bjx")("username")<>"" then
username=trim(request.Cookies("bjx")("username"))
else
username=request.Cookies("bjx")("dingdanusername")
end if%>
<html><head><title><%=webname%>--我要下订单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="Include/Iheeo_head.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=970 align=center border=0>
  <TBODY>
    <TR>
      <TD class=b vAlign=top align=left>
<%dim bookid,action,i
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from BJX_action where username='"&username&"' and zhuangtai=7",conn,1,1
if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起，您购物车没有商品，请在购物后，再去“结算中心”！');window.close();</script>"
response.End
end if
rs.close
set rs=nothing
//////////////////////////////////
select case action
case ""
set rs=server.CreateObject("adodb.recordset")
rs.open "select bjx_action.actionid,bjx_action.bookid,bjx_action.bookcount,bjx_action.zonger,BJX_goods.bookname,bjx_action.shjiaid,BJX_goods.shichangjia,BJX_goods.huiyuanjia,BJX_goods.vipjia,BJX_goods.shuilv from BJX_goods inner join  bjx_action on BJX_goods.bookid=bjx_action.bookid where bjx_action.username='"&username&"' and bjx_action.zhuangtai=7",conn,1,1 
%>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td class="table-shangxia" background="images/class_bg.jpg" height=50>　<img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >> 下定单 <font color="#FF6633"><b>(在最后结算前您还可以修改购物车内容)</b></font></td>
          </tr>
        </table>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td bgColor=#ffffff colSpan=5 height=1></TD>
          </tr>
          <form name='form1' method='post' action=Iheeo_car.asp?action=shop1>
            <tr bgcolor="#f1f1f1" align="center">
              <td width=25% height="30">商品名称 </td>
              <td width=15%>市场价</td>
              <td width=15%>单价
                  <%if request.Cookies("bjx")("reglx")="2" then %>
        (VIP)
        <%else%>
        (会员)
        <%end if%>
              </td>
              <td width=15%>数量</td>
              <td width=10%>总价</td>
            </tr>
            <tr>
              <td bgColor=#cccccc colSpan=5 height=1></TD>
            </tr>
            <tr>
              <td bgColor=#f1f1f1 colSpan=5 height=3></TD>
            </tr>
            <%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
            <tr bgcolor="#ffffff">
              <td height="30" width="25%" class="table-xia">　<a target="_blank" href="product.asp?Iheeoid=<%=rs("bookid")%>"><%=rs("bookname")%></a>
                  <input name=bookid type=hidden value="<%=rs("bookid")%>">
                  <input name=actionid type=hidden value="<%=rs("actionid")%>">
              </td>
              <td align="center" class="table-xia"><%=rs("shichangjia")%></td>
              <td align="center" class="table-xia"><%
			  							a=rs("shuilv")
b=a+1
	if request.Cookies("bjx")("reglx")="2" then 
	response.write rs("vipjia")*b
	else
	response.write rs("huiyuanjia")*b
	end if%>
        元</td>
              <td align="center" class="table-xia"><%=rs("bookcount")%></td>
              <td align="center" class="table-xia"><%=rs("zonger")%> 元</td>
            </tr>
            <%
jianshu=jianshu+rs("bookcount")
zongji=zongji+rs("zonger")
rs.movenext
loop
rs.close
set rs=nothing%>
            <tr bgcolor=#ffffff align=center>
              <td height=30 colspan=5> 您的购物车里有商品：<%=shuliang%> 件　总数量：<%=jianshu%> 件　共计：<font color=red><%=zongji%></font> 元　您有预存款：<%
if request.Cookies("bjx")("yucun")<>"" then
response.write request.Cookies("bjx")("yucun")&" 元"
else
response.write "0 元"
end if%></td>
            </tr>
            <tr bgcolor=#ffffff align=center>
              <td height=40 colspan=5><input class="go-wenbenkuang" type="button" name="Submit" value="修改购物车" onClick="this.form.action='buy.asp?action=show';this.form.submit()">
                  <input class="go-wenbenkuang" type="submit" name="Submit3" value="确认订单 下一步">
              </td>
            </tr>
            <%set Godbook=server.CreateObject("adodb.recordset")
	Godbook.open "select * from BJX_action_jp where username='"&username&"' and zhuangtai=7",conn,1,1
	if Godbook.recordcount>0 then%>
            <tr bgcolor="#ffffff">
              <td colspan=5><table width="95%" border="0" cellspacing="1" cellpadding="1" bgcolor="#cccccc" align="center">
                  <tr bgcolor="#ffffff">
                    <td colspan="2" align="center" height="30">您已选择的奖品清单</td>
                  </tr>
                  <tr bgcolor="#cccccc" align="center">
                    <td height="30"><b><font color="#ffffff">奖品名称</font></b></td>
                    <td height="30"><b><font color="#ffffff">使用积分</font></b></td>
                  </tr>
                  <%while not Godbook.eof%>
                  <tr bgcolor="#ffffff">
                    <td>
					<%
	set Godbook1=server.CreateObject("adodb.recordset")
	Godbook1.open "select * from BJX_jiangpin where bookid="&Godbook("bookid"),conn,1,1
	if Godbook1.recordcount=1 then
	response.write "<font color=blue>"&Godbook1("bookname")&"</font>"
	end if
	Godbook1.close
	set Godbook1=nothing%>
                    </td>
                    <td align="center"><%=Godbook("jifen")%></td>
                  </tr>
                  <%Godbook.movenext
wend%>
              </table></td>
            </tr>
            <%end if
Godbook.close
set Godbook=nothing%>
          </form>
        </table>
        <%
/////////////////////////////////////////
case "shop1"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bjx_User where username='"&username&"'",conn,1,1
userid=rs("userid")
%>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td class="table-shangxia" background="images/class_bg.jpg" height=50>　<img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >> 填写收货信息</td>
          </tr>
        </table>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td bgColor=#ffffff colSpan=2 height=1></TD>
          </tr>
          <tr bgcolor="#ffffff">
            <td bgColor="#f1f1f1" colspan="2" height="30" align="center">请正确填写以下收货信息</td>
          </tr>
          <tr>
            <td bgColor=#cccccc colSpan=2 height=1></TD>
          </tr>
          <tr>
            <td bgColor=#f1f1f1 colSpan=2 height=3></TD>
          </tr>
          <form name="shouhuoxx" method="post" action="Iheeo_car.asp?action=shop2" onSubmit="ssxx">
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">收货人真实姓名：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><input name=userid type=hidden value="<%=userid%>">
                  <input name="userzhenshiname" class="wenbenkuang" type="text" id="userzhenshiname" size="16" value=<%=trim(rs("userzhenshiname"))%>>
        性别：
        <select class="wenbenkuang" name="shousex" id="shousex">
          <option value=1 <%if rs("sex")="1" then%>selected<%end if%>>男</option>
          <option value=2 <%if rs("sex")="0" then%>selected<%end if%>>女</option>
          <option value=0 <%if rs("sex")="2" then%>selected<%end if%>>保密</option>
        </select>
              </td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">详细地址：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><input class="wenbenkuang" name="shouhuodizhi" type="text" id="shouhuodizhi" size="50" value=<%=trim(rs("shouhuodizhi"))%>>
              </td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">邮政编码：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><input class="wenbenkuang" name="youbian" type="text" id="youbian" size="16" value="<%=rs("youbian")%>" ONKEYPRESS="event.returnValue=IsDigit();"></td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">联系电话：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><input class="wenbenkuang" name="usertel" type="text" id="usertel" size="16" value=<%=trim(rs("usertel"))%>>
              </td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">电子邮件：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><input class="wenbenkuang" name="useremail" type="text" id="useremail" size="30" value=<%=trim(rs("useremail"))%>>
              </td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">送货方式：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><%set rs6=server.CreateObject("adodb.recordset")
rs6.open "select * FROM Iheeo_Delivery order by SongList",conn,1,1
%><select name="songhuofangshi" size=4 style="WIDTH: 180px">
        <%do while not rs6.eof%>
        <option value="<%=rs6("SongKey")%>" <%if int(rs("songhuofangshi"))=int(rs6("SongKey")) then response.Write "selected" %>><%=trim(rs6("SongName"))%></option><%rs6.movenext
loop
rs6.close
set rs6=nothing%></select></td>
            </tr>
            <tr bgcolor="#ffffff">
              <td width="30%" height="30" align="right" class="table-xia">支付方式：</td>
              <td width="70%" height="30" style="PADDING-LEFT: 20px" class="table-xia"><%set rs5=server.CreateObject("adodb.recordset")
rs5.open "select * FROM Iheeo_Pay order by PayList",conn,1,1
%><select name="zhifufangshi" size=8 style="WIDTH: 180px">
        <%do while not rs5.eof%>
        <option value="<%=rs5("PayKey")%>" <%if int(rs("zhifufangshi"))=int(rs5("PayKey")) then response.Write "selected" %>><%=trim(rs5("PayName"))%></option><%rs5.movenext
loop
rs5.close
set rs5=nothing%></select></td>
            </tr>
            <tr bgcolor="#ffffff">
              <td height="40" colspan="2" align=center><input class="go-wenbenkuang" type="button" name="Submit2" value="上一步" onClick="javascript:history.go(-1)">
                  <input class="go-wenbenkuang" type="submit" name="Submit4" value="确认收货信息 下一步" onclick='return ssxx();'>
              </td>
            </tr>
          </form>
        </table>
        <SCRIPT LANGUAGE="JavaScript">
<!--
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function ssxx()
{
   if(checkspace(document.shouhuoxx.userzhenshiname.value)) {
	document.shouhuoxx.userzhenshiname.focus();
    alert("对不起，请填写收货人姓名！");
	return false;
  }
  if(checkspace(document.shouhuoxx.shouhuodizhi.value)) {
	document.shouhuoxx.shouhuodizhi.focus();
    alert("对不起，请填写收货人详细收货地址！");
	return false;
  }
  if(checkspace(document.shouhuoxx.youbian.value)) {
	document.shouhuoxx.youbian.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
  if(document.shouhuoxx.youbian.value.length!=6) {
	document.shouhuoxx.youbian.focus();
    alert("对不起，请正确填写邮编！");
	return false;
  } 
    if(checkspace(document.shouhuoxx.usertel.value)) {
	document.shouhuoxx.usertel.focus();
    alert("对不起，请留下您的电话！");
	return false;
  }
    if(checkspace(document.shouhuoxx.songhuofangshi.value)) {
	document.shouhuoxx.songhuofangshi.focus();
    alert("对不起，请选择送货方式！");
	return false;
  }
    if(checkspace(document.shouhuoxx.zhifufangshi.value)) {
	document.shouhuoxx.zhifufangshi.focus();
    alert("对不起，请选择支付方式！");
	return false;
  }
  if(document.shouhuoxx.useremail.value.length!=0)
  {
    if (document.shouhuoxx.useremail.value.charAt(0)=="." ||        
         document.shouhuoxx.useremail.value.charAt(0)=="@"||       
         document.shouhuoxx.useremail.value.indexOf('@', 0) == -1 || 
         document.shouhuoxx.useremail.value.indexOf('.', 0) == -1 || 
         document.shouhuoxx.useremail.value.lastIndexOf("@")==document.shouhuoxx.useremail.value.length-1 || 
         document.shouhuoxx.useremail.value.lastIndexOf(".")==document.shouhuoxx.useremail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.shouhuoxx.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.shouhuoxx.useremail.focus();
   return false;
   }
   
}
//-->
        </script>
        <%
rs.close
set rs=nothing
'/////////////////////////////////////////
case "shop2"
shijian=now()
dingdan=year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)
%>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td class="table-shangxia" background="images/class_bg.jpg" height=50>　<img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >> 提交定单</td>
          </tr>
        </table>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td bgColor=#ffffff height=1></TD>
          </tr>
          <tr bgcolor="#ffffff">
            <td bgColor="#f1f1f1" height="30" align="center">请正确填写定单以便收货|订单号：<%= dingdan%> </td>
          </tr>
          <tr>
            <td bgColor=#cccccc height=1></TD>
          </tr>
          <tr>
            <td bgColor=#f1f1f1 height=3></TD>
          </tr>
          <tr>
            <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr bgcolor="#ffffff">
                  <td align="center" valign="top" height=50 colspan=2><%set rs=server.CreateObject("adodb.recordset")
rs.open "select bjx_action.actionid,bjx_action.bookid,bjx_action.bookcount,bjx_action.zonger,BJX_goods.bookname,bjx_action.shjiaid,BJX_goods.anclassid,BJX_goods.banci,BJX_goods.shichangjia,BJX_goods.huiyuanjia,BJX_goods.vipjia,BJX_goods.shuilv from BJX_goods inner join  bjx_action on BJX_goods.bookid=bjx_action.bookid where bjx_action.username='"&username&"' and bjx_action.zhuangtai=7 order by BJX_goods.shjiaid",conn,1,1 
%>
                      <br>
                      <table width=95% border=0 align=center cellpadding=2 cellspacing=1 bgcolor=#cccccc>
                        <tr align=center bgcolor=#f1f1f1>
                          <td width=35%>商品名称</td>
                          <td width=20%>市 场 价</td>
                          <td width=15%><%if request.Cookies("bjx")("reglx")="2" then %>VIP<%else%>会员<%end if%>价格</td>
                          <td width=15%>数 量</td>
                          <td width=15%>总 价</td>
                        </tr>
                        <%shuliang=rs.recordcount
jianshu=0
zongji=0
fudongjia=0
bjxbookname=""
do while not rs.eof
a=rs("shuilv")
b=a+1
bjxbookname=bjxbookname&"|"&rs("bookname")
%>
                        <tr align="center" bgcolor=#ffffff>
                          <td height="30" align="left">　<a target="_blank" href="product.asp?Iheeoid=<%=rs("bookid")%>"><%=rs("bookname")%></a>
                              <input name=bookid2 type=hidden value="<%=rs("bookid")%>">
                              <input name=actionid2 type=hidden value="<%=rs("actionid")%>">
                          </td>
                          <td><s><%=rs("shichangjia")*b%></s>元</td>
                          <td><%

	if request.Cookies("bjx")("reglx")="2" then 
	response.write rs("vipjia")*b
	else
	response.write rs("huiyuanjia")*b
	end if%>
                  元</td>
                          <td><%=rs("bookcount")%></td>
                          <td><%=rs("zonger")%> 元</td>
                        </tr>
                        <%
jianshu=jianshu+rs("bookcount")
zongji=zongji+rs("zonger")
'算每件商品的浮动价
firstshjid=rs("shjiaid")
rs.movenext
if not rs.eof then
nextshjid=rs("shjiaid")
end if

loop
rs.close
set rs=nothing
zongji=formatnumber(zongji,2)
%>
                        <tr bgcolor=#ffffff>
                          <td height=30 colspan=5 align=center>货款总计：<font color=red><%=zongji%></font> 元</td>
                        </tr>
                        <%set Godbook=server.CreateObject("adodb.recordset")
Godbook.open "select * from BJX_action_jp where username='"&username&"' and zhuangtai=7",conn,1,1
if Godbook.recordcount>0 then%>
                        <tr>
                          <td colspan=5 bgcolor=#ffffff><table width="95%" border="0" cellspacing="1" cellpadding="1" bgcolor="#cccccc" align="center">
                              <tr bgcolor="#ffffff">
                                <td colspan="2" align="center">您已选择的奖品清单</td>
                              </tr>
                              <tr align="center" bgcolor="#f1f1f1">
                                <td>奖品名称</td>
                                <td>使用积分</td>
                              </tr>
                              <%
while not Godbook.eof%>
                              <tr bgcolor="#ffffff">
                                <td align="center"><%
	set Godbook1=server.CreateObject("adodb.recordset")
	Godbook1.open "select * from BJX_jiangpin where bookid="&Godbook("bookid"),conn,1,1
	if Godbook1.recordcount=1 then
	response.write "<font color=blue>"&Godbook1("bookname")&"</font>"
	end if
	Godbook1.close
	set Godbook1=nothing%>
                                </td>
                                <td align="center"><%=Godbook("jifen")%></td>
                              </tr>
                              <%Godbook.movenext
                              wend%>
                          </table></td>
                        </tr>
                        <%end if
Godbook.close
set Godbook=nothing%>
                      </table>
                      <br>
                  </td>
                </tr>
                <tr bgcolor="#ffffff">
                  <td width="50%" align="center" valign="top"><table width="90%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
                      <tr>
                        <td colspan="2" height="24" bgcolor="#f1f1f1" align="center">您的订单信息</td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td width="30%" align="center">姓名：</td>
                        <td width="70%" style="PADDING-LEFT: 20px"><%=request("userzhenshiname")%></td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">邮编：</td>
                        <td style="PADDING-LEFT: 20px"><%=request("youbian")%></td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">地址：</td>
                        <td style="PADDING-LEFT: 20px"><%=request("shouhuodizhi")%></td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">电话：</td>
                        <td style="PADDING-LEFT: 20px"><%=request("usertel")%></td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">邮箱：</td>
                        <td style="PADDING-LEFT: 20px"><%=request("useremail")%></td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">送货：</td>
                        <td style="PADDING-LEFT: 20px"><%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from Iheeo_Delivery where SongKey="&request("songhuofangshi"),conn,1,1
if rs.eof and rs.bof then
response.write "方式已经被删除"
else
response.write rs("SongName")
end if
rs.close
set rs=nothing%>
                        </td>
                      </tr>
                      <tr bgcolor="ffffff">
                        <td align="center">支付：</td>
                        <td style="PADDING-LEFT: 20px"><%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from Iheeo_Pay where PayKey="&request("zhifufangshi"),conn,1,1
if rs.eof and rs.bof then
response.write "方式已经被删除"
else
response.write rs("PayName")

end if
rs.close
set rs=nothing%>
                        </td>
                      </tr>
                  </table></td>
                  <td width="50%" align="center" valign="top"><table width="90%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
                      <tr>
                        <td colspan="2" height="24" bgcolor="#f1f1f1" align="center">送货费计算</td>
                      </tr>
                      <%
'计算费用
'先取出参数
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from Iheeo_Delivery where SongKey="&request("songhuofangshi"),conn,1,1
SongFei=rs("SongFei")
	
	feiyong=SongFei
		if request("zhifufangshi")=71 then
          '得到预存款
          set rs2=server.CreateObject("adodb.recordset")
          rs2.Open "select yucun from bjx_User where username='"&username&"'",conn,1,1
          yucunkuan=rs2("yucun")
          rs2.close
          set rs2=nothing
	  if yucunkuan<feiyong+zongji then
	  	response.write "<script language=javascript>alert('您的预存款不足，请更换支付方式！');history.go(-1);</script>"
	end if
	end if%>
                      <tr>
                        <td style="PADDING-right: 20px" align="right" bgcolor="ffffff">商品总价：<%=zongji%> 元<br>您的送货费用计：<%=feiyong%> 元</td>
                      </tr>
                      <tr>
                        <td style="PADDING-right: 20px" align="right" bgcolor="ffffff"><font color=red>您的订单总金额： <%=FormatNumber((feiyong+zongji),2)%> 元</font></td>
                      </tr>
                      <tr>
                        <td style="PADDING-right: 20px" align="right" bgcolor="ffffff"><a target="_blank" href="help.asp?action=feiyong">查看送货费用说明</a></td>
                      </tr></table></td>
                </tr>
                <form name="shouhuoxx2" method="post" action="iheeo_car.asp?action=ok">
                  <tr bgcolor="#ffffff" align="center">
                    <td colspan="2"><table width="95%" border="0" cellspacing="0" cellpadding="2">
                        <tr>
                          <td width="20%"><input type="checkbox" name="fapiao" value="1">
                    是否要发票？
                      <input name="dingdan" type="hidden" value=<%=trim(dingdan)%>>
                      <input name="userzhenshiname" type="hidden" value=<%=trim(request("userzhenshiname"))%>>
                      <input name="shousex" type="hidden" value=<%=trim(request("shousex"))%>>
                      <input name="useremail" type="hidden" value=<%=trim(request("useremail"))%>>
                      <input name="shouhuodizhi" type="hidden" value=<%=trim(request("shouhuodizhi"))%>>
                      <input name="youbian" type="hidden" value=<%=trim(request("youbian"))%>>
                      <input name="usertel" type="hidden" value=<%=trim(request("usertel"))%>>
                      <input name="songhuofangshi" type="hidden" value=<%=trim(request("songhuofangshi"))%>>
                      <input name="zhifufangshi" type="hidden" value=<%=trim(request("zhifufangshi"))%>>
                      <input name="feiyong" type="hidden" value=<%=feiyong%>>
                      <input name="zongji" type="hidden" value=<%=zongji%>>
                      <input name="money" type="hidden" value=<%=zongji+feiyong%>>
                      <input name=userid type=hidden value="<%=request("userid")%>" >
					  <input name="bjxbookname" type="hidden" value=<%=bjxbookname%>>
                          </td>
                          <td width="60%"><input class="wenbenkuang" type="text" name="liuyan" size="35" maxlength="30">
                    您对此订单的特殊说明(30字内) </td>
                          <td width="20%" align="center" height="60"><input class="go-wenbenkuang" type="button" name="Submit22" value="上一步" onClick="javascript:history.go(-1)">
                              <input class="go-wenbenkuang" type="submit" name="Submit42" value="完成订单">
                          </td>
                        </tr>
                    </table></td>
                  </tr>
                </form>
            </table></td>
          </tr>
        </table>
        <%
case "ok"
'/////////////////////////////////////////////////
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function

'修改用户的送货信息
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bjx_User where username='"&username&"'",conn,1,3
rs("userzhenshiname")=trim(request("userzhenshiname"))
rs("sex")=trim(request("shousex"))
rs("useremail")=trim(request("useremail"))
rs("shouhuodizhi")=trim(request("shouhuodizhi"))
rs("youbian")=trim(request("youbian"))
rs("usertel")=trim(request("usertel"))
rs("songhuofangshi")=trim(request("songhuofangshi"))
rs("zhifufangshi")=trim(request("zhifufangshi"))
rs.update
rs.close
set rs=nothing

if session("xiadan")<>minute(now) then
'再判断库存
'未写

dim shijian,dingdan,zongji,feiyong
shijian=now()
money=trim(request("money"))
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from BJX_action where username='"&username&"' and zhuangtai=7",conn,1,3
if request.Cookies("bjx")("username")<>"" then
dingdan=trim(request("dingdan"))
else
dingdan=username
end if
do while not rs.eof
'得到价格，减库存
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from BJX_goods where bookid="&rs("bookid"),conn,1,3
if request.Cookies("bjx")("reglx")="2" then 
danjia=rs2("vipjia")
else
danjia=rs2("huiyuanjia")
end if
rs2("chengjiaocount")=rs2("chengjiaocount")+rs("bookcount")
rs2("kucun")=rs2("kucun")-rs("bookcount")
rs2.update
rs2.close
set rs2=nothing
'rs.addnew
'rs("username")=trim(request.cookies("bookshop")("username"))
'rs("bookid")=rs2("bookid")
rs("actiondate")=shijian
'rs("bookcount")=CInt(Request("Godbook"&rs2("bookid")))
if request("zhifufangshi")=71 then    '送货上门或预存款支付，直接改为订单完成（已收到款）
rs("zhuangtai")=3
else
rs("zhuangtai")=1
end if
rs("dingdan")=dingdan
rs("youbian")=int(request("youbian"))
rs("shouhuoname")=trim(request("userzhenshiname"))
rs("shouhuodizhi")=trim(request("shouhuodizhi"))
rs("zhifufangshi")=int(request("zhifufangshi"))
rs("songhuofangshi")=int(request("songhuofangshi"))
rs("shousex")=int(request("shousex"))
rs("liuyan")=HTMLEncode2(trim(request("liuyan")))
rs("userzhenshiname")=trim(request("userzhenshiname"))
rs("useremail")=trim(request("useremail"))
rs("usertel")=trim(request("usertel"))
rs("userid")=request("userid")
'新增
if request("fapiao")<>1 then 
fapiao=0
else
fapiao=1
end if
rs("fapiao")=fapiao
rs("feiyong")=request("feiyong")
rs("danjia")=danjia
rs.update
actionid=rs("actionid")
'rs.close
'set rs=nothing
'conn.execute "delete from BJX_action where username='"&request.cookies("bookshop")("username")&"' and bookid in ("&bookid&") and zhuangtai=6"
rs.movenext
loop
rs.close
set rs=nothing
'再改奖品
z_jifen=0
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from BJX_action_jp where username='"&username&"' and zhuangtai=7",conn,1,3
do while not rs.eof
rs("actiondate")=shijian
rs("zhuangtai")=5
rs("dingdan")=dingdan
rs("userid")=request("userid")
z_jifen=z_jifen+rs("jifen")
rs.update
rs.movenext
loop
rs.close
set rs=nothing
'减去积分
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bjx_User where username='"&username&"'",conn,1,3
rs("jifen")=rs("jifen")-z_jifen
'如果是在线支付，要扣预存款
if request("zhifufangshi")=71 then 
rs("yucun")=rs("yucun")-request("feiyong")-request("zongji")
end if
rs.update
rs.close
set rs=nothing

session("xiadan")=minute(now)
else
response.Write "<center>您不能重复提交！</center>"
response.End
end if
%>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td class="table-shangxia" background="images/class_bg.jpg" height=50>　<img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >>定单提交成功</td>
          </tr>
        </table>
        <table width="970" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
          <tr>
            <td bgColor=#ffffff height=1></TD>
          </tr>
          <tr bgcolor="#ffffff">
            <td bgColor="#f1f1f1" height="30" align="center">您的订单已经成功提交，我们会在第一时间进行处理，请记清您的订单号以备查询。</td>
          </tr>
          <tr>
            <td bgColor=#cccccc height=1></TD>
          </tr>
          <tr>
            <td bgColor=#f1f1f1 height=3></TD>
          </tr>
          <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">订单号：<font color=red><%=dingdan%></font></td>
          </tr>
		  <%if request.Cookies("bjx")("username")<>"" then%>
          <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">订单查询：您可通过“<a href="javascript:;" onClick="javascript:window.open('user.asp','','')">我的专区</a>”&gt;&gt;“<a href="javascript:;" onClick="javascript:window.open('user.asp?action=dindan','','')">我的订单</a>”查询您的订单状态。</td>
          </tr>
          <tr>
            <td height="60" bgcolor="ffffff" style="PADDING-LEFT: 100px">购物积分：请在收货后通过“<a href="javascript:;" onClick="javascript:window.open('user.asp','','')">我的专区</a>”&gt;&gt;“<a href="javascript:;" onClick="javascript:window.open('user.asp?action=dindan','','')">我的订单</a>”及时更改您的订单状态为“完成”<br>
			因为每笔订单的积分只有在订单完成后才能累计到您的购物积分中。 </td>
          </tr>
		  <%else%>
		  <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">订单查询：因为您不是我们的会员，所以您不能查询您的订单状态。</td>
          </tr>
		  <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">购物积分：因为您不是我们的会员，所以您不能获得积分奖励。 </td>
          </tr>
          <%
		  end if
		  if request("zhifufangshi")=90 then %>
          <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">您是通过预存款支付的，我们会尽快地给你发货的！</td>
          </tr>
          <%else
if request("zhifufangshi")=91 then %>
          <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">您是选择的“货到付款”，我们会尽快给您送货的！</td>
          </tr>
          <%else%>
          <tr>
            <td height="30" bgcolor="ffffff" style="PADDING-LEFT: 100px">请您在一周内依照您选择的支付方式进行汇款，汇款时请注明您的<font color="#FF0000">订单号</font>！</td>
          </tr>
          <tr>
            <td height="30" bgcolor="ffffff" align="center"><br>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr " method="post">
    <input name="hiddenField" type="hidden" id="hiddenField" value="<%=actionid%>">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="laowan_1248836018_biz@163.com">      
    <input type="hidden" name="item_name" value="<%=dingdan%>"> 
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="amount" value="<%=request("money")%>"> 
<input type="hidden" name="return" value="http://<%                 '这里是客户支付成功, 返回信息的地址!
theurl=LCase(Request.ServerVariables("HTTP_HOST"))&Request.ServerVariables("URL")
theurl=Left(theurl,InstrRev(theurl,"/"))
response.write theurl&"paypal.asp?aid="&actionid&""
%>">    
<input type="submit" name="Submit3" value="Use Paypal Payment">
</form>
</td>
          </tr>
          <%end if%>
          <%end if%><tr>
            <td height="30" bgcolor="ffffff" style='PADDING-LEFT: 100px' align="right"><a href="#" onClick=javascript:window.close()> 关闭窗口</a><font color="#999999">　订单提交完成 创建时间：<%=shijian%>&nbsp;</font> </td>
          </tr>
        </table>
        <%
		response.Cookies("bjx")("dingdanusername")=""
		end select%></TD>
    </TR>
  </TBODY>
</TABLE>
<!--#include file="Include/Iheeo_service.asp"-->
<!--#include file="Include/Iheeo_foot.asp"-->
</body>
</html>
<script language=javascript>
<!--
function regInput(obj, reg, inputStr)
{
	var docSel	= document.selection.createRange()
	if (docSel.parentElement().tagName != "INPUT")	return false
	oSel = docSel.duplicate()
	oSel.text = ""
	var srcRange	= obj.createTextRange()
	oSel.setEndPoint("StartToStart", srcRange)
	var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
	return reg.test(str)
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
   //-->
</script>
