<%@ Page language="c#" Codebehind="Pay.aspx.cs" AutoEventWireup="true" Inherits="XpShop.WebUI.Pay" %>
<%@ Register TagPrefix="uc1" TagName="MemberMenu" Src="Modules/MemberMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
	<HEAD>
		<!--#include file="../../inc/encoding.inc"-->
		<title>订单付款,<%=config.SiteTitle%></title>
		<!--#include file="../../inc/head.inc"-->
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/member.css" rel="stylesheet" type="text/css"/>
		<script type="text/javascript">
            $(document).ready(function(){
                $('#btnpay').click(function(){
                    if($('[@name=payment]').length != 0){
                        if($('[@name=payment][@checked]').length == 0){
                            alert('请选择支付方式');return false;
                        }else{
                            $.ajax({
                                url:'ajax.aspx?NoCopyRight=1&type=UpdatePayment&OrderID=<%=Request.QueryString["OrderID"] %>',
                                type:'post',
                                data:$('input[@name=payment]').serialize(),
                                cache:false,
                                async:false,
                                success:function(data){
                                    if(data==1){
                                        $('#formpay').submit();
                                    };
                                },
                                error:function(){alert('error');}
                            });
                        };
                    };
                });
				
				$('[name=bank]').hover(
					function () {
						$(this).addClass('bank');
					},
					function () {
						$(this).removeClass('bank');
					}
				); 

            });
		</script>
	</HEAD>
	<body>
		<uc1:Header id="Header1" runat="server"></uc1:Header>
		<div class="xp-w clear">
		    <!--位置导航开始-->
		    <div class="path"><a href="<%=webSite %><%if(config.html==""){%>default.aspx<%}else{%>Index.<%=config.html%><%}%>"><%=GetResourceString("Home")%></a>&nbsp;&gt;&nbsp;<a href="<%=webSite %>Center.<%=config.html %>"><%=GetResourceString("MemberCenter")%></a>&nbsp;&gt;&nbsp;<a href='<%=webSite %>MyOrders.<%=config.html %>'><%=GetResourceString("MyOrders")%></a>&nbsp;&gt;&nbsp;为订单付款</div>
		    <!--位置导航结束-->
			<div class="member_left">
				<!--会员中心导航开始-->
				<uc1:MemberMenu id="MemberMenu1" runat="server"></uc1:MemberMenu>
				<!--会员中心导航结束-->
			</div>
			<div class="member_middle_right">
			    <!--内容开始-->
			    <div class="mframe">
                    <div class="tl"></div>
                    <div class="tr"></div>
                    <div class="tm">为订单付款</div>
                    <div class="ml"></div>
                    <div class="mr"></div>
                    <div class="mm">						
					    <%if(Request.QueryString["Action"] == "1" && order.PaymentType != 0){%><!--如果Action为1,显示"立即支付"按钮和"修改支付方式"的链接-->
					        <table style="width:100%;">
					            <tr>
					                <td style="width:50%;">您选择的支付方式为：<%=GetPaymentName() %><br /><a href='<%=webSite %>ModifyPay-<%=Request.QueryString["OrderID"] %>.<%=config.html%>' class="pay-btn1">修改支付方式</a></td>
					                <td><a href='<%=webSite %>OrderPay-<%=order.OrderID %>.<%=config.html%>' class="pay-btn">立即支付</a></td>
					            </tr>
					        </table>
					    <%}else{%><!--Action为2显示支付方式列表供用户选择-->
					        <!--支付方式列表开始-->
					        <%if (order.PayType <=4 ){%>
                	            <%if(order.PayType ==1 ){%>
                                <%--银联支付--%>
                                <div style="background-color:#EBF4FB; padding:10px;">
                    	            <div>&nbsp;&nbsp;请点击以下银行支付</div>
                                    <div><%=GetAD(71).ToString().Replace("{OrderID}",Request.QueryString["OrderID"])%></div>
                                </div>
                                <div style="height:50px; line-height:50px;">&nbsp;&nbsp;&nbsp;&nbsp;请点击以下支付网关支付</div>
                                <%}%>
					            <%GetPayments(order.OrderID); %>
		                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="liststyle data">
                                    <colgroup class="span-4 ColColorGray"></colgroup>
                                    <colgroup class="span-auto"></colgroup>
		                            <asp:Repeater ID="rptPayments" runat="server">
		                                <ItemTemplate>
		                                    <tr>
		                                        <th style="text-align:left;"><%# (order.PayType == 1 ? "<input type='radio' name='payment' value='" + DataBinder.Eval(Container.DataItem, "PaymentID") + "' />" : "")%><%# DataBinder.Eval(Container.DataItem, "Name") %></td>
		                                        <td><%# DataBinder.Eval(Container.DataItem, "Description") %>&nbsp;</td>
		                                    </tr>
		                                </ItemTemplate>
		                            </asp:Repeater>
		                        </table>
		                    <%}%>
		                    <!--支付方式列表结束-->
	                        <%if (order.PayType == 1 && decimal.Parse(GetPay()) > 0){%>
	                        <table style="width:100%; text-align:center;">
	                            <tr>
	                                <td>
			                            <input type="button" id="btnpay" class="pay-btn" value="立即支付" />
	                                </td>
	                            </tr>
	                        </table>    
					        <%} %>
					    <%} %>
					</div>
	                <div class="bl"></div>
	                <div class="br"></div>
	                <div class="bm"></div>
	            </div>
				<!--内容结束-->
			</div>
		</div>
		<uc1:Helper id="Helper1" runat="server"></uc1:Helper>
		<uc1:Footer id="Footer1" runat="server"></uc1:Footer>
		<%if (order.PayType == 1 && decimal.Parse(GetPay()) > 0) {%><!--不能少-->
	    <form id="formpay" action='<%=webSite %>OrderPay-<%=Request.QueryString["OrderID"] %>.<%=config.html%>' method="post" target="_blank"></form>
	    <%} %>
	</body>
</HTML>
