<!--#include file="../conn.asp"-->
<!--#include file="../KS_Cls/Kesion.membercls.asp"-->
<!--#include file="../plus/md5.asp"-->
<!--#include file="../user/payfunction.asp"-->

<%
Dim KS:Set KS=New PublicCls

        Dim ID:ID=KS.ChkClng(KS.S("ID"))
		 Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
		 RS.Open "Select top 1 OrderID,MoneyTotal,DeliverType From KS_Order Where ID="& ID,Conn,1,1
		 If RS.Eof Then
		  rs.close:set rs=nothing
		  KS.Die "<script>alert('出错啦,没有找到订单!');history.back();</script>"
		 End If 
		Dim OrderID:OrderID=RS("OrderID")
	   	Dim Money:Money=RS("MoneyTotal")
		Dim DeliverType:DeliverType=RS("DeliverType")
		RS.Close
		Dim DeliverName,ProductName
		RS.Open "Select Top 1 TypeName From KS_Delivery Where Typeid=" & DeliverType,conn,1,1
		If Not RS.Eof Then
		 DeliverName=RS(0)
		End IF
		RS.Close
		
		RS.Open "Select top 1 Title From Product Where ID in(Select proid From KS_OrderItem Where OrderID='" & OrderID& "')",conn,1,1
		If RS.Eof And RS.Bof Then
		 ProductName=OrderID
		Else
			Do While Not RS.Eof
			 if ProductName="" Then
			   ProductName=rs(0)
			 Else
			   ProductName=ProductName&","&rs(0)
			 End If
			 RS.MoveNext
			Loop
		End If
		RS.Close
		
		If Not IsNumeric(Money) Then
		  Call KS.AlertHistory("对不起，订单金额不正确！",-1)
		  response.end
		End If
		If Money=0 Then
		  Call KS.AlertHistory("对不起，订单金额最低为0.01元！",-1)
		  response.end
		End If
Dim KSUser:Set KSUser=New UserCls
KSUser.UserLoginChecked
Dim PaymentPlat:PaymentPlat=KS.ChkClng(KS.S("PaymentPlat"))  '设置为支付宝即时到账付款
If PaymentPlat=0 Then PaymentPlat=7
Dim PayMentField,PayUrl,ReturnUrl,Title,RealPayMoney,RateByUser,PayOnlineRate,RealPayUSDMoney
Call GetPayMentField(OrderID,PaymentPlat,Money,0,ProductName,"shop",KSUser,PayMentField,PayUrl,ReturnUrl,Title,RealPayMoney,RealPayUSDMoney,RateByUser,PayOnlineRate)
%>
<FORM name="myform"  id="myform" action="<%=PayUrl%>" <%if PaymentPlat=11 or PaymentPlat=9 then response.write "method=""get""" else response.write "method=""post"""%> >
		  <table id="c1" class=border cellSpacing=1 cellPadding=2 width="100%" align=center border=0>
			<tr class=title>
			  <td align=middle colSpan=2 height=22><B> 确 认 款 项</B></td>
			</tr>
			<tr class=tdbg>
			  <td align=right width=167>用户名：</td>
			  <td width="505"><%=KSUser.UserName%></td>
			</tr>
			<tr class=tdbg>
			  <td width="167" align=right>支付编号：</td>
			  <td><%=OrderID%>&nbsp;</td>
		    </tr>
			<tr class=tdbg>
			  <td align=right width=167>支付金额：</td>
			  <td><%=formatnumber(Money,2,-1)%> 元</td>
			</tr>
			
             <%If PaymentPlat=12 Then%>
			<tr class=tdbg>
			  <td align=right width=167>实际支付美金：</td>
			  <td style="color:#FF6600;font-weight:bold">
			  $<%=formatnumber(RealPayUSDMoney,2,-1)%> USD</td>
			</tr>
			<%End If%>
						<%if title<>"" then%>
			<tr class=tdbg>
			  <td align=right width=167>支付用途：</td>
			  <td style="color:red">“<%=title%>”</td>
			</tr>
			<%end if%>
			<%
			if RateByUser=1 then
			%>
			<tr class=tdbg>
			  <td align=right width=167>手续费：</td>
			  <td><%=PayOnlineRate%>%</td>
			</tr>
			<%end if%>

			<tr class=tdbg>
			  <td colspan=2>点击“确认支付”按钮后，将进入在线支付界面，在此页面选择您的银行卡。</td>
		    </tr>
			<tr class=tdbg>
			  <td align=middle colSpan=2 height=40>
			    <%=PayMentField%>
				<%if PaymentPlat=9 then%>
				<Input class="button" id=Submit type=button onClick="$('#myform').submit()" value=" 确定支付 " onClick="document.all.c1.style.display='none';document.all.c2.style.display='';">
				<%else%>
				<Input class="button" id=Submit type=submit value=" 确定支付 " onClick="document.all.c1.style.display='none';document.all.c2.style.display='';">
				<%end if%>
				<input class="button" type="button" value=" 上一步 " onClick="javascript:history.back();"> </td>
			</tr>
		  </table>
		</FORM>
		<script src="../inc/jquery.js"></script>
		<script type="text/javascript">
		 $(function(){
		  $("#myform").submit();
		 });
		</script>
<%
CloseConn
Set KSUser=Nothing
Set KS=Nothing
%>