{layout:default} {class:Shop.Admin.user.User_Edit}
<lbhead>
    <title><%if (model.id != 0)
      { %>
    <%=Tag("编辑会员")%> <%=model.UserName %>
    <%}else{ %><%=Tag("会员添加")%>
    <%}%>-<%=Tag("会员管理")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <div class="tools">
    <ul>
    <%if (PageReturnMsg == ""){%>
    <li class="submit"><a href="javascript:void(0);" onclick="SaveObj();"><b></b><span><%=Tag("保存")%></span></a></li>
    <%}%>
    <li class="rotate"><a href="javascript:void(0);" onclick="history.back();"><b></b><span><%=Tag("返回")%></span></a></li>
    <li class="name"><span id="navIgation"><%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a> > <a href="<%=site.AdminPath %>/user/default.aspx"><%=Tag("会员管理")%></a> > 
    <%if (model.id != 0)
      { %>
    <%=Tag("编辑会员")%> <%=model.UserName %>
    <%}else{ %><%=Tag("会员添加")%>
    <%}%></span></li>
    </ul>
    </div>
</lbpath>
<lbbody>
    <div class="searchbox clear">
        <ul class="tabmenus">
            <li class="current"><a href="user_edit.aspx?id=<%=model.id %>"><span><%if (model.id != 0)
      { %><%=Tag("编辑会员")%><%}else{ %><%=Tag("会员添加")%><%}%></span></a></li>
            <li><a href="javascript:void(0)" onclick="EditPassword(<%=model.id %>);"><span><%=Tag("改密")%></span></a></li>
            <li><a href="javascript:void(0)" onclick="Question(<%=model.id %>);"><span><%=Tag("安全问题")%></span></a></li>
            <li><a href="UserMoney.aspx?user_id=<%=model.id %>" target="_blank"><span><%=Tag("资金")%></span></a></li>
            <li><a href="UserPoint.aspx?user_id=<%=model.id %>" target="_blank"><span><%=Tag("积分")%></span></a></li>
            <li><a href="../promotion/cardlist.aspx?user_id=<%=model.id %>&type=312" target="_blank"><span><%=Tag("代金券")%></span></a></li>
            <li><a href="Message.aspx?user_id=<%=model.id %>" target="_blank"><span><%=Tag("站内信")%></span></a></li>
            <li><a href="OftenBuy.aspx?user_id=<%=model.id %>" target="_blank"><span><%=Tag("常购清单")%></span></a></li>
            <%if (Shop.LebiAPI.Service.Instanse.Check("plugin_agent")){ %><li><a href="../agent/agentmoney.aspx?user_id=<%=model.id %>" target="_blank"><span><%=Tag("佣金")%></span></a></li><%} %>
        </ul>
    </div>
    <table class="table">
        <tr>
            <th>
                <%=Tag("会员帐号")%>：
            </th>
            <td>
                <%if (model.id == 0){ %><input name="UserName" id="UserName" value="<%=model.UserName %>" onchange="CheckUserName();" shop="true" type="text" class="input" style="width: 200px;" />
                <%}else{ %>
                <%=model.UserName %>
                <%}%>

                <span id="FormUserName"></span>
            </td>
            <%if (domain3admin)
              { %>
            <th>
               <%=Tag("站点")%>：
            </th>
            <td >
                <%=SiteName(model.Site_id,model.DT_id, CurrentLanguage.Code)%>
            </td>
            <%}
              else
              {%>
            <th>&nbsp;</th>
            <td >&nbsp;</td>
            <%} %>
        </tr>
        <tr>
            <th>
                 <%=Tag("性别")%>：
            </th>
            <td>
                <input type="radio" name="Sex" shop="true" value="男" <%=model.Sex=="男"?"checked":""%> /><%=Tag("男")%>
                <input type="radio" name="Sex" shop="true" value="女" <%=model.Sex=="女"?"checked":""%> /><%=Tag("女")%>
            </td>
            <th>
                <%=Tag("绑定")%>：
            </th>
            <td > 
                <%
                  if (model.bind_weixin_id != "")
                  {
                      Response.Write("<img src=\"" + SYS.platform_weixin_image + "\" height=\"24px\" />");
                  }
                  if (model.bind_weibo_id != "")
                  {
                      Response.Write("<img src=\"" + SYS.platform_weibo_image + "\" height=\"24px\" />");
                  }
                  if (model.bind_qq_id != "")
                  {
                      Response.Write("<img src=\"" + SYS.platform_qq_image + "\" height=\"24px\" />");
                  }
                  if (model.bind_taobao_id != "")
                  {
                      Response.Write("<img src=\"" + SYS.platform_taobao_image + "\" height=\"24px\" />");
                  }
                  if (model.bind_facebook_id != "")
                  {
                      Response.Write("<img src=\"" + SYS.platform_facebook_image + "\" height=\"24px\" />");
                  }
                %>&nbsp;
            </td>
        </tr>
         <tr  >
            <th>
                <%=Tag("会员编号")%>：
            </th>
            <td >
                <input name="UserNumber" value="<%=model.UserNumber %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th>
                <%=Tag("有效期")%>：
            </th>
            <td >
                <input name="Time_End" value="<%=FormatDate(model.Time_End)%>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>
        <%--<tr  >
            <th style="width:12%">
                <%=Tag("密码问题")%>：
            </th>
            <td style="width:38%">
                <input name="pwdwen" value="<%=model.pwdwen %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th style="width:12%">
                <%=Tag("密码答案")%>：
            </th>
            <td style="width:38%">
                <input name="pwdda" value="<%=model.pwdda %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>--%>
        <tr  >
            <th>
                <%=Tag("真实姓名")%>：
            </th>
            <td >
                <input name="RealName" value="<%=model.RealName %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th>
                <%=Tag("昵称")%>：
            </th>
            <td >
                <input name="NickName" value="<%=model.NickName %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>
        <tr  >
            <th>
                <%=Tag("出生日期")%>：
            </th>
            <td >
                <input name="Birthday" value="<%if (model.id > 0){Response.Write(FormatDate(model.Birthday));} %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th>
                <%=Tag("手机号码")%>：
            </th>
            <td >
                <input name="MobilePhone" value="<%=model.MobilePhone %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>
        <tr  >
            <th>
                <%=Tag("电话号码")%>：
            </th>
            <td >
                <input name="Phone" value="<%=model.Phone %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th>
                <%=Tag("传真号码")%>：
            </th>
            <td >
                <input name="Fax" value="<%=model.Fax %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>
        <tr>
            <th>
                <%=Tag("QQ号码")%>：
            </th>
            <td >
                <input name="QQ" value="<%=model.QQ %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
            <th>
                <%=Tag("Email地址")%>：
            </th>
            <td >
                <input name="Email" value="<%=model.Email %>" shop="true" type="text" class="input" style="width: 200px;" />
            </td>
        </tr>
        <tr>
            <th>
                <%=Tag("会员分组")%>：
            </th>
            <td>
                <select name="UserLevel_id" shop="true">
                <option value="0">┌ <%=Tag("会员分组")%></option>
                <%=Shop.Bussiness.EX_User.TypeOption("grade > 0", model.UserLevel_id, CurrentLanguage.Code)%>
                </select>
            </td>
            <th>
                <%=Tag("语言")%>：
            </th>
            <td>
                <select name="Language" id="Language" shop="true">
                    <%= Shop.Bussiness.Language.LanguageOption(model.Language)%>
                </select>
            </td>
        </tr>
        <%if (Shop.LebiAPI.Service.Instanse.Check("plugin_agent")){ %>
        <tr>
            <th>
                <%=Tag("上级用户")%>：
            </th>
            <td >
                <input name="User_id_parent" value="<%=model.User_id_parent %>" shop="true" type="text" class="input" style="width: 200px;" /> <a href="../agent/agentuser.aspx?parent_id=<%=model.User_id_parent %>" target="_blank"><%=Shop.Bussiness.EX_User.GetUser(model.User_id_parent).UserName%></a>
            </td>
            <th>
                <%=Tag("下级用户")%>：
            </th>
            <td >
                <a href="../agent/agentuser.aspx?id=<%=model.id %>" target="_blank"><%=Shop.Bussiness.Common.GetValue("select count(1) from Lebi_User where User_id_parent="+model.id+"") %></a>
            </td>
        </tr>
        <%} %>
        <tr>
            <th>
                <%=Tag("注册日期")%>：
            </th>
            <td >
                <%=FormatTime(model.Time_Reg) %>
            </td>
            <th>
                <%=Tag("上次登陆")%>：
            </th>
            <td >
                <%=FormatTime(model.Time_Last) %>&nbsp;&nbsp;<%=Tag("IP")%>：<a href="http://www.ip138.com/ips138.asp?ip=<%=model.IP_Last%>&action=2" target="_blank"><%=model.IP_Last %></a>
            </td>
        </tr>
        <tr>
            <th>
                <%=Tag("最后登陆")%>：
            </th>
            <td >
                <%=FormatTime(model.Time_This) %>&nbsp;&nbsp;<%=Tag("IP")%>：<a href="http://www.ip138.com/ips138.asp?ip=<%=model.IP_This%>&action=2" target="_blank"><%=model.IP_This %></a>
            </td>
            <th>
                <%=Tag("登录次数")%>：
            </th>
            <td >
                <%=model.Count_Login %>
            </td>
        </tr>
        <tr  >
            <th style="vertical-align:top">
                <%=Tag("内部备注")%>：<br>
                <em>≤ <span id="remLen">255</span></em>
            </th>
            <td colspan="3">
                <textarea name="Introduce" id="Introduce" shop="true" rows="3" cols="60" class="input" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" style="height: 55px;width: 550px;"><%=model.Introduce%></textarea>
                <div class="tools clear">
                    <ul>
                        <li class="plus"><a href="javascript:void(0);" onclick="javascript:resizeEditor('Introduce',100);"><b></b><span><%=Tag("展开")%></span></a></li>
                        <li class="minus"><a href="javascript:void(0);" onclick="javascript:resizeEditor('Introduce',-100)"><b></b><span><%=Tag("收缩")%></span></a></li>
                    </ul>
                </div>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        var maxLen = 255;
        var Introduce = document.getElementById("Introduce");
        function checkMaxInput(form) {
        if (Introduce.value.length > maxLen)
        Introduce.value = Introduce.value.substring(0, maxLen);
        else document.getElementById("remLen").innerHTML = maxLen - Introduce.value.length;
        }
        function SaveObj() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_user.aspx?__Action=User_Edit&id=<%=model.id %>";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "default.aspx")});
        }
        function CheckUserName()
        {
            var UserName=$("#UserName").val();
            var postData={"UserName":UserName};
            var url = "<%=site.AdminPath %>/ajax/ajax_user.aspx?__Action=CheckUserName&id=<%=model.id %>";
            $.ajax({
            type: "POST",
            url: url,
            data: postData,
            dataType: 'json',
            success: function (res) {
                if(res.msg=="OK")
                    CheckOK("UserName",'');
                else
                    CheckNO("UserName",'<%=Tag("用户名已经存在") %>');
                }
            });
        }
        function EditPassword(id) {
            var title_ = "<%=Tag("改密")%>";
            var url_ = "userpassword_edit_window.aspx?id="+id;
            var width_ = 500;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function Question(id) {
            var title_ = "<%=Tag("安全问题")%>";
            var url_ = "userquestion_edit_window.aspx?id="+id;
            var width_ = 500;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
    </script>
</lbbody>