<!--
┌─ o91.com───────────────┐
│  动感购物商务平台WWW.SNSN.NET版权所有  │
│  设计：模糊视线13855119911 QQ：9912515 │
└────────────────────┘
-->
<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<%if request.cookies("snsn")("username")="" then
response.write "<script language=javascript>alert('对不起，您还没有登陆！');history.go(-1);</script>"
response.End
end if%>
<html>
 <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>
<head>
<title><%=webname%>--我要下订单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onMouseOver="window.status='【<%=webname%>】<%=weburl%> 如果您喜欢本站,别忘了把本站介绍给您的好友哦！：）';return true">
<!--#include file="webtop.asp"-->
<div align="center">
<TABLE id=table1 style="MARGIN: 0px auto; BORDER-BOTTOM: #ffffff 0px solid" 
height="100%" cellSpacing=0 borderColorDark=#FFFFFF cellPadding=0 width=976 
borderColorLight=#CECECE border=1>
  <TBODY>
  <TR><!--sart left-->
    <TD vAlign=top width=234 bgcolor="#F1F1F1">
      <p align="center"><!--#include file="left.asp"--></TD><!---end left--><!--start right-->
    <TD vAlign=top align=middle width=736>
      <table width="700" height="300" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr> 
    <td width="0"><img src="../images/block.gif" width="1" height="1"></td>
    <td valign="top"><br>
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
        <tr> 
          <td height="0" bgcolor="cccccc"><img src="images/dot_03.gif" width="9" height="1" border="0"></td>
        </tr>
        <tr> 
          <td height="25" bgcolor="efefef"> <strong>&nbsp;&nbsp;<img src="images/dot_03.gif" width="9" height="9" border="0"> 
            </strong><strong>提交订单</strong>： 
            <b><font color="#FF0000">在最后结算前您还可以修改购物车内容</font></b>&nbsp; 
            </td>
        </tr>
        <tr> 
          <td height="1" bgcolor="cccccc"><img src="images/dot_03.gif" width="9" height="1" border="0"></td>
        </tr>
      </table>
      <%
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from shop_action where username='"&request.cookies("snsn")("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.shopid,shop_action.shopcount,shop_action.zonger,shop_snsn.shopname,shop_snsn.shichangjia,shop_snsn.huiyuanjia,shop_snsn.vipjia from shop_snsn inner join  shop_action on shop_snsn.shopid=shop_action.shopid where shop_action.username='"&request.cookies("snsn")("username")&"' and shop_action.zhuangtai=7",conn,1,1 
%>
      <table width=96% border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#CCCCCC">
        <form name='form1' method='post' action=jszx.asp?action=txxx>
          <tr bgcolor="f1f1f1" class="a1"> 
            <td width=21% height="22"  > <div align=center>商品名称</div></td>
            <td width=21% height="22"  > <div align=center>市场价</div></td>
            <td width=14% height="22"  > <div align=center>单价 
                <%if request.cookies("snsn")("reglx")=2 then %>
                (VIP) 
                <%else%>
                (会员) 
                <%end if%>
              </div></td>
            <td width=9% height="22"  > <div align=center>VIP(批发)价</div></td>
            <td width=14% height="22"  > <div align=center>数量</div></td>
            <td width=14% height="22"  > <div align=center>总价</div></td>
          </tr>
          <%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
          <tr bgcolor="#FFFFFF"> 
            <td style='PADDING-LEFT: 5px'  > <div align=left><%=rs("shopname")%> 
                <input name=shopid type=hidden value="<%=rs("shopid")%>" >
                <input name=actionid type=hidden value="<%=rs("actionid")%>" >
              </div></td>
            <td  ><%=rs("shichangjia")%></td>
            <td  > <div align=center> 
                <%
if request.Cookies("snsn")("reglx")=2 then 
	response.write rs("vipjia")
else
	response.write rs("huiyuanjia")
end if%>
                元</div></td>
            <td  ><%=rs("vipjia")%></td>
            <td  > <div align=center> <%=rs("shopcount")%> </div></td>
            <td  > <div align=center><%=rs("zonger")%>元</div></td>
          </tr>
          <%
