<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_Orderlist, LebiMall" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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 id="Head1" runat="server">
    <title>订单管理</title>
     <link rel="stylesheet" type="text/css" href="css/css.css" media="screen"/>
    <script type="text/javascript" language="javascript" src="js/topHead.js"></script>
    <script src="js/checked.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        var page='<%=page %>';
        function onloadinit(){
            var state='<%=state %>';
            var lists=document.getElementById("select1");
            for(var i=0;i<lists.length;i++){
                if(state==lists[i].value){
                    lists[i].selected=true;
                    break;
                }
            }
            var tags='<%=tags %>';
            var list2=tags.split(',');
            for(i=0;i<list2.length;i++){
                if(list2[i]=="1"){
                    document.getElementById("ch1").checked=true;
                }
                if(list2[i]=="2"){
                    document.getElementById("ch2").checked=true;
                }
                if(list2[i]=="3"){
                    document.getElementById("ch3").checked=true;
                }
                if(list2[i]=="4"){
                    document.getElementById("ch4").checked=true;
                }
                if(list2[i]=="5"){
                    document.getElementById("ch5").checked=true;
                }
            }
            var cont='<%=cont %>';
            if(cont !=""){
                document.getElementById("txt_sel").value=cont;
            }
            var zt='<%=state %>';
            document.getElementById("li"+zt).className="current";
        }
        function dels(){
            var form =document.forms[0];
            var strid="";
            if (confirm("确认要删除？")) {
                for(i=0;i<form.elements.length;i++)
                {
                    if(form.elements[i].type=="checkbox")
                    {
                        if(form.elements[i].checked==true){
                            strid+=form.elements[i].value+",";
                        }
                    }
                }
                window.location.href="OrderFormDel.aspx?strid="+strid+"&page="+page;
            }
        }
        function chaxun(){
            var chlist=document.getElementsByName("ch_");
            var tags="";
            for(i=0;i<chlist.length;i++){
                if(chlist[i].checked){
                    tags+=chlist[i].value+",";
                }
            }
            var stime=escape(document.getElementById("txt_starttime").value);
            var etime=escape(document.getElementById("txt_endtime").value);
            var state=document.getElementById("select1").value;
            var cont=document.getElementById("txt_sel").value;
            window.location.href="Orderlist.aspx?state="+state+"&cont="+escape(cont)+"&tags="+escape(tags)+"&stime="+stime+"&etime="+etime+"&page=1";
        }
        
    </script>
