<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<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"-->
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
    <td> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="100" valign="top"> <img src="images/block.gif" width="1" height="1"> 
            <br> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
              <tr> 
                <td height="1" 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><b>我要下订单</b></td>
              </tr>
              <tr> 
                <td height="1" bgcolor="cccccc"><img src="images/dot_03.gif" width="9" height="1" border="0"></td>
              </tr>
            </table>
            <%dim shopid,action,i
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from shop_action where username='"&session("tmp_usersessionid")&"' and zhuangtai=7",conn,1,1
if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起，您购物车没有商品，请在购物后，再去“结算中心”！');window.history.go(-1);</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='"&session("tmp_usersessionid")&"' and shop_action.zhuangtai=7",conn,1,1 
%>
            <table width=96% border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#CCCCCC" class="table-zuoshang">
              <form name='form1' method='post' action=snsn.asp?action=txxx>
                <tr class="a1"> 
                  <td width=21% height="25" bgcolor="f1f1f1"  > <div align=center><strong>商品名称</strong></div></td>
                  <td width=21% height="25" bgcolor="f1f1f1"  > <div align=center><strong>市场价</strong></div></td>
                  <td width=21% height="25" bgcolor="f1f1f1"  > <div align=center><strong>批发价</strong></div></td>
                  <td width=14% height="25" bgcolor="f1f1f1"  > <div align=center><strong>单价</strong></div></td>
                  <td width=14% height="25" bgcolor="f1f1f1"  > <div align=center><strong>数量</strong></div></td>
                  <td width=14% height="25" bgcolor="f1f1f1"  > <div align=center><strong>总价</strong></div></td>
                </tr>
                <%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
                <tr> 
                  <td height="25" bgcolor="#FFFFFF"   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 height="25" align="center" bgcolor="#FFFFFF"  ><%=rs("shichangjia")%></td>
                  <td height="25" align="center" bgcolor="#FFFFFF"  ><%=rs("vipjia")%></td>
                  <td height="25" bgcolor="#FFFFFF"  > <div align=center><%=rs("shichangjia")%> 
                      元</div></td>
                  <td height="25" bgcolor="#FFFFFF"  > <div align=center> <%=rs("shopcount")%> 
                    </div></td>
                  <td height="25" bgcolor="#FFFFFF"  > <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> 
                  <td height=36 colspan=7 bgcolor="#FFFFFF"  > <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> 
                  <td height=36 colspan=7 bgcolor="#FFFFFF"  > <div align=center> 
                      您的购物车里有商品：<%=shuliang%>件　总数量：<%=jianshu%>件　共计：<%=zongji%>元　您有预存款：<%=request.cookies("snsn")("yucun")%>元 
                      <%if (jianshu>=cint(pifa_s)) or (zongji>=cint(pifa_e)) then%>
                      <br>
                      <font color=red>您所购商品已经达到享有批发价的标准，结算时，将按批发价计算！</font> 
                      <%end if%>
                    </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> 
                  <td colspan=5 bgcolor="#FFFFFF"><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="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                      <tr bgcolor="#FFFFFF"> 
                        <td height="23" colspan="2"  ><b>您已选择的奖品清单</b></td>
                      </tr>
                      <tr align="center" bgcolor="f1f1f1" class="a1"> 
                        <td height="23"  >奖品名称</td>
                        <td height="23"  >使用积分</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%>
              </form>
            </table>
            <br> 
            <%
