<%@ page language="C#" masterpagefile="~/Admin/AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_CouponItem, WebApp_deploy" title="优惠券" %>

<asp:Content ID="cphContent" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link rel="stylesheet" href="css/admin_style.css" />
    <script src="Js/Jquery/jquery-1.4.1.min.js" type="text/javascript"></script>
    <style>
        /*--切换导航按钮样式background:url(/images/shop_topBg.gif) repeat-x 0px 27px;*/
        #MainMenu
        {
            width: 100%;
            height: 100px;
            margin: 5px auto;
        }
        #MainMenu .TabText
        {
            border: #C4D8ED 2px solid;
            text-align: left;
        }
        #MainMenu .TabMenu
        {
            background: none transparent scroll repeat 0% 0%;
            margin: 0;
            width: 100%;
            height: 24px;
        }
    </style>
    <script src="Js/Function.js" type="text/javascript"></script>
    <script type="text/javascript">
        function channel(obj, par) {
            var tMenu = document.getElementById("tMenu");
            for (var i = 0; i < tMenu.childNodes.length; i++) {
                if (tMenu.childNodes[i].className == "act")
                    tMenu.childNodes[i].className = "on";
            }
            obj.className = "act";
            window.location.href = "Admin_CouponItem.aspx?MenuName=运营管理&FileName=优惠券管理&m_flag=" + par;
            //main.location.href = "admin_main.html?id=" + par;
        }
    </script>
    <script type="text/javascript">
        function setButtonActive(flags) {
            var _flag = parseInt(flags);
            var ulObj = document.getElementById("tMenu");
            for (var i = 0; i < ulObj.childNodes.length; i++)
                ulObj.childNodes[i].className = "on";
            if (ulObj.childNodes.length > 5)
            { _flag = _flag * 2 + 1; }
            ulObj.childNodes[_flag].className = "act";

        }
    </script>
    <div>
        <%--列表 begin--%>
        <asp:Panel ID="phManage" runat="server">
            <div>
                <table class="nick" id="table_item" runat="server">
                    <tr>
                        <td class="tit left1">
                            &nbsp;&nbsp;优惠券管理
                        </td>
                    </tr>
                </table>
            </div>
            <div id="MainMenu" style="margin-left: 10px">
                <%--<li onclick="channel(this,1)" onmouseover="if (this.className!='act') this.className='on';"
            onmouseout="if (this.className!='act') this.className='';">网 站</li>--%>
                <div class="TabMenu">
                    <!--一级导航-->
                    <ul id="tMenu" style="margin-left: 0px">
                        <li class="on" onclick="channel(this,0)">全 部</li>
                        <li class="on" onclick="channel(this,1)">未使用</li>
                        <li class="on" onclick="channel(this,2)">已使用</li>
                        <li class="on" onclick="channel(this,3)">未过期</li>
                        <li class="on" onclick="channel(this,4)">已过期</li>
                    </ul>
                </div>
                <div class="TabText" style="text-align: center">
                    <asp:GridView ID="gvList" runat="server" CssClass="adminlist" AllowPaging="True"
                        AutoGenerateColumns="False" PageSize="20" OnRowDataBound="gvList_RowDataBound">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <input type="checkbox" id="chk_select" name="chk_select" value='<%# Eval("CouponItemID") %>' />
                                </ItemTemplate>
                                <HeaderTemplate>
                                    <input id="chkAll" onclick="SelectAllCheckboxes(this,'chk_select');" runat="server"
                                        type="checkbox" />
                                </HeaderTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="5%" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="CouponName" SortExpression="CouponName" HeaderText="名称" />
                            <asp:BoundField DataField="CouponNum" SortExpression="CouponNum" HeaderText="编号 " />
                            <asp:BoundField DataFormatString="{0:0.00}" DataField="CouponParvalue" SortExpression="CouponParvalue"
                                HeaderText="面值" />
                            <asp:BoundField DataFormatString="{0:0.00}" DataField="NeedsMoney" SortExpression="NeedsMoney"
                                HeaderText="所需金额" />
                            <asp:TemplateField HeaderText="有效期">
                                <ItemTemplate>
                                    <%# Convert.ToDateTime(Eval("BeginDate")).ToShortDateString() %>&nbsp;&nbsp;至&nbsp;&nbsp;<%# Convert.ToDateTime(Eval("EndDate")).ToShortDateString() %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="用户名">
                                <ItemTemplate>
                                    <asp:Literal ID="ltrUserName" runat="server" Text='<%# Eval("UserName") %>'></asp:Literal>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="使用订单">
                                <ItemTemplate>
                                    <asp:Literal ID="ltrUserOrder" runat="server" Text='<%# Eval("UseOrderID") %>'></asp:Literal>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="是否使用">
                                <ItemTemplate>
                                    <%# getUseStatus(Eval("UseStatus"))%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <a href='<%#"Admin_CouponItem.aspx?action=checkinfo&MenuName=运营管理&FileName=查看优惠券&ItemID="+Eval("CouponItemID") %>'>
                                        查看</a>
                                    <asp:LinkButton ID="btnDelete" runat="server" OnClientClick="return confirm('您真的要删除?')"
                                        CommandName='DelInfo' CommandArgument='<%# Eval("CouponItemID") %>' Text="删除"
                                        OnCommand="Button_Command" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            <table class="adminlist">
                                <tr>
                                    <th>
                                        名称
                                    </th>
                                    <th>
                                        编号
                                    </th>
                                    <th>
                                        面值
                                    </th>
                                    <th>
                                        所需金额
                                    </th>
                                    <th>
                                        有效期
                                    </th>
                                    <th>
                                        使用订单
                                    </th>
                                    <th>
                                        是否使用
                                    </th>
                                </tr>
                                <tr>
                                    <td colspan="7">
                                        优惠券无数据!
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                    </asp:GridView>
                    <div class="page">
                        &nbsp;<asp:Label ID="PagePanel" runat="server" />
                    </div>
                    <div class="div_btm">
                        <asp:Button ID="ButDel" runat="server" CausesValidation="False" CommandName="MoreDel"
                            Text="批量删除" OnClientClick="return confirm('您真的要删除?')" OnCommand="Button_Command">
                        </asp:Button>&nbsp;
                    </div>
                </div>
            </div>
        </asp:Panel>
        <%--列表 end--%>
        <asp:Panel ID="phCheck" runat="server">
            <table cellspacing="0" cellpadding="0" class="nick" width="auto">
                <tr>
                    <td class="tit" colspan="2">
                        &nbsp;&nbsp;查看优惠券
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        号码 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblCouponNum" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        对应优惠券规则 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblCouponInfoID" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        面值 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblCouponValue" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        有效期 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblDate" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        用户名 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblUserName" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        得到订单 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblGainOrderID" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        使用订单 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblUseOrderID" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        得到时间 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblGainDate" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        使用时间 ：
                    </td>
                    <td class="rtd">
                        <asp:Label ID="lblUseDate" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        使用状态 ：
                    </td>
                    <td class="rtd" style="color: Green;">
                        <asp:Label ID="lblUseStatus" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="btm">
                        <input type="button" onclick="location.href='Admin_CouponItem.aspx?MenuName=运营管理&FileName=优惠券管理&m_flag=<%=M_flag %>'" value="返 回" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    <script type="text/javascript">        setButtonActive("<%=M_flag %>");</script>
</asp:Content>
