{layout:default} {class:Shop.Admin.product.product_price}
<lbhead>
    <title><%=Tag("会员价格")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <link href="<%=site.AdminAssetsPath %>/plugins/multiselect/css/jquery.multiselect2side.css" rel="stylesheet">
</lbfile>
<lbpath>
    <h3 class="text-themecolor m-b-0 m-t-0"><%=ename%></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"><%=Tag("会员价格")%></li>
        <li class="breadcrumb-item active"><%=ename%></li>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-7 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <button class="btn btn-info" onclick="model_Add();"><i class="ti-plus"></i> <%=Tag("添加")%></button>
                        <button class="btn btn-success" onclick="model_Copy();"><i class="ti-files"></i> <%=Tag("复制")%></button>
                        <button class="btn btn-success" onclick="model_Save();"><i class="ti-check"></i> <%=Tag("保存")%></button>
                        <button class="btn btn-danger" onclick="DeleteConfirm()"><i class="ti-trash"></i> <%=Tag("删除")%></button>
                        <%}%>
                    </div>
                    <div class="col-md-5 m-b-10">
                        <div class="input-group">
                            <input type="text" id="key" name="key" value="<%=key %>" class="form-control" onkeydown="if(event.keyCode==13){search_();}">
                            <select id="User_Tags_id" name="User_Tags_id" class="form-control">
                                <option value=""><%=Tag("会员标签")%></option>
                                <%=Shop.Bussiness.EX_User.User_TagsOption(User_Tags_id)%>
                            </select>
                            <div class="input-group-append">
                                <button type="button" class="btn btn-primary" onclick="search_();"><i class="ti-search"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr>
                                <th class="selectAll" style="width:40px">
                                    <a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
                                </th>
                                <!--<th style="width: 100px">
        <%=Tag("编号")%>
    </th>
    <th>
        <%=Tag("商品名称")%>
    </th>-->
                                <th>
                                    <%=Tag("昵称")%>
                                </th>
                                <th>
                                    <%=Tag("姓名")%>
                                </th>
                                <th>
                                    <%=Tag("等级")%>
                                </th>
                                <th>
                                    <%=Tag("标签") %>
                                </th>
                                <th>
                                    <%=Tag("价格")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (var pro in models){
                            DB.LebiShop.Lebi_Product model=GetPro(pro.Product_id);
                            DB.LebiShop.Lebi_User user=GetUser(pro.User_id);
                            %>
                            <tr>
                                <td>
                                    <label class="custom-control custom-checkbox">
                                        <input type="checkbox" id="checkbox<%=model.id %>" name="id" value="<%=pro.id %>" class="custom-control-input" ShopKeyID="true">
                                        <span class="custom-control-label"></span>
                                    </label>
                                </td>
                                <!--<td>
        <%=model.Number%>
    </td>
    <td><%=Lang(model.Name)%></td>-->
                                <td><%=user.NickName%></td>
                                <td><%=user.RealName%></td>
                                <td>
                                    <%=Shop.Bussiness.EX_User.TypeName(user.UserLevel_id, CurrentLanguage.Code)%>
                                </td>
                                <td>
                                    <%=Shop.Bussiness.EX_User.User_Tags(user.User_Tags_ids) %>
                                </td>
                                <td>
                                    <input type="text" id="Price<%=pro.id%>" name="Price<%=pro.id%>" value="<%=FormatMoney(pro.Price," Number") %>" class="form-control form-control-sm" shop="true" onkeyup="value=value.replace(/[^.\d.]/g,'')" style="max-width:70px;">
                                    <input type="hidden" name="id" value="<%=pro.id%>" shop="true" />
                                </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 src="<%=site.AdminAssetsPath %>/plugins/multiselect/js/jquery.multiselect2side.js"></script>
    <script>
        function search_() {
            var key = $("#key").val();
            var User_Tags_id = $("#User_Tags_id").val();
            window.location = "?id=<%=id %>&key=" + escape(key) + "&User_Tags_id=" + User_Tags_id;
        }
        function DeleteConfirm() {
            $("#Modal-Confirm").modal("show");
            $("#Confirm-Content").html("<%=Tag("确认要删除吗？")%>");
            $("#Modal-Confirm .btn-success.btn-ok").attr("onclick", "model_Del();");
        }
        function model_Del() {
            $("#Modal-Confirm").modal("hide");
            var postData = GetFormJsonData("ShopKeyID");
            var url = "<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Product_Price_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function model_Save() {
            var postData=GetFormJsonData("shop");
            var url="<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Product_Price_Update";
            RequestAjax(url,postData,function(){MsgBox(1,"<%=Tag("操作成功")%>","?")});
        }
        function model_Copy() {
            var ids = GetChkCheckedValues("id");
            if (ids == "") {
                MsgBox(2, "<%=Tag("没有选择任何数据")%>", "");
                return;
            }
            $("#EditModal").modal("show");
            $.ajax({
                url: "product_price_copy_window.aspx",
                type: "GET",
                cache: false,
                data: { id: '<%=id %>', ids: ids },
            }).done(function (result) {
                $("#EditModal .modal-content").html(result);
            });
        }
        function model_Add(){
            var title_ = "<%=Tag("会员价格")%>-<%=ename%>";
            <%if(id>0){%>
                var url_ = "<%=site.AdminPath %>/product/product_price_window.aspx?productid=<%=id %>";
            <%}%>
            $("#EditModal .modal-dialog").attr("class", "modal-dialog modal-lg");
            $("#EditModal .modal-dialog").attr("style", "max-width:1500px;");
            $("#EditModal").modal("show");
            $.ajax({
                url: url_,
                type: "GET",
                cache: false,
                data: {title:title_},
            }).done(function(result){
                $("#EditModal .modal-content").html(result);
            });
        }
    </script>
</lbscripts>