jianshu=jianshu+rs("shopcount")
zongji=zongji+rs("zonger")
rs.movenext
loop
rs.close
set rs=nothing%>
          <tr bgcolor="#FFFFFF"> 
            <td height=36 colspan=7  > <div align=center> 
                <input name="Submit2" type="button" class="go-wenbenkuang" value="修改购物车" onClick="javascript:window.history.go(-1)">
                <input type="submit" name="Submit32" class="go-wenbenkuang" value="下一步">
              </div></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height=36 colspan=7  > <div align=center> 您的购物车里有商品：<%=shuliang%>件　总数量：<%=jianshu%>件　共计：<%=zongji%>元　您有预存款：<%=request.cookies("snsn")("yucun")%>元 
              </div></td>
          </tr>
          <%set snsn=server.CreateObject("adodb.recordset")
	snsn.open "select * from shop_action_jp where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,1
	if snsn.recordcount>0 then%>
          <tr bgcolor="#FFFFFF"> 
            <td colspan=5><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td><IMG height=5 src="images/block.gif" width=1></td>
                </tr>
              </table>
              <table width="81%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                <tr bgcolor="#FFFFFF"> 
                  <td height="22" colspan="2"  ><b>您已选择的奖品清单</b></td>
                </tr>
                <tr align="center" bgcolor="f1f1f1" class="a1"> 
                  <td height="23"  >奖品名称</td>
                  <td  >使用积分</td>
                </tr>
                <%
	while not snsn.eof%>
                <tr> 
                  <td bgcolor="#FFFFFF"  > 
                    <%
	set snsn1=server.CreateObject("adodb.recordset")
	snsn1.open "select * from shop_jiangpin where shopid="&snsn("shopid"),conn,1,1
	if snsn1.recordcount=1 then
	response.write "<font color=blue>"&snsn1("shopname")&"</font>"
	end if
	snsn1.close
	set snsn1=nothing%>
                  </td>
                  <td align="center" bgcolor="#FFFFFF"  ><%=snsn("jifen")%></td>
                </tr>
                <%
	snsn.movenext
	wend%>
              </table>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td height="5"><IMG height=5 src="images/block.gif" width=1></td>
                </tr>
              </table></td>
          </tr>
          <%end if
snsn.close
set snsn=nothing%>
        </form>
      </table>
      <br>
      <%
'/////////////////////////////////////////
case "txxx"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shop_user] where username='"&request.cookies("snsn")("username")&"'",conn,1,1
userid=rs("userid")
%>
      <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="f1f1f1"  class="a1"> 
          <td height="30" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>
			请正确填写以下收货信息</b></td>
        </tr>
        <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx2" onSubmit="ssxx">
          <tr bgcolor="#FFFFFF"> 
            <td width="103" bgcolor="#FFFFFF"   ><b>&nbsp;&nbsp;您的姓名：</b></td>
            <td width="564" height="28"   > &nbsp;&nbsp; <input name=userid type=hidden value="<%=userid%>" > 
              <b> 
              <input name="userzhenshiname" type="text" class="wenbenkuang" id="userzhenshiname" value=<%=trim(rs("userzhenshiname"))%>>
              　　性 别： 
              <select name="shousex" id="shousex" class="wenbenkuang">
                <option value="1">男</option>
                <option value="2">女</option>
                <option value="0">保密</option>
              </select>
              </b></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="103" bgcolor="#FFFFFF"  ><b>&nbsp;&nbsp;详细地址：</b></td>
            <td height="28" width="564"  > <b> &nbsp;&nbsp; 
              <input name="shouhuodizhi" type="text" class="wenbenkuang" id="shouhuodizhi"  value="<%=trim(rs("shouhuodizhi"))%>" size="40">
              </b></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="103" bgcolor="#FFFFFF"  ><b>&nbsp;&nbsp;邮政编码：</b></td>
            <td height="28" width="564"  > <p><b> &nbsp;&nbsp; 
                <input name="youbian" type="text" class="wenbenkuang" id="youbian" size="10" value="<%=rs("youbian")%>" onKeyPress="event.returnValue=IsDigit();">
                （我们将按邮政编码划分送货区域，请您正确填写！）</b></p></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="103" bgcolor="#FFFFFF"  ><b>&nbsp;&nbsp;联系电话：</b></td>
            <td height="28" width="564"  > <b> &nbsp;&nbsp; 
              <input name="usertel" class="wenbenkuang"  type="text" id="usertel"value=<%=trim(rs("usertel"))%>>
              </b></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="103" bgcolor="#FFFFFF"  ><b>&nbsp;&nbsp;电子邮件：</b></td>
            <td height="28" width="564"  > <b> &nbsp;&nbsp; 
              <input name="useremail" type="text" id="useremail" value=<%=rs("useremail")%> class="wenbenkuang">
              </b></td>
          </tr>
          <b><%=trim(request("useremail"))%> </b> 
          <tr bgcolor="#FFFFFF"> 
            <td height="32" colspan="2" align=center  > <input type="button" name="Submit22" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
              <input type="submit" name="Submit423" class="go-wenbenkuang" value="下一步" onClick="return ssxx();"> 
            </td>
          </tr>
        </form>
      </table>
      <%
rs.close
set rs=nothing%>
      <%