'/////////////////////////////////////////
case "txxx"
%>
            <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
              <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="f1f1f1"  class="a1"> 
                                        <td height="40" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>请正确填写以下收货信息</b></td>
                                      </tr>
                                      <form name="shouhuoxx" method="post" action="snsn.asp?action=txxx2" onSubmit="ssxx">
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"  ><b>&nbsp;&nbsp;收货人姓名：</b></td>
                                          <td width="771" height="28"  > &nbsp;&nbsp; 
                                            <input name=userid type=hidden value="" > 
                                            <b> 
                                            <input name="userzhenshiname" type="text" class="wenbenkuang" id="userzhenshiname" value=>
                                            　　性 别： 
                                            <select name="shousex" id="select" class="wenbenkuang">
                                              <option value=1 selected>男</option>
                                              <option value=2 >女</option>
                                              <option value=0>保密</option>
                                            </select>
                                            </b></td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"  ><b>&nbsp;&nbsp;详细地址：</b></td>
                                          <td width="771" height="28"  > <b> &nbsp;&nbsp; 
                                            <input name="shouhuodizhi" type="text" class="wenbenkuang" id="shouhuodizhi"  value="" size="40">
                                            </b></td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"  ><b>&nbsp;&nbsp;邮编：</b></td>
                                          <td width="771" height="28"  > <p><b> 
                                              &nbsp;&nbsp; 
                                              <input name="youbian" type="text" class="wenbenkuang" id="youbian" size="10" value="" onKeyPress="event.returnValue=IsDigit();">
                                              （我们将按邮政编码划分送货区域，请您正确填写！）</b></p></td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"  ><b>&nbsp;&nbsp;电话：</b></td>
                                          <td width="771" height="28"  > <b> &nbsp;&nbsp; 
                                            <input name="usertel" class="wenbenkuang"  type="text" id="usertel"value=>
                                            </b></td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"  ><b>&nbsp;&nbsp;电子邮件：</b></td>
                                          <td width="771" height="28"  > <b> &nbsp;&nbsp; 
                                            <input name="useremail"class="wenbenkuang" type="text" id="useremail" value= >
                                            </b></td>
                                        </tr>
                                        <b></b> 
                                        <tr bgcolor="#FFFFFF"> 
                                          <td height="32" colspan="2" align=center  > 
                                            <input type="button" name="Submit2" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
                                            <input type="submit" name="Submit42" class="go-wenbenkuang" value="下一步" onClick='return ssxx();'> 
                                          </td>
                                        </tr>
                                      </form>
                                    </table></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <%
'/////////////////////////////////////////
case "txxx2"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shop_action] where userzhenshiname=userzhenshiname",conn,1,1
%>
            <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
              <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" class="table-zuoshang">
                                      <tr bgcolor="#FFFFFF" class="a1"> 
                                        <td height="40" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>请正确选择送货方式</b></td>
                                      </tr>
                                      <form name="shouhuoxx" method="post" action="snsn.asp?action=txxx3">
                                        <tr bgcolor="#FFFFFF"> 
                                          <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_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="Submit" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
                                            <input type="submit" name="Submit" class="go-wenbenkuang" value="下一步" > 
                                          </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 [shop_action] where userzhenshiname=userzhenshiname",conn,1,1
%>
            <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
              <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%" class="table-zuoshang">
                                <tr> 
                                  <td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                      <tr bgcolor="#FFFFFF" class="a1"> 
                                        <td height="40" colspan="2" align="center"   style='PADDING-LEFT: 20px'><b>请正确选择付款方式</b></td>
                                      </tr>
                                      <form name="shouhuoxx" method="post" action="snsn.asp?action=txxx4">
                                        <tr bgcolor="#FFFFFF"> 
                                          <td width="199"   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 int(rs("zhifufangshi"))=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="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="Submit2" class="go-wenbenkuang" value="上一步" onClick="javascript:history.go(-1)"> 
                                            <input type="submit" name="Submit42" class="go-wenbenkuang" value="下一步"> 
                                          </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="0" 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="0" cellspacing="0">
                                      <tr> 
                                        <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='"&session("tmp_usersessionid")&"' and zhuangtai=7",conn,1,1 
if (rs("Sum_jianshu")>cint(pifa_s)) or (rs("Sum_zonger")>cint(pifa_e)) then
	tmpPIFA=1
else 
	tmpPIFA=0
end if
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='"&session("tmp_usersessionid")&"' 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="#FFFFFF" class="a1"> 
                                              <td width=21% height="23"  > <div align=center><strong>商品名称</strong></div></td>
                                              <td width=21% height="23"  > <div align=center><strong>市场价</strong></div></td>
                                              <td width=21% height="23"  > <div align=center><strong>批发价</strong></div></td>
                                              <td width=14% height="23"  > <div align=center><strong>单价 
                                                  </strong></div></td>
                                              <td width=14% height="23"  > <div align=center><strong>数量</strong></div></td>
                                              <td width=14% height="23"  > <div align=center><strong>邮寄浮动<br>
                                                  (单价)</strong></div></td>
                                              <td width=14% height="23"  > <div align=center><strong><font color="<%=flzhbt%>">总价</font></strong></div></td>
                                            </tr>
                                            <%
											shuliang=rs.recordcount
