<%@ page language="C#" autoeventwireup="true" inherits="User_Gift_GiftList, DoodiiShop" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!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>
    <meta name="keywords" content="快餐,外卖，丽华快餐,快餐加盟,快餐店,中式快餐,西式快餐,北京快餐" />
    <link id="lnkCT" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkKC" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkNKC" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkLib" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkP" runat="server" rel="Stylesheet" type="text/css" />
    <link id="lnkUT" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkTB" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkCSS" runat="server" rel="stylesheet" type="text/css" />
    <link id="lnkJFSC" runat="server" rel="stylesheet" type="text/css" />

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

    <script type="text/javascript" src="/system/js/func.js"></script>

    <script type="text/javascript" src="/system/js/jquery.floatDiv.js"></script>

    <script type="text/javascript" src="/system/js/unitpngfix.js"></script>

    <script type="text/javascript" src="/system/js/Lib/WindowsManager.js"></script>

    <script type="text/javascript" src="/system/js/Lib/Tabs1.js"></script>

    <script type="text/javascript" src="/system/js/thickbox/thickbox.js"></script>

    <script type="text/javascript" src="/system/js/unitpngfix.js"></script>

    <style type="text/css">
.STYLE1 {color: #FF0000}
</style>
</head>
<body>
    <form id="form1" runat="server">
        <input type="hidden" runat="server" id="gifClass" value="-1" />
        <%--<div id="gifinfo" class="AlertMessageBox1 vWindowDialog">
            <div class="GiftNote">
                <div class="liyi">
                    礼品说明</div>
                <div style="float: right;">
                    <a class="lier" href="javascript:void(0)"
                        onclick="vWindowsManager.HideDialog()">［关闭］</a></div>
            </div>
            <div id="gifinfoTwo" class="lisan">
            </div>
        </div>--%>
        <div runat="server" id="Band">
            <div class="BandContain">
                <%--头部开始--%>
                <asp:PlaceHolder ID="phTop" runat="server"></asp:PlaceHolder>
                <%--头部结束--%>
                <%--内容开始--%>
                <div class="lisi">
                    &nbsp;</div>
                <div id="gifinfo" class="AlertMessageBox1 vWindowDialog">
                    <div class="GiftNote">
                        <div style="float: left; color: #fff;">
                            礼品说明</div>
                        <div style="float: right;">
                            <a style="color: #fff; background-color: Transparent;" href="javascript:void(0)"
                                onclick="vWindowsManager.HideDialog()">［关闭］</a></div>
                    </div>
                    <div id="gifinfoTwo" style="width: 485px; margin: 10px auto; overflow-y: auto; overflow-x: hidden;
                        height: 260px; float: left; padding-left: 10px; display:inline;">
                    </div>
                </div>
                <table class="Gift_table1" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                        <td class="liwu" valign="top">
                            <div class="zp">
                            </div>
                            <div class="zi">
                            </div>
                            <div class="Gift_div" runat="server" id="giftClassTable" style="display: none;">
                            </div>
                        </td>
                        <td rowspan="2" valign="top" class="liliu">
                            <div class="Gift_title">
                                积分商城</div>
                            <div class="Gift_centent">
                                <div id="divInfo" runat="server" style="display: none;">
                                    <div class="Gift_tishi" id="divIntNotLogin" runat="server">
                                        哇！这么多有趣好玩的礼品，但您还没有注册或者登录，只有登录后才可以换礼品哦！<br />
                                        <div class="liqi">
                                            <a style="float: left;" class="Style_Input" id="Button1" href="javascript:window.location.href='/Member/Register.aspx'">
                                                注册会员</a> <a class="Style_Inputer" id="Button2" href="javascript:window.location.href='/Member/MemberLogin.aspx'">
                                                    会员登录</a></div>
                                    </div>
                                    <div class="Gift_tishi" id="divInt" runat="server">
                                        欢迎&nbsp;&nbsp;&nbsp;<span class="lijiu" id="lblUserName" runat="server"></span>&nbsp;&nbsp;&nbsp;！<br />
                                        您的累计积分：<span class="f_import" id="lblTotalIntegral" runat="server">0分</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用积分：<span
                                            class="f_import" id="lblUsedIntegral" runat="server">0分</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;剩余积分：<span
                                                class="f_import" id="lblExpendIntegral" runat="server">0分</span>
                                    </div>
                                    <div id="divListArry">
                                    </div>
                                </div>
                                <div class="Gift_tishia" id="divDemo" runat="server">
                                    此功能 <strong><span class="STYLE1">未购买授权</span></strong>，如需购买详请登录<a href='http://www.doulaiding.com'
                                        target="_blank">都来订网络外卖订餐系统</a>官方网站！<br />
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="ao">
                        </td>
                    </tr>
                </table>
                <%--内容结束--%>
                <%--底部开始--%>
                <asp:PlaceHolder ID="phBottom" runat="server"></asp:PlaceHolder>
                <%--底部结束--%>
            </div>
        </div>
    </form>
</body>
</html>

<script type="text/javascript">
    var GiftClass_Tabs = null;
    var GiftClass_TabsCount = 0;
    var GiftClass_currentTab = 0;//当前选中的Tab
    var url = "/User/Gift/ExchangeGiftDefault.aspx";   
    var htmlmoren = $.ajax({ url: url, async: false,ifModified:true}).responseText;
    var page = 1;
    var str='<div class="GiftList" id="divList0" style="display:none">'+htmlmoren+'</div>';
    var tabNameStr="推荐礼品,";
function getClasss()
{
   var ret=User_Gift_GiftList.getClass().value;
   if(ret!=null)
   {
  　　GiftClass_TabsCount=ret.Rows.length;
       var pageNo=1;
       
       if (pageNo==null)
       {pageNo = page;page = pageNo;}
       for (i=0;i<ret.Rows.length;i++)
       {
           var url = "/Private/UserIntegralExchangeTemplate.aspx" + "?pageno="+pageNo + "&giftClassID=" + ret.Rows[i]["id"];   
           var html = $.ajax({ url: url, async: false,ifModified:true}).responseText;
           str +='<input type="hidden" value="'+ret.Rows[i]["id"]+'" id="hdclass'+i+'"/><div class="GiftList" id="divList'+(i+1)+'" style="display:none">'+html+'</div>';
           if(i==(ret.Rows.length-1))
           {tabNameStr += ret.Rows[i]["ClassName"];}
           else{tabNameStr += ret.Rows[i]["ClassName"] + ",";}
       }
       document.getElementById("divListArry").innerHTML=str;
       GiftClass_Tabs = new vensonTabs1("<%=giftClassTable.ClientID %>","GiftClass_Tabs_onChangeTabIndex",tabNameStr,1,"DefaultGift"); 
       
       var c=getQuery("class",window,"");
       if (c=="")
       {
        GiftClass_Tabs.setIndex(0);
        GiftClass_Tabs_onChangeTabIndex(0);
        }
       else{
        GiftClass_Tabs.setIndex(c);
        GiftClass_Tabs_onChangeTabIndex(c);
        }
      // document.getElementById("aaaa").value=str;
   }
}

 function GetList(pageNo,i)
 {    
   if (pageNo==null)
        pageNo = page;page = pageNo;
   //var divList = document.getElementById("divList"+2);  
   var hidGiftClassID = document.getElementById("<%=gifClass.ClientID %>").value;
   
   //alert(GiftClass_currentTab);
   var url = "/Private/UserIntegralExchangeTemplate.aspx" + "?pageno="+pageNo + "&giftClassID=" + hidGiftClassID;   
   //Loading();
   var html = $.ajax({ url: url, async: false,ifModified:true}).responseText;
   document.getElementById("divList"+GiftClass_currentTab).innerHTML="正在载入...";
   document.getElementById("divList"+GiftClass_currentTab).innerHTML="";
   document.getElementById("divList"+GiftClass_currentTab).innerHTML = html;
 }
function pageChange(obj,pageNo,i)
{
     GetList(pageNo,i);
}
//兑换礼品验证
function CheckSel(id,is,type)
{
  var selamount=0;
  if(is>0)
  {
    if(type==0)
    selamount=parseInt($("#selAmount"+id+"").val());
    else
    selamount=parseInt($("#selAmount1"+id+"").val());
  }
  else
  {
    selamount=parseInt($("#selAmountcmd"+id+"").val());
  }
  var Id=parseInt(id);
  var ret=User_Gift_GiftList.checkSel(Id,selamount).value;
  if(ret=="1")
  {
    //window.location="/User/Gift/ExchangeGiftInputOrderInfo.aspx?giftid="+id+"&quantity="+selamount+"";
    tb_show("兑换礼品","ExchangeGiftInputOrderInfo.aspx?giftid="+id+"&quantity="+selamount+"&TB_iframe=true&height=410&width=650&top=150");
  }
  else if(ret==null)
  {alert("发生错误请刷新本页！");}
  else
  {window.alert(ret);}

}

function getinfo(id)
{
   var ret=User_Gift_GiftList.getgifInfo(id).value;
   $("#gifinfoTwo").html(ret);
   vWindowsManager.ShowDialog("gifinfo");   
}
//切换类别
function GiftClass_Tabs_onChangeTabIndex(index)
{
    if (GiftClass_TabsCount==0)
    {
        return;
    }
    //alert(GiftClass_TabsCount);
    for(var i=0;i<=GiftClass_TabsCount;i++)
    {
        var divListTabItem = document.getElementById("divList" + i);
        if (i == index)
        {        
            divListTabItem.style.display = "";
            GiftClass_currentTab=i;
            if(i>0)
            {var a=(i-1);}
            else{a=i}
           // alert(a+","+$("#hdclass"+a).val());
            document.getElementById("<%=gifClass.ClientID %>").value=document.getElementById("hdclass"+a).value;
            //alert(a+","+document.getElementById("<%=gifClass.ClientID %>").value);
        }
        else{ divListTabItem.style.display = "none";  }        
    }   
}
function GetMore(id)
{
    GiftClass_Tabs_onChangeTabIndex(id);
    GiftClass_Tabs.setIndex(id);
}
function UserIsLogin()
{
   var ret= User_Gift_GiftList.islogin().value;
   if(ret>0)
   {window.open("/Spread/MyExchangeGift.aspx");}
   else
   {alert("请先登录！");return;}
}
 $(document).ready( function(){ getClasss();  });
</script>