'/////////////////////////////////////////
case "txxx2"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shop_user] where username='"&request.cookies("snsn")("username")&"'",conn,1,1
%>
      <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
        <tr bgcolor="f1f1f1" class="a1"> 
          <td height="30" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>
			请正确选择送货方式</b></td>
        </tr>
        <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx3">
          <tr bgcolor="#FFFFFF"> 
            <td width="199" bgcolor="#FFFFFF"   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_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
          do while not rs3.EOF
          if not(shangmen=0 and trim(rs3("songid"))=3) then          '显示不显示“送货上门”
          	response.Write "<input name=songhuofangshi type=radio value="&rs3("songid")
          	if int(rs("songhuofangshi"))=int(rs3("songid")) then 
          		response.Write " checked>"
          	else
          		response.Write ">"
          	end if
          	response.Write trim(rs3("subject"))          
          end if
          rs3.MoveNext
          loop
          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="#FFFFFF"> 
            <td height="32" colspan="2" align=center  > <input type="button" name="Submit23" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
              <input type="submit" name="Submit424" class="go-wenbenkuang" value="下一步"> 
            </td>
          </tr>
        </form>
      </table>
      <%
rs.close
set rs=nothing
'/////////////////////////////////////////
case "txxx3"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shop_user] where username='"&request.cookies("snsn")("username")&"'",conn,1,1
%>
      <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="f1f1f1" class="a1"> 
          <td height="30" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>
			请正确选择付款方式</b></td>
        </tr>
        <form name="shouhuoxx" method="post" action="jszx.asp?action=txxx4">
          <tr bgcolor="#FFFFFF"> 
            <td width="199" bgcolor="#FFFFFF"   style='PADDING-LEFT: 20px'><b>
			付款方式：</b></td>
            <td width="771" height="28" style='PADDING-LEFT: 20px'  > <b> 
              <%
          if cint(request("songhuofangshi"))=3 then
          	fukuan=1
          else
          	fukuan=0
          end if
          '//////////判断支付方式
          set rs3=server.CreateObject("adodb.recordset")
          rs3.open "select * from shop_songhuo where fangshi=1 order by songidorder",conn,1,1
          do while not rs3.eof
          if not(fukuan=0 and trim(rs3("songid"))=4) then	'显示不显示“货到付款”
          	response.Write "<input name=zhifufangshi type=radio value="&rs3("songid")
          	if rs3("songid")=21 then
          		response.Write " checked>"
          	else
          		response.Write ">"
          	end if
          	response.Write trim(rs3("subject"))
          end if
          rs3.movenext
          loop
          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="songhuofangshi" type="hidden" value=<%=trim(request("songhuofangshi"))%>> 
              <input name=userid type=hidden value="<%=request("userid")%>" > 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="32" colspan="2" align=center  > <input type="button" name="Submit24" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
              <input type="submit" name="Submit42" class="go-wenbenkuang" value="下一步"> 
            </td>
          </tr>
        </form>
      </table>
      <%
rs.close
set rs=nothing
'/////////////////////////////////////////
case "txxx4"
%>
      <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
        <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="0" cellspacing="0">
                                <tr bgcolor="#FFFFFF"> 
                                  <td align="center" valign="top" height=50 colspan=2> 
                                    <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select sum(shopcount) as Sum_jianshu,sum(zonger) as Sum_zonger from shop_action where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,1 
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_action.actionid,shop_action.shopid,shop_action.shopcount,shop_action.zonger,shop_snsn.shopname,shop_snsn.anclassid,shop_snsn.banci,shop_snsn.shichangjia,shop_snsn.huiyuanjia,shop_snsn.vipjia from shop_snsn inner join  shop_action on shop_snsn.shopid=shop_action.shopid where shop_action.username='"&request.cookies("snsn")("username")&"' and shop_action.zhuangtai=7",conn,1,1 
%>
                                    <table width=100% border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#CCCCCC" class="table-zuoshang">
                                      <tr bgcolor="f1f1f1" class="a1"> 
                                        <td width=21% height="22"  > <div align=center>
											商品名称</div></td>
                                        <td width=21% height="22"  > <div align=center>
											市场价</div></td>
                                        <td width=14% height="22"  > <div align=center>
											单价 
                                            <%if request.cookies("snsn")("reglx")=2 then %>
                                            (VIP) 
                                            <%else%>
                                            <%if tmpPIFA=1 then %>
                                            (批发) 
                                            <%else%>
                                            (会员) 
                                            <%end if%>
                                            <%end if%>
                                          </div></td>
                                        <td width=14% height="22"  > <div align=center>
											数量</div></td>
                                        <td width=14% height="22"  > <div align=center>
											邮寄浮动<br>
                                            (单价)</div></td>
                                        <td width=14% height="22"  > <div align=center>
											总价</div></td>
                                      </tr>
                                      <%shuliang=rs.recordcount
jianshu=0
zongji=0
fudongjia=0
do while not rs.eof%>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td style='PADDING-LEFT: 5px'  > <div align=left><%=rs("shopname")%> 
                                            <input name=shopid2 type=hidden value="<%=rs("shopid")%>" >
                                            <%shopname=rs("shopname")%>
                                            <input name=actionid2 type=hidden value="<%=rs("actionid")%>" >
                                          </div></td>
                                        <td align="center"  ><s><%=rs("shichangjia")%></s> 
                                          元</td>
                                        <td  > <div align=center> 
                                            <%
