<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="RechargeList.aspx.cs" Inherits="WAP2P.Web.PC.User.Account.RechargeList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-userbox">
        <dl class="ui-tab">
            <%= WAP2P.Sys.GlobalSetting.Get(WAP2P.Sys.GlobalSetting.Keys.Account.MaxRechargeAmount) == "0" ? string.Empty : WAP2P.Sys.OnlinePayment.FindActive().Count() > 0? string.Format("<dt><a href=\"OnlineRecharge{0}\">在线充值</a></dt>",PageBase.PageExt) : string.Empty %>
            <%= WAP2P.Sys.GlobalSetting.Get(WAP2P.Sys.GlobalSetting.Keys.Account.MaxRechargeAmount) == "0" ? string.Empty : WAP2P.Sys.OfflinePayment.FindActive().Count() > 0 ? string.Format("<dt><a href=\"OfflineRecharge{0}\">线下充值</a></dt>",PageBase.PageExt) : string.Empty %>
            <dt><a href="RechargeList<% =PageBase.PageExt %>" class="on">充值记录</a></dt>
            <dd>
                <form action="?action=search" method="get" class="search">
                    <table class="m-filter mt20 js-filter">
                        <tr class="filter-date">
                            <th style="width:12%;">日期范围</th>
                            <td>
                                <input type="text" class="text w130 ui-date" name="startAt" id="startAt" value="<% =Request.QueryString["startAt"].UrlEncode() %>" data-maxdate="#endAt" />
                                <span>-</span>
                                <input type="text" class="text w130 ui-date" name="endAt" id="endAt" value="<% =Request.QueryString["endAt"].UrlEncode() %>" data-mindate="#startAt" data-maxdate="<%= DateTime.Now.AddDays(1).ToDateString() %>" />
                                <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddDays(-7).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一周</a>
                                <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddMonths(-1).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一月</a>
                                <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddMonths(-3).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近三月</a>
                                <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddYears(-1).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一年</a>
                            </td>
                        </tr>
                        <tr class="filter-style">
                            <th style="width: 12%; vertical-align: top">交易类型</th>
                            <td>
                                <a href="javascrip:void(0);" class="on" data-filter-to="#status" data-filter-value="">全部</a>
                                <asp:Repeater runat="server" ID="rptStatusFilter">
                                    <ItemTemplate>
                                        <a href="javascrip:void(0);" data-filter-to="#status" data-filter-value="<%# Eval("Key") %>"><%# Eval("Value") %></a>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <input type="hidden" name="status" id="status" value="<% =Request.QueryString["status"].UrlEncode() %>" />
                            </td>
                        </tr>
                    </table>
                </form>
                <table class="table-normal mt25 js-ajaxlist">
                    <tr>
                        <th style="width:7%;">类型</th>
                        <th style="width:20%;">支付机构</th>
                        <th style="width:15%;">交易流水号</th>
                        <th style="width:12%;">充值金额</th>
                        <th style="width:10%;">手续费</th>
                        <th style="width:20%;">操作时间</th>
                        <th style="width:12%;">操作及状态</th>
                    </tr>
                </table>
            </dd>
        </dl>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        $('.js-ajaxlist').on('click', '.js-mending', function () {
            var me = $(this);
            $.ajax({
                url: '/OnlinePayment/Default<% =PageExt %>?action=userPayQuery' + me.attr('data-parameter'),
                dataType: 'json',
                data: { payName: me.attr('data-payName'), orderMoney: me.attr('data-amount') },
                success: function (res) {
                    if (res.Success)
                        $.jSuccess("补单成功", function () { location.href = 'RechargeList<% =PageExt %>'; });
                    else
                        $.jError("没有找到对应的订单", '', '');
                }
            })
        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
    <ruson:Repater runat="server" ID="rptList" ItemType="WAP2P.Account.Recharge">
        <ItemTemplate>
            <tr>
                <td><%# Item.Type.GetDescription() %></td>
                <td><%# Item.PayPlatformName %></td>
                <td><span title="<%# Item.OrderNo %>"><%# Item.OrderNo %></td>
                <td class="fcred-3 js-amount"><span title="<%# Item.Amount.ToMoneyString() + " 元" %>"><%# Item.Amount.ToMoneyString() %> 元</td>
                <td><%# Item.Fee.ToMoneyString() %> 元</td>
                <td><%# Item.CreateAt.ToDateTimeString() %></td>
                <td><%# Item.Type == WAP2P.Account.Recharge.RechargeType.Online && Item.Status == WAP2P.Account.Recharge.AuditingStatusType.Waiting ? string.Format("{0} <a class=\"js-mending\" href=\"javascript:void(0);\" data-parameter=\"{1}\" data-payName=\"{2}\" data-amount=\"{3}\" >[补单]</a>",Item.Status.GetDescription(), string.Format("&orderNo={0}&orderDateTime={1}", Item.OrderNo , Item.CreateAt.ToString("yyyyMMddhhmmss")), WAP2P.Sys.OnlinePayment.FindByName(Item.PayPlatformName).CallCode, Item.Amount) : Item.Status.GetDescription() %></td>
            </tr>
        </ItemTemplate>
        <EmptyTemplate>
            <tr>
                <td colspan="7" class="g-fleft">暂无数据。</td>
            </tr>
        </EmptyTemplate>
    </ruson:Repater>
    <tr class="pager">
        <td colspan="7">
            <div class="ui-pages g-fright">
                <ruson:Pager runat="server" ID="pages" CssClass="pages" />
                <a href="<% =Request.RawUrl.UrlEncodeParam() %>" class="g-hide"></a>
            </div>
        </td>
    </tr>
</asp:Content>