</head>
<body onload="onloadinit()">
<form id="form1" runat="server">
        <script>header(3,0,"images/");</script>
        <div class="blank clearfix"></div>
        <div class="tabmenus mainwidth">
            <ul>
                <li id="li"><a href="Orderlist.aspx"><span>全部订单</span></a></li>
                <li id="li0"><a href="Orderlist.aspx?state=0"><span>未 付 款</span></a></li>
                <li id="li1"><a href="Orderlist.aspx?state=1"><span>未 发 货</span></a></li>
                <li id="li2"><a href="Orderlist.aspx?state=2"><span>已 发 货</span></a></li>
                <li id="li3"><a href="Orderlist.aspx?state=3"><span>已 收 货</span></a></li>
                <li id="li4"><a href="Orderlist.aspx?state=4"><span>已 归 档</span></a></li>
            </ul>
        </div>
        <div class="tab-mainbody">
            <div class="tab-mainbody2">
                <div class="functionHandleArea clearfix" style="padding:3px 0 3px 4px">
                 <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td style="width:250px">
                            <input type="checkbox" id="ch1"  name="ch_" value="1"><img src="images/mark/1.gif" title="" border="0" align="absmiddle" height="18">
                            <input type="checkbox" id="ch2"  name="ch_" value="2"><img src="images/mark/2.gif" title="" border="0" align="absmiddle" height="18">
                            <input type="checkbox" id="ch3"  name="ch_" value="3"><img src="images/mark/3.gif" title="" border="0" align="absmiddle" height="18">
                            <input type="checkbox" id="ch4"  name="ch_" value="4"><img src="images/mark/4.gif" title="" border="0" align="absmiddle" height="18">
                            <input type="checkbox" id="ch5"  name="ch_" value="5"><img src="images/mark/5.gif" title="" border="0" align="absmiddle" height="18">
                        </td>
                        <td style="width:100px">
                            <select name="orderzt" id="select1">
                                <option value="">┌ 状态</option>
                                <option value="0">├ 未付款</option>
                                <option value="1">├ 未发货</option>
                                <option value="2">├ 已发货</option>
                                <option value="3">├ 已收货</option>
                                <option value="4">├ 已归档</option>
                                <option value="9">├ 无效</option>
                            </select>
                        </td>
                        <td width="125px"><input type="text" id="txt_starttime"  runat=server class="texttime" style="width: 100px;"
                                onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" /></td>
                            <td width="5px">-</td>
                            <td width="130px"><input type="text" id="txt_endtime" runat=server class="texttime" style="width: 100px;" 
                                onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" /></td>
                        <td><input name="s_order_number" type="text" class="input" id="txt_sel"><input type="button" title="查询" class="btn-search" onclick="chaxun();">
                         </td>
                        <td style="text-align:right; padding-right:10px;">
                            <input type="image" src="images/bt_quick_back.gif"  alt=" 返回 " title=" 返回 " onclick="location.href='javascript:history.back()';return false;" align="absmiddle">
                        </td>
                    </tr>
                    <tr>
                        <td style="height:30px;">
                            <input type="image" title=" 删除 " onClick="dels();return false;" src="images/bt_delete.gif" align="absmiddle">
                        </td>
                    </tr>
                </table>
                </div>
                <div id="datalist">
                    <table cellspacing="0" border="0" id="list" style="width: 100%; border-collapse: collapse;">
                    <!-- table 导航 -->
                        <tr>
                            <th style="width: 5%; cursor: pointer;" title="全选" onclick="AllChecked()">
                                选择</th>
                            <th style="width: 5%">
                                备注</th>
                            <th style="width: 20%">
                                订单编号
                            </th>
                            <th style="width: 15%">
                                卖家
                            </th>
                            <th style="width: 15%">
                                购买人
                            </th>
                            <th style="width: 12%">
                                金额(元)
                            </th>
                            <th style="width: 10%">
                                支付方式
                            </th>
                            <th style="width: 12%">
                                订购日期
                            </th>
                            <th style="width: 6%">
                                状态
                            </th>
                        </tr>
                        <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++){%>
                        <tr>
                            <td>
                                <input type="checkbox" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                                <input type="hidden" id="hidden_id<%=i %>" name="hidden_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                            </td>
                            <td>
                            <%if (ds.Tables[0].Rows[i]["Otag"].ToString() != "0"){%>
                                <img title="<%=ds.Tables[0].Rows[i]["Otagc"] %>" alt="<%=ds.Tables[0].Rows[i]["Otagc"] %>" src="images/mark/<%=ds.Tables[0].Rows[i]["Otag"] %>.gif" /><%} else{%>&nbsp;<%} %>
                            </td>
                            <td>
                                <a href="orderDetail.aspx?id=<%=ds.Tables[0].Rows[i]["id"] %>"><%=ds.Tables[0].Rows[i]["OCode"] %></a> 
                            </td>
                            <td>
                               <%=ds.Tables[0].Rows[i]["t_name"] %>
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["f_name"] %>
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["zsum"] %>
                            </td>
                            <td>
                                <%if(ds.Tables[0].Rows[i]["ptw"].ToString()=="1"){ %>
                                    在线支付
                                <%}else if(ds.Tables[0].Rows[i]["ptw"].ToString()=="2"){ %>
                                    货到付款
                                <%}else{ %>
                                    银行汇款
                                <%} %>
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["submittime"] %>
                            </td>
                            <td>
                                <%if(ds.Tables[0].Rows[i]["ostate"].ToString()=="0"){ %>
                                    未付款
                                <%}else if (ds.Tables[0].Rows[i]["ostate"].ToString() == "1"){ %>
                                    未发货
                                <%}else if (ds.Tables[0].Rows[i]["ostate"].ToString() == "2"){  %>
                                    已发货
                                <%}else if (ds.Tables[0].Rows[i]["ostate"].ToString() == "3"){  %>
                                    已收货
                                <%} else if (ds.Tables[0].Rows[i]["ostate"].ToString() == "4"){%>
                                    无效订单
                                <%} %>
                            </td>
                        </tr>
                        <%} %>
                        <tr>
                            <td class="list-foot" colspan="9">
                                <div style="float: left; padding-top: 3px;">
                                </div>
                                <div id="divAsp" runat="server" style="float: right; padding-top: 3px;">
                                    <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                                        runat="server" RecordCount="228" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                                        PrevPageText="上一页" PageSize="20" UrlPaging="True" CustomInfoClass="pages1" CurrentPageButtonPosition="Center" ShowBoxThreshold="50"
                                        ShowFirstLast="true" NumericButtonCount="4" BackColor="Transparent" ShowDisabledButtons="False" EnableViewState="False">
                                    </webdiyer:AspNetPager>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <script type="text/javascript">tdshowm("list");</script>
                </div>
            </div>
        </div>
        </form>
</body>
</html>
