<%@ page language="C#" masterpagefile="~/MasterPage/MyspaceMasterPage.master" autoeventwireup="true" inherits="User_Gift_IntegralUserExchange, DoodiiShop" title="Untitled Page" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">
    .STYLE1 {color: #FF0000}
a.Select,a.Select:hover,a.Select:link{color:gray;}
.red{color:red;}
.OrderInfo_Header
    {
        height:15px;
        background-color:#ffc0c0;
        padding:10px;
    }
    .OrderInfo_Content
    {
        padding:10px;
        background-color:#ffc0c0;
        padding-top:0px;
        float:left;
        width:623px;
    }/*（待处理）*/
    .OrderInfo_Header1
    { 
        height:15px;
        background-color:#ffffc6;
        padding:10px;
    }
    .OrderInfo_Content1
    {
        padding:10px;
        background-color:#ffffc6;
        padding-top:0px;
        float:left;
        width:623px;
    }/*（已完成）*/
    .OrderInfo_Header2
    { 
        height:15px;
        background-color:#c0f0c0;
        padding:10px;    
    }
    .OrderInfo_Content2
    {
        padding:10px;
        background-color:#c0f0c0;
        padding-top:0px;
        float:left;
        width:623px;
    }
    .OrderPageInfo {
        padding:10px;
        text-align:right;
       /* float:right;*/
    }
.lipin{height::30px;}
/*.wei{ height:15px; line-height;35px; background-color:#ffffc6; padding:10px 0 0 20px;}*/
.zuo{width:48px; height:15px; margin-left:394px; display:inline; }
.di{float: left; width:200px; height:15px;}
.zhis{padding:10px; background-color:rgb; background-color:#ffffff; float:left; width:603px; display:inline;}
.NewTable
{ float:left;
	width:100%;
	border-collapse:collapse;
}
.NewTable th{	
	border:1px solid #ccc;
	padding:5px;
}
.NewTable td{	
	border:1px solid #ccc;
	padding:5px;
}
.NewTable thead th {
	border-bottom:2px solid #3D580B;
	background-color:#f4f4f4;
	color:#fff;	
	padding:10px 0px;	
}
.NewTable th{
	background-color:#f4f4f4;
	text-align:center;
}
.NewTable th.title{
	background-color:#E3E685;
}
.NewTable .htd 
{
	background-color:#F2F4B9;
	font-weight:bold;
	text-align:center;
}
.NewTable tfoot td{
	border-width:0px;
	text-align:right;
	font-size:12px;
	color:#777;
}
.NewTable caption{
	font-weight:bold;
	padding:6px 0px;
	color:#3D580B;	
	font-size:25px;
}
.xhtml th.title{
	background-color:#FFD56C;
}
.xhtml th{
	background-color:#FFE8AE;
}
.NewTable .bl{
	border-left:none;
}
.NewTable .br{
	border-right:none;
}
.NewTable .bn{
	border:none;
}

</style>

    <script type="text/javascript">
        
    $(document).ready( function(){ init() });
        
    var init = function() {
        bindEvents();
    }
    
    var bindEvents = function() {
//        window.onscroll = refreshPopMessage;
       getNewOrderCount();
//        $("#PopMessage").bind("click", function(){ $(this).hide() });
    }
    
//    function refreshPopMessage()
//    {
//        var _PopMessageHeight = parseInt($("#PopMessage").css("height"));
//        var _PopMessageTop = document.documentElement.scrollTop
//            + document.documentElement.clientHeight
//            - _PopMessageHeight - 5;
//        $("#PopMessage").css("top", _PopMessageTop + "px");
//    }
    
    function getNewOrderCount()
    {
        var ret = User_Gift_IntegralUserExchange.GetNewOrderCount(3).value;
        if (ret != null)
            $("#spDui").html(ret+"笔");
        else  $("#spDui").html(0+"笔");
        var ret = User_Gift_IntegralUserExchange.GetNewOrderCount(0).value;
        if (ret != null)
            $("#lblNewOrderCount").html(ret+"笔");
        else
            $("#lblNewOrderCount").html(0+"笔");
        var ret = User_Gift_IntegralUserExchange.GetNewOrderCount(2).value;
        if (ret != null)
            $("#spOk").html(ret+"笔");
        else  $("#spOk").html(0+"笔");
        
        var ret = User_Gift_IntegralUserExchange.GetNewOrderCount(-1).value;
        if (ret != null)
            $("#spFeild").html(ret+"笔");
        else  $("#spFeild").html(0+"笔");
        var ret = User_Gift_IntegralUserExchange.GetNewOrderCount(1).value;
        if (ret != null)
            $("#spWait").html(ret+"笔");
        else  $("#spWait").html(0+"笔");
    }
    function deleteInfo()
    {
        if(!window.confirm('确认作废这条兑换礼品信息吗?'))return false;
        var remark = window.prompt("请输入作废原因","");
        if (remark == null) return false;
        if ($.trim(remark) == "") {
            alert("请输入作废原因");
            return false;
        }
        if(remark.length > 50)
        {
            altert("字数限制在50个以内!");return false;
        }
        else
        {
            document.getElementById("<%=hidRemark.ClientID%>").value = remark;
            return true;
        }
        
    }
    </script>

    <div class="Gift_tishia" id="divDemo" runat="server">
        此功能<strong><span class="STYLE1">未购买授权</span></strong>，如需购买详请登录<a href='http://www.doulaiding.com' target="_blank">都来订网络外卖订餐系统</a>官方网站！
    </div>
    <div id="divContent" runat="server">
        <div id="PopMessage" style="right: 22px; bottom: 39px; height: 30px;">
            <div class="Content">
                兑换笔数：&nbsp;&nbsp;<span id="spDui" class="red">0</span>&nbsp;&nbsp; ( 待处理：&nbsp;&nbsp;<span
                    class="red" id="lblNewOrderCount">0</span>&nbsp;&nbsp;准备中：&nbsp;&nbsp;<span class="red"
                        id="spWait">0</span>&nbsp;&nbsp; 已完成：&nbsp;&nbsp;<span id="spOk" class="red">0</span>&nbsp;&nbsp;
                已作废：&nbsp;&nbsp;<span class="red" id="spFeild">0</span>&nbsp;&nbsp; )</div>
        </div>
        <div class="lipin">
            兑换单号：<asp:TextBox ID="tbNum" runat="server" BorderStyle="Groove"></asp:TextBox>
            状态：<asp:DropDownList ID="giftstate" runat="server" Width="70px">
                <asp:ListItem Value="3">全部</asp:ListItem>
                <asp:ListItem Value="0" Selected="True">待处理</asp:ListItem>
                <asp:ListItem Value="1">准备中</asp:ListItem>
                <asp:ListItem Value="2">已完成</asp:ListItem>
                <asp:ListItem Value="-1">已作废</asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="Button1" CssClass="sio" runat="server" Text="查询" OnClick="Button1_Click" />
            <div style="display: none;">
                起始时间：<asp:TextBox ID="tbStartDate" runat="server" BorderStyle="Groove"></asp:TextBox>
                截止时间：<asp:TextBox ID="tbEndDate" runat="server" BorderStyle="Groove"></asp:TextBox>&nbsp;
                会员账号：<asp:TextBox ID="tbEmail" runat="server" BorderStyle="Groove"></asp:TextBox>
                姓名：<asp:TextBox ID="tbName" runat="server" BorderStyle="Groove"></asp:TextBox>
                电话：<asp:TextBox ID="tbPhone" runat="server" BorderStyle="Groove"></asp:TextBox></div>
        </div>
        <asp:DataList ID="DataList1" runat="server" DataKeyField="ID" OnItemCommand="DataList1_ItemCommand"
            OnPreRender="DataList1_PreRender" Width="100%">
            <ItemTemplate>
                <div id="ting" style="clear: both; margin-top: 8px; padding-bottom: 15px;">
                    <div class='<%#getBackGroumd(DataBinder.Eval(Container, "DataItem.State").ToString()) %>'
                        runat="server" id="OrderInfo_Header">
                        <strong>兑换单号：</strong>
                        <%# DataBinder.Eval(Container, "DataItem.id")%>
                        &nbsp;&nbsp;<strong>状态：</strong><asp:Label runat="server" ID="tcL" Text='<%# DataBinder.Eval(Container, "DataItem.State") %>'
                            ForeColor="Red"></asp:Label>
                        <asp:LinkButton ID="BTCN2" Visible="false" runat="server" CommandName="CN2" Text="处理"></asp:LinkButton>
                        <asp:LinkButton ID="BTCN3" runat="server" Visible="false" CommandName="CN3" Text="完成"></asp:LinkButton>
                        <asp:LinkButton ID="BTCN1" CssClass="zuo" Visible="false" runat="server" CommandName="CN1"
                            Text="作废"></asp:LinkButton>
                        <asp:Label runat="server" ID="ttcL" Visible="false" Text='<%# DataBinder.Eval(Container, "DataItem.UserID") %>'></asp:Label>
                    </div>
                    <div id="OrderInfo_Content" runat="server" class='<%#getBackGroumdContent(DataBinder.Eval(Container, "DataItem.State").ToString()) %>'>
                        <div class="zhis">
                            <table class="NewTable" width="100%" style="float: left;">
                                <tr>
                                    <th>
                                        会员账号：</th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.Email")%>
                                    </td>
                                    <th>
                                        姓　　名：
                                    </th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.trueName")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        电　　话：
                                    </th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.phone")%>
                                    </td>
                                    <th>
                                        邮　　编：</th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.PostCode")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        地　　址：</th>
                                    <td colspan="3">
                                        <%# DataBinder.Eval(Container, "DataItem.Address")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        礼品名称：</th>
                                    <td class="red">
                                        <%# DataBinder.Eval(Container, "DataItem.GiftName")%>
                                    </td>
                                    <th>
                                        兑换积分：</th>
                                    <td class="red">
                                        <%# DataBinder.Eval(Container, "DataItem.totalExpend")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        兑换数量：</th>
                                    <td class="red">
                                        <%# DataBinder.Eval(Container, "DataItem.amounts")%>
                                    </td>
                                    <th>
                                        兑换时间：</th>
                                    <td class="red">
                                        <%# DateTime.Parse(DataBinder.Eval(Container, "DataItem.PostTime").ToString()).ToString("yyyy-MM-dd hh:mm")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        备　　注：</th>
                                    <td colspan="3">
                                        <%# DataBinder.Eval(Container, "DataItem.Note")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        操 作 人：</th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.AdminName")%>
                                    </td>
                                    <th>
                                        更新时间：</th>
                                    <td>
                                        <%# DataBinder.Eval(Container, "DataItem.UpdateTime")%>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        操作原因：</th>
                                    <td colspan="3">
                                        <%# DataBinder.Eval(Container, "DataItem.Remark")%>
                                    </td>
                                </tr>
                            </table>
                            <br />
                        </div>
                    </div>
                </div>
            </ItemTemplate>
        </asp:DataList>
        <div style="float: left; padding-top: 20px;">
            <PageControl:myPageControl ID="MyPageControl1" runat="server" PageSize="5" TotalRecord="20"
                IsDoPostBack="true" ItemSize="5" PageInfoShow="False" OnChangePageClick="MyPageControl1_OnChangePageClick" />
        </div>
        <input type="hidden" id="hidRemark" runat="server" />
    </div>
</asp:Content>
