<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="CashApplyDeatil.aspx.cs" Inherits="WAP2P.Web.PC.Admin.Account.CashApplyDeatil" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <form class="auto" method="post" action="<% =Request.RawUrl %>"  onsuccess="parent.$.jPopupEdit.close(true);">
        <div class="m-editbar">
            <% =Request.QueryString["op"]  == "view" ? string.Empty : "<input type=\"submit\" class=\"btn-larger c-priority iconfont\" value=\"&#xe684; 保存\" />" %>
            <input type="button" class="btn-larger c-normal iconfont" value="&#xe634; 关闭" onclick="parent.$.jPopupEdit.close();" />
        </div>
        <div class="m-content m-editcontent">  
            <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                <ruson:Space runat="server" id="processing" Visible="false"> 
                    <tr>
                        <th>会员账号</th>
                        <td>
                            <%= Model.UserName %>
                            <input type="button" class="btn-base c-normal iconfont ml10" value="&#xe655; 查看资料" onclick="$.jPopupEdit('查看会员资料', '../Common/UserInfo.aspx?Id=<% =Model.UserId %>');" />
                        </td>
                    </tr>
                    <tr>
                        <th>实名姓名</th>
                        <td><%= WAP2P.Member.User.LoadOrNew(Model.UserId).RealName %></td>
                    </tr>
                    <tr>
                        <th>提现银行</th>
                        <td><%= Model.BankName %></td>
                    </tr>
                    <tr>
                        <th>提现账号</th>
                        <td><%= Model.CardNo %></td>
                    </tr>
                    <tr>
                        <th>提现账号户名</th>
                        <td><%= Model.AccountName %></td>
                    </tr>
                    <tr>
                        <th>提现金额</th>
                        <td><%= Model.Amount.ToMoneyString() %> 元</td>
                    </tr>
                    <tr>
                        <th>提现手续费</th>
                        <td><%= Model.Fee.ToMoneyString() %> 元</td>
                    </tr>
                    <tr>
                        <th>实际应到帐金额</th>
                        <td><%= (Model.Amount - Model.Fee).ToMoneyString() %> 元</td>
                    </tr>                                  
                    <tr>
                        <th>申请时间</th>
                        <td><%= Model.CreateAt.ToDateTimeString() %></td>
                    </tr>
                    <tr>
                        <th>到账周期</th>
                        <td><%= Model.ExtractionCashTime.GetDescription() %></td>
                    </tr>
                    <tr>
                        <th>审核信息</th>
                        <td><% =string.Format("操作员[{0}] 于 {1}审核，状态为：{2}。", Model.VerifyAdminName, Model.VerifyAt.ToDateTimeString(), Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.ValidFailure ? "审核失败" : "审核成功")%></td>
                    </tr>
                    <tr>
                        <th>审核备注</th>
                        <td><%= Model.VerifyRemark.BrEncode() %></td>
                    </tr>
                    <tr>
                        <th colspan="2" class="info-listhead">出纳操作</th>
                    </tr>
                    <ruson:Space runat="server" ID="payNone">                        
                        <tr>
                            <th>支付状态</th>
                            <td>
                                <% if(isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.WaitPay){ %>
                                    <div class="ui-radio">                                    
                                        <label><input type="radio" name="processingStatus" checked="checked" value="<% =(int)WAP2P.Account.CashApply.CashApplyStatusType.Success %>">支付成功</label>
                                        <label><input type="radio" name="processingStatus" value="<% =(int)WAP2P.Account.CashApply.CashApplyStatusType.PayFailure %>" />支付失败</label>
                                    </div>
                                <%} else if(Model.Status != WAP2P.Account.CashApply.CashApplyStatusType.WaitPay) { %>
                                    <% =string.Format("出纳员[{0}] 于 {1}操作，状态为：{2}。", Model.PayAdminName, Model.PayAt.ToDateTimeString(), Model.Status.GetDescription())%>                            
                                <% } %>
                            </td>
                        </tr>                 
                        <tr>
                            <th>交易流水</th>                        
                            <td><%= isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.WaitPay ? string.Format("<input type=\"text\" name=\"exchangeNo\" />", Model.ExchangeNo) : Model.ExchangeNo %></td>
                        </tr>
                    </ruson:Space>
                    <ruson:Space runat="server" ID="payToUser" Visible="false">
                        <tr>
                            <th>付款操作</th>
                            <td>请通过列表批量代付</td>
                        </tr>
                    </ruson:Space>
                    <ruson:Space runat="server" ID="payQuery" Visible="false">
                        <tr>
                            <th>交易流水</th>
                            <td><% =Model.ExchangeNo %></td>
                        </tr>
                        <tr>
                            <th>支付操作</th>
                            <td>
                                <div><input type="button" value="查询付款状态" class="js-dopay" /><span class="ml10 fcash-1"></span></div>
                            </td>
                        </tr>
                    </ruson:Space>                    
                    <tr>
                        <th>支付备注</th>
                        <td><%= isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.WaitPay ? string.Format("<textarea name=\"userRemark\" data-vtype=\"must\" data-vmsg=\"请输入支付备注\">{0}</textarea>", Model.UserRemark.HtmlEncode()) : Model.UserRemark.BrEncode() %></td>
                    </tr>                                                         
                </ruson:Space>
                <ruson:Space runat="server" id="apply" Visible="false">
                    <tr>
                        <th>会员账号</th>
                        <td>
                            <%= Model.UserName %>
                            <input type="button" class="btn-base c-normal iconfont ml10" value="&#xe655; 查看资料" onclick="$.jPopupEdit('查看会员资料', '../Common/UserInfo.aspx?Id=<% =Model.UserId %>');" />
                        </td>
                    </tr>
                    <tr>
                        <th>实名姓名</th>
                        <td><%= WAP2P.Member.User.LoadOrNew(Model.UserId).RealName %></td>
                    </tr>              
                    <tr>
                        <th>提现银行</th>
                        <td><%= Model.BankName %></td>
                    </tr>
                    <tr>
                        <th>提现账号</th>
                        <td><%= Model.CardNo %></td>
                    </tr>
                    <tr>
                        <th>提现账号户名</th>
                        <td><%= Model.AccountName %></td>
                    </tr>
                    <tr>
                        <th>提现金额</th>
                        <td><%= Model.Amount.ToMoneyString() %> 元</td>
                    </tr>
                    <tr>
                        <th>到账周期</th>
                        <td><%= Model.ExtractionCashTime.GetDescription() %></td>
                    </tr>
                    <tr>
                        <th>申请时间</th>
                        <td><%= Model.CreateAt.ToDateTimeString() %></td>
                    </tr>
                    <tr>
                        <th class="info-listhead" colspan="2">审核状态</th>
                    </tr>
                    <tr>
                        <th>审核状态</th>
                        <td>
                            <%if (isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.Waiting) { %>
                                <div class="ui-radio">
                                    <label><input type="radio" name="applyStatus" value="<% =(int)WAP2P.Account.CashApply.CashApplyStatusType.WaitPay %>" checked="checked">通过</label>
                                    <label><input type="radio" name="applyStatus" value="<% =(int)WAP2P.Account.CashApply.CashApplyStatusType.ValidFailure %>" />拒绝</label>                                    
                                </div>
                            <% } else if (Model.Status != WAP2P.Account.CashApply.CashApplyStatusType.Waiting) { %>
                                <% =string.Format("操作员[{0}] 于 {1}审核，状态为：{2}。", Model.VerifyAdminName, Model.VerifyAt.ToDateTimeString(), Model.Status.GetDescription()) %>
                            <% } %>
                        </td>
                    </tr>
                    <tr>
                        <th>提现应算详情</th>
                        <td><% =GetDetail() %></td>
                    </tr>
                    <tr>
                        <th>提现手续费</th>
                        <td><%= isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.Waiting ? string.Format("<input type=\"text\" name=\"fee\" data-vtype=\"must\" data-vmsg=\"请输入提现手续费\" class=\"w100 ui-float\" value=\"{0}\" /> 元<label class=\"pl50\">实际到账金额：<i id=\"account\" class=\"fcred-2 ui-float\">{1}</i> 元</label>", Model.Fee.ToMoneyString(), (Model.Amount - Model.Fee).ToMoneyString()) : string.Format("手续费 {0} 元，实际应到帐 {1} 元。", Model.Fee.ToMoneyString(), (Model.Amount - Model.Fee).ToMoneyString()) %></td>
                    </tr>
                    <tr>
                        <th>审核备注</th>
                        <td><%= isValid && Model.Status == WAP2P.Account.CashApply.CashApplyStatusType.Waiting ? string.Format("<textarea name=\"verifyRemark\" data-vtype=\"must\" data-vmsg=\"请输入审核备注\">{0}</textarea>", Model.VerifyRemark.HtmlEncode()) : Model.VerifyRemark.BrEncode() %></td>
                    </tr>
                </ruson:Space>
            </table>
        </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        $("input[name=fee]").keyup(function(){
            $("#account").html(finance.toMoneyString(<%= Model.Amount %> - $(this).val()));
        }).trigger('keyup');

        $('.js-dopay').click(function() {
            var me = $(this).attr('disabled', 'disabled'), msg = me.next().html('');

            var fn = function() {
                msg.html('请稍候..');
                $.ajax({
                    url: 'CashApplyList.aspx?action=loan&idValues=<% =Model.Id %>',
                    dataType: "json",                    
                    success: function (res) {
                        msg.html(res.Message || '跟进成功。');
                        if (res.Success) {                            
                            setTimeout(function() {
                                parent.$.jPopupEdit.close(true);
                            }, 2000);
                        } else {
                            me.removeAttr('disabled');
                        }
                    }
                });
            };

            if (me.attr('data-confirm'))
                $.jConfirm(me.attr('data-confirm'), fn, function() {
                    me.removeAttr('disabled');
                });
            else
                fn();
        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>
