<%@ Page language="c#" Codebehind="MyOrders.aspx.cs" AutoEventWireup="true" Inherits="XpShop.WebUI.MyOrders" %>
<%@ Register TagPrefix="uc1" TagName="MemberMenu" Src="Modules/MemberMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ 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>
	<HEAD>
		<!--#include file="../../inc/encoding.inc"-->
		<title><%=GetResourceString("MyOrders")%>,<%=config.SiteTitle%></title>
		<!--#include file="../../inc/head.inc"-->
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/member.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript">
		    $(document).ready(function(){
		        //确认已签收
                $('[@orderID]').click(function(){
                    var objbtn = $(this);
                    var orderID = objbtn.attr('orderID');
                    if(confirm('如果您已经收到货物，请点击"确认"，否则点击"取消"')){
                        $.ajax({
                            url:'ajax.aspx?NocopyRight=1&type=ConfirmReceived',
                            data:'orderID='+ orderID,
                            type:'post',
                            cache:false,
                            success:function(msg){
                                switch(msg){
                                    case 'NOLOGIN':
                                        alert('请先登陆！');window.location.href = window.location.href;
                                        break;
                                    case '1':
                                        alert('操作失败');
                                        break;
                                    case '0':
                                        alert('操作成功');
                                        objbtn.parent().html('[已签收]');
                                        break;                            
                                }
                            },
                            error:function(){alert('error');}
                        });//end ajax
                    };//end if
                });
                var keyword2 = '<%=Server.UrlDecode(Request.QueryString["keyword2"])%>';
                var status='<%=Request.QueryString["status"]%>';
	                if(keyword2!= '')
	                {
		                $("#keyword").val(keyword2);
	                }
	                if(status!=''){
	                    $("#status").val(status);
	                }

	                $("#btnSearch").click(function(){
                        window.location.href="/<%=ShopFolder%>MyOrders.aspx?keyword2=" + $('#keyword').val() + "&status=" + $('#status').val()
	                });
		    });
		</script>
	</HEAD>
	<body>
		<uc1:Header id="Header1" runat="server"></uc1:Header>
		<div class="xp-qgw clear">
			<!--位置导航开始-->
			<div class="path"><a href="<%=webSite %><%if(config.html==""){%>default.<%=config.html%><%}else{%>Index.<%=config.html%><%}%>"><%=GetResourceString("Home")%></a>&nbsp;&gt;&nbsp;<a href="<%=webSite %>Center.<%=config.html %>"><%=GetResourceString("MemberCenter")%></a>&nbsp;&gt;&nbsp;<%=GetResourceString("MyOrders")%></div>
			<!--位置导航结束-->
			<div class="member_left">
				<!--会员中心导航开始-->
				<uc1:MemberMenu id="MemberMenu1" runat="server"></uc1:MemberMenu>
				<!--会员中心导航结束-->
				<!--订单反馈开始-->
				<div class="lframe" style=" display:none;">
					<div class="tl"></div>
					<div class="tr"></div>
					<div class="tm">
					    <%=GetResourceString("OrderFeedback")%>
				    </div>
					<div class="ml"></div>
					<div class="mr"></div>
					<div class="mm">
				        <%=GetFeedback()%>
					</div>
				    <div class="bl"></div>
				    <div class="br"></div>
				    <div class="bm"></div>
				</div>
				<!--订单反馈结束-->
			</div>
			<div class="member_middle_right">
				<!--内容开始-->
				    <div class="mframe">
				        <div class="tl"></div>
				        <div class="tr"></div>
				        <div class="tm"><%=GetResourceString("MyOrders")%></div>
				        <div class="ml"></div>
				        <div class="mr"></div>
				        <div class="mm">
				            <form id="Form1" method="post" runat="server">
                            <div class="page" style="margin-bottom:10px">
                                <div class="fr" style="float:right">
                                    <select name="status" id="status">
	                                    <option selected="selected" value="-1">全部</option>
	                                    <%--<option value="0">等待付款</option>--%>
	                                    <option value="1">未完成</option>
	                                    <option value="2">已完成</option>
	                                    <option value="3">已取消</option>
	                                    <option value="4">已失败</option>
                                    </select>
                                    <input  type=text id="keyword" name="keyword" />
                                    <input type=button ID="btnSearch" value="查询"/>
                                    
                                </div>
                                <div class="clear"></div>
                            </div>
                            
					        <asp:datagrid id="dgOrderList" CssClass="dgborder" runat="server"
						    AutoGenerateColumns="False" DataKeyField="OrderID" Width="100%" HorizontalAlign="Center" BorderWidth="1"
						    BorderColor="#d6d6d6">
						    <ItemStyle BackColor="White"></ItemStyle>
			                <HeaderStyle BackColor="#fff7d3" Height="20px"></HeaderStyle>
						    <Columns>
							    <asp:TemplateColumn HeaderText="订单编号">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Left" Width="15%" Height="20px"></ItemStyle>
								    <ItemTemplate>
									    <a href="<%=webSite %>OrderDetail-<%# DataBinder.Eval(Container.DataItem, "OrderID") %>.<%=config.html%>" style="padding-left:5px;">
										    <%# DataBinder.Eval(Container.DataItem, "OrderNo") %>
									    </a>
								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:BoundColumn DataField="OrderTime" HeaderText="下单时间" DataFormatString="{0:yyyy-MM-dd}">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Center" Width="15%"></ItemStyle>
							    </asp:BoundColumn>
							    <asp:TemplateColumn HeaderText="订单金额">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Right" Width="10%"></ItemStyle>
								    <ItemTemplate>
									    ￥<%# DataBinder.Eval(Container.DataItem, "TotalPrice","{0:f}") %>
								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="还需支付金额">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Right" Width="10%"></ItemStyle>
								    <ItemTemplate>
									    <font color="Tomato">
										    ￥<%# DataBinder.Eval(Container.DataItem, "NeedPayMoney", "{0:f}")%>
									    </font>
								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="订单状态">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Center" Width="15%"></ItemStyle>
								    <ItemTemplate>
									    <%# GetStatus(DataBinder.Eval(Container.DataItem, "OrderID").ToString(), DataBinder.Eval(Container.DataItem, "PayType").ToString(), (int)DataBinder.Eval(Container.DataItem, "PaymentType"), DataBinder.Eval(Container.DataItem, "Status").ToString())%>
									    <%# DataBinder.Eval(Container.DataItem, "Status").ToString() == "6" ? ("<input type='button' value='签收' orderID='" + DataBinder.Eval(Container.DataItem, "OrderID") + "' />") : ""%>
								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="操作">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Center" Width="15%"></ItemStyle>
								    <ItemTemplate>
									    <a href="<%=webSite %>OrderDetail-<%# DataBinder.Eval(Container.DataItem, "OrderID") %>.<%=config.html%>">
										    <%=GetResourceString("ViewOrder")%></a> <%--<a href='<%=webSite %>OrderFeedback.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "OrderID") %>&type=1'>
										    <%=GetResourceString("LeaveWord")%></a> <a href='<%=webSite %>OrderFeedback.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "OrderID") %>&type=2'>
										    <%=GetResourceString("Cancel")%></a>--%>
								    </ItemTemplate>
							    </asp:TemplateColumn>
