<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="OfflineRecharge.aspx.cs" Inherits="WAP2P.Web.PC.User.Account.OfflineRecharge" %>
<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">
            <%= maxRechargeAmount.HasValue && maxRechargeAmount.Value == 0 ? string.Empty : WAP2P.Sys.OnlinePayment.FindActive().Count() > 0 ? string.Format("<dt><a href=\"OnlineRecharge{0}\">在线充值</a></dt>",PageBase.PageExt) : string.Empty %>
            <%= maxRechargeAmount.HasValue && maxRechargeAmount.Value == 0 ? string.Empty : WAP2P.Sys.OfflinePayment.FindActive().Count() > 0 ? string.Format("<dt><a href=\"OfflineRecharge{0}\" class=\"on\">线下充值</a></dt>",PageBase.PageExt) : string.Empty %>
            <dt><a href="RechargeList<% =PageBase.PageExt %>">充值记录</a></dt>
            <dd>
                <div class="form-big m-account">
                    <form class="js-auto js-vsum" method="post" action="<% =Request.RawUrl.UrlEncodeParam() %>" data-onsuccess="location.href = 'RechargeList<% =PageBase.PageExt %>'">
                        <div class="input-big g-ohide mt20 js-recorded">
                            <span class="leftfont g-left">入账银行</span>
                            <div class="ui-radio t-longradio g-left account-radiobox">
                                <ruson:Repater runat="server" ID="rptPaymentList" ItemType="WAP2P.Sys.OfflinePayment">
                                    <ItemTemplate>
                                        <label class="ptb1">
                                            <input type="radio" name="forBank" data-vtype="group" data-vmin="1" data-vmsg="请选择入账银行" class="g-left" data-name="<%# Item.BankName %>" data-no="<%# Item.CardNo %>" />
                                            <img src="<%# WAP2P.Web.Extensions.GetBankLogo(Item.BankName) %>" class="g-left mr20" style="width:126px;height:40px;" title="<%# Item.BankName %>"/>
                                            <span class="g-left mt5">
                                                <span class="name">开户名：<%# Item.AccountName %></span>银行账号：<span class="fcred-3"><%# Item.CardNo %></span><br />
                                                开户行：<%# string.Format("{0} {1}",Item.AreaName, Item.Branch) %>
                                            </span>
                                        </label>
                                    </ItemTemplate>
                                </ruson:Repater>
                                <input type="hidden" name="recordedBankName" id="recordedBankName"/>
                                <input type="hidden" name="recordedCardNo" id="recordedCardNo" />
                            </div>
                        </div>
                                                                                             
                        <div class="input-big">
                            <label class="leftfont">充值金额</label>
                            <input type="text" class="text ui-float input-moneyicon" placeholder="请输入您要充值的金额" name="amount" data-vtype="money" data-vmsg="请输入正确的充值金额"/>
                        </div>
                        <div class="input-big">
                            <label class="leftfont">流水号</label>
                            <input type="text" class="text w218" placeholder="请输入您充值的流水号" name="orderNo" data-vtype="must" data-vmsg="请输入充值流水号" />
                        </div>
                        <div class="input-big">
                            <label class="leftfont">支付银行</label>
                            <ruson:Select runat="server" ID="bankName" data-vtype="must" data-vmsg="请选择支付银行" TipsText="请选择"></ruson:Select>
                         </div>
                        <div class="input-big js-payment">
                            <span class="leftfont">支付账号</span>
                            <input type="text" class="text w218 ui-int" placeholder="请输入您支付的账号" data-vtype="must" data-vmsg="请输入支付的账号" maxlength="23"  name="payAccount" id="payAccount" onkeypress="formatCardNo(this);" />
                            <div class="ui-radio t-iconradio ml99 mt10">
                                <ruson:Repater runat="server" ID="rptBankList" ItemType="WAP2P.Account.BankCard">
                                    <ItemTemplate>
                                        <label class="ptb1"><input type="radio" data-name="<%# Item.BankName %>" data-no="<%# Item.CardNo %>" /><img src="<%# WAP2P.Web.Extensions.GetBankLogo(Item.BankName,"logo") %>" title="<%# Item.BankName %>" /><%# Item.CardNo.HidePart() %></label>
                                    </ItemTemplate>
                                </ruson:Repater>
                            </div>
                        </div>
                        <div class="btn-submits mt10 ml204">
                            <input type="submit" value="提 交" class="btn-bbord fs16 c-normal w258 mt10" />
                            <div class="w258"><em class="m-sumtip js-vsum"></em></div>
                        </div>
                    </form>
                </div>
            </dd>
        </dl>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        $('.js-recorded :radio').on('click', function () {
            var me = $(this);
            $('#recordedBankName').val(me.attr('data-name'));
            $('#recordedCardNo').val(me.attr('data-no'));
        });

        $('.js-payment :radio').on('click', function () {
            var me = $(this);
            $('#bankName').val(me.attr('data-name'));
            $('#payAccount').val($(this).attr('data-no'));

            formatCardNo('#payAccount');
        });

        function formatCardNo(element) {
            if ($(element).val() != '') {
                if ($(element).val().length >= 4) {
                    $(element).val($(element).val().replace(/(\d{4})(?=\d)/g, "$1 "));
                }
            }
        }
    </script>
</asp:Content>