jianshu=0
zongji=0
fudongjia=0
do while not rs.eof%>
                                            <tr> 
                                              <td bgcolor="#FFFFFF" style='PADDING-LEFT: 5px'  > 
                                                <div align=left><%=rs("shopname")%> 
                                                  <input name=shopname type=hidden value="<%=rs("shopname")%>" >
                                                  <input name=shopid2 type=hidden value="<%=rs("shopid")%>" >
                                                  <input name=actionid type=hidden value="<%=rs("actionid")%>" >
                                                </div></td>
                                              <td align="center" bgcolor="#FFFFFF"  ><s><%=rs("shichangjia")%></s> 
                                                元</td>
                                              <td align="center" bgcolor="#FFFFFF"  ><s><%=rs("vipjia")%></s> 
                                                元</td>
                                              <td bgcolor="#FFFFFF"  > <div align=center> 
                                                  <%if tmpPIFA=1 then%>
                                                  <%=rs("Vipjia")%> 
                                                  <%else%>
                                                  <%=rs("shichangjia")%> 
                                                  <%end if%>
                                                  元</div></td>
                                              <td bgcolor="#FFFFFF"  > <div align=center> 
                                                  <%=rs("shopcount")%> </div></td>
                                              <td bgcolor="#FFFFFF"  > <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 bgcolor="#FFFFFF"  > <div align=center><font color=#FF3300> 
                                                  <%if tmpPIFA=1 then%>
                                                  <%=rs("vipjia")*rs("shopcount")%> 
                                                  <%else%>
                                                  <%=rs("zonger")%> 
                                                  <%end if%>
                                                  </font>元</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> 
                                              <td height=36 colspan=7 bgcolor="#FFFFFF"  > 
                                                <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> 
                                              <td colspan="6" bgcolor="#FFFFFF"  ><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" >
                                                  <tr bgcolor="#FFFFFF"> 
                                                    <td height="23" colspan="2"  ><b>您已选择的奖品清单</b></td>
                                                  </tr>
                                                  <tr align="center" bgcolor="f1f1f1"  > 
                                                    <td height="23" class="a1">奖品名称</td>
                                                    <td height="23" 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> 
                                        <td width="594"  align="center" valign="top" bgcolor="#FFFFFF"> 
                                          <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="23"  >姓名<br> 
                                              </td>
                                              <td width="77%" height="23"  ><%=request("userzhenshiname")%></td>
                                            </tr>
                                            <tr bgcolor="#FFFFFF"> 
                                              <td width="23%" height="23"  >邮编<br> 
                                              </td>
                                              <td width="77%" height="23"  ><%=request("youbian")%></td>
                                            </tr>
                                            <tr bgcolor="#FFFFFF"> 
                                              <td width="23%" height="23"  >地址<br> 
                                              </td>
                                              <td width="77%" height="23"  ><%=request("shouhuodizhi")%></td>
                                            </tr>
                                            <tr bgcolor="#FFFFFF"> 
                                              <td width="23%" height="23"  >电话<br> 
                                              </td>
                                              <td width="77%" height="23"  ><%=request("usertel")%></td>
                                            </tr>
                                            <tr bgcolor="#FFFFFF"> 
                                              <td width="23%" height="23"  >邮箱 
                                              </td>
                                              <td width="77%" height="23"  ><%=request("useremail")%></td>
                                            </tr>
                                            <tr bgcolor="#FFFFFF"> 
                                              <td width="23%" height="23"  >送货 
                                              </td>
                                              <td width="77%" height="23"  > 
                                                <%
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="23"  >支付</td>
                                              <td width="77%" height="23"  > 
                                                <%
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" bgcolor="#FFFFFF"> 
                                          <table width="98%" border="0" align="right" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table-zuoshang">
                                            <tr align="center"  > 
                                              <td height="22" colspan="2" 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
%>
                                            <tr> 
                                              <td height="23" bgcolor="#FFFFFF"  >　</td>
                                            </tr>
                                            <tr> 
                                              <td height="23" align=right bgcolor="#FFFFFF" style='PADDING-right: 20px'  >您的送货费用计：　<%=feiyong%> 
                                                元</td>
                                            </tr>
                                            <tr> 
                                              <td height="23" align=right bgcolor="#FFFFFF" style='PADDING-right: 20px'  >(其中　　基价：<%=jijia%>元)</td>
                                            </tr>
                                            <tr> 
                                              <td height="23" align=right bgcolor="#FFFFFF" style='PADDING-right: 20px'  >(浮动价：<%=fudongjia%>元)</td>
                                            </tr>
                                            <tr> 
                                              <td height="23" bgcolor="#FFFFFF"  >　</td>
                                            </tr>
                                            <tr> 
                                              <td height="23" align=right bgcolor="#FFFFFF" style='PADDING-right: 20px'  ><b><font color="#FF0000">您的订单总金额：　<%=feiyong+zongji%> 
                                                元</font></b></td>
                                            </tr>
                                            <tr> 
                                              <td height="23" align=right bgcolor="#FFFFFF"  ><a href="help.asp?action=feiyong" target=_blank>查看送货费用说明</a></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <form name="shouhuoxx" method="post" action="snsn.asp?action=ok">
                                        <tr align="center"> 
                                          <td colspan="2" bgcolor="#FFFFFF"> <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=shopid2 type=hidden value="<%=request("shopid")%>" > 
                                                </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

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='"&session("tmp_usersessionid")&"' and zhuangtai=7",conn,1,1 
if (rs("Sum_jianshu")>cint(pifa_s)) or (rs("Sum_zonger")>cint(pifa_e)) then
	tmpPIFA=1
