<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="Cash.aspx.cs" Inherits="WAP2P.Web.PC.User.Account.Cash" %>
<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">
            <dt><a href="Cash<% =PageBase.PageExt %>" class="on">提现申请</a></dt>
            <dt><a href="CashList<% =PageBase.PageExt %>">提现记录</a></dt>
            <dd>
                <div class="form-big m-account">
                    <ruson:Space runat="server" ID="cash">
                        <form class="js-auto js-vsum" method="post" action="<% =Request.RawUrl.UrlEncodeParam() %>" data-onsuccess="member.pay('<% =(int)WAP2P.Account.AccountActionType.提现申请 %>', 'amount=' + $('#amount').val() + '&bankCardId=' + $('input[name=bankCard]:checked').val() + '&extractionCashTime=' + $('input[name=extractionCashTime]:checked').val(), function () { common.pageTip('<% =PageBase.TipType.Success %>', '您的提现申请已提交成功，我们的工作人员将尽快处理您的申请。', '/User/Account/CashList' + gconfig.pageExt, '跳转到提现记录'); })">
                            <div class="input-big mt10 g-ohide">
                                <span class="leftfont g-left">选择银行卡</span>
                                <div class="account-radiobox g-left">
                                    <div class="ui-radio t-cashradio">
                                        <ruson:Repater runat="server" ID="rptCashBankList" ItemType="WAP2P.Account.BankCard">
                                            <ItemTemplate>
                                                <label><input type="radio" name="bankCard" data-vtype="group" data-vmin="1" data-vmsg="请选择银行卡" value="<%# Item.Id %>" /><img src="<%# WAP2P.Web.Extensions.GetBankLogo(Item.BankName) %>" title="<%# Item.BankName %>" /><%# Item.CardNo.HidePart() %></label>
                                            </ItemTemplate>
                                        </ruson:Repater>
                                    </div>
                                    <ruson:Space runat="server" ID="addBank" Visible="true">
                                        <a href="BankDetail<% =PageBase.PageExt %>" class="account-addcard">添加银行卡</a>
                                    </ruson:Space>
                                </div>
                            </div>
                            <div class="g-clear"></div>
                            <div class="input-big">
                                <label class="leftfont mr3">提现金额</label>
                                <input type="text" class="text ui-float input-moneyicon" id="amount" name="amount" placeholder="请输入您要提现的金额" data-vtype="money|range" data-vmsg="请输入正确的金额|<%=string.Format("提现金额范围：{0}元~{1}元", GlobalSetting.Get(GlobalSetting.Keys.Account.MinCashAmount).ToDecimal(1).ToMoneyString(), maxCashAmount.ToMoneyString("100,000,000")) %>" data-vmin="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.MinCashAmount).ToInt32(1) %>" data-vmax="<%= !maxCashAmount.HasValue ? "100000000" : maxCashAmount.ToString() %>" />                                
                            </div>
                            <ruson:Space runat="server" ID="cashTime" Visible="false">
                                <div class="ui-radio js-radio">
                                    <span class="leftfont">到账时间</span>
                                    <asp:Repeater runat="server" ID="rptExtractionCashs" >
                                        <ItemTemplate>
                                            <label class="w95 g-fcenter">
                                                <input type="radio" name="extractionCashTime" data-vtype="group" data-vmin="1" data-vmsg="请选择到账时间" value="<%# (int)Eval("Type") %>"<%# Container.ItemIndex == 0 ? " checked=\"checked\"" : string.Empty %> /><%# (ExtractionCashTime)Eval("Type") == ExtractionCashTime.T0 ? "当天到账" : (ExtractionCashTime)Eval("Type") == ExtractionCashTime.T1 ? "隔天到账" : "未知" %>
                                            </label>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </div>
                            </ruson:Space>
                            <div class="input-big">
                                <label class="leftfont">可提现金额</label>
                                单日提现最高金额 <span class="fcred-3"><% =maxCashAmount.ToMoneyString("不限") %></span>，您还可以提取 <span class="fcred-3 fs16"><%= WAP2P.Account.CashApply.GetCanCashAmount(CurrentUser.Id).ToMoneyString()  %></span> 元 
                            </div>
                            <div class="input-big">
                                <label class="leftfont">到账金额</label>
                                <span class="fcred-3 fs16 js-amount">0.00</span> 元<span class="in-prompt">（预计扣除手续费 <span class="fcred-3 js-fee">0.00</span> 元）</span>
                            </div>                            
                            <div class="btn-submits mt10 ml204">
                                <input type="submit" value="提 交" class="btn-bbord fs16 c-normal w258 js-submit" />
                                <div class="w258"><em class="m-sumtip js-vsum"></em></div>
                            </div>
                        </form>
                    </ruson:Space>
                    <ruson:Space runat="server" ID="prompt" Visible="false">
                        <div class="g-fcenter mt25">当前会员组不允许提现</div>
                    </ruson:Space>
                </div>
            </dd>
        </dl>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        function getFee() {
            $.ajax({
                url: '?action=getFee',
                dataType: 'json',
                data: { 'amount': $('#amount').val(), 'extractionCashTime': $('input[name=extractionCashTime]:checked').val() },
                success: function (res) {
                    if (res.Success) {
                        $('.js-amount').html(finance.toMoneyString(parseFloat($('#amount').val().replace(/,/g, '')) - parseFloat(res.Message.replace(/,/g, ''))));
                        $('.js-fee').html(res.Message);
                    } else {
                        $('.js-amount').html("0.00 ");
                        $('.js-fee').html("0.00");
                    }
                }
            });
        };

        $('#amount').on('keyup', getFee);
        $('input[name=extractionCashTime]').click(getFee);

        if ($('input[name=bankCard]').length == 0) {
            $.jError('您尚未绑定提现银行卡或银行卡暂未审核。', '绑定银行卡', 360, function () {
                location.href = 'BankList<% =PageExt %>';
            });
        }
    </script>
</asp:Content>
