<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style3 {color: #000000; font-weight: bold; }
body {
	background-image: url(admin/images/bg.gif);
}
-->
</style>
<table width="700"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
        <tr>
          <td width="700" bgcolor="#656565"><table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" bgcolor="#f2f2f2">
            <tr bgcolor="#f7f7f7" height="25" align="center">
              <td width="107"><span class="style3">编 号</span></td>
              <td width="169"><span class="style3">商 品 名 称</span></td>
              <td width="37"><span class="style3">数量</span></td>
              <td width="34"><span class="style3">积分</span></td>
              <td width="100"><span class="style3">会员价</span></td>
              <td width="88"><span class="style3">成交价</span></td>
              <td width="95"><span class="style3">总 计</span></td>
            </tr>
            <%
Set rsCheck=Server.CreateObject("ADODB.RecordSet") 
strsql="select ID,Name,Score,Price2," & LstPrice & ",amount,VipPrice,Stock,Solded,Code from Product where ID in ("&Session("ProductList")&") order by ID"
rsCheck.open strsql,conn,1,1

Sum = 0
SumS = 0
SumFee = 0
Do While Not rsCheck.EOF
     Quatity = CInt( Request( "Q_" & rsCheck("ID")) )
     If Quatity <= 0 Then 
        Quatity = CInt( Session(rsCheck("ID")) )
        If Quatity <= 0 Then Quatity = 1
     End If
if len(Quatityt)=0 then
Quatityt=Quatity
else
Quatityt=Quatityt&","&Quatity
end if
strprice2 = Round(rsCheck("Price2"),2)
strvipprice = Round(rsCheck("VipPrice"),2)
ProScore = rsCheck("Score")
YourPrice =  Round(rsCheck("" & LstPrice & ""),2)
Session(rsCheck("ID")) = Quatity
Sum = Sum + (YourPrice + strvipprice)*Quatity
Sum=Round(Sum,2) 
SumS = SumS + ProScore*Quatity
%>
            <tr bgcolor="#FFFFFF" height="25"align="center">
              <td height="30"><%=rsCheck("Code")%></td>
              <td height="30" align="left">&nbsp;<a href="b2b_cpinfo.asp?ID=<%=rsCheck("ID")%>" target="_blank">
			  <%
			  	Flag=""
			  	selectProperty1List= Split( Session("selectProperty1List"),",")
				For I=0 To UBound(selectProperty1List)
					tmp = Split(selectProperty1List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
				
			  	selectProperty2List= Split( Session("selectProperty2List"),",")
				For I=0 To UBound(selectProperty2List)
					tmp = Split(selectProperty2List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
			  	selectProperty3List= Split( Session("selectProperty3List"),",")
				For I=0 To UBound(selectProperty3List)
					tmp = Split(selectProperty3List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
			  	selectProperty4List= Split( Session("selectProperty4List"),",")
				For I=0 To UBound(selectProperty4List)
					tmp = Split(selectProperty4List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next	
				
			  	selectProperty5List= Split( Session("selectProperty5List"),",")
				For I=0 To UBound(selectProperty5List)
					tmp = Split(selectProperty5List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next			
			  Response.Write(rsCheck("Name")&"("&Flag&")")
			  %></a></td>
              <td height="30"><%=Quatity%> </td>
              <td height="30"><%=ProScore %>&nbsp;分</td>
              <td height="30"><%=strprice2 %>&nbsp;元</td>
              <td height="30"><%=YourPrice %>&nbsp;元</td>
              <td height="30"><%=Round((YourPrice + strvipprice)*Quatity,2) %>&nbsp;元</td>
            </tr>
            <%
Message=message &"<tr bgcolor=#FFFFFF height=25 align=center> "
Message=message &"<td>"& rsCheck("Code") &"</td>"
Message=message &"<td align=left><a href=b2b_cpinfo.asp?ID="& rsCheck("ID")&" target=_blank>"& rsCheck("Name") &"</a></td>"
Message=message &"<td>"& Quatity &"</td>"
Message=message &"<td>"&ProScore &"</td>"
Message=message &"<td>"& strprice2 &"</td>"
Message=message &"<td>"& strvipprice &"</td>"
Message=message &"<td>"& YourPrice &"</td>"
Message=message &"<td>"& Round((YourPrice + strvipprice)*Quatity,2) &"</td>"
Message=message &"</tr>"

IF FormatSQL(SafeRequest("action",0)) = 3 Then 
strprice2 = rsCheck("Price1")
strvipprice = rsCheck("Vipprice")
YourPrice =  (rsCheck("" & LstPrice & "")+strvipprice)*Quatity
If LngUserID=0 Then
strUserName = Request.ServerVariables("REMOTE_ADDR")
End IF
if request.form("receipt")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写收货人姓名！');history.go(-1);</script>"
response.End
end if
if request.form("address")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写详细地址！');history.go(-1);</script>"
response.End
end if
if request.form("postcode")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写邮编！');history.go(-1);</script>"
response.End
end if
if request.form("usertel")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写电话！');history.go(-1);</script>"
response.End
end if
if request.form("useremail")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写电子邮件！');history.go(-1);</script>"
response.End
end if
if request.form("deliverymethord")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写送货方式！');history.go(-1);</script>"
response.End
end if
if request.form("paymethord")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写支付方式！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")  
rs.open "select * from orders",conn,1,3
rs.addnew
rs("username")=trim(strUserName)
rs("id")=rsCheck("ID")
rs("actiondate")=Now()
rs("productnum")=Quatity
rs("state")=2
rs("goods")=goods
rs("postcode")=int(request.form("postcode"))
rs("receipt")=trim(request.form("receipt"))
rs("address")=trim(request.form("address"))
rs("paymethord")=int(request.form("paymethord"))
rs("deliverymethord")=int(request.form("deliverymethord"))
rs("UserSex")=int(request.form("UserSex"))
rs("comments")=HTMLEncode2(trim(request.form("comments")))
rs("paid")=YourPrice
rs("realname")=trim(request.form("realname"))
rs("score")=ProScore*Quatity
rs("useremail")=trim(request.form("useremail"))
rs("usertel")=trim(request.form("usertel"))
rs("comments")=trim(request.form("comments"))
rs("userid")=LngUserID
'**************************************************************************************************************
			  	Flag=""
			  	selectProperty1List= Split( Session("selectProperty1List"),",")
				For I=0 To UBound(selectProperty1List)
					tmp = Split(selectProperty1List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
				
			  	selectProperty2List= Split( Session("selectProperty2List"),",")
				For I=0 To UBound(selectProperty2List)
					tmp = Split(selectProperty2List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
			  	selectProperty3List= Split( Session("selectProperty3List"),",")
				For I=0 To UBound(selectProperty3List)
					tmp = Split(selectProperty3List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
			  	selectProperty4List= Split( Session("selectProperty4List"),",")
				For I=0 To UBound(selectProperty4List)
					tmp = Split(selectProperty4List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next	
				
			  	selectProperty5List= Split( Session("selectProperty5List"),",")
				For I=0 To UBound(selectProperty5List)
					tmp = Split(selectProperty5List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next	
rs("OtherProperty")=Flag				
'**************************************************************************************************************
rs.update
rs.close
Session(rsCheck("ID")) = 1
End IF

     rsCheck.MoveNext
     Loop
rsCheck.close
set rsCheck=nothing
%>
            <tr align="right" bgcolor="#FFFFFF">
              <td height="30" colspan="8"> 您现在是：<font color="#FF6600"><%= strTitle %></font>&nbsp; 商品总计：<font color="#FF6600"><%=Sum  %></font>&nbsp;元&nbsp; 获得积分：<font color="#FF6600"><%=SumS %></font>&nbsp;分 </td>
            </tr>
            <% 
Message=message &"<tr bgcolor=#FFFFFF>"
Message=message &"<td colspan=8 height=25>"
Message=message &"您现在是：<font color=#FF6600>"& strTitle &"</font>"
Message=message &"商品总计：<font color=#FF6600>"& Sum  &"</font>元"
Message=message &"获得积分：<font color=#FF6600>"& SumS &"</font>分"
Message=message &"</td>"
Message=message &"</tr>"

IF FormatSQL(SafeRequest("action",0)) = 3 Then 

rs.open "select * from delivery where deliveryid="&int(request.form("deliverymethord")),conn,1,1
	  if rs.eof and rs.bof then
	  strMth = "您选择的送货方式已经被删除"
	  LngMth = 0
	  else
	  strMth = rs("subject")
	  LngMth = rs("fee")
	  LngPayfee = rs("payfee")
      end if
	  rs.close
	  Sum = Sum*(1+LngPayfee/100)
	  If webbj5 = 0 Then
	  Sum = Sum +LngMth
	  strMian = ""
	  Else
	  strMian = "(购物满&nbsp;<font color=red>"&webbj5&"</font>&nbsp;元免附加邮费)"
		  	IF Sum < webbj5 Then
		         Sum = Sum +LngMth
			End IF 
	  End If
			 %>
            <tr align="right" bgcolor="#FFFFFF">
              <td height="30" colspan="8"> 您选择的送货方式：<font color="#FF6600">
                <% = strMth %>
                </font>&nbsp;附加邮费：<font color="#FF6600">
                <% = LngMth %>
                </font>&nbsp;方式加收：
                <% = LngPayfee %>
                %&nbsp;订单费用总计：<font color="#FF6600">
                <% = Round(Sum,2) %>
          &nbsp;</font>元
                <% = strMian %>
              </td>
            </tr>
            <%
Message=message &"<tr bgcolor=#FFFFFF> "
Message=message &"<td colspan=8 height=25>"
Message=message &"您选择的送货方式：<font color=#FF6600>"& strMth &"</font>&nbsp;附加邮费：<font color=#FF6600>"& LngMth &"</font>&nbsp;订单费用总计：<font color=#FF6600>"& Sum &"</font>&nbsp;"& strMian &" "
Message=message &"</td>"
Message=message &"</tr>"
%>
            <tr>
              <td colspan="8" bgcolor=#FFFFFF><table width="100%"  border="0" cellpadding="4" cellspacing="1" bgcolor="#f2f2f2">
                  <tr>
                    <td width="13%" height="25" bgcolor="#f7f7f7">订单号：</td>
                    <td width="43%" height="25" bgcolor="#FFFFFF"><% = goods %></td>
                    <td width="14%" height="25" bgcolor="#f7f7f7">收货人姓名：</td>
                    <td width="30%" height="25" bgcolor="#FFFFFF"><%response.Write trim(request.form("receipt"))
    if request.form("UserSex")=0 then
    response.Write "&nbsp;(先生)"
	strMale = "&nbsp;(先生)"
    else
    response.Write "&nbsp;(女士)"
	strMale = "&nbsp;(女士)"
    end if 
	Message=message &"<tr>"
	Message=message &"<td colspan=8 bgcolor=#FFFFFF>"
	Message=message &"订单号："& goods &"<br> "
	Message=message &"收货人姓名："& trim(request.form("receipt")) &" "& strMale &" <br>"
	%></td>
                  </tr>
                  <tr>
                    <td height="25" bgcolor="#f7f7f7">详细地址：</td>
                    <td height="25" bgcolor="#FFFFFF"><% = trim(request.form("address")) %></td>
                    <td height="25" bgcolor="#f7f7f7">邮政编码：</td>
                    <td height="25" bgcolor="#FFFFFF"><% = trim(request.form("postcode")) %></td>
                  </tr>
                  <tr>
                    <td height="25" bgcolor="#f7f7f7">联系电话：</td>
                    <td height="25" bgcolor="#FFFFFF"><% = trim(request.form("usertel")) %></td>
                    <td height="25" bgcolor="#f7f7f7">电子邮件：</td>
                    <td height="25" bgcolor="#FFFFFF"><% = trim(request.form("useremail")) %>
                        <%
	Message=message &"详细地址："& trim(request.form("address")) &" <br>"
	Message=message &"邮政编码："& trim(request.form("postcode")) &" <br>"
	Message=message &"联系电话："& trim(request.form("usertel")) &" <br>"
	Message=message &"电子邮件："& trim(request.form("useremail")) &" <br>"
	%></td>
                  </tr>
                  <tr>
                    <td height="25" bgcolor="#f7f7f7">送货方式：</td>
                    <td height="25" bgcolor="#FFFFFF"><% 
	rs.open "select * from delivery where deliveryid="&int(request.form("deliverymethord")),conn,1,1
	  if rs.eof and rs.bof then
	  response.write "方式已经被删除"
	   Message=message &"送货方式：方式已经被删除<br>"
	  else
      response.Write trim(rs("subject"))&"(送货费用"
	  response.Write (rs("fee"))&"元，方式加收"
	   response.Write (rs("payfee"))&"%)"
	  Message=message &"送货方式："& rs("subject") &" ("
	  Message=message &" "& rs("fee") &") <br>"
      end if
	  rs.close %></td>
                    <td height="25" bgcolor="#f7f7f7">支付方式：</td>
                    <td height="25" bgcolor="#FFFFFF"><% 
	  rs.open "select * from delivery where deliveryid="&request.form("paymethord"),conn,1,1
	  if rs.eof and rs.bof then
	  response.write "方式已经被删除"
	  Message=message &"汇款方式：方式已经被删除<br>"
	  else
      response.Write trim(rs("subject"))
	  Message=message &"方式："& rs("subject") &"<br> "
      end if
	  rs.close
	  
	  
	  if LngDeposit>Sum then
		 rs.open "select state,goods From Orders Where Orders.Goods = '"& goods &"' ",conn,1,3
		 do while not rs.eof
		 rs("state")=3
		 rs.update
		 rs.movenext
		 loop
		 rs.close

		 rs.open "Select score,deposit From [User] where userid = "&LngUserID,conn,1,3
		 rs("deposit")=rs("deposit")-sum
		 rs("score")=rs("score")+sums
		 rs.update
		 rs.close
		 
		strsql="select ID,Stock,Solded from Product where ID in ("&Session("ProductList")&") order by ID"
		rs.open strsql,conn,1,3
		rs("Stock") = rs("Stock") - Quatity
		rs("Solded") = rs("Solded") + Quatity
		rs.Update
		rs.close

		 strtxtdeposit="<b><font color=#ff0000>已从您的预存款中扣除"&""&Round(sum,2)&""&"元，给您加了"&""&sums&""&"分，订单状态自动变成已汇款</font></b>"
else
		 strtxtdeposit="<b><font color=#ff0000>您的订单流程已经完成！请您在72小时内按您选择的支付方式进行汇款，并即时联系我们的客服!<br>如果您没有申请在线支付，您还可以在以下银行柜台办理汇款，请注意随身携带物品的安全！</font></b>"
         rs.open "select paymethord from b2b_systemdata",conn,1,1
		 strtxtdeposit = strtxtdeposit &"<br><br> "& rs("paymethord") &" "
		 rs.close
end if
     set rs=nothing
      %></td>
                  </tr>
                  <tr>
                    <td height="25" bgcolor="#f7f7f7">您的留言：</td>
                    <td height="25" colspan="3" bgcolor="#FFFFFF"><% = trim(request.form("comments")) %>
                    </td>
                  </tr>
                </table>
                  <br>
                  <table width="100%"  border="0" cellspacing="1" cellpadding="4">
                    <tr>
                      <td align="right"><!-- 支付宝 接口代码 开始 -->
                          <%
'dim cmd,subject,body,order_no,prices,rurl,types,number,transport,ordinary_fee,express_fee,readonly,buyer_msg,buyer,buyer_name,buyer_address,buyer_zipcode,buyer_tel,buyer_mobile,partner
'dim t1,t2,t3,t4,t5
'dim AlipayObj,itemUrl
	mSql="select * from b2b_systemdata"
	set mRs=conn.execute(mSql)
	if not (mRs.eof and mRs.bof ) then
		PayMail=Trim(mRs("PayMail"))
		PayPassword=Trim(mRs("PayPassword"))
		webName=Trim(mRs("webName"))
		webUrl=trim(mRs("weburl"))
		PayZFBisV=trim(mRs("PayZFBisV"))
	end if
	mRs.close
	set mRs=nothing
	tempBody="送货方式： "&strMth&" 附加邮费："&LngMth&" 元，方式加收："&LngPayfee&"％ 金额总计："
	tempBody=tempBody&Sum&" 元，获得"&webName&"提供的积分："&SumS&" 分，"
	tempBody=tempBody&"您的此次配送费用已经总计至支付费用中，如有疑问请与"&webName&"客服联系。"
	
	if PayZFBisV="支付宝有效" then
	t1				=	"https://www.alipay.com/payto:"	'支付接口
	t2				=	PayMail		'商户支付宝账户（改成你自己的）
	t3				=	PayPassword	'安全校验码（改成你自己的）		
	t4				=	"images/alipay_bwrx.gif"		'支付宝按钮图片
	t5				=	"推荐使用支付宝付款"						'按钮悬停说明
	cmd				=	"0001"						'cmd			命令码
	subject			=	webName&"商品在线支付"			'subject		商品名称
	body			=	tempBody			'body			商品描述
	order_no		=	goods	'order_no		商户订单号
	prices			=	Sum 					'price			商品单价			0.01～50000.00
	rurl			=	weburl	'url			商品展示网址
	types			=	"1"						'type支付类型			1：商品购买2：服务购买3：网络拍卖4：捐赠
	number			=	""						'number			购买数量
	transport		=	"2"					'transport		发货方式			1：平邮2：快递3：虚拟物品
	ordinary_fee	=	""			'ordinary_fee	平邮运费
	express_fee		=	""				'express_fee	快递运费
	readonly		=	"true"				'readonly		交易信息是否只读
	buyer_msg		=	trim(request.form("comments"))				'buyer_msg		买家给卖家的留言
	buyer			=	""						'buyer			买家Email
	buyer_name		=	trim(request.form("receipt"))			'buyer_name		买家姓名
	buyer_address	=	trim(request.form("address"))	'buyer_address	买家地址
	buyer_zipcode	=	trim(request.form("postcode"))		'buyer_zipcode	买家邮编
	buyer_tel		=	trim(request.form("usertel"))			'buyer_tel		买家电话号码
	buyer_mobile	=	""	'buyer_mobile	买家手机号码
	partner			=	"2088002009605903"						'partner		合作伙伴ID			保留字段

	Set AlipayObj	= New creatAlipayItemURL
	itemUrl=AlipayObj.creatAlipayItemURL(t1,t2,t3,t4,t5,cmd,subject,body,order_no,prices,rurl,types,number,transport,ordinary_fee,express_fee,readonly,buyer_msg,buyer,buyer_name,buyer_address,buyer_zipcode,buyer_tel,buyer_mobile,partner)
	end if
%>
                          <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse: collapse">
                            <tr>
                              <td height="30" align="right"><%=itemUrl%> </td>
                            </tr>
                          </table>
                          <!-- 支付宝 接口代码 结束 --></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td><% = strtxtdeposit %></td>
                    </tr>
                  </table>
                  <br>
                  <br>
                  <div align="center"><a href="JavaScript:onClick=window.close();">关闭窗口</a></div></td>
            </tr>
            <% 
End IF %>
          </table></td>
        </tr>
      </table>
      