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

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">@import url(/js/jquery-calendar/jquery-calendar.css);</style>

    <script type="text/javascript" src="/js/jquery-calendar/jquery-calendar.js"></script>

    <style type="text/css">

</style>
    <%--<div class="UserIntegral_02">想了解自己如何获取了这些积分吗？您可以使用积分获取搜索。</div>--%>
    <div class="mt10 UserIntegral_03 wh100">
        
        <span class="span03"> 
            累计积分：<strong class="red "><asp:Label ID="lblTotalIntegral"
            runat="server" Text="0"></asp:Label>分</strong>　　　
            消费积分：<strong class="red "><asp:Label ID="lblUsedIntegral"
            runat="server" Text="0"></asp:Label>分</strong>　　　
            剩余积分：<strong class="red "><asp:Label ID="lblExpendIntegral"
            runat="server" Text="0"></asp:Label>分</strong>
        </span>       

        <div class="wh100 fl" style="margin-top:10px; width:600px; height:45px;">
            查询日期：<asp:TextBox ID="tbStartDate" runat="server"></asp:TextBox>
            至
            <asp:TextBox ID="tbEndDate" runat="server"></asp:TextBox>
            <input class="sio" type="button" name="button" id="button" onclick="getIntegral();GetList(1);"
                value=" 查 询 " /></div>     
    </div>
    <div id="divList">
    
    </div>

    <script type="text/javascript">
function Loading()
{
    var divList = document.getElementById("divList");
    divList.innerHTML = "<img src='/images/System/loading.gif' alt='正在载入...'/>";
}
var page = 1;
function GetList(pageNo)
{    
   if (pageNo==null)
        pageNo = page;page = pageNo;
   var divList = document.getElementById("divList");   
   var startDate = document.getElementById("<%=tbStartDate.ClientID%>").value;
   var endDate = document.getElementById("<%=tbEndDate.ClientID%>").value;
   var url = "/Private/UserIntegralTemplate.aspx" + "?pageno="+pageNo;
   if (startDate!="" && endDate=="")
   {
        alert("请选择结束日期！");document.getElementById("<%=tbEndDate.ClientID%>").focus();return ;
   }
   if (startDate=="" && endDate!="")
   {
        alert("请选择开始日期！");document.getElementById("<%=tbStartDate.ClientID%>").focus();return;
   }   
   if (startDate!="" && endDate!="")
   {
        if (date_compare(startDate,endDate)<0)
        {
            alert("开始时间不能大于结束日期！");document.getElementById("<%=tbStartDate.ClientID%>").focus();return;
        }
        url += "&startDate="+startDate+"&endDate="+endDate;   
   }   
   Loading();
   var html = $.ajax({ url: url, async: false,ifModified:true}).responseText
   document.getElementById("divList").innerHTML = html;
}
function getIntegral()
{
    var ret = User_UserIntegral.getIntegral().value;
    
    if(ret!=null)
    {
        if(ret.ExpendIntegral!=0)
	    $("#<%=lblExpendIntegral.ClientID %>").html(ret.ExpendIntegral);
        if(ret.UsedIntegral!=0)
	    $("#<%=lblUsedIntegral.ClientID %>").html(ret.UsedIntegral);
        if(ret.UsedIntegral!=0 || ret.ExpendIntegral!=0)
	    $("#<%=lblTotalIntegral.ClientID %>").html(ret.ExpendIntegral + ret.UsedIntegral);
	}
}
function pageChange(obj,pageNo)
{
     GetList(pageNo);
}
var loadPage = function() 
{    
    $("#<%=tbStartDate.ClientID %>").calendar(); 
    $("#<%=tbEndDate.ClientID %>").calendar();  
    GetList(1); 
    getIntegral();
}
$(document).ready( function(){ loadPage() });

    </script>

</asp:Content>
