<!--#include file="conn.asp"-->
<!--#include file="buy2buysys.asp"-->
<!--#include file="Alipay/Alipay_Payto.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=webname%>--下订单</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function ssother()
{
   if(checkspace(document.receiveaddr.receipt.value)) {
	document.receiveaddr.receipt.focus();
    alert("对不起，请填写收货人姓名！");
	return false;
  }
  if(checkspace(document.receiveaddr.city.value)) {
	document.receiveaddr.city.focus();
    alert("对不起，请填写收货人所在省市！");
	return false;
  }
  if(checkspace(document.receiveaddr.address.value)) {
	document.receiveaddr.address.focus();
    alert("对不起，请填写收货人详细收货地址！");
	return false;
  }
  if(checkspace(document.receiveaddr.postcode.value)) {
	document.receiveaddr.postcode.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
 
    if(checkspace(document.receiveaddr.usertel.value)) {
	document.receiveaddr.usertel.focus();
    alert("对不起，请留下您的电话！");
	return false;
  }
      if(checkspace(document.receiveaddr.deliverymethord.value)) {
	document.receiveaddr.deliverymethord.focus();
    alert("对不起，您还没有选择送货方式！");
	return false;
  }
      if(checkspace(document.receiveaddr.paymethord.value)) {
	document.receiveaddr.paymethord.focus();
    alert("对不起，您还没有选择支付方式！");
	return false;
  }
  if(document.receiveaddr.useremail.value.length!=0)
  {
    if (document.receiveaddr.useremail.value.charAt(0)=="." ||        
         document.receiveaddr.useremail.value.charAt(0)=="@"||       
         document.receiveaddr.useremail.value.indexOf('@', 0) == -1 || 
         document.receiveaddr.useremail.value.indexOf('.', 0) == -1 || 
         document.receiveaddr.useremail.value.lastIndexOf("@")==document.receiveaddr.useremail.value.length-1 || 
         document.receiveaddr.useremail.value.lastIndexOf(".")==document.receiveaddr.useremail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.receiveaddr.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.receiveaddr.useremail.focus();
   return false;
   }
   
}


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 osubmit()
{
receiveaddr.submit1.disabled=true;  
receiveaddr.submit();}
//-->
</SCRIPT>

<%
action=FormatSQL(SafeRequest("action",0))
If Session("ProductList") = "" Then
Response.write "<script language=javascript>alert('对不起，您的购物车中还没有商品！');history.go(-1);</script>"
Conn.Close
Set Conn = Nothing
Response.End
End IF
Dim YourPrice,strprice2,strvipprice,ProScore
select case action
Case "1"
If LngUserID=0 Then %>
<style type="text/css">
<!--
.style2 {
	color: #000000;
	font-weight: bold;
}
.style3 {font-weight: bold}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
body {
	background-image: url(admin/images/bg.gif);
}
.STYLE8 {color: #FF0000}
</style>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF6F0F">
  <tr>
    <td width="63%" height="40" align="right"><strong><font color="#FFFFFF">只用一分钟，注册会员享受更大优惠！</font>　</strong></td>
    <td width="37%" valign="bottom" background="image/ddbg.jpg"><a href="b2b_ddlcsys.asp?action=2"><img src="image/fzc.gif" width="248" height="36" border="0"></a></td>
  </tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> 
<tr align="center" height="40" bgcolor="#FFFFFF">
<td height="50" bgcolor="#FFFFFF"><!--#include file="login_dd.asp" --></td>
<% If webimg6 = 1 Then %>
<% End IF %>
</tr>
<tr><td><!--#include file="details.asp"--><br></td></tr>
</table>
<%
Else 
Response.Redirect"b2b_ddlcsys.asp?action=2"
End IF
Case "2"
IF LngUserID=0 and webimg6 = 0 Then
response.write "<script language=javascript>alert('对不起，匿名购物被关闭，请先注册或登录！');history.go(-1);</script>" 
Conn.Close
Set Conn = Nothing
response.End()
end if

set rs=server.CreateObject("adodb.recordset")
rs.open "select receipt,userid,UserSex,useremail,address,postcode,usertel,paymethord,deliverymethord,realname,userqq,msn from [user] where username='"&strUserName&"'",conn,1,1
%> 
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> 
<tr><td><!--#include file="details.asp"-->
<br></td></tr>
<tr><td>





  <table width="100%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  <form name="receiveaddr" method="post" action="b2b_ddlcsys.asp?action=3" onSubmit="return ssother();">
    <tr align="center" bgcolor="#FDDFEF">
      <td height="30" colspan="2" bgcolor="#f7f7f7"><strong>请填写相关信息</strong></td>
      </tr>
    <tr>
      <td width="17%" align="right" bgcolor="#f7f7f7">电子邮箱：</td>
      <td width="83%" bgcolor="#FFFFFF"><input name="useremail" type="text" class="input_sr" id="useremail" value="<%=trim(rs("useremail"))%>" size="40">
        * 很重要！订单、发货等信息都会发送到此信箱</td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">收货人姓名：</td>
      <td bgcolor="#FFFFFF"><input name="receipt" type="text" class="input_sr" id="receipt" value="<%=trim(rs("receipt"))%>" size="40">
        * 请填写您的真实姓名 </td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">性别：</td>
      <td bgcolor="#FFFFFF"><select name="UserSex" id="UserSex">
        <option value="1" <% if rs("UserSex")=1 Then Response.write("Selected") %>>女</option>
        <option value="0" <% if rs("UserSex")=0 Then Response.write("Selected") %>>男</option>
      </select></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">详细地址：</td>
      <td bgcolor="#FFFFFF"><input name="address" type="text" class="input_sr" id="address" value="<%=trim(rs("address"))%>" size="40">
        * 格式：省市-区-街道-小区-门牌号数-楼层-房间</td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">邮政编码：</td>
      <td bgcolor="#FFFFFF"><input name="postcode" type="text" class="input_sr" id="postcode" value="<%=trim(rs("postcode"))%>" size="40">
        * </td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">联系电话：</td>
      <td bgcolor="#FFFFFF"><input name="usertel" type="text" class="input_sr" id="usertel" value="<%=trim(rs("usertel"))%>" size="40">
        * 请勿必真实填写此项，我们会对您的信息保密。</td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">其它联系方式：</td>
      <td bgcolor="#FFFFFF"><input name="otherR" type="text" class="input_sr" id="otherR" value="<%response.write trim(rs("userQQ"))&" "&trim(rs("msn"))%>" size="40">
 如QQ号、淘宝旺旺、MSN等联系方式 </td>
    </tr>
    <tr>
      <td align="right" bgcolor="#f7f7f7">简单留言：</td>
      <td bgcolor="#FFFFFF"><textarea name="comments" cols="78" rows="8" id="comments"></textarea></td>
    </tr>
    <tr align="center">
      <td colspan="2" bgcolor="#FFFFFF"><font color="#FF0000">注意: 务必填写准确的收货人姓名、电话、联系方式等;邮政信箱及党政军事机关及敏感地区无法派送上门</font></td>
      </tr>
    <tr align="center" bgcolor="#F7F7F7">
      <td height="30" colspan="2"><strong>请选择配送方式</strong></td>
      </tr>
    <tr>
      <td align="right" valign="top" bgcolor="#FFFFFF"><img src="image/pspic.gif" width="106" height="173"></td>
      <td bgcolor="#FFFFFF">
	  <%
          set rs3=server.CreateObject("adodb.recordset")
          rs3.Open "select * from delivery where methord=0 order by deliveryidorder",conn,1,1
		  do while not rs3.EOF
	  %>
	  <table width="100%"  border="0" cellspacing="5" cellpadding="5">
        <tr>
          <td width="74%">
            <input name="deliverymethord" type="radio" id="deliverymethord" value="<%=rs3("deliveryid")%>" <%if int(rs("deliverymethord"))=int(rs3("deliveryid")) then response.write "checked" end if%>>
            <strong><%response.write trim(rs3("subject"))%></strong> </td>
          <td width="26%"><strong>费用：￥<%response.write trim(rs3("Fee"))*(1+trim(rs3("payfee")/100))%>元</strong></td>
        </tr>
        <tr>
          <td colspan="2"><%response.write Trim(rs3("memo"))%></td>
          </tr>
        <tr>
          <td colspan="2"><img src="image/bgline.gif" width="502" height="5"></td>
        </tr>
      </table>
	  <%
         	rs3.MoveNext
          loop
          rs3.Close
          set rs3=nothing	  
	  %>        </td>
    </tr>
    <tr align="center" bgcolor="#F7F7F7">
      <td height="30" colspan="2"><strong>请选择支付方式</strong></td>
      </tr>
    <tr>
      <td align="right" valign="top" bgcolor="#FFFFFF"><img src="image/zfpic.gif" width="106" height="187"></td>
      <td bgcolor="#FFFFFF">
	  

	  
	    <table width="100%"  border="0" cellspacing="5" cellpadding="5">
	  <%
          set rs3=server.CreateObject("adodb.recordset")
          rs3.open "select * from delivery where methord=1 order by deliveryidorder",conn,1,1
		  do while not rs3.eof	  
	  %>	  
        <tr>
          <td><input name="paymethord" type="radio" id="paymethord" value="<%=rs3("deliveryid")%>" <%if int(rs("deliverymethord"))=int(rs3("deliveryid")) then response.write "checked" end if%>>
            <strong><%response.write trim(rs3("subject"))%></strong></td>
          </tr>
        <tr>
          <td><%response.write trim(rs3("memo"))%></td>
        </tr>
        <tr>
          <td><img src="image/bgline.gif" width="502" height="5"></td>
        </tr>
	<%
          rs3.movenext
          loop
          rs3.close
		   set rs3=nothing
	  rs.close
	  set rs=nothing
	%>			
      </table>	  </td>
    </tr>
    <tr>
      <td colspan="2" align="right" bgcolor="#FFFFFF"><input name="submit1" type="submit" class="input_bot" onClick="osubmit()" value="提交订单"></td>
      </tr></form>
  </table>
  
   </td>
</tr> </table>
  
  <% 
Case "3"
Function GetOrderNo(dDate)
    GetOrderNo = RIGHT("0000"+Trim(Year(dDate)),4)+RIGHT("00"+Trim(Month(dDate)),2)+RIGHT("00"+Trim(Day(dDate)),2)+RIGHT("00" + Trim(Hour(dDate)),2)+RIGHT("00"+Trim(Minute(dDate)),2)+RIGHT("00"+Trim(Second(dDate)),2)
End Function
goods=GetOrderNo(Now())

Dim strMth,LngMth,strMian,Message,strtxtdeposit,LngState
strMian = ""
Message = ""
strtxtdeposit = ""
LngState = 2
Message="<html>"
Message=message &"<table border=0 cellspacing=1 cellpadding=4 align=center width=100％ bgcolor=#6699FF>"
Message=message &"<tr bgcolor=#FFFFFF height=25 align=center>"
Message=message &"<td width=40>编 号</td>"
Message=message &"<td width=300>商 品 名 称</td>"
Message=message &" <td width=40>数量</td>"
Message=message &"<td width=40>积分</td>"
Message=message &"<td width=60>会员价</td>"
Message=message &"<td width=40>邮费</td>"
Message=message &"<td width=60>成交价</td>"
Message=message &"<td width=70>总 计</td>"
Message=message &"</tr>"
%>  
<table border="0" align="center" cellpadding="0" cellspacing="0"> 
<tr><td><!--#include file="details.asp"--></td>
</tr>
</table>
<!--#INCLUDE file="b2b_includefile/b2b_mail.asp"-->
<%
MailType = webbj4
smtpserver = webbj7
sendusername = webbj8
sendpassword = webbj9
SendName = webbj3
SendTO = trim(request.form("useremail"))
SendFrom = webbj8
subject="您在"&webname&"的订单信息！"
Select Case MailType
Case "Nothing"

Case "CDONTS"
call sendemail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,Message)
Case "Jmail"
call SendJmail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,Message,SendName)
End Select

Session("ProductList") = ""
%>
<br>
<% 
end select  %>
<%
Conn.Close
Set Conn = Nothing
%> 