if (request.Cookies("snsn")("reglx")=2) or (tmpPIFA=1) then 
	response.write rs("vipjia")
else
	response.write rs("huiyuanjia")
end if%>
                                            元</div></td>
                                        <td  > <div align=center> <%=rs("shopcount")%> 
                                          </div></td>
                                        <td  > <div align=center> 
                                            <%
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"))=3 then	'看是不是“送货上门”
	if request.Cookies("snsn")("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("snsn")("reglx")=2 then
		fudongjia_dj=rs_s("pyvip")
	else
		fudongjia_dj=rs_s("pyhy")
	end if
else
	if request.Cookies("snsn")("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
%>
                                          </div></td>
                                        <td  > <div align=center> 
                                            <%if tmpPIFA=1 then%>
                                            <%=rs("vipjia")*rs("shopcount")%> 
                                            <%else%>
                                            <%=rs("zonger")%> 
                                            <%end if%>
                                            元</div></td>
                                      </tr>
                                      <%
jianshu=jianshu+rs("shopcount")
if tmpPIFA=1 then
	zongji=zongji+rs("vipjia")*rs("shopcount")
else
	zongji=zongji+rs("zonger")
end if
'算每件商品的浮动价
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_fudong where id="&rs("banci"),conn,1,1 
fudongjia=fudongjia+rs("shopcount")*fudongjia_dj
rs_s.close
set rs_s=nothing

rs.movenext
loop
rs.close
set rs=nothing%>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td height=36 colspan=7  > <div align=center> 
                                            货款总计：<%=zongji%>元</div></td>
                                      </tr>
                                      <%set snsn=server.CreateObject("adodb.recordset")
	snsn.open "select * from shop_action_jp where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,1
	if snsn.recordcount>0 then%>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td colspan="6"  ><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td><IMG height=5 src="images/block.gif" width=1></td>
                                            </tr>
                                          </table>
                                          <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
                                            <tr bgcolor="#FFFFFF"> 
                                              <td height="23" colspan="2"  ><b>
												您已选择的奖品清单</b></td>
                                            </tr>
                                            <tr align="center" bgcolor="f1f1f1"  > 
                                              <td height="22" class="a1">奖品名称</td>
                                              <td height="22" class="a1">使用积分</td>
                                            </tr>
                                            <%
	while not snsn.eof%>
                                            <tr bgcolor="#FFFFFF"  > 
                                              <td> 
                                                <%
	set snsn1=server.CreateObject("adodb.recordset")
	snsn1.open "select * from shop_jiangpin where shopid="&snsn("shopid"),conn,1,1
	if snsn1.recordcount=1 then
	response.write "<font color=blue>"&snsn1("shopname")&"</font>"
	end if
	snsn1.close
	set snsn1=nothing%>
                                              </td>
                                              <td align="center"><%=snsn("jifen")%></td>
                                            </tr>
                                            <%
	snsn.movenext
	wend%>
                                          </table>
                                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td><IMG height=5 src="images/block.gif" width=1></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <%end if
snsn.close
set snsn=nothing%>
                                    </table>
                                    <br> </td>
                                </tr>
                                <tr bgcolor="#FFFFFF"> 
                                  <td width="594"  align="center" valign="top"> 
                                    <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
                                      <tr align="center" bgcolor="f1f1f1" class="a1"> 
                                        <td height="23" colspan="2"  ><b>您的订单信息</b></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										收货人姓名<br> 
                                        </td>
                                        <td width="77%"  ><%=request("userzhenshiname")%></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										邮政编码<br> 
                                        </td>
                                        <td width="77%"  ><%=request("youbian")%></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										收货地址<br> 
                                        </td>
                                        <td width="77%"  ><%=request("shouhuodizhi")%></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										联系电话<br> 
                                        </td>
                                        <td width="77%"  ><%=request("usertel")%></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										电子邮箱 
                                        </td>
                                        <td width="77%"  ><%=request("useremail")%></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										送货方式 
                                        </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 bgcolor="#FFFFFF"> 
                                        <td width="23%" height="22" align="center" bgcolor="#FFFFFF"  >
										支付方式</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>
                                    </table></td>
                                  <td width="356"  align="center" valign="top"> 
                                    <table width="98%" border="0" align="right" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
                                      <tr align="center"  > 
                                        <td height="23" colspan="2" align="center" bgcolor="f1f1f1" class="a1"><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")

if cint(request("songhuofangshi"))=3 then	'先看是不是送货
	'rs.close
	if request.cookies("snsn")("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
else
	'不是送货上门的还要看是什么方式送货
	if cint(request("songhuofangshi"))=1 then	'看是不是"普通平邮"
		'rs.close
		if request.cookies("snsn")("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
	else
		rs.close
		if request.cookies("snsn")("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 [shop_user] where username='"&request.cookies("snsn")("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
zj=feiyong+zongji
%>
                                      <tr> 
                                        <td height="22" align="right" bgcolor="#FFFFFF"   style='PADDING-right: 20px'>
										订单总金额为： 
                                          <%=formatnumber(zj,2)%></td>
                                      </tr>
                                      <tr> 
                                        <td height="22" align=right bgcolor="#FFFFFF"   style='PADDING-right: 20px'>
										您的送货费用计：　<%=feiyong%> 
                                          元</td>
                                      </tr>
                                      <tr> 
                                        <td height="22" align=right bgcolor="#FFFFFF"   style='PADDING-right: 20px'>
										(其中　　基价：<%=jijia%>元)</td>
                                      </tr>
                                      <tr> 
                                        <td height="22" align=right bgcolor="#FFFFFF"   style='PADDING-right: 20px'>
										(浮动价：<%=fudongjia%>元)</td>
                                      </tr>
                                      <tr> 
                                        <td height="22" bgcolor="#FFFFFF"  >　</td>
                                      </tr>
                                      <tr> 
                                        <td height="22" align=right bgcolor="#FFFFFF"   style='PADDING-right: 20px'><b><font color="#FF0000">
										订单总金额 ： <%=formatnumber(zj,2)%>元</font></b></td>
                                      </tr>
                                      <tr> 
                                        <td height="22" align=right bgcolor="#FFFFFF"  ><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="#FFFFFF" 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">
                                            要求发票<font color="#FF3300">&nbsp;</font> 
                                            <input name="shopname" type="hidden" value=<%=shopname%>>
                                            <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" class="wenbenkuang"> 
                                          </td>
                                          <td width="31%" align="center" height="60"> 
                                            <input type="button" name="Submit222" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
                                            <input type="submit" name="Submit422" class="go-wenbenkuang" 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
'修改用户的送货信息
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shop_user] where username='"&request.cookies("snsn")("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
'再判断库存
set rs=server.CreateObject("adodb.recordset")
rs.open "select sum(shopcount) as Sum_jianshu,sum(zonger) as Sum_zonger from shop_action where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,1 
rs.close
dim shijian,dingdan
shijian=now()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,3
dingdan=year(shijian)&month(shijian)&day(shijian)&hour(shijian)&minute(shijian)&second(shijian)
do while not rs.eof
'得到价格，减库存
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from shop_snsn where shopid="&rs("shopid"),conn,1,3
if (request.Cookies("snsn")("reglx")=2)  then 
	danjia=rs2("vipjia")
else
	danjia=rs2("huiyuanjia")
end if
rs2("chengjiaocount")=rs2("chengjiaocount")+rs("shopcount")
rs2("kucun")=rs2("kucun")-rs("shopcount")
rs2.update
rs2.close
set rs2=nothing
rs("actiondate")=shijian
if request("zhifufangshi")=17 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("zonger")=danjia*rs("shopcount")
rs.update
rs.movenext
loop
rs.close
set rs=nothing
'再改奖品
z_jifen=0
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action_jp where username='"&request.cookies("snsn")("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 [shop_user] where username='"&request.cookies("snsn")("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
'/////////////HTML
'发送邮件
set rs=server.CreateObject("adodb.recordset")
rs.Open "select mailaddress,mailusername,mailuserpass,mailname,mailsend from shop_config",conn,1,1
mailaddress=rs("mailaddress")
mailusername=rs("mailusername")
mailuserpass=rs("mailuserpass")
mailname=rs("mailname")
mailsend=rs("mailsend")
rs.close
set rs=nothing
	'发送注册邮件
	topic="您在" & webname & "的订单信息"
	
set rs=server.CreateObject("adodb.recordset")
rs.open "select sum(shopcount) as Sum_jianshu,sum(zonger) as Sum_zonger from shop_action where username='"&request.cookies("snsn")("username")&"' and dingdan='"&dingdan&"'",conn,1,1 
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_action.actionid,shop_action.shopid,shop_action.shopcount,shop_action.zonger,shop_snsn.shopname,shop_snsn.anclassid,shop_snsn.banci,shop_snsn.shichangjia,shop_snsn.huiyuanjia,shop_snsn.vipjia from shop_snsn inner join  shop_action on shop_snsn.shopid=shop_action.shopid where shop_action.username='"&request.cookies("snsn")("username")&"' and dingdan='"&dingdan&"'",conn,1,1 

	mailbody="<html>"
	mailbody=mailbody & "<title>订单信息</title>"
	mailbody=mailbody & "<style type=text/css>"
	mailbody=mailbody & ".table-you {	border-right-width: 1px;	border-right-style: dotted;	border-right-color: #cccccc;}"
	mailbody=mailbody & ".table-zuo {	border-left-width: 1px;	border-left-style: dotted;	border-left-color: #CCCCCC;}"
	mailbody=mailbody & ".table-shang {	border-top-width: 1px;	border-top-style: dotted;	border-top-color: #CCCCCC;}"
	mailbody=mailbody & ".table-xia {	border-bottom-width: 1px;	border-bottom-style: dotted;	border-bottom-color: #CCCCCC;}"
	mailbody=mailbody & ".table-xiayou {border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #cccccc;border-right-width: 1px;border-right-style: solid;border-right-color: #cccccc;}"
	mailbody=mailbody & ".table-zuoshang {border-left-width: 1px;border-left-style: solid;border-left-color: #cccccc;border-top-width: 1px;order-top-style: solid;border-top-color: #cccccc;border-top-style: solid;}"
	mailbody=mailbody & "</style>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	                  
	 mailbody=mailbody & "<table width=98% border=0 align=center cellpadding=0 cellspacing=0 class='table-zuoshang'>"
     mailbody=mailbody & "<tr  class=a1>"
     mailbody=mailbody & "<td width=21% height=22 > "
     mailbody=mailbody & "<div align=center> 商品名称</font></div></td>"
      mailbody=mailbody & "<td width=21% height=22 > "
      mailbody=mailbody & "<div align=center> 市场价</font></div></td>"
      mailbody=mailbody & "<td width=14% height=22 >"
      mailbody=mailbody & "<div align=center> 单价 "
      if request.cookies("snsn")("reglx")=2 then
		mailbody=mailbody & "(VIP)"
      else
		if tmpPIFA=1 then
			mailbody=mailbody & "(批发)"
		else
			mailbody=mailbody & "(会员)"
		end if
      end if
      mailbody=mailbody & "</font></div></td>"
      mailbody=mailbody & "<td width=14% height=22 >"
      mailbody=mailbody & "<div align=center> 数量</font></div></td>"
      mailbody=mailbody & "<td width=14% height=22 > "
      mailbody=mailbody & "<div align=center> 邮寄浮动<br>"
      mailbody=mailbody & "(单价)</font></div></td>"
      mailbody=mailbody & "<td width=14% height=22 >"
      mailbody=mailbody & "<div align=center> 总价</font></div></td>"
      mailbody=mailbody & "</tr>"
		shuliang=rs.recordcount
        jianshu=0
        zongji=0 
        fudongjia=0 
        do while not rs.eof 
      mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
      mailbody=mailbody & "<td style='PADDING-LEFT: 5px' > "
      mailbody=mailbody & "<div align=left><font color=blue>"&rs("shopname")&"</font> "
      mailbody=mailbody & "<input name=shopid2 type=hidden value="&rs("shopid")&">"
      mailbody=mailbody & "<input name=actionid2 type=hidden value="&rs("actionid")&">"
      mailbody=mailbody & "</div></td>"
      mailbody=mailbody & "<td align=center ><s>"&rs("shichangjia")&"</s>元</td>"
      mailbody=mailbody & "<td > <div align=center>"
      if (request.Cookies("snsn")("reglx")=2) or (tmpPIFA=1) then
		mailbody=mailbody & rs("vipjia")
      else
		mailbody=mailbody & rs("huiyuanjia")
      end if
     mailbody=mailbody & "元</div></td>"
     mailbody=mailbody & "<td > <div align=center><font color=#dd6600> "
     mailbody=mailbody & rs("shopcount")&"</font></div></td>"
     mailbody=mailbody & "<td > <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"))=3 then	'看是不是“送货上门”
		if request.Cookies("snsn")("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("snsn")("reglx")=2 then
			fudongjia_dj=rs_s("pyvip")
		else
			fudongjia_dj=rs_s("pyhy")
		end if
	 else
		if request.Cookies("snsn")("reglx")=2 then
			fudongjia_dj=rs_s("emsvip")
		else
			fudongjia_dj=rs_s("emshy")
		end if
	 end if
	mailbody=mailbody & fudongjia_dj
	rs_s.close
	set rs_s=nothing

 mailbody=mailbody & "</font></div></td>"
 mailbody=mailbody & "<td > <div align=center><font color=#FF3300>"
	if tmpPIFA=1 then
		mailbody=mailbody & rs("vipjia")*rs("shopcount")
	else
		mailbody=mailbody & rs("zonger")
	end if
   mailbody=mailbody & "</font>元</div></td>"
   mailbody=mailbody & "</tr>"
	jianshu=jianshu+rs("shopcount")
	if tmpPIFA=1 then
		zongji=zongji+rs("vipjia")*rs("shopcount")
	else
		zongji=zongji+rs("zonger")
	end if

	set rs_s=server.CreateObject("adodb.recordset")
	rs_s.open "select * from shop_fudong where id="&rs("banci"),conn,1,1
	fudongjia=fudongjia+rs("shopcount")*fudongjia_dj
	rs_s.close
	set rs_s=nothing

	rs.movenext
	loop
	rs.close
	set rs=nothing
 mailbody=mailbody & "<tr bgcolor=#FFFFFF>"
 mailbody=mailbody & "<td height=36 colspan=7 >"
 mailbody=mailbody & "<div align=center> 货款总计："&zongji&"元</div></td>"
 mailbody=mailbody & "</tr>"
	set snsn=server.CreateObject("adodb.recordset")
	snsn.open "select * from shop_action_jp where username='"&request.cookies("snsn")("username")&"' and zhuangtai=7",conn,1,1
	if snsn.recordcount>0 then
	mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
	mailbody=mailbody & "<td colspan=6 > "
	mailbody=mailbody & "<table width=96% border=0 cellspacing=0 cellpadding=0 align=center  >"
  mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
  mailbody=mailbody & " <td colspan=2 ><b> 您已选择的奖品清单</font></b></td>"
  mailbody=mailbody & "</tr>"
  mailbody=mailbody & "<tr align=center  > "
   mailbody=mailbody & "<td height=22  class=a1><font color="&flzhzt&">奖品名称</font></td>"
   mailbody=mailbody & "<td height=22  class=a1><font color="&flzhzt&">使用积分</font></td>"
   mailbody=mailbody & "</tr>"
   while not snsn.eof
    mailbody=mailbody & "<tr bgcolor=#FFFFFF > "
    mailbody=mailbody & "<td>"
    set snsn1=server.CreateObject("adodb.recordset")
	snsn1.open "select * from shop_jiangpin where shopid="&snsn("shopid"),conn,1,1
	if snsn1.recordcount=1 then
		mailbody=mailbody & "<font color=blue>"&snsn1("shopname")&"</font>"
	end if
		snsn1.close
	set snsn1=nothing
     mailbody=mailbody & "</td>"
     mailbody=mailbody & "<td align=center>"&snsn("jifen")&"</td>"
     mailbody=mailbody & "</tr>"
    snsn.movenext
   wend
    mailbody=mailbody & "</table></td>"
    mailbody=mailbody & "</tr>"
    end if
	snsn.close
	set snsn=nothing
    mailbody=mailbody & "</table>"

	mailbody=mailbody & "<table width=98% border=0 align=center cellpadding=0 cellspacing=0 class='table-zuoshang'>"

    mailbody=mailbody & " <tr bgcolor=#FFFFFF> "
    mailbody=mailbody & "<td width=594  align=center valign=top>"
    mailbody=mailbody & "<table width=96% border=0 cellspacing=0 cellpadding=0  >"
    mailbody=mailbody & "<tr align=center  class=a1> "
    mailbody=mailbody & "<td height=22 colspan=2 ><b> 您的订单信息</font></b></td></tr><tr bgcolor=#FFFFFF> <td width=23% >姓名<br></td><td width=77% >"&request("userzhenshiname")&"</td></tr><tr bgcolor=#FFFFFF> <td width=23% >邮编<br></td><td width=77% >"&request("youbian")&"</td></tr><tr bgcolor=#FFFFFF> <td width=23% >地址<br>  </td><td width=77% >"&request("shouhuodizhi")&"</td></tr>"
    mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
    mailbody=mailbody & "<td width=23% >电话<br></td>"
    mailbody=mailbody & "<td width=77% >"&request("usertel")&"</td></tr>"
    mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
    mailbody=mailbody & "<td width=23% >邮箱</td>"
    mailbody=mailbody & "<td width=77% >"&request("useremail")&"</td></tr>"
    mailbody=mailbody & " <tr bgcolor=#FFFFFF> "
    mailbody=mailbody & "<td width=23% >送货 </td>"
    mailbody=mailbody & "<td width=77% > "
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where songid="&request("songhuofangshi"),conn,1,1
	mailbody=mailbody & rs("subject")
rs.close
set rs=nothing
    mailbody=mailbody & "</td></tr>"
    mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
    mailbody=mailbody & " <td width=23% >支付</td>"
    mailbody=mailbody & " <td width=77% > "
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where songid="&request("zhifufangshi"),conn,1,1
	mailbody=mailbody &  rs("subject")
rs.close
set rs=nothing
    mailbody=mailbody & "</td></tr>"
    mailbody=mailbody & "<tr bgcolor=#FFFFFF> "
    mailbody=mailbody & "<td width=23% ><br> </td>"
    mailbody=mailbody & "<td width=77% >&nbsp; </td></tr> </table></td>"
    mailbody=mailbody & "<td width=356  align=center valign=top> "
    mailbody=mailbody & "<table width=96% border=0 cellspacing=0 cellpadding=0  >"
    mailbody=mailbody & "<tr align=center > "
    mailbody=mailbody & "<td height=22 colspan=2  class=a1><b> 送货费计算</font></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")

'先看是不是送货
'set rs=server.CreateObject("adodb.recordset")
'rs.open "select * from shop_songhuo where songid="&trim(request("songhuofangshi")),conn,1,1
if cint(request("songhuofangshi"))=3 then	'先看是不是送货
	'rs.close
	if request.cookies("snsn")("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("snsn")("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
	else
		rs.close
		if request.cookies("snsn")("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
end if

	mailbody=mailbody & "<tr><td bgcolor=#FFFFFF >&nbsp;</td></tr>"
	mailbody=mailbody & "<tr><td style='PADDING-right: 20px' align=right bgcolor=#FFFFFF >您的送货费用计：　"&feiyong&" 元<br>(其中　　基价："&jijia&"元)<br>(浮动价："&fudongjia&"元)</td></tr>"
    mailbody=mailbody & "<tr> <td bgcolor=#FFFFFF >&nbsp;</td></tr>"
    mailbody=mailbody & "<tr><td style='PADDING-right: 20px' align=right bgcolor=#FFFFFF ><b><font color=red>您的订单总金额：　"&feiyong+zongji&" 元</font></b></td> </tr>"
    mailbody=mailbody & "<tr><td height=20 bgcolor=#FFFFFF ></td></tr>"
    mailbody=mailbody & "<tr><td align=right bgcolor=#FFFFFF ><a href='"&weburl&"/help.asp?action=feiyong' target=_blank>查看送货费用说明</a></td></tr> </table></td></tr>"
    mailbody=mailbody & "</table></td></tr>"


	mailbody=mailbody & "<tr><td><table width=98% border=0 align=center cellpadding=0 cellspacing=0 class='table-zuoshang'><tr><td>"
	mailbody=mailbody & request.cookies("snsn")("username")&"("&trim(request("userzhenshiname"))&")"&"，您好：<br><br>"
	mailbody=mailbody & "感谢您在本购物中心，我们将提供给您最好的服务！<br>"
	mailbody=mailbody & "下面是您在" & webname & "的订单信息：<br><br>"
	mailbody=mailbody & "订单号："& dingdan &"<br>"
	mailbody=mailbody & "<br><br>"
	mailbody=mailbody & "<center><font color=red>再次感谢您使用本系统！</font>"
	mailbody=mailbody & "</TD></TR></TABLE></TD></TR></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
'response.write mailbody
'response.end
	
%>
      <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr class="a1"> 
          <td height="23" bgcolor="f1f1f1"   > <div align="center"><b>
			您的订单已经成功提交，我们会在第一时间进行处理，请记住您的订单号以备查询。</b></div></td>
        </tr>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  >订单号：<%=dingdan%>&nbsp; 
            <%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_pay ",conn,1,3
username=trim(rs("username"))
leixing=trim(rs("leixing"))
ver=trim(rs("ver"))
xinxi=trim(rs("xinxi"))
payid=trim(rs("payid"))
urlback=trim(rs("urlback"))
fangshi=trim(rs("fangshi"))
email=trim(rs("email"))
handphone=trim(rs("handphone"))
rs.Close
set rs=nothing
%></font></a></td>
        </tr>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  >
			订单查询：您可通过“<a href="user.asp">我的专区</a>”&gt;&gt;“<a href="user.asp?action=dingdan">我的订单</a>”查询您的订单状态。</td>
        </tr>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  >
			购物积分：请在收货后通过“<a href="user.asp">我的专区</a>”&gt;&gt;“<a href="user.asp?action=dindan">我的订单</a>”及时更改您的订单状态为“完成”，因为每笔订单的积分只有在订单完成后才能累计到您的购物积分中。 
          </td>
        </tr>
        <%if request("zhifufangshi")=17 then %>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  >
			您是通过预存款支付的，我们会尽快地给你发货的！</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="#FFFFFF" style='PADDING-LEFT: 50px'>
			您是选择的“货到付款”，我们会尽快给您送货的！</td>
          <script language=javascript>alert('您是选择的“货到付款”，请确认您的订单，我们会尽快给您送货的！');</script>
        </tr>
        <%else
                          rs.close
                          set rs=nothing%>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  >
			请您在一周内依照您选择的支付方式进行付款，付款时请注明您的订单号！</td>
          <script language=javascript>alert('请您在一周内依照您选择的支付方式进行付款，付款时请注明您的订单号！');</script>
        </tr>
        <%end if%>
        <%end if%>
        <tr> 
          <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 50px'  > <div align="right"><a href="#" onClick=javascript:window.close()> 
              关闭窗口</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单完成 创建时间：<%=shijian%>&nbsp;</div></td>
        </tr>
      </table>
      <br> 
      <%end select%>
    </td>
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
  </tr>
</table>

</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>　</TD><!--end right--></TR></TBODY></TABLE></div>
<!--#include file="copyright.asp"-->