<!--#include file="conn.asp"-->
<%if request.cookies("songxf")("username")="" then
response.redirect "login.asp"
response.End
end if%>
<!--#include file="webconfig.asp"-->

<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">
<style>
td{font-size:9pt;line-height:120%;color:#353535} 
body{font-size:9pt;line-height:120%} 

a:link          { color: #000000; text-decoration: none }
a:visited       { color: #000000; text-decoration: none }
a:active        { color: #000000; text-decoration: none }
a:hover         { color: #336699; text-decoration: none; position: relative; right: 0px; top: 1px }
</style>
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<%dim bookid,action,i
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from shop_action where username='"&request.cookies("songxf")("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 shop_action.actionid,shop_action.bookid,shop_action.bookcount,shop_action.zonger,shop_books.bookname,shop_action.shjiaid,shop_books.shichangjia,shop_books.huiyuanjia,shop_books.vipjia from shop_books inner join  shop_action on shop_books.bookid=shop_action.bookid where shop_action.username='"&request.cookies("songxf")("username")&"' and shop_action.zhuangtai=7",conn,1,1 
%>
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr>
    <td height="40"><font color="#FF6633"><b>在最后结算前您还可以修改购物车内容</b></font></td>
  </tr>
</table>
<table width=96% border=0 align=center cellpadding=1 cellspacing=1 bgcolor=#FFCC00>
  <form name='form1' method='post' action=jszx.asp?action=txxx>
    <tr bgcolor="#FFE697">
	  <td width=20%> 
        <div align=center><font color="#666666">商家名称</font></div>
      </td> 
      <td width=25%> 
        <div align=center><font color="#666666">商品名称</font></div>
      </td>
      <td width=15%> 
        <div align=center><font color="#666666">市场价</font></div>
      </td>
      <td width=15%> 
        <div align=center><font color="#666666">单价 
          <%if request.cookies("songxf")("reglx")=2 then %>
          (VIP) 
          <%else%>
          (会员) 
          <%end if%>
          </font></div>
      </td>
      <td width=15%> 
        <div align=center><font color="#666666">数量</font></div>
      </td>
      <td width=10% bgcolor=#FFE697> 
        <div align=center><font color="#666666">总价</font></div>
      </td>
    </tr>
    <%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
    <tr bgcolor="#FFF9E6">
	  <td height="22" width="20%"><%id=rs("shjiaid")
	  if id>1 then
	  set rs_shj=server.CreateObject("adodb.recordset")
rs_shj.open "select name from shjia where shjiaid="&id,conn,1,1%> 
        <div align=center><font color=#dd6600> 
          <%=rs_shj("name")%>
		  <%
		  rs_shj.close
	set rs_shj=nothing
	else
	response.write "<div align=center><font color=#dd6600>网上商城"
	end if%>
          </font></div>
      </td>
      <td style='PADDING-LEFT: 5px'> 
        <div align=left><font color=blue><%=rs("bookname")%></font> 
          <input name=bookid type=hidden value="<%=rs("bookid")%>" >
          <input name=actionid type=hidden value="<%=rs("actionid")%>" >
        </div>
      </td>
      <td><%=rs("shichangjia")%></td>
      <td> 
        <div align=center> 
          <%
if request.Cookies("songxf")("reglx")=2 then 
	response.write rs("vipjia")
else
	response.write rs("huiyuanjia")
end if%>
          元</div>
      </td>
      <td> 
        <div align=center><font color=#dd6600> <%=rs("bookcount")%> </font></div>
      </td>
      <td bgcolor=#FFF9E6> 
        <div align=center><font color=#FF3300><%=rs("zonger")%></font>元</div>
      </td>
    </tr>
    <%
jianshu=jianshu+rs("bookcount")
zongji=zongji+rs("zonger")
rs.movenext
loop
rs.close
set rs=nothing%>
    <tr bgcolor="#FFF9E6"> 
      <td height=36 colspan=7> 
        <div align=center> 
          <input type="button" name="Submit" value="修改购物车" onClick="javascript:window.open('gouwu.asp?action=show','gouwu','width=450,height=350,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');window.close()">
          <input type="submit" name="Submit3" value="下一步">
        </div>
      </td>
    </tr>
    <tr bgcolor="#FFF9E6"> 
      <td height=36 colspan=7> 
        <div align=center> 您的购物车里有商品：<%=shuliang%>件　总数量：<%=jianshu%>件　共计：<%=zongji%>元　您有预存款：<%=request.cookies("songxf")("yucun")%>元 
        </div>
      </td>
    </tr>
    <%set songxf=server.CreateObject("adodb.recordset")
	songxf.open "select * from shop_action_jp where username='"&request.cookies("songxf")("username")&"' and zhuangtai=7",conn,1,1
	if songxf.recordcount>0 then%>
    <tr bgcolor="#FFF9E6"> 
      <td colspan=5> 
        <table width="96%" border="0" cellspacing="1" cellpadding="1" bgcolor="#FFCC00" align="center">
          <tr bgcolor="#FFF0C4"> 
            <td colspan="2"><b>您已选择的奖品清单</b></td>
          </tr>
          <tr bgcolor="#FFE697" align="center"> 
            <td><font color=#FFFFFF>奖品名称</font></td>
            <td><font color=#FFFFFF>使用积分</font></td>
          </tr>
          <%
	while not songxf.eof%>
          <tr bgcolor="#FFF9E6"> 
            <td> 
              <%
	set songxf1=server.CreateObject("adodb.recordset")
	songxf1.open "select * from shop_jiangpin where bookid="&songxf("bookid"),conn,1,1
	if songxf1.recordcount=1 then
	response.write "<font color=blue>"&songxf1("bookname")&"</font>"
	end if
	songxf1.close
	set songxf1=nothing%>
            </td>
            <td align="center"><%=songxf("jifen")%></td>
          </tr>
          <%
	songxf.movenext
	wend%>
        </table>
      </td>
    </tr>
    <%end if
songxf.close
set songxf=nothing%>
  </form>
</table>
<%
'/////////////////////////////////////////
case "txxx"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [user] where username='"&request.cookies("songxf")("username")&"'",conn,1,1
userid=rs("userid")
%>
<table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFCC00">
                          <tr bgcolor="#FFF9E6"> 
                            <td colspan="2" style='PADDING-LEFT: 20px' height="40" align="center"><b><font color="#0000FF">请正确填写以下收货信息</font></b></td>
                          </tr>
                          <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx2" onsubmit="ssxx">
                            <tr bgcolor="#FFF9E6"> 
                              <td width="199" style='PADDING-LEFT: 20px'><b>收货人姓名：</b></td>
                              <td width="771" height="28" style='PADDING-LEFT: 20px'> 
                                <input name=userid type=hidden value="<%=userid%>" >
                                <b> 
                                <input name="userzhenshiname" type="text" id="userzhenshiname" size="12" value=<%=trim(rs("userzhenshiname"))%>>
                                　　性 别： 
                                <select 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>
                                </b></td>
                            </tr>
                            <tr bgcolor="#FFF9E6"> 
                              <td style='PADDING-LEFT: 20px' width="199"><b>详细地址：</b></td>
                              <td height="28" style='PADDING-LEFT: 20px' width="771"> 
                                <b> 
                                <input name="shouhuodizhi" type="text" id="shouhuodizhi" size="40" value=<%=trim(rs("shouhuodizhi"))%>>
                                </b></td>
                            </tr>
                            <tr bgcolor="#FFF9E6"> 
                              <td style='PADDING-LEFT: 20px' width="199"><b>电话：</b></td>
                              <td height="28" style='PADDING-LEFT: 20px' width="771"> 
                                <b> 
                                <input name="usertel" type="text" id="usertel" size="12" value=<%=trim(rs("usertel"))%>>
                                </b></td>
                            </tr>
                            <tr bgcolor="#FFF9E6"> 
                              <td style='PADDING-LEFT: 20px' width="199"><b>电子邮件：</b></td>
                              <td height="28" style='PADDING-LEFT: 20px' width="771"> 
                                <b> 
                                <input name="useremail" type="text" id="useremail" value=<%=trim(rs("useremail"))%>>
                                </b></td>
                            </tr>
                            <b><%=trim(request("useremail"))%> </b> 
                            <tr bgcolor="#FFF9E6"> 
                              <td height="32" colspan="2" align=center> 
                                <input type="button" name="Submit2" value="上一步" onclick="javascript:history.go(-1)">
                                <input type="submit" name="Submit4" value="下一步" onclick='return ssxx();'>
                              </td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%
rs.close
set rs=nothing%>
<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(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>

<%
'/////////////////////////////////////////
case "txxx2"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [user] where username='"&request.cookies("songxf")("username")&"'",conn,1,1
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ssxx()
{
    if(checkspace(document.shouhuoxx.songhuofangshi.value)) {
	document.shouhuoxx.songhuofangshi.focus();
    alert("对不起，请选择送货方式！");
	return false;
  }
   
}
//-->
</script>
<table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFCC00">
                          <tr bgcolor="#FFF9E6"> 
                            <td colspan="2" style='PADDING-LEFT: 20px' height="40" align="center"><b><font color="#0000FF">请正确选择送货方式</font></b></td>
                          </tr>
                          <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx3">
                            <tr bgcolor="#FFF9E6"> 
                              <td width="199" style='PADDING-LEFT: 20px'><b>送货方式：</b></td>
                              <td width="771" height="28" style='PADDING-LEFT: 20px'> 
                                <b> 
                                <%
          set rs2=server.CreateObject("adodb.recordset")
          rs2.Open "select * from youbian where youbian='"&trim(request("youbian"))&"'",conn,1,1
          if rs2.recordcount=1 then
          	shangmen=1
          else
          	shangmen=0
          end if
          rs2.close
          set rs2=nothing
          '//////////判断送货方式
          set rs3=server.CreateObject("adodb.recordset")
          rs3.Open "select * from shop_songhuo where fangshi=0 order by songidorder",conn,1,1
          response.Write "<select name=songhuofangshi size="&rs3.recordcount&">"
          do while not rs3.EOF
          if not(shangmen=0 and trim(rs3("songid"))=3) then          '显示不显示“送货上门”
          	response.Write "<option value="&rs3("songid")
          	if int(rs("songhuofangshi"))=int(rs3("songid")) then 
          		response.Write " selected>"
          	else
          		response.Write ">"
          	end if
          	response.Write trim(rs3("subject"))&"</option>"          
          end if
          rs3.MoveNext
          loop
          response.Write "</select>"
          rs3.Close
          set rs3=nothing
         %>
                                </b> 
                                <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=userid type=hidden value="<%=request("userid")%>" >
                               </td>
                            </tr>
                            <tr bgcolor="#FFF9E6"> 
                              <td height="32" colspan="2" align=center> 
                                <input type="button" name="Submit2" value="上一步" onclick="javascript:history.go(-1)">
                                <input type="submit" name="Submit4" value="下一步" onclick='return ssxx();'>
                              </td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%
rs.close
set rs=nothing

'/////////////////////////////////////////
case "txxx3"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [user] where username='"&request.cookies("songxf")("username")&"'",conn,1,1
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ssxx()
{
    if(checkspace(document.shouhuoxx.zhifufangshi.value)) {
	document.shouhuoxx.zhifufangshi.focus();
    alert("对不起，请选择货款支付方式！");
	return false;
  }
   
}
//-->
</script>
<table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFCC00">
                          <tr bgcolor="#FFF9E6"> 
                            <td colspan="2" style='PADDING-LEFT: 20px' height="40" align="center"><b><font color="#0000FF">请正确选择付款方式</font></b></td>
                          </tr>
                          <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx4">
                            <tr bgcolor="#FFF9E6"> 
                              <td width="199" style='PADDING-LEFT: 20px'><b>付款方式：</b></td>
                              <td width="771" height="28" style='PADDING-LEFT: 20px'> 
                                <b> 
                                <%
          'set rs2=server.CreateObject("adodb.recordset")
          'rs2.Open "select * from shop_songhuo where songid="&trim(request("songhuofangshi")),conn,1,1
          if cint(request("songhuofangshi"))=19 then
          	fukuan=1
          else
          	fukuan=0
          end if
          'rs2.close
          'set rs2=nothing
          '//////////判断支付方式
          set rs3=server.CreateObject("adodb.recordset")
          rs3.open "select * from shop_songhuo where fangshi=1 order by songidorder",conn,1,1
          response.Write "<select name=zhifufangshi size="&rs3.recordcount&" >"
          do while not rs3.eof
          if not(fukuan=0 and trim(rs3("songid"))=19) then	'显示不显示“货到付款”
          	response.Write "<option value="&rs3("songid")
          	if int(rs("zhifufangshi"))=int(rs3("songid")) then
          		response.Write " selected>"
          	else
          		response.Write ">"
          	end if
          	response.Write trim(rs3("subject"))&"</option>"
          end if
          rs3.movenext
          loop
          response.Write "</select>"
          rs3.close
          set rs3=nothing
		  %><img src="image/images/icon_anniu.gif" width="25" height="32"><a href="alipay/alipay.htm" target="_blank">使用支付宝说明</a>
                                </b> 
                                <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=userid type=hidden value="<%=request("userid")%>" >
                               </td>
                            </tr>
                            <tr bgcolor="#FFF9E6"> 
                              <td height="32" colspan="2" align=center> 
                                <input type="button" name="Submit2" value="上一步" onclick="javascript:history.go(-1)">
                                <input type="submit" name="Submit4" value="下一步" onclick='return ssxx();'>
                              </td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%
rs.close
set rs=nothing

'/////////////////////////////////////////
case "txxx4"
%>
<table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFCC00">
                          <tr bgcolor="#FFF9E6"> 
                            <td align="center" valign="top" height=50 colspan=2> 
                              <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_action.actionid,shop_action.bookid,shop_action.bookcount,shop_action.zonger,shop_books.bookname,shop_action.shjiaid,shop_books.anclassid,shop_books.banci,shop_books.shichangjia,shop_books.huiyuanjia,shop_books.vipjia from shop_books inner join  shop_action on shop_books.bookid=shop_action.bookid where shop_action.username='"&request.cookies("songxf")("username")&"' and shop_action.zhuangtai=7 order by shop_books.shjiaid",conn,1,1 
%>
                              <table width=98% border=0 align=center cellpadding=1 cellspacing=1 bgcolor=#FFCC00>
                                <tr bgcolor="#FFE493">
								  <td width=20%> 
                                    <div align=center><font color="#666666">商品名称</font></div>
                                  </td> 
                                  <td width=25%> 
                                    <div align=center><font color="#666666">商品名称</font></div>
                                  </td>
                                  <td width=10%> 
                                    <div align=center><font color="#666666">市场价</font></div>
                                  </td>
                                  <td width=15%> 
                                    <div align=center><font color="#666666">单价 
                                      <%if request.cookies("songxf")("reglx")=2 then %>
                                      (VIP) 
                                      <%else%>
                                      (会员) 
                                      <%end if%>
                                      </font></div>
                                  </td>
                                  <td width=15%> 
                                    <div align=center><font color="#666666">数量</font></div>
                                  </td>
                                  <td width=10%> 
                                    <div align=center><font color="#666666">邮寄浮动<br>
                                      (单价)</font></div>
                                  </td>
                                  <td width=10% bgcolor=#FFE493> 
                                    <div align=center><font color="#666666">总价</font></div>
                                  </td>
                                </tr>
                                <%shuliang=rs.recordcount
jianshu=0
zongji=0
fudongjia=0
do while not rs.eof
%>
      <tr>
		<td bgcolor=#FFF9E6 height="22" width="20%">
			<%id=rs("shjiaid")
			
	  if id>1 then
	  set rs_shj=server.CreateObject("adodb.recordset")
rs_shj.open "select name from shjia where shjiaid="&id,conn,1,1%> 
        <div align=center><font color=#dd6600> 
          <%=rs_shj("name")%>
		  <%
		  rs_shj.close
	set rs_shj=nothing
	else
	response.write "<div align=center><font color=#dd6600>网上商城"
	end if%>
          </font></div>
      </td> 
                                  <td bgcolor=#FFF9E6 style='PADDING-LEFT: 5px'> 
                                    <div align=left><font color=blue><%=rs("bookname")%></font> 
                                      <input name=bookid2 type=hidden value="<%=rs("bookid")%>" >
                                      <input name=actionid2 type=hidden value="<%=rs("actionid")%>" >
                                    </div>
                                  </td>
                                  <td bgcolor=#FFF9E6 align="center"><s><%=rs("shichangjia")%></s> 
                                    元</td>
                                  <td bgcolor=#FFF9E6> 
                                    <div align=center> 
                                      <%
if request.Cookies("songxf")("reglx")=2 then 
	response.write rs("vipjia")
else
	response.write rs("huiyuanjia")
end if%>
                                      元</div>
                                  </td>
                                  <td bgcolor=#FFF9E6> 
                                    <div align=center><font color=#dd6600> <%=rs("bookcount")%> 
                                      </font></div>
                                  </td>
                                  <td bgcolor=#FFF9E6> 
                                    <div align=center><font color=#dd6600> 
                                      <%
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_fudong where id="&rs("banci"),conn,1,1
if cint(request("songhuofangshi"))=19 then	'看是不是“送货上门”
	if request.Cookies("songxf")("reglx")=2 then
		fudongjia_dj=rs_s("smvip")
	else
		fudongjia_dj=rs_s("smhy")
	end if
elseif cint(request("songhuofangshi"))=1 then	'看是不是“平邮”
	if request.Cookies("songxf")("reglx")=2 then
		fudongjia_dj=rs_s("pyvip")
	else
		fudongjia_dj=rs_s("pyhy")
	end if
else
	if request.Cookies("songxf")("reglx")=2 then
		fudongjia_dj=rs_s("emsvip")
	else
		fudongjia_dj=rs_s("emshy")
	end if
end if
response.write fudongjia_dj
rs_s.close
set rs_s=nothing
%>
                                      </font></div>
                                  </td>
                                  <td bgcolor=#FFF9E6> 
                                    <div align=center><font color=#FF3300><%=rs("zonger")%></font>元</div>
                                  </td>
                                </tr>
                                <%
jianshu=jianshu+rs("bookcount")
zongji=zongji+rs("zonger")
'算每件商品的浮动价
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_fudong where id="&rs("banci"),conn,1,1 
fudongjia=fudongjia+rs("bookcount")*fudongjia_dj
rs_s.close
set rs_s=nothing

firstshjid=rs("shjiaid")
rs.movenext
if not rs.eof then
nextshjid=rs("shjiaid")
end if
if rs.recordcount<>1 and firstshjid<>nextshjid then
response.write "<script language=javascript>alert('对不起，您选购的商品不属于同一个商家，请重新下订单！');window.close();</script>"
exit do
end if
loop
rs.close
set rs=nothing%>
                                <tr> 
                                  <td height=36 colspan=7 bgcolor=#FFF9E6> 
                                    <div align=center> 货款总计：<%=zongji%>元</div>
                                  </td>
                                </tr>
                                <%set songxf=server.CreateObject("adodb.recordset")
	songxf.open "select * from shop_action_jp where username='"&request.cookies("songxf")("username")&"' and zhuangtai=7",conn,1,1
	if songxf.recordcount>0 then%>
                                <tr> 
                                  <td colspan=7 bgcolor=#FFF9E6> 
                                    <table width="96%" border="0" cellspacing="1" cellpadding="1" bgcolor="#FFCC00" align="center">
                                      <tr bgcolor="#FFF2CA"> 
                                        <td colspan="2"><b>您已选择的奖品清单</b></td>
                                      </tr>
                                      <tr bgcolor="#FFE493" align="center"> 
                                        <td><font color="#666666">奖品名称</font></td>
                                        <td bgcolor="#FFE493"><font color="#666666">使用积分</font></td>
                                      </tr>
                                      <%
	while not songxf.eof%>
                                      <tr bgcolor="#FFF9E6"> 
                                        <td> 
                                          <%
	set songxf1=server.CreateObject("adodb.recordset")
	songxf1.open "select * from shop_jiangpin where bookid="&songxf("bookid"),conn,1,1
	if songxf1.recordcount=1 then
	response.write "<font color=blue>"&songxf1("bookname")&"</font>"
	end if
	songxf1.close
	set songxf1=nothing%>
                                        </td>
                                        <td align="center"><%=songxf("jifen")%></td>
                                      </tr>
                                      <%
	songxf.movenext
	wend%>
                                    </table>
                                  </td>
                                </tr>
                                <%end if
songxf.close
set songxf=nothing%>
                              </table>
                            </td>
					      </tr>
                          <tr bgcolor="#FFF9E6"> 
                            <td width="594"  align="center" valign="top"> 
                              <table width="96%" border="0" cellspacing="0" cellpadding="2">
                                <tr> 
                                  <td colspan="2" height=8></td>
                                </tr>
                                <tr align="center" bgcolor="FFE493"> 
                                  <td colspan="2" height="22"><b>您的订单信息</b></td>
                                </tr>
                                <tr> 
                                  <td width="23%">姓名<br>
                                  </td>
                                  <td width="77%"><%=request("userzhenshiname")%></td>
                                </tr>
                                <tr> 
                                  <td width="23%">邮编<br>
                                  </td>
                                  <td width="77%"><%=request("youbian")%></td>
                                </tr>
                                <tr> 
                                  <td width="23%">地址<br>
                                  </td>
                                  <td width="77%"><%=request("shouhuodizhi")%></td>
                                </tr>
                                <tr> 
                                  <td width="23%">电话<br>
                                  </td>
                                  <td width="77%"><%=request("usertel")%></td>
                                </tr>
                                <tr> 
                                  <td colspan="2" height=8></td>
                                </tr>
                                <tr> 
                                  <td width="23%">邮箱<br>
                                  </td>
                                  <td width="77%"><%=request("useremail")%></td>
                                </tr>
                                <tr> 
                                  <td colspan="2" height=8></td>
                                </tr>
                                <tr> 
                                  <td width="23%">送货<br>
                                  </td>
                                  <td width="77%"> 
                                    <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where songid="&request("songhuofangshi"),conn,1,1
response.write rs("subject")
rs.close
set rs=nothing%>
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="23%">支付</td>
                                  <td width="77%"> 
                                    <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where songid="&request("zhifufangshi"),conn,1,1
response.write rs("subject")
rs.close
set rs=nothing%>
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="23%"><br>
                                  </td>
                                  <td width="77%">&nbsp; </td>
                                </tr>
                              </table>
                            </td>
                            <td width="356"  align="center" valign="top"> 
                              <table width="96%" border="0" cellspacing="0" cellpadding="2">
                                <tr> 
                                  <td colspan="2" height=8></td>
                                </tr>
                                <tr align="center" bgcolor="#00CCFF"> 
                                  <td colspan="2" height="22" bgcolor="#FFE493"><b>送货费计算</b></td>
                                </tr>
<%
'计算费用
'先取出参数
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_sys ",conn,1,1
t_sm1=rs("sm1")
t_sm2=rs("sm2")
t_sm3=rs("sm3")
t_py1=rs("py1")
t_py2=rs("py2")
t_py3=rs("py3")
t_ems1=rs("ems1")
t_ems2=rs("ems2")
t_ems3=rs("ems3")
t_kd1=rs("kd1")
t_kd2=rs("kd2")
t_kd3=rs("kd3")
'先看是不是送货
'set rs=server.CreateObject("adodb.recordset")
'rs.open "select * from shop_songhuo where songid="&trim(request("songhuofangshi")),conn,1,1
if cint(request("songhuofangshi"))=19 then	'先看是不是送货
	'rs.close
	if request.cookies("songxf")("reglx")=2 then
		if zongji>=t_sm3 then 
			jijia=0
		else
			jijia=t_sm1
		end if
	else
		if zongji>=t_sm2 then 
			jijia=0
		else
			jijia=t_sm1
		end if
	end if
	feiyong=jijia+fudongjia
	'fudongjia=0
else
	'不是送货上门的还要看是什么方式送货
	if cint(request("songhuofangshi"))=1 then	'看是不是"普通平邮"
		'rs.close
		if request.cookies("songxf")("reglx")=2 then
			if zongji>=t_py2 then 
				jijia=t_py1-t_py3
			else
				jijia=t_py1
			end if
		else
				jijia=t_py1
		end if
	elseif cint(request("songhuofangshi"))=24 then
		if request.cookies("songxf")("reglx")=2 then
			if zongji>=t_kd2 then 
				jijia=t_kd1-t_kd3
			else
				jijia=t_kd1
			end if
		else
				jijia=t_kd1
		end if	
	else
		'rs.close
		if request.cookies("songxf")("reglx")=2 then
			if zongji>=t_ems2 then 
				jijia=t_ems1-t_ems3
			else
				jijia=t_ems1
			end if
		else
				jijia=t_ems1
		end if
	
	end if
	'算商品基价+浮动价=费用
	
	feiyong=jijia+fudongjia
	if request("zhifufangshi")=17 then
          '得到预存款
          set rs2=server.CreateObject("adodb.recordset")
          rs2.Open "select yucun from [user] where username='"&request.cookies("songxf")("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
end if
rs.close
%>
                                <tr> 
                                  <td>&nbsp;</td>
                                </tr>
                                <tr> 
                                  <td style='PADDING-right: 20px' align=right>您的送货费用计：　<%=feiyong%> 元<br>
                                    (其中　　基价：<%=jijia%>元)<br>
                                    (浮动价：<%=fudongjia%>元)</td>
                                </tr>
                                <tr> 
                                  <td>&nbsp;</td>
                                </tr>
                                <tr> 
                                  <td style='PADDING-right: 20px' align=right><b><font color=red>您的订单总金额：　<%=feiyong+zongji%> 元</font></b></td>
                                </tr>
                                <tr> 
                                  <td height=20></td>
                                </tr>
                                <tr> 
                                  <td align=right><a href="help.asp?action=feiyong" target=_blank>查看送货费用说明</a></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                          <form name="shouhuoxx" method="post" action="jszx.asp?action=ok">
                            <tr bgcolor="#FFF9E6" align="center"> 
                              <td colspan="2"> 
                                <table width="98%" border="0" cellspacing="0" cellpadding="2">
                                  <tr>
                                    <td width="27%"> 
                                      <input type="checkbox" name="fapiao" value="1">
                                      是否要发票？ 
                                      <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=userid type=hidden value="<%=request("userid")%>" >
                                    </td>
                                    <td width="42%">您对此订单的特殊说明(30字内) <br>
                                      <input type="text" name="liuyan" size="30" maxlength="30">
                                    </td>
                                    <td width="31%" align="center" height="60"> 
                                      <input type="button" name="Submit22" value="上一步" onClick="javascript:history.go(-1)">
                                      <input type="submit" name="Submit42" value="　完　成　">
                                    </td>
                                  </tr>
                                </table>
                              </td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </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

'修改用户的送货信息
dim tuijian1,tuijian2,tuijian3
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [user] where username='"&request.cookies("songxf")("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"))
tuijian1=rs("tuijian1")
tuijian2=rs("tuijian2")
tuijian3=rs("tuijian3")
rs.update
rs.close
set rs=nothing

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

dim shijian,dingdan
shijian=now()
'dingdan=year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)
'response.write bookid
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action where username='"&request.cookies("songxf")("username")&"' and zhuangtai=7",conn,1,3
dingdan=year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)
dim gouwujifen,danjifen
gouwujifen=0
do while not rs.eof
'得到价格，减库存
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from shop_books where bookid="&rs("bookid"),conn,1,3
if request.Cookies("songxf")("reglx")=2 then 
	danjia=rs2("vipjia")
else
	danjia=rs2("huiyuanjia")
end if
danjifen=rs2("yeshu")
rs2("chengjiaocount")=rs2("chengjiaocount")+rs("bookcount")
rs2("kucun")=rs2("kucun")-rs("bookcount")
rs2.update
rs2.close
set rs2=nothing

gouwujifen=gouwujifen+rs("bookcount")*danjifen
'rs.addnew
'rs("username")=trim(request.cookies("bookshop")("username"))
'rs("bookid")=rs2("bookid")
rs("actiondate")=shijian
'rs("bookcount")=CInt(Request("songxf"&rs2("bookid")))
if request("zhifufangshi")=17 then    '送货上门或预存款支付，直接改为订单完成（已收到款）
rs("zhuangtai")=3
else
rs("zhuangtai")=1
end if
rs("dingdan")=dingdan
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("zonger")=request("zongji")
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
'rs.close
'set rs=nothing
'conn.execute "delete from shop_action where username='"&request.cookies("bookshop")("username")&"' and bookid in ("&bookid&") and zhuangtai=6"
rs.movenext
loop
rs.close
set rs=nothing
	conn.execute("update [user] set jifen=jifen+" & gouwujifen & " where username='"&request.cookies("songxf")("username")&"'")
	if trim(cstr(tuijian1))<>"0" then
		conn.execute("update [user] set jifen=jifen+" & (gouwujifen*40/100) & " where UserID=" & cint(tuijian1))
	end if
	if trim(cstr(tuijian2))<>"0" then
		conn.execute("update [user] set jifen=jifen+" & (gouwujifen*20/100) & " where UserID=" & cint(tuijian2))
	end if
	if trim(cstr(tuijian3))<>"0" then
		conn.execute("update [user] set jifen=jifen+" & (gouwujifen*10/100) & " where UserID=" & cint(tuijian3))
	end if

'再改奖品
z_jifen=0
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action_jp where username='"&request.cookies("songxf")("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 [user] where username='"&request.cookies("songxf")("username")&"'",conn,1,3
rs("jifen")=rs("jifen")-z_jifen
'如果是在线支付，要扣预存款
if request("zhifufangshi")=17 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="96%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFCC00">
                          <tr> 
                            <td height="23" bgcolor="FFF9E6"> 
                              <div align="center"><font color="#FF6600"><b>您的订单已经成功提交，我们会在第一时间进行处理，请记清您的订单号以备查询。</b></font></div>
                            </td>
                          </tr>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" style='PADDING-LEFT: 100px'>订单号：<font color=red><%=dingdan%></font></td>
                          </tr>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" 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=dingdan','','')">我的订单</a>”查询您的订单状态。</td>
                          </tr>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" 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=dingdan','','')">我的订单</a>”及时更改您的订单状态为“完成”，因为每笔订单的积分只有在订单完成后才能累计到您的购物积分中。 
                            </td>
                          </tr>
                          <%if request("zhifufangshi")=17 then %>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" style='PADDING-LEFT: 100px'>您是通过预存款支付的，我们会尽快地给你发货的！</td>
                            <script language=javascript>alert('您是通过预存款支付的，我们会尽快地给你发货的！');</script>
                          </tr>
                          <%else
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where songid="&trim(request("zhifufangshi")),conn,1,1
if trim(rs("subject"))="货到付款" then
                          rs.close
                          set rs=nothing
%>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" style='PADDING-LEFT: 100px'>您是选择的“货到付款”，我们会尽快给您送货的！</td>
                            <script language=javascript>alert('您是选择的“货到付款”，请确认您的订单，我们会尽快给您送货的！');</script>
                          </tr>
<%else
                          rs.close
                          set rs=nothing%>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" style='PADDING-LEFT: 100px'>请您在一周内依照您选择的支付方式进行汇款，汇款时请注明您的<font color="#FF0000">订单号</font>！</td>
                            <script language=javascript>alert('请您在一周内依照您选择的支付方式进行汇款，汇款时请注明您的订单号！');</script>
                          </tr>
                          <%end if%>
                          <%end if%>
                          <tr> 
                            <td height="22" bgcolor="FFF9E6" style='PADDING-LEFT: 100px'> 
                              <div align="right">
							  
							  <!-- 支付宝 -->
              </b><b>可以立即在线用支付宝支付：</b></div>
            <form action="alipay/Doalipay.asp" method="post">
			<%
			session("hyj")=request("zongji")
			session("Pname")="订单号:"&dingdan
			session("goodsTitle")=dingdan
			session("rurl")="www.itfirst.com.cn"
			%>
              <div align="center">订 单 号： 
                <input type="text" name="test1" value="<%=dingdan%>" disabled>
                <br>
                付款金额： 
                <input type="text" name="test2" value="<%=request("zongji")%>" disabled>
                
                <br>
                运输费用： 
                <input type="text" name="test3" value="平邮13快递25" disabled>
                
                <br><br><br><br>
                <input  type="submit" name="submit" value="立 即 用支付宝付款">
              </div>
			  <br><div align="center"><a href="http://dev.alipay.com/promotion/promotion.htm" target="_blank"> 
              <img src="http://dev.alipay.com/promotion/images/88x30_logo.gif" width="88" height="30" border="0" alt="支付宝"></a> 
              <!-- 支付宝 --><br><br>
			
							  
							  
							  <a href="#" onClick=javascript:window.close()> 
                                关闭窗口</a><font color="#999999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单完成 
                                创建时间：<%=shijian%>&nbsp;</font></div>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%end select%>
</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>