<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductList.aspx.cs" Inherits="XpShop.Supplier.ProductList" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="SupplierMenu" Src="Modules/SupplierMenu.ascx" %>
<%@	Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox"	%>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<!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>
		<!--#include file="inc/head.inc"-->
		<title>商家中心 <%=config.SiteTitle%></title>
        <script type="text/javascript" src="inc/OrderPayList.js"></script>
        <script src="/supplier/inc/jquery.cookie.js" type="text/javascript"></script>
        <script type="text/javascript" src="inc/commond.js"></script>
		<script src="inc/ui.datepicker.cn.js" type="text/javascript"></script>
		<link type="text/css" rel="stylesheet" href="style/ui.datepicker.css" />
		
		<script type="text/javascript">
            $(document).ready(function() {
                //当按下编辑链接时，纪录下地址栏的值，当编辑完后要返回这个地地址
                $('.pid').click(function(){
                    var src = window.location.href; 
                    $.cookie('url', src);
                });
                
                $("#txtStartTime").datepicker().click(function(){$(this).blur()});
                $("#txtEndTime").datepicker().click(function(){$(this).blur()});
                
                $("#btnReset").click(function(){
                    var len = document.Form1.elements.length;
                    for(i = 0 ; i < len ; i++){
                      if(document.Form1.elements[i].type == 'text'){
                        document.Form1.elements[i].value = '';
                      }else if(document.Form1.elements[i].type == 'select-one'){
                        document.Form1.elements[i].options[0].selected=true;
                      }
                    }
                    return false;
                  })
                  
                $('.btnDelete').click(function(){
                    if(confirm('确定要删除该商品吗?')){
                        return true;
                    }
                    else{
                        return false;
                    }
                });
                
                //全选
                $('input[name=chkAll]').click(function(){
                    $('input[name=chkItem]').attr('checked',$(this).attr('checked'));
                });
               
                //给跳转按钮绑定onclick事件
	            $("#go").bind("click",function(){
		            var pageNum = $("#gopage").val();
		            var totalpage =  parseInt($("#totalpage").text());
		            if(pageNum.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "") != "" ){
                        if(pageNum != "0"& !isNaN(parseInt(pageNum,10))){
                            if(pageNum > totalpage){
                                alert("输入的数字大于总页数");
                                $("#gopage").attr("value","");
                                return false;
                            }
                        }
                        else{  
                            alert("输入错误！");
                            $("#gopage").attr("value","");
                            return false;
                        }
                    }
                    else{
                        alert("请输入要跳转到的页面");
                        $("#gopage").attr("value","");
                        return false;
                    }
	            });
            });
        </script>
	</head>
	<body>
			<uc1:Header id="Header1" runat="server"></uc1:Header>
			 <!--位置导航开始-->
			 <div class="path"><a href="<%=webSite %>supplier/default.<%=config.html%>">商家桌面</a> > 商品管理 > 查询与编辑</div>
			<!--位置导航结束-->
			<div class="xp-w clear">
				<div class="content-left">
					<!--会员中心导航开始-->
					<uc1:SupplierMenu id="SupplierMenu1" runat="server"></uc1:SupplierMenu>
					<!--会员中心导航结束-->
				</div>
				<div class="content-middle">	
					<%--<h3>欢迎您,<%=CurrentSupplier.RealName%></h3>
					<hr class="itemhr" />--%>
				    <div class="rframe">
				        <div class="tm">查询与编辑</div>
				        <div class="mm clear" style="padding:15px 5px;">
				            <form id="Form1" runat="server" >
						        <input type=hidden name=url id=url />
                                    <table>
                                        <tr>
	                                        <td class="right" width="100">商品编号：</td>
	                                        <td width="200">
	                                        <asp:TextBox ID="txtPdtID" runat="server" ></asp:TextBox>
	                                        </td>
	                                        <td class="right" width="100">商品名称：</td>
	                                        <td width="200">
	                                        <asp:TextBox ID="txtPdtName" runat="server" ></asp:TextBox>
	                                        </td>
                                        </tr>
                                        <tr>
	                                        <td class="right" width="100">品牌：</td>
	                                        <td width="200">
	                                        <asp:TextBox ID="txtBrand" runat="server" ></asp:TextBox>
	                                        </td>
                                            <td class="right">店内分类：</td>
	                                        <td>
	                                            <asp:DropDownList ID="ddlSubCategory" runat=server>
	                                            </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
	                                        <td class="right" width="100">商品状态：</td>
                                            <td>
                                                <asp:DropDownList ID="ddlStatus" runat=server>
                                	                <asp:ListItem Value="9999">全部</asp:ListItem>
                                                    <%--<asp:ListItem Value=-1>已删除</asp:ListItem>--%>
                                                    <asp:ListItem Value=1>上架</asp:ListItem>
                                                    <asp:ListItem Value=0>下架</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                            <td class="right">审核状态：</td>
	                                        <td>
	                                            <asp:DropDownList ID="ddlVerify" runat=server>
	                                	            <asp:ListItem Value="9999">全部</asp:ListItem>
                                                    <asp:ListItem Value=0>待审核</asp:ListItem>
                                                    <asp:ListItem Value=1>已审核</asp:ListItem>
                                                    <asp:ListItem Value=-1>审核未通过</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                </table>
                                <hr class="itemhr" />
                                <div style="float:right ;padding:5px 0px">
                                <input type=hidden  id=hidePage value=""/>
                                <asp:Button  id="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" ></asp:Button>&nbsp;&nbsp;
                                <asp:Button  id="btnReset" runat="server" Text="重置" ></asp:Button>&nbsp;&nbsp;
                                </div>
                                <div style="clear:right"></div>
                              
						        <div class="pro_hlist">
							        <asp:DataList id="dlProducts" CellPadding="4" RepeatColumns="1" 
                                        RepeatDirection="Horizontal" Width="100%" runat="server" ForeColor="#333333">
								        <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                        <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
								        <HeaderTemplate>								
                                            <ItemTemplate>													
									            <table cellpadding="3" cellspacing="0" width="100%">
										            <tr>
                                                        <td width="3%">
                                                        <input type=checkbox id="checkbox" name="chkAll" />
                                                        </td>
											            <td width="6%" align="center">
                                                            商品编号
											            </td>
                                                        <td width="10%" align="center">
                                                            缩略图
											            </td>
                                                        <td width="10%">
                                                            商品名称
											            </td>
                                                        <td width="5%">
                                                            品牌
											            </td>										
                                                        <td width="5%">
                                                            型号/货号
											            </td>
                                                        <td width="10%">
                                                            商品价格
											            </td>
                                                        <td width="5%">
                                                            库存数量
											            </td>
                                                        <td width="10%">
                                                            店内分类
											            </td>										
                                                        <td width="8%">
                                                            商品状态
											            </td>
                                                        <td width="8%">
                                                            审核状态
											            </td>
                                                        <td width="10%">
                                                            最后修改时间
											            </td>
                                                        <td width="5%">
                                                            编辑
											            </td>
											            <td width="5%">
                                                            删除
											            </td>
										            </tr>
									            </table>
								            </ItemTemplate>								
								        </HeaderTemplate>
								        <ItemTemplate>													
									        <table cellpadding="3" cellspacing="0" width="100%">
										        <tr>
                                                    <td width="3%">
                                                        <input type=checkbox value="<%#DataBinder.Eval(Container.DataItem, "ProductID")%> "name="chkItem" />
                                                    </td>
										            <td width="6%">
                                                        <%#DataBinder.Eval(Container.DataItem, "ProductNo")%> 
										            </td>
                                                    <td width="10%">
		                                                <img height="53" width="70"  src="<%=webSite %>upload/ProductImg/<%# DataBinder.Eval(Container.DataItem,"ImgFolder")%><%#DataBinder.Eval(Container.DataItem,"ThumbnailImg")%>" />
										            </td>
                                                    <td width="10%">
                                                        <a href='<%=webSite %>products/product-<%#DataBinder.Eval(Container.DataItem,"ProductID")%>.<%=config.html%>'target="_blank"><%#DataBinder.Eval(Container.DataItem, "ProductName")%></a>
										            </td>
                                                    <td width="5%">
                                                        <%#DataBinder.Eval(Container.DataItem, "BrandName")%> 
										            </td>										
                                                    <td width="5%">
										            </td>
                                                    <td width="10%">
                                                        <%#DataBinder.Eval(Container.DataItem, "MemberPrice")%> 
										            </td>
                                                    <td width="5%">
                                                        <%#DataBinder.Eval(Container.DataItem, "Storage")%> 
										            </td>
                                                    <td width="10%">
                                                        <%#DataBinder.Eval(Container.DataItem, "Cname")%> 
										            </td>										
                                                    <td width="8%">
                                                        <%# DataBinder.Eval(Container.DataItem, "IsForSale").ToString() == "0" ? "下架" : "上架"%> 
										            </td>
                                                    <td width="8%">
                                                        <%# DataBinder.Eval(Container.DataItem, "status").ToString() == "0" ? "待审核" : (DataBinder.Eval(Container.DataItem, "status").ToString() == "1" ? "审核通过" : "审核未通过")%> 
										            </td>
                                                    <td width="10%">
										            </td>
                                                    <td width="5%">
                                                        <a  class=pid href='store_product_add2.aspx?pid=<%#DataBinder.Eval(Container.DataItem, "ProductID")%>'>编辑</a>
										            </td>
                                                    <td width="5%">
                                                        <a  class="btnDelete" href='ProductList.aspx?action=del&pid=<%#DataBinder.Eval(Container.DataItem, "ProductID")%>'>删除</a>
										            </td>
										        </tr>
									        </table>
								        </ItemTemplate>
							        </asp:DataList>
				                    <asp:panel id="plPage" visible="true" runat="server">
				                    <!-- 翻页开始-->
				                    <div class="page clear">
					                    <div class="fpage1">
                                            <asp:Label ID="lblPagerInfo" runat="server"></asp:Label>

                                            <asp:textbox id="gopage"  runat="server" class="gopage" size="1" />
                                            <asp:button id="go" runat="server" text="Go" class="go" onclick="go_Click" />
                                        </div>
                                        <div class="fpage2">
                                            <span class="prepage"></span>
                                            <asp:Label ID="lbPage" runat="server"></asp:Label>
                                            <span class="nextpage"></span>
                                        </div>                                
				                    </div>
				                    <!-- 翻页结束-->
				                    </asp:panel>
				                    <asp:panel id="plNoProduct" visible="false" runat="server">
					                    <div style="margin:20px;">
						                    <h3>抱歉，没有找到符合条件的商品！</h3>
					                    </div>
				                    </asp:panel>
						        </div>
				            </form>
				        </div>
				    </div>
			    </div>
			</div>
		<uc1:Helper id="Helper" runat="server"></uc1:Helper>
		<uc1:Footer id="Footer" runat="server"></uc1:Footer>
	</body>
</html>