<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="UserValidDetail.aspx.cs" Inherits="WAP2P.Web.PC.Admin.Member.UserValidDetail" %>
<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%">
                <tr>
                    <th>会员账号</th>
                    <td colspan="2" class="g-fbold"><% =GetUserDisplay(Model.Id, Model.Name) %></td>
                </tr>
                <ruson:Space runat="server" ID="edit" Visible="false">
                    <tr>
                        <th>真实姓名</th>
                        <td colspan="2"><input type="text" name="realName" placeholder="请输入身份证上的姓名" class="w150" maxlength="50" data-vtype="must" data-vmsg="请输入真实姓名" value="<% =Model.RealName.HtmlEncode() %>" /></td>
                    </tr>
                    <tr>
                        <th>身份证号码</th>
                        <td colspan="2"><input type="text" name="cardNumber" id="cardNumber" placeholder="请输入身份证号码" class="w300" maxlength="50" data-vtype="custom" data-vreg="^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$" data-vmsg="请输入正确的身份证号码" value="<% =Model.CardNumber.HtmlEncode() %>" /></td>
                    </tr>
                    <tr>
                        <th>性别</th>
                        <td colspan="2"><div class="ui-radio"><label><input type="radio" name="sex" id="sex0" value="0"<% =Model.Sex.HasValue && !Model.Sex.Value ? " checked=\"checked\"" : string.Empty %> /> 男</label> <label><input type="radio" name="sex" id="sex1" value="1" data-vtype="group" data-vmsg="请选择性别" data-vmin="1"<% =Model.Sex.HasValue && Model.Sex.Value ? " checked=\"checked\"" : string.Empty %> /> 女</label></div></td>
                    </tr>
                    <tr>
                        <th>生日</th>
                        <td colspan="2"><input type="text" name="birthday" id="birthday" placeholder="请选择身份证上的日期" class="ui-date w150" value="<% =Model.Birthday.ToDateString() %>" data-vtype="date" data-vmsg="请选择生日" /></td>
                    </tr>
                    <ruson:Space runat="server" ID="cardPhoto" Visible="false">
                    <tr>
                        <th>身份证图片</th>
                        <td style="width:50%">
                            <div>
                                <div id="cardPhoto1Result" class="mb10">
                                    <% =string.IsNullOrWhiteSpace(Model.CardPhoto1) ? string.Empty : string.Format("<a href=\"\" target=\"_blank\"><img width=\"380\" src=\"{0}\", alt=\"\" /></a>", Model.CardPhoto1) %>
                                </div>
                                <div class="pl136" > 
                                    <input type="hidden" name="cardPhoto1" id="cardPhoto1" value="<% =Model.CardPhoto1.HtmlEncode() %>" data-vtype="must" data-vmsg="请上传身份证正面" />
                                </div>
                                <input type="file" id="cardPhoto1File" />
                                 <em>请上传尺寸为 <i class="fcred-3">800 X 任意 像素</i> 的身份证图片</em>
                            </div>
                        </td>
                        <td style="width:50%">
                            <div>
                                <div id="cardPhoto2Result" class="mb10">
                                    <% =string.IsNullOrWhiteSpace(Model.CardPhoto2) ? string.Empty : string.Format("<a href=\"\" target=\"_blank\"><img width=\"380\" src=\"{0}\", alt=\"\" /></a>", Model.CardPhoto2) %>
                                </div>
                                <div class="pl136" > 
                                    <input type="hidden" name="cardPhoto2" id="cardPhoto2" value="<% =Model.CardPhoto2.HtmlEncode() %>" data-vtype="must" data-vmsg="请上传身份证反面" />
                                </div>
                                <input type="file" id="cardPhoto2File" />
                                 <em>请上传尺寸为 <i class="fcred-3">800 X 任意 像素</i> 的身份证图片</em>
                            </div>
                        </td>
                    </tr>
                    </ruson:Space>
                </ruson:Space>
                <ruson:Space runat="server" ID="view" Visible="false">
                    <tr>
                        <th>真实姓名</th>
                        <td><% =Model.RealName %></td>
                    </tr>
                    <tr>
                        <th>身份证号码</th>
                        <td><% =CurrentAdmin.HavePermission("会员管理", "查看联系方式", "身份证") ? Model.CardNumber : Model.CardNumber.HidePart() %></td>
                    </tr>
                    <tr>
                        <th>性别</th>
                        <td><% =Model.Sex.HasValue ? Model.Sex.Value ? "女" : "男" : string.Empty %></td>
                    </tr>
                    <tr>
                        <th>生日</th>
                        <td><% =Model.Birthday.ToDateString() %></td>
                    </tr>
                    <% if (GlobalSetting.Get<bool>(GlobalSetting.Keys.Risk.RealnameNeedPhoto)) { %>
                    <tr>
                        <th>身份证图片</th>
                        <td><% =CurrentAdmin.HavePermission("会员管理", "查看联系方式", "身份证") ? string.IsNullOrWhiteSpace(Model.CardPhoto1) ? string.Empty : string.Format("<a href=\"{0}\" target=\"_blank\"><img src=\"{0}\" alt=\"身份证正面\" width=\"380\" /></a> <a href=\"{1}\" target=\"_blank\"><img src=\"{1}\" alt=\"身份证反面\" width=\"380\" /></a>", Model.CardPhoto1, Model.CardPhoto2) : "您无权限查看身份证图片" %></td>
                    </tr>
                    <% } %>
                    <tr>
                        <th>手机号码</th>
                        <td><% =CurrentAdmin.HavePermission("会员管理", "查看联系方式", "手机") ? Model.Phone : Model.Phone.HidePart() %></td>
                    </tr>
                    <tr>
                        <th>电子邮箱</th>
                        <td><% =CurrentAdmin.HavePermission("会员管理", "查看联系方式", "邮箱") ? Model.Email : Model.Email.HidePart() %></td>
                    </tr>
                    <tr><th class="info-listhead" colspan="2">认证状态</th></tr>
                    <tr>
                        <th>实名认证状态</th>
                        <td>
                            <% if (Model.RealNameValid == WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess) { var validInfo = Model.BaseValid.FirstOrDefault(item => item.ValidName == "实名认证") ?? new WAP2P.Member.User.BaseInfoValidResult(); %>
                                <%  =validInfo.ValidByName == "系统" ? "系统" : "操作员[" + validInfo.ValidByName + "]" %> 于 <% =validInfo.ValidAt.ToLocalTime().ToDateTimeString() %> 审核通过。
                                <ruson:PermissionSpace runat="server" Module="会员管理" Function="会员认证管理" Operate="重置实名认证">
                                    <input type="button" class="btn-smaller c-obvious iconfont" id="js-resetRealname" value="&#xe680; 重置实名认证" />
                                </ruson:PermissionSpace>
                            <% } else if(Model.RealNameValid == WAP2P.Member.User.BaseInfoValidStatus.WaitValid && Request.QueryString["op"] == "valid") { %>
                                <div class="ui-radio"><label><input type="radio" name="realValid" value="1" /> 通过</label> <label><input type="radio" name="realValid" value="-1" /> 拒绝</label></div>
                            <% } else { %>
                                未认证
                            <% } %>
                        </td>
                    </tr>
                    <tr>
                        <th>手机认证状态</th>
                        <td>
                            <% if (Model.PhoneValid == WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess) { var validInfo = Model.BaseValid.FirstOrDefault(item => item.ValidName == "手机认证") ?? new WAP2P.Member.User.BaseInfoValidResult(); %>
                                <%  =validInfo.ValidByName == "系统" ? "系统" : "操作员[" + validInfo.ValidByName + "]" %> 于 <% =validInfo.ValidAt.ToLocalTime().ToDateTimeString() %> 审核通过。
                            <% } else if(Model.PhoneValid == WAP2P.Member.User.BaseInfoValidStatus.WaitValid && Request.QueryString["op"] == "valid") { %>
                                <div class="ui-radio"><label><input type="radio" name="phoneValid" value="1" /> 通过</label> <label><input type="radio" name="phoneValid" value="-1" /> 拒绝</label></div>
                            <% } else { %>
                                未认证
                            <% } %>
                        </td>
                    </tr>
                    <tr>
                        <th>邮箱认证状态</th>
                        <td>
                            <% if (Model.EmailValid == WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess) { var validInfo = Model.BaseValid.FirstOrDefault(item => item.ValidName == "邮箱认证") ?? new WAP2P.Member.User.BaseInfoValidResult(); %>
                                <%  =validInfo.ValidByName == "系统" ? "系统" : "操作员[" + validInfo.ValidByName + "]" %> 于 <% =validInfo.ValidAt.ToLocalTime().ToDateTimeString() %> 审核通过。
                            <% } else if(Model.EmailValid == WAP2P.Member.User.BaseInfoValidStatus.WaitValid && Request.QueryString["op"] == "valid") { %>
                                <div class="ui-radio"><label><input type="radio" name="emailValid" value="1" /> 通过</label> <label><input type="radio" name="emailValid" value="-1" /> 拒绝</label></div>
                            <% } else { %>
                                未认证
                            <% } %>
                        </td>
                    </tr>
                    <tr>
                        <th>现场认证状态</th>
                        <td>
                            <% if (Model.OnsiteValid == WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess) { var validInfo = Model.BaseValid.FirstOrDefault(item => item.ValidName == "现场认证") ?? new WAP2P.Member.User.BaseInfoValidResult(); %>
                                <%  =validInfo.ValidByName == "系统" ? "系统" : "操作员[" + validInfo.ValidByName + "]" %> 于 <% =validInfo.ValidAt.ToLocalTime().ToDateTimeString() %> 审核通过。
                            <% } else if(Model.OnsiteValid == WAP2P.Member.User.BaseInfoValidStatus.WaitValid && Request.QueryString["op"] == "valid") { %>
                                <div class="ui-radio"><label><input type="radio" name="onsiteValid" value="1" /> 通过</label> <label><input type="radio" name="onsiteValid" value="-1" /> 拒绝</label></div>
                            <% } else { %>
                                未认证
                            <% } %>
                        </td>
                    </tr>
                </ruson:Space>
            </table>
        </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        var initUpload = function (n) {
            setTimeout(function () {
                $('#cardPhoto' + n + 'File').uploadify({
                    width: 120,
                    height: 32,
                    multi: false,
                    removeTimeout: 0,
                    swf: '../res/uploadify/uploadify.swf?v=<% =CryptoHelper.Random(100000,999999) %>',
                    uploader: '../res/uploadify/SwfUpload.aspx?type=image&width=800',
                    buttonClass:'iconfont',
                    buttonText: '&#xe629; 上传' + (n == 1 ? '正' : '反') + '面',
                    fileTypeExts: '<% =WAP2P.Web.PC.Admin.Res.uploadify.SwfUpload.AllowImages %>',
                    formData: {
                        <% =WAP2P.Web.Admin.Membership.CookieName %> : '<% =Request.Cookies[WAP2P.Web.Admin.Membership.CookieName].Value %>'
                    },
                    onUploadSuccess: function(res, data) {
                        eval('var d = ' + data);
                        if (d.Success) {
                            $('#cardPhoto' + n).val(d.Message).trigger('blur');
                            $('#cardPhoto' + n + 'Result').html('<a href="' + d.Message + '" target="_blank"><img width="380" src="' + d.Message + '" /></a>');
                        } else {
                            $.jError(d.Message);
                        }
                    }
                });
            }, 10);
        };        

        <% =Request.QueryString["op"]  == "edit" ? "initUpload(1); initUpload(2);" : string.Empty %>
        $('#cardNumber').change(function() {
            var val = $.trim($(this).val());

            if (val && val.length == 18) {
                var isman = parseInt(val.substr(16, 1)) % 2 == 1;
                var birthday = $('#birthday'), sex0 = $('#sex0')[0], sex1 = $('#sex1')[0];

                if (!sex0.checked && !sex1.checked) {
                    if (isman)
                        sex0.checked = true;
                    else
                        sex1.checked = true;
                }

                if (birthday.val() == '') {
                    birthday.val(utils.dateToString(utils.toDate(val.substr(6, 8), 'yyyyMMdd')));
                }
            }
        });

        $('#js-resetRealname').click(function() {
            $.jConfirm('确认重置吗?', function() {
                $.get('?id=<% =Model.Id %>&op=resetRealname&_rnd=' + (new Date()).getTime(), function(res) {
                    if (res.Success)
                        location.reload();
                    else
                        $.jError(res.Message);
                }, 'json');
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>