<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="BankCardDetail.aspx.cs" Inherits="WAP2P.Web.PC.Admin.Member.BankCardDetail" %>
<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="edit" Visible="true">
                    <tr>
                        <th>会员账号</th>
                        <td>
                            <label id="name"></label>
                            <input type="button" id="userInfo" class="c-normal iconfont ml10 g-hide" value="&#xe655; 查看资料" />
                            <input type="button" class="btn-base c-normal iconfont" value="&#xe60f; 选择会员" onclick="$.jPopupEdit('选择会员', '../Common/UserSelect.aspx?radio=true&fn=selectUser');" />
                            <input type="hidden" id="userId" name="userId" data-vtype="must" data-vmsg="请选择会员" />
                        </td>
                    </tr>
                    <tr>
                        <th>银行名称</th>
                        <td>                            
                            <ruson:Select runat="server" ID="bankName" data-vtype="must" data-vmsg="请选择银行" TipsText="请选择"></ruson:Select>
                        </td>
                    </tr>              
                    <tr>
                        <th>银行卡号</th>
                        <td><input type="text" id="cardNo" name="cardNo" placeholder="请输入该会员的银行卡号" maxlength="23" class="w250 ui-int" data-vtype="must" data-vmsg="请输入银行卡号" /></td>
                    </tr>
                    <tr>
                        <th>开户人名称</th>
                        <td><input type="text" name="accountName" placeholder="请输入该卡片的开户人" maxlength="50" class="w150" data-vtype="must" data-vmsg="请输入开户人名称" /></td>
                    </tr>
                    <tr>
                        <th>开户地区及分行</th>
                        <td>
                            <span id="area"></span> 
                            <p class="mt5"><input type="text" name="branch" placeholder="请输入详细的支行地址及名称" maxlength="50" class="w250" /></p>
                        </td>
                    </tr>
                </ruson:Space>  
                <ruson:Space runat="server" ID="view" Visible="false">
                    <tr>
                        <th>会员账号</th>
                        <td>
                            <%= WAP2P.Member.User.LoadOrNew(Model.UserId).Name %>
                            <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><%= Model.BankName %> </td>
                    </tr>              
                    <tr>
                        <th>银行卡号</th>
                        <td><%= Model.CardNo %></td>
                    </tr>
                    <tr>
                        <th>开户人名称</th>
                        <td><%= Model.AccountName %></td>
                    </tr>
                    <tr>
                        <th>开户详情</th>
                        <td><%= IsNew ? string.Empty : WAP2P.Sys.Area.LoadOrNew(Model.ProvinceId ?? 0).Name %> <%= IsNew ? string.Empty : WAP2P.Sys.Area.LoadOrNew(Model.CityId ?? 0).Name %> <%= IsNew ? string.Empty : WAP2P.Sys.Area.LoadOrNew(Model.AreaId ?? 0).Name %> <%= Model.Branch %></td>
                    </tr>
                    <tr>
                        <th>添加时间</th>
                        <td><%= Model.CreateAt.ToDateTimeString() %></td>
                    </tr>
                    <tr>
                        <th colspan="2" class="info-listhead">审核状态</th>
                    </tr>
                    <tr>
                        <th>审核状态</th>
                        <td>
                            <% if ((Model.Status == WAP2P.Account.BankCard.AuditingStatus.Waiting) && Request.QueryString["op"] == "valid")
                               { %>
                                <div class="ui-radio">                                    
                                    <label><input type="radio" name="status" value="<% =(int)WAP2P.Account.BankCard.AuditingStatus.Success %>" checked="checked" >通过</label>
                                    <label><input type="radio" name="status" value="<% =(int)WAP2P.Account.BankCard.AuditingStatus.Failure %>" />拒绝</label>                                    
                                </div>
                            <% } else if(Model.Status != WAP2P.Account.BankCard.AuditingStatus.Waiting) { %>                               
                                <% =string.Format("操作员[{0}] 于 {1}审核，状态为：{2}。", Model.ValidBy, Model.ValidAt.ToDateTimeString(), Model.Status.GetDescription())%>
                            <% } %>
                        </td>
                    </tr>
                    <tr>
                        <th>审核备注</th>
                        <td><%= Request.QueryString["op"] != "valid" ? Model.ValidRemark.BrEncode() : string.Format("<textarea name=\"validRemark\">{0}</textarea>", Model.ValidRemark.HtmlEncode()) %></td>
                    </tr>
                    <tr>
                        <th>操作员名称</th>
                        <td><%= Request.QueryString["op"] == "valid" ? CurrentAdmin.Name : Model.ValidBy %></td>
                    </tr>
                    <tr>
                        <th>审核时间</th>
                        <td><% = Request.QueryString["op"] == "valid" ? DateTime.Now.ToDateTimeString() : Model.ValidAt.ToDateTimeString() %></td>
                    </tr>
                </ruson:Space>
            </table>
        </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script src="<% =this.ImportJsCss("../../res/core/scripts/areadata.js") %>"></script>
    <script>
        $("#cardNo").keypress(function(){
            var text = $(this).val();
            if($(this).val().length >= 4){
                $(this).val(text.replace(/(\d{4})(?=\d)/g,"$1 "));
            }
        });

        //开户地区编辑
        $('#area').cascade({ data: areadata, names: ['provinceId', 'cityId', 'areaId'], emptyTip: '全部', values: [<% =Model.ProvinceId %>, <% =Model.CityId %>, <% =Model.AreaId %>], ismust:true });

        function selectUser(obj) {
            if (obj && obj.users && obj.users.length) {
                $("#userInfo").removeClass("g-hide").addClass("btn-base");
                $("#userInfo").attr("onclick", "$.jPopupEdit('查看会员资料', '../Common/UserInfo.aspx?Id=" + obj.users[0].id + "');");
                $("#userId").val(obj.users[0].id);
                $("#name").html(obj.users[0].name);
                $.ajax({
                    url: '?action=getUser',
                    data: { userId : obj.users[0].id },
                    dataType: 'json',
                    success: function (res) {
                        $("input[name=accountName]").val(res.RealName);
                        $('#area').cascade({ data: areadata, names: ['provinceId', 'cityId', 'areaId'], emptyTip: '全部', values: [res.ProvinceId, res.CityId, res.AreaId], ismust:true });
                    }
                })
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>