else 
	tmpPIFA=0
end if
rs.close
dim shijian,dingdan
shijian=now()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action where username='"&session("tmp_usersessionid")&"' 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 tmpPIFA=1 then
	danjia=rs2("vipjia")
else
	danjia=rs2("shichangjia")
end if
	'danjia=rs2("shichangjia")
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("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("zonger")=danjia*rs("shopcount")
rs.update
rs.movenext
loop
rs.close
set rs=nothing
'添加到＿FHY表
conn.execute "insert into shop_action_fhy (username,actiondate,shopid,shopcount,dingdan,zhuangtai,shouhuoname,shouhuodizhi,youbian,liuyan,zhifufangshi,songhuofangshi,shousex,zonger,userzhenshiname,useremail,usertel,userid,danjia,feiyong,fapiao,fhsj) select username,actiondate,shopid,shopcount,dingdan,zhuangtai,shouhuoname,shouhuodizhi,youbian,liuyan,zhifufangshi,songhuofangshi,shousex,zonger,userzhenshiname,useremail,usertel,userid,danjia,feiyong,fapiao,fhsj FROM shop_action where username='"&session("tmp_usersessionid")&"'"
'删除原表
conn.execute "delete from shop_action where username='"&session("tmp_usersessionid")&"'"
session("xiadan")=minute(now)
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
	on error resume next
	'发送注册邮件
	topic="您在" & webname & "的订单信息"
	
	mailbody="<html>"
	mailbody=mailbody & "<title>订单信息</title>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	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></TBODY></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
	
Set JMail=Server.CreateObject("JMail.Message")
	JMail.Charset="gb2312"
	JMail.ContentType = "text/html"
jmail.from = mailsend
jmail.silent = true
jmail.Logging = true
jmail.FromName = mailname
jmail.mailserverusername = mailusername
jmail.mailserverpassword = mailuserpass
jmail.AddRecipient trim(request("useremail"))
jmail.body=mailbody
JMail.Subject=topic
if not jmail.Send ( mailaddress ) then
SendMail=""
else
SendMail="OK"
end if
	if SendMail="OK" then
		sendmsg="<li>您的订单信息已经发往您的邮箱，请注意查收。</li>"
	else
		sendmsg="<li>由于系统错误，给您发送的订单信息未成功。</li>"
	end if
%>
            <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
              <tr class="a1"> 
                <td height="23" bgcolor="#FFFFFF"  > <div align="center"><b>您的订单已经成功提交，我们会在第一时间进行处理，请记清您的订单号以备查询。</b></div></td>
              </tr>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 100px'  >订单号：<%=dingdan%></td>
              </tr>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 100px'  >订单查询：由于您不是本站会员，可能无法查到订单状态。</td>
              </tr>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 100px'  >购物积分： 
                  由于您不是本站会员没有积分待遇。</td>
              </tr>
              <%if request("zhifufangshi")=17 then %>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" 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="#FFFFFF" style='PADDING-LEFT: 100px'>您是选择的“货到付款”，我们会尽快给您送货的！</td>
                <script language=javascript>alert('您是选择的“货到付款”，请确认您的订单，我们会尽快给您送货的！');</script>
              </tr>
              <%else
                          rs.close
                          set rs=nothing%>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 100px'  >请您在一周内依照您选择的支付方式进行汇款，汇款时请注明您的订单号！</td>
                <script language=javascript>alert('请您在一周内依照您选择的支付方式进行汇款，汇款时请注明您的订单号！');</script>
              </tr>
              <%end if%>
              <%end if%>
              <tr> 
                <td height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 100px'  > 
                  <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>
        </tr>
      </table></td>
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
  </tr>
</table>
<!--#include file="copyright.asp"-->
</body>
</html>
<script language=javascript>
<!--
function regInput(obj, reg, inputStr)
{
	var docSel	= document.selection.createRange()
	if (docSel.parentElement().tagName != "INPUT")	return false
	oSel = docSel.duplicate()
	oSel.text = ""
	var srcRange	= obj.createTextRange()
	oSel.setEndPoint("StartToStart", srcRange)
	var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
	return reg.test(str)
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

   //-->
</script>