<%--							    <asp:TemplateColumn HeaderText="是否评价商家">
								    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
								    <ItemStyle HorizontalAlign="Center" Width="15%"></ItemStyle>
								    <ItemTemplate>
									    <%# GetShopEvalLink(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "OrderID")),Convert.ToInt32(DataBinder.Eval(Container.DataItem, "SupplierID")))%>
								    </ItemTemplate>
							    </asp:TemplateColumn>--%>						    
						    </Columns>
					    </asp:datagrid>
					    
				        <asp:panel id="plPage" visible="true" runat="server">
				        <!-- 翻页开始-->
				        <div class="page clear">
                            <div class="fpage">
                                <asp:Label ID="lbPage" class="lb-page" runat="server"></asp:Label>
                            </div>                                
				        </div>
				        <!-- 翻页结束-->
				        </asp:panel>
        				
				        <asp:panel id="plNoProduct" visible="false" runat="server">
					        <div style="margin:20px;">
						        <h3>暂无订单</h3>
					        </div>
				        </asp:panel>
				        </form>
					        <script language="javascript">
	                        function printOrder(oid)
	                        {
		                        temp=window.open('<%=webSite %>OrderPrint.aspx?OrderID='+oid+'&NoCopyright=1','shopcat','width=700,height=850,scrollbars=yes,resizable=yes');
		                        temp.focus();
	                        }
					        </script>
				        </div>
				        <div class="bl"></div>
				        <div class="br"></div>
				        <div class="bm"></div>
				    </div>
				<!--内容结束-->
			</div>
		</div>
		<uc1:Helper id="Helper1" runat="server"></uc1:Helper>
		<uc1:Footer id="Footer1" runat="server"></uc1:Footer>
	</body>
</HTML>
