<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeBehind="KS.CosLimitBuyList.aspx.cs" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CosLimitBuyList" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.APPCode" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
<asp:Panel ID="ListPanel" runat="server" Width="100%">
    <script>
    function SetDate() {
    var today = new Date();
    if ($("#showdate").is(":hidden")) {
        $("#showdate").show();
        $('#<%=TxtBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                $('#<%=TxtEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
            }
            else {
                $("#showdate").hide();
                $('#<%=TxtBeginDate.ClientID%>').val('');
        $('#<%=TxtEndDate.ClientID%>').val('');
            }
        }

    function GetMyIds() {
            var sid = null;
            for (var i = 0; i < document.getElementsByName("ids").length; i++) {
                var KS = document.getElementsByName("ids")[i];
                if (KS.checked == true) {
                    if (sid == null)
                        sid = KS.value;
                    else
                        sid += "," + KS.value;
                }
            }
            return sid;
           
        } 
     function ContentSetAttribute(){
            var sid = GetMyIds();
            if (sid!=null)  parent.openWin("批量设置限时抢购课程属性","<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Course/KS.CosBatch.aspx?ContentID="+sid+"&costype=1",true,880,600);
        }
	</script>
    <div class="content-area mt20">
        <div class="tabs_header">
            <ul class="tabs">
                <li <%=KSCMS.S("costype")==""? " class='active'" : string.Empty %>><a href="KS.CosLimitBuyList.aspx">点播课程</a></li>
                <li <%=KSCMS.S("costype") == "5" ? " class='active'" : string.Empty %>><a href="KS.CosLimitBuyList.aspx?costype=5">直播课程</a></li>
            </ul>
        </div>
        <div class="quickSearch clearfix">
            
            <div class="longquickSearch">
                <div class="SearchBox fl">
                    <asp:DropDownList ID="DrpClassID" runat="server" onchange="location.href='?classid='+this.value;" style="width:130px;margin-right:8px;">
                        <asp:ListItem Value="0">--按分类查看--</asp:ListItem>
                    </asp:DropDownList>
                    <asp:DropDownList ID="Condition" runat="server" Style="margin-right:8px;">
                        <asp:ListItem Value="1">课程名称</asp:ListItem>
                        <asp:ListItem Value="2">发布者</asp:ListItem>
                        <asp:ListItem Value="3">名师</asp:ListItem>
                        <asp:ListItem Value="4">课程介绍</asp:ListItem>
                        <asp:ListItem Value="5">课程ID</asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox Style="color: #ccc"  CssClass="textbox" ID="TextBox1" runat="server" Width="180px"></asp:TextBox>
                    <b class="link-color" onclick="SetDate()">日期范围？</b>
                    <span id="showdate" <%if (this.TxtBeginDate.Text == ""){ %>
                        style="display: none" <%} %>>
                        <asp:TextBox ID="TxtBeginDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                       <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                    </span>
                    <asp:Button ID="Button1" runat="server" Text="搜索" CssClass="button" OnClick="Button1_Click" />
                </div>
                <div class="property">
                    <div class="name button ml15">筛选</div>
                    <div class="propertyBox">
                            <asp:CheckBoxList ID="Attribute" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" AutoPostBack="True" OnSelectedIndexChanged="Arrtibute_SelectedIndexChanged">
                                    <asp:ListItem Value="1">推荐</asp:ListItem>
                                    <asp:ListItem Value="2">精彩</asp:ListItem>
                                    <asp:ListItem Value="3">头条</asp:ListItem>
                                    <asp:ListItem Value="4">幻灯</asp:ListItem>
                                    <asp:ListItem Value="5">手机</asp:ListItem>
                                    <asp:ListItem Value="6">在售</asp:ListItem>
                                </asp:CheckBoxList>
                         <ul class="clearfix">
                                    <span class="screen fl">审核状态：</span>
                                    <li <%=KSCMS.S("status")=="2"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=2&flag=<%=flag %>&costype=<%=cosType%>"><span>未审核</span></a></li>
                                    <li <%=KSCMS.S("status")=="1"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=1&flag=<%=flag %>&costype=<%=cosType%>>"><span>已审核</span></a></li>
                          </ul>
                         <ul class="clearfix">
                           <span class="screen fl">抢购时间：</span>
                             <li <%=KSCMS.S("flag") == "1" ? " class='active'" : string.Empty %>><a href="KS.CosLimitBuyList.aspx?flag=1&status<%=status%>&costype=<%=cosType%>"><span>未到过期</span></a></li>
                             <li <%=KSCMS.S("flag") == "2" ? " class='active'" : string.Empty %>><a href="KS.CosLimitBuyList.aspx?flag=2&status<%=status%>&costype=<%=cosType%>"><span>已过期</span></a></li>
                          </ul>
                    </div>
                </div>
            </div>
            <div class="fr longliwrap"><a href="<%=cosType==5?"KS.CosLiveList.aspx":"KS.CosList.aspx"%>?action=add&Type=1" class="button button_on">添加课程</a></div>
        </div>
           <div class="listedit">
               <div class="floatLeft allCheck">
                <label><input type="checkbox"  name="chkall" id="chkall"  onclick="CheckAll(this.form);"/>全选</label>
            </div>
               <ul class="fl">
                   <asp:LinkButton ID="delclassbutton" runat="server" OnClientClick="return(GetIDS('del'));" OnClick="delclassbutton_Click" CssClass="button">删除</asp:LinkButton>
                   <asp:LinkButton ID="LinkButton10" runat="server" OnClick="LinkButton10_Click" OnClientClick="return(GetIDS());" CssClass="button">批量审核</asp:LinkButton>
                   <asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkButton11_Click" OnClientClick="return(GetIDS());" CssClass="button">批量取消审核</asp:LinkButton>
                   <asp:LinkButton ID="batchset" runat="server" CssClass="button">批量设置</asp:LinkButton>
                
            </ul>
                
          </div>
        <asp:Repeater ID="CourseRepeater" runat="server">
            <HeaderTemplate>
            <table width="99%" border="0" cellpadding="2" cellspacing="1" class="CTable">
                <tr align="center" class="CTitle">
                    <td width="5%"  height="40px" align="center">选择</td>
                    <td width="5%"  align="center"><b>课程封面</b></td>
                    <td width="20%" align="center"><b>限时抢购课程</b></td>
                    <td width="5%"  align="center"><b>课程原价</b></td>
                    <td width="6%"  align="center"><b>抢购价  </b></td>                   
                    <td width="12%"  align="center"><b>抢购时间段</b></td>
                    <td width="6%" align="center"><b>限购人数</b></td>
                    <td width="10%" align="center"><b>状态</b></td>
                    <td width="5%" align="center"><b>发布者</b></td>
                    <td width="10%"  align="center" nowrap><b>详情</b></td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tdbg">
                    <td align="center">
                        <input type="checkbox" name="ids" id="ids" value="<%# Eval("CourseID") %>" />
                    </td>
                    <td align="center">
                         <a href="<%# BaseFun.GetRewriteUrl("courseview",Utils.StrToInt(Eval("courseid").ToString()))%>" title="前台页" target="_blank"><img src="<%# Eval("photourl") %>" style="height: 66px; width: 80px;display: block;" onerror="this.src='/sysimg/nopic.gif'" /></a>
                    </td>
                    <td align="left"> <a href="<%# BaseFun.GetRewriteUrl("courseview",Utils.StrToInt(Eval("courseid").ToString()))%>" title="前台页" target="_blank"><%# Eval("Name") %><%# Convert.ToString(Eval("verify"))=="0"?"<font class='redFont'>（未审核）</font>":"<font class='greenFont'>（已审核）</font>" %></a></td>
                    <td align="center">¥<%# Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("Money").ToString()))%></td>
                    <td align="center">¥<%# Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("PanicMoney").ToString()))%> </td>

                   
                    <td align="center">开始时间：<%# (Utils.StrToDateTime(Eval("BeginTime")).ToString("yyyy-MM-dd HH:ss") + "<br>结束时间：" + Utils.StrToDateTime(Eval("EndTime")).ToString("yyyy-MM-dd HH:ss")) %> </td>
                    <td align="center"> <%# Eval("Limited") %></td>
                    <td align="center">
                        <%#DateTime.Compare(Utils.StrToDateTime(Eval("BeginTime").ToString()), DateTime.Now) > 0?"<font class='redFont'>未开始</font>":Utils.StrToDateTime(Eval("endTime").ToString()) < DateTime.Now?"<font class='grayFont'>已结束</font>":"<font class='greenFont'>进行中</font>" %>
                    </td>
                    <td align="center" class="num"><%# Eval("username") %> </td>
                   	<td align="center">
                        <a href="KS.CosLimitBuyList.aspx?action=order&p=<%=MyPage.CurrPage %>&courseid=<%#Eval("courseid") %>&costype=<%#cosType%>" class="greenFont">详情</a>&nbsp;&nbsp;&nbsp;
                        <a href="<%#cosType==5?"KS.CosLiveList.aspx":"KS.CosList.aspx"%>?action=modify&p=<%=MyPage.CurrPage %>&type=1&courseid=<%#Eval("courseid") %>" class="greenFont">编辑</a>&nbsp;&nbsp;&nbsp;
                        <a href="?action=del&p=<%=MyPage.CurrPage %>&Ids=<%#Eval("courseid") %>&costype=<%#cosType%>" onclick="return(confirm('此操作不可逆，确定删除操作吗?'))" class="greenFont">删除</a>
                   	</td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
            
                <tr class="tdbg" style="display: <%# bool.Parse((CourseRepeater.Items.Count==0).ToString())?"":"none"%>">
                    <td class="Ctd" style="text-align: center" colspan="10">
                        <div class="empty">没有任何抢购课程</div>
                    </td>
                </tr>
            </table>
            </FooterTemplate>
        </asp:Repeater>
          
         <asp:Label ID="LabPage" runat="server"></asp:Label>
    </div>
 
</asp:Panel>

<asp:Panel ID="DetailPanel" runat="server">
     <script>
    function SetDate2() {
    var today = new Date();
    if ($("#showdate2").is(":hidden")) {
        $("#showdate2").show();
        $('#<%=TxtBeginDate2.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                $('#<%=TxtEndDate2.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
            }
            else {
                $("#showdate2").hide();
                $('#<%=TxtBeginDate2.ClientID%>').val('');
        $('#<%=TxtEndDate2.ClientID%>').val('');
            }
         }

     </script>
   <div class="content-area mt20">
            <div class="myTitle">
                <font class="greenFont">限时抢购</font>&nbsp;/&nbsp;查看详情
            </div>
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
             
                        <asp:DropDownList ID="DrpPaymentPlat" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="-1">-选择支付方式-</asp:ListItem>
                            <asp:ListItem Value="0"> 余额支付</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="DropDownList3" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="0">订单来源</asp:ListItem>
                            <asp:ListItem Value="1">PC端</asp:ListItem>
                            <asp:ListItem Value="2">手机端</asp:ListItem>
                            <asp:ListItem Value="3">微信</asp:ListItem> 
                            <asp:ListItem Value="4">APP</asp:ListItem> 
                            <asp:ListItem Value="5">小程序</asp:ListItem> 
                        </asp:DropDownList>
                        <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="1">订单编号</asp:ListItem>
                            <asp:ListItem Value="2">购买学员</asp:ListItem>
                            <asp:ListItem Value="3">姓名</asp:ListItem>
                            <asp:ListItem Value="4">联系电话</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox  Style="color: #ccc"  CssClass="textbox" ID="TxtKey" runat="server" Width="180px"></asp:TextBox>
                        <b class="link-color" onclick="SetDate2()">日期范围？</b>
                        <span id="showdate2" <%if (this.TxtBeginDate2.Text == ""){ %> style="display: none" <%} %>>
                            <asp:TextBox ID="TxtBeginDate2" placeholder="格式：YYYY-MM-DD" Width="180px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                            <asp:TextBox ID="TxtEndDate2" placeholder="格式：YYYY-MM-DD" Width="180px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                        </span>
                        <asp:Button ID="Button2" runat="server" Text="开始搜索" CssClass="button" OnClick="Button2_Click" />
                 
            </div>
            <div class="property">
                <div class="name button ml15">筛选</div>
                <div class="propertyBox">
                	<ul class="clearfix">
                        <span class="screen fl">订单查看：</span>
                        <li <%=KSCMS.S("status")==""?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?action=order&courseid=<%=courseId %>"><span>所有订单</span></a></li>
                        <li <%=KSCMS.S("status")=="1"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=1&action=order&courseid=<%=courseId %>"><span>今日订单</span></a></li>
                        <li <%=KSCMS.S("status")=="2"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=2&action=order&courseid=<%=courseId %>"><span>已付款</span></a></li>
                        <li <%=KSCMS.S("status")=="3"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=3&action=order&courseid=<%=courseId %>"><span>未付款</span></a></li>
                        <li <%=KSCMS.S("status")=="4"?" class='active'":string.Empty %>><a href="KS.CosLimitBuyList.aspx?status=4&action=order&courseid=<%=courseId %>"><span>已关闭</span></a></li>
                    </ul>
                    
                </div>
            </div>
        </div>
        <asp:Repeater ID="Repeater2" runat="server" >
            <HeaderTemplate>
            <table width="99%" border="0" cellpadding="2" cellspacing="1" class="CTable">
                <tr align="center" class="CTitle">
                    <td align="center" width="8%"><b>下单时间</b></td>
                    <td width="8%"><b>订单编号</b></td>
                    <td width="6%"  align="center"><b>订单来源  </b></td>
                    <td width="7%"  align="center"><b>支付方式/类型</b></td>
                    <td width="8%" align="center"><b>购买学员</b></td>
                    <td width="8%" align="center"><b>实付价格</b></td>
                    <td width="6%"  align="center" nowrap><b>状态</b></td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tdbg">
                    
                    <td align="center">
                        <%# Eval("InputTime") %>
                    </td>
                     <td align="center">
                        <%# Eval("orderid") %>
                    </td>
                     <td align="center"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("OrderDevice"))) %> </td>
                    <td align="center">  <%#Kesion.Course.CourseOrderService.GetPayStatusType( Utils.StrToInt(Eval("paystatus")),Utils.StrToInt(Eval("PaymentPlatId").ToString()),Utils.StrToInt(Eval("id")),Eval("courseOrder").ToString())%></td>
                    <td align="center"><%# Eval("username") %> </td>
                  
                    <td align="center">
                         <%# Utils.StrToInt(Eval("scoretf").ToString())==0?Utils.StrToInt(Eval("orderscore").ToString())>0?Eval("orderscore").ToString()+"积分"+(Utils.StrToDecimal(Eval("OrderTotalPrice"))>0?@"+"+Public.ReturnShopPrice(Convert.ToString(Eval("OrderTotalPrice"))):""):""+"¥"+Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("OrderTotalPrice"))):Eval("orderscore").ToString()+"积分" %>
                        </td>
                    <td align="center">
                         <%#Kesion.Course.CourseOrderService.GetCosOrderStatus(Utils.StrToInt(Eval("Status")),Utils.StrToInt(Eval("DeliverStatus")),Utils.StrToInt(Eval("IsSendNote")),Utils.StrToInt(Eval("IsInvoice")) ) %>              
                      </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                
                <tr class="tdbg" style="display: <%# bool.Parse((Repeater2.Items.Count==0).ToString())?"":"none"%>">
                    <td class="Ctd" style="text-align: center" colspan="6">
                        <div class="empty">没有任何订单详情</div>
                    </td>
                </tr>
            </table>
            </FooterTemplate>
        </asp:Repeater>

      <asp:Label ID="LabPage2" runat="server"></asp:Label>
    </div>
</asp:Panel>
</asp:Content>
