<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_Commodity_List, 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 href="css/css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/checked.js"></script>
        <script type="text/javascript" src="js/ryjs.js"></script>
    <script type="text/javascript" src="js/js_link.js"></script>
    <script type="text/javascript" src="js/MyCalendar.js"></script>
    <script type="text/javascript" src="../images/js/My97DatePicker/WdatePicker.js"></script>
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/topHead.js" type="text/javascript"></script>
    <script type="text/javascript">
         function toupProduct(){
             GetCheckedBoxall();
             document.getElementById("CheckedIDS").value = document.getElementById("CheckedIDS").value.replace('0,','');
             var type = "";
             for(var i=0;i<document.getElementsByName("uptype").length ;i++){
                  if(document.getElementsByName("uptype")[i].checked){
                      type = document.getElementsByName("uptype")[i].value;
                  }
             }
             if(document.getElementById("CheckedIDS").value=="0"){
                   alert("请选择一条数据");
                   return;
             }
             document.getElementById("typeId").value = type;
             document.getElementById("btnSub").click();
         }
         
         function up_Sj(id,value){
            document.getElementById("CheckedIDS").value = id+","+value;
            document.getElementById("btnSj").click();
         }
         
         function select(){
            document.getElementById("btnSou").click();
         }
         
         function up_tj(id,value){
              document.getElementById("CheckedIDS").value = id+","+value;
              document.getElementById("btnTj").click();
         }
         
         function  del(id){
            document.getElementById("CheckedIDS").value = id;
            if(confirm("确定要删除吗？")){
                document.getElementById("btnDel").click();
            } 
         }
         
         function dels(){
            GetCheckedBoxall();
            if(confirm("确定要删除吗？")){
                document.getElementById("btnDel").click();
            }
         }
         
         function update(id){
             window.location.href="Commodity_up.aspx?id="+id;
         }
         
         function keydown(id){
            document.getElementById(id).value="";
         }
    </script>
      <style type="text/css">
      .form_Calendar1{border: 1px #e5e5e5 solid; height:18px; font-size:12px; background:url(../images/calendar.png) no-repeat 1px 1px; padding-left:20px;}
      </style>
</head>
<body>
    <div id="dhtmltooltip">
        <img src=""></div>
    <script type="text/javascript" language="javascript" src="js/js_link.js"></script>
    <form id="form1" runat="server">
           <script>header(2,0,"images/");</script>
    <!--面包屑-->
    <div class="blank clearfix"></div>
    
    <!--功能区-->
   <div class="tabmenus mainwidth">
            <ul>
                <li class="current"><a href="Commodity_List.aspx"><span>商品管理</span></a></li>
                <li><a href="Commodity_Add.aspx"><span>商品添加</span></a></li>
                <li><a href="Commodity_sort.aspx"><span>商品推荐</span></a></li>
                <li><a href="Commodity_Search.aspx"><span>商品高级搜索</span></a></li>
            </ul>
        </div>
    <div class="tab-mainbody">
        <div class="tab-mainbody2">
        <div class="functionHandleArea clearfix" style="padding:3px 4px 3px 4px; left: 0px; top: 0px;">
            <div style="float: left;">
             <table cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                <select name="zhuangtai" id="zhuangtai" runat="server" align="absmiddle">
                    <option value="" selected>┌ 状态</option>
                    <option value="0">├ 下架</option>
                    <option value="1">├ 上架</option>
                </select>
                <select name="tuijian" id="tuijian" runat="server" align="absmiddle">
                    <option value="" selected>┌推荐状态</option>
                    <option value="0">├ 无推荐</option>
                    <option value="1">├ 推荐中</option>
                </select>
                <input type="text" name="dateFrom" id="dateFrom" runat="server" size="12" class="texttime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" onkeydown="quickQueryCust(event);"/>
                -
                <input type="text" name="dateTo" id="dateTo" runat="server" size="12" class="texttime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" onkeydown="quickQueryCust(event);"/>
                <input name="keyword" type="text" id="keyword" runat="server" class="input" style="width: 150px;" onkeydown="quickQueryCust(event);"/><input type="button" title=" 查询 " class="btn-search" value=""  onclick="location.href='javascript:select()';return false;" align="absmiddle" />
                </td>
                </tr> 
                <tr>
                    <td colspan="6" style="height:30px;"> 
                <input type="image" title=" 保存 " onclick="javascript:toupProduct();return false;" src="images/bt_app.gif" align="absmiddle">
                <input type="image" name="Submit" title=" 删除 " onclick="dels();return false;" src="images/bt_delete.gif" align="absmiddle">
                <span id="msg_sub" class="title_r"></span>
                <script type="text/javascript">
                    var i = 2;
                    var f="<%=Session["returnValue"] %>";
                     if(f=="true"){
                        tipswindown('操作结果','text:操作成功！','250','60','true','2000','true','text');
                        <% Session["returnvalue"]= null; %>
                        setinterval("fun()", 1000);
                    }
                    if(f=="false"){
                        tipswindown('操作结果','text:操作失败！','250','60','true','2000','true','text');
                        <% Session["returnvalue"]= null; %>
                    }
                    function fun() {
                        if (i == 1) {
                            document.getElementById("msg_sub").style.visibility="hidden";
                        }
                        i--;
                    }
                </script>
                </td></tr>
                </table>
            </div>
            <div style="float: right;">
                 <select name="anclassid" id="anclassid" runat="server" onchange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }">
                    <option selected="selected" value="?">┌ 浏览方式</option>
                    <option value="?vtype=1">├ 全部商品</option>
                    <option value="?vtype=3">├ 浏览排行</option>
                    <option value="?vtype=4">├ 销量排行</option>
                    <option value="?vtype=5">├ 日期排行</option>
                </select>
                <input type="image" src="images/bt_quick_back.gif" alt=" 返回 " title=" 返回 " onclick="location.href='javascript:history.back()';return false;" align="absmiddle">
            </div>
            <div class="both"></div>
        </div>
        <div id="datalist">
                <table cellpadding="0" cellspacing="0" width="100%" id="list">
                    <tr>
                        <th style="width: 6%; cursor: pointer;" title="全选" onclick="AllChecked()">
                            选择
                        </th>
                        <th style="width: 6%">
                            图片
                        </th>
                        <th style="width: 24%">
                            商品名称</th>
                        <th style="width: 11%">
                            商城价格</th>
                        <th style="width: 8%">
                            库存</th>
                        <th style="width: 8%">
                            推荐</th>
                        <th style="width: 10%">
                            销量</th>
                        <th style="width: 10%">
                            浏览量</th>
                        <th style="width: 6%">
                            状态</th>
                        <th style="width: 14%">
                            操作
                        </th>
                    </tr>
                    <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                      {
                    %>
                    <tr>
                        <td >
                            <input type="checkbox" name="checkbox" id="<%=ds.Tables[0].Rows[i]["id"] %>" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                            <input type="hidden" id="txt_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                        </td>
                        <td >
                            <%if (ds.Tables[0].Rows[i]["cmin_img"].ToString() != "")
                              { %>
                            <img src="../images/kind-pic001.jpg" align='absmiddle' onmouseover="javascript:ddrivetip('<div class=hideimg><img src=../Upload/commodity/<%=ds.Tables[0].Rows[i]["cmin_img"].ToString() %>></div>', '#ffffff', '150')"
                                onmouseout="hideddrivetip()" /><%} %></td>
                        <td >
                            <%=ds.Tables[0].Rows[i]["cname"] %>
                        </td>
                        <td >
                            ￥
                            <%=ds.Tables[0].Rows[i]["Cprice"] %>
                        </td>
                        <td >
                            <%=ds.Tables[0].Rows[i]["Cnum"] %>
                        </td>
                        <td >
                            <div id="Div3" title="点击更改属性">
                                <% if (ds.Tables[0].Rows[i]["Crecommend"].ToString() == "1")
                                   {%>
                                <a href="javascript:up_tj(<%=ds.Tables[0].Rows[i]["id"] %>,0);"><font color="red">√</font></a><%}
                                else
                                { %><a href="javascript:up_tj(<%=ds.Tables[0].Rows[i]["id"] %>,1);">×</a><%} %>
                            </div>
                        </td>
                        <td >
                            <div style="position:relative; border:1px solid #ccc; width:88px; height:10px; overflow:hidden" title="销量： <%=ds.Tables[0].Rows[i]["CSales_num"] %>">
                                <div style="background:url(images/bar.gif); width:1px; height:10px" width="<%=(int.Parse(ds.Tables[0].Rows[i]["CSales_num"].ToString()))/5 %>"
                                     alt="销量： <%=ds.Tables[0].Rows[i]["CSales_num"] %>" ></div>
                        </td>
                        <td >
                            <div style="position:relative; border:1px solid #ccc; width:88px; height:10px; overflow:hidden" title="浏览量： <%=ds.Tables[0].Rows[i]["Cclicknum"] %>">
                                <div style="background:url(images/bar1.gif); width:1px; height:10px" width="<%=(int.Parse(ds.Tables[0].Rows[i]["Cclicknum"].ToString()))/20 %> "
                                    alt="浏览： <%=ds.Tables[0].Rows[i]["Cclicknum"]%> "></div>
                        </td>
                        <td >
                            <div id="shelve" title="点击更改属性">
                                <% if (ds.Tables[0].Rows[i]["Cshelve"].ToString() == "0")
                                   {%>
                                <a href="javascript:up_Sj(<%=ds.Tables[0].Rows[i]["id"] %>,1);">下架</a><%}
                                                                                                        else
                                                                                                        { %><a href="javascript:up_Sj(<%=ds.Tables[0].Rows[i]["id"] %>,0);">上架</a><%} %>
                            </div>
                        </td>
                        <td >
                            <a href="javascript:update(<%=ds.Tables[0].Rows[i]["id"] %>)">编辑</a>&nbsp;|&nbsp;<a
                                href="javascript:del(<%=ds.Tables[0].Rows[i]["id"] %>)">删除</a>
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td height="30" align="left" class="list-foot" colspan="5">
                            &nbsp; 操作：<input type="radio" name="uptype" value="2" checked>
                            上架
                            <input type="radio" name="uptype" value="1">
                            下架
                            <input type="radio" name="uptype" value="4">
                            推荐
                            <input type="radio" name="uptype" value="3">
                            撤销推荐 &nbsp;
                            <input type="image" border="0" title=" 提交 " onclick="location.href='javascript:toupProduct();';return false;"
                                src="images/bt_app.gif" align="absmiddle">
                            <!--传递给js-->
                            <input type="hidden" name="js_sort_id" value="0">
                            <input type="hidden" name="page" value="1">
                            <input type="hidden" name="vtype" value="">
                            <input type="hidden" name="zhuangtai" value="">
                            <input type="hidden" name="Lang" value="">
                        </td>
                        <td colspan="6" class="list-foot">
                            <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="15" 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 id="Div1" runat="server" style="display: none">
                <input type="hidden" id="CheckedIDS" runat="server" />
                <input type="hidden" id="typeId" runat="server" />
                <input type="hidden" id="souValue" runat="server" />
                <input type="button" id="btnSub" style="display: none;" runat="server" onserverclick="btnSub_ServerClick" />
                <input type="button" id="btnSou" style="display: none;" runat="server" onserverclick="btnSou_ServerClick" />
                <input type="button" id="btnSj" style="display: none;" runat="server" onserverclick="btnSj_ServerClick" />
                <input type="button" id="btnTj" style="display: none;" runat="server" onserverclick="btnTj_ServerClick" />
                <input type="button" id="btnDel" style="display: none;" runat="server" onserverclick="btnDel_ServerClick" />
            </div></div>
        </div>
    </form>
</body>
</html>
