{layout:default} {class:Shop.Admin.user.UserLevel}
<lbhead>
    <title><%=Tag("会员分组")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <h3 class="text-themecolor m-b-0 m-t-0"><%=Tag("会员分组")%></h3>
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a></li>
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/user/default.aspx"><%=Tag("会员管理")%></a></li>
        <li class="breadcrumb-item active"><%=Tag("会员分组")%></li>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-12 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <button class="btn btn-info" onclick="Edit(0);"><i class="ti-plus"></i> <%=Tag("添加")%></button>
                        <%}%>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr>
                                <th>
                                    <%=Tag("名称")%>
                                </th>
                                <th>
                                    <%=Tag("级别")%>
                                </th>
                                <th>
                                    <%=Tag("价格文字")%>
                                </th>
                                <th>
                                    <%=Tag("图片")%>
                                </th>
                                <th>
                                    <%=Tag("积分水平线")%>
                                </th>
                                <th>
                                    <%=Tag("折扣")%>
                                </th>
                                <th>
                                    <%=Tag("会员数量")%>
                                </th>
                                <th>
                                    <%=Tag("操作")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_UserLevel model in models){%>
                            <tr ondblclick="Edit(<%=model.id %>);">
                                <td>
                                    <%=Shop.Bussiness.Language.Content(model.Name, CurrentLanguage.Code)%>
                                </td>
                                <td>
                                    <%=model.Grade %>
                                </td>
                                <td>
                                    <%=Shop.Bussiness.Language.Content(model.PriceName, CurrentLanguage.Code)%>
                                </td>
                                <td>
                                    <%if (model.ImageUrl != ""){ %><img src="<%=site.WebPath + model.ImageUrl %>" style="max-height:30px" /><%} %>
                                </td>
                                <td>
                                    <%=model.Lpoint %>
                                </td>
                                <td>
                                    <%=model.Price %>
                                </td>
                                <td>
                                    <a href="default.aspx?level=<%=model.id %>"><%=Shop.Bussiness.EX_User.UserCount(model.id)%></a>
                                </td>
                                <td>
                                    <a href="javascript:void(0)" onclick="Edit(<%=model.id %>);"><%=Tag("编辑")%></a>
                                    <%if (model.Grade > 0){%> | <a href="javascript:void(0)" onclick="DeleteConfirm(<%=model.id %>);"><%=Tag("删除")%></a><%} %>
                                    <%if (Shop.LebiAPI.Service.Instanse.Check("plugin_productlimit")){%> | <a href="javascript:void(0)" onclick="ProductLimit(<%=model.id %>,'<%=Lang(model.Name)%>');"><%=Tag("商品权限")%></a><%} %>
                                </td>
                            </tr>
                            <%} %>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-12">
                        <nav aria-label="Page navigation">
                            <%=PageString%>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</lbbody>
<lbscripts>
    <script>
        function Edit(id) {
            window.location = "UserLevel_Edit.aspx?id=" + id;
        }
        function DeleteConfirm(id) {
            $("#Modal-Confirm").modal("show");
            $("#Confirm-Content").html("<%=Tag("确认要删除吗？")%>");
            $("#Modal-Confirm .btn-success.btn-ok").attr("onclick", "Delete(" + id + ");");
        }
        function Delete(id) {
            $("#Modal-Confirm").modal("hide");
            var postData = { "id": id };
            var url= "<%=site.AdminPath %>/ajax/ajax_user.aspx?__Action=UserLevel_Del";
            RequestAjax(url,postData,function(res){MsgBox(1, "<%=Tag("操作成功")%>", '?')});
        }
        function ProductLimit(id,name){
            window.open("<%=site.AdminPath %>/product/productlimit_userlevel.aspx?userlevelid="+id);
            return;
            var title_ = "<%=Tag("商品权限")%>-"+name;
            var url_ = "<%=site.AdminPath %>/product/productlimit_window.aspx?userlevelid="+id;
            var width_ = 900;
            var height_ = 750;
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_, 'selectproduct');
        }
    </script>
</lbscripts>