<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="LMN.Web.Admin.Shop.List" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/jquery-1.4.1.min.js"></script>
</head>
<body>
<form id="form1" runat="server" method="GET">
    <div style="padding: 20px;">
        <h4 class="title" style="float: left; height: 22px; line-height: 24px;">商品列表：</h4>
        <select id="category" name="category" size="1" style="float: left; margin-right: 10px;">
            <option value="0">商品分类</option>
            <%=categoryList%>
        </select><select name="tag" id="tag" size="1" style="float: left; margin-right: 10px;">
            <option value="0">商品标签</option>
            <option value="1" <%=(TagId==1?" selected=\"selected\"":"") %>>热门</option>
            <option value="2" <%=(TagId==2?" selected=\"selected\"":"") %>>推荐</option>
            <option value="3" <%=(TagId==3?" selected=\"selected\"":"") %>>特价</option>
            <option value="4" <%=(TagId==4?" selected=\"selected\"":"") %>>新品</option>
            <option value="5" <%=(TagId==5?" selected=\"selected\"":"") %>>包邮</option>
        </select><input type="text" runat="server" id="key" name="key" style="float: left; margin-right: 10px;" maxlength="20" /><input type="submit" value="筛选" />
        <div class="division">
            <table width="100%">
                <thead>
                    <tr class="left">
                        <th class="chk"><input type="checkbox" tags="" class="sel" name="all" value="true" id="all"></th>
                        <th class="w20">排序</th>
                        <th>名称</th>
                        <th class="w60">市场价</th>
                        <th class="w60">售价</th>
                        <th class="w60">库存</th>
                        <th class="w60">上架</th>
                        <th class="w60">类型</th>
                        <th class="w60">分类</th>
                        <th class="w60">品牌</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="repeater1" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td><input type="checkbox" value="<%#Eval("id")%>" id="id_<%#Eval("id")%>" name="id" value="78"></td>
                                <td>
                                    <%#Eval("sort")%></td>
                                <td><a href="AddNew.aspx?id=<%#Eval("id")%>">
                                <%#Eval("name")%></a></td>
                                <td>￥<%#Eval("market")%></td>
                                <td>￥<%#Eval("price")%></td>
                                <td>
                                    <%#Eval("store")%></td>
                                <td>
                                    <%#Convert.ToByte(Eval("issale"))==0 ?"否":"是"%></td>
                                <td><a href="List.aspx?model=<%#Eval("model_id")%>">
                                <%#Eval("model")%></a></td>
                                <td>
                                    <%--<a href="List.aspx?category=<%#Eval("category_id")%>">--%>
                                    <%#Eval("category")%></td>
                                <td><a href="List.aspx?brand=<%#Eval("brand_id")%>">
                                <%#Eval("brand")%></a></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="10"><input style="float: left;" type="button" id="dele" name="dele" value="批量删除" />
                            <div style="float: left; margin-left: 5px;">
                                <LMN:Pager ID="Pager1" runat="server" PageSize="20" CssClass="pager">
                                </LMN:Pager>
                            </div>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</form>
<script type="text/javascript">
    $("#all").click(function() {
        var b = $(this).attr("checked");
        $("input[name=id]").each(function() {
            $(this).attr("checked", b);
        });
    });
    $("#dele").click(function() {
        if ($("input[name=id]:checked").length == 0) {
            showTips("请选择要删除的项！", 3);
            return false;
        }

        if (!confirm("确认删除选中的记录？"))
            return false;

        var ids = "";
        $("input[name=id]:checked").each(function() {
            ids += (ids == "" ? "" : ",") + $(this).val();
        });

        if (ids != "") {
            $.get("Action.aspx?action=goodsdelete&id=" + ids + "&" + new Date(), function(data) {
                if (data == "-1") {
                    alert("请选择要删除的记录！");
                } else if (data == "0") {
                    alert("删除失败，请重试！");
                } else {
                    alert("删除成功！");
                    location.reload();
                }
            });
        }
        return true;
    });
</script>
</body>
</html>
