<%@ Page language="c#" Codebehind="OrderDetail.aspx.cs" AutoEventWireup="true" Inherits="XpShop.WebUI.OrderDetail" %>
<%@ Register TagPrefix="cc1" Namespace="PayPal.Web.Controls" Assembly="PayPal.Web.Controls" %>
<%@ Register TagPrefix="uc1" TagName="MemberMenu" Src="Modules/MemberMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="MemberHelper" Src="Modules/MemberHelper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="memberfooter" Src="Modules/memberfooter.ascx" %>
<%@ Import Namespace="System.Data"%>
<!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/encoding.inc"-->
		<title>订单信息</title>
		<!--#include file="../../inc/head.inc"-->
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/pop.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src='<%=webSite %>Template/<%=config.TemplateFolder%>/inc/OrderDetail.js'></script>
		<script src="<%=webSite %>Template/<%=config.TemplateFolder%>/inc/jquery.easydrag.handler.beta2.js" type="text/javascript"></script>
		<script src="<%=webSite %>Template/<%=config.TemplateFolder%>/inc/multi_popup.js" type="text/javascript"></script>
		<script src="<%=webSite %>inc/tab.js" type="text/javascript"></script>
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/member.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript">var orderID=<%=Request.QueryString["OrderID"] %>;</script>
		<script type="text/javascript">
		    function printPage() {
			    eval("printOrder" + ".style.display=\"none\";");
			    window.print(); 
		    }
		</script>
		<style type="text/css">
		    #datalist { border-collapse:collapse; border-right:1px solid #cecece;}
		    #datalist td,#datalist th { border:1px solid #cecece;}
		    .textleft { text-align:left;}
		    .order_btn1{float:left;margin-left:0px;}
		    .order_btn2{margin-left:0px}
		</style>
	</HEAD>
	<body>
		<uc1:Header id="Header1" runat="server"></uc1:Header>
		<div class="xp-qgw clear">
			<div class="member_left">
				<!--会员中心导航开始-->
				<uc1:MemberMenu id="MemberMenu1" runat="server"></uc1:MemberMenu>
				<!--会员中心导航结束-->
				
			</div>
			<div class="member_middle_right">
		        <form id="Form1" method="post" runat="server">
		            <div style="color:#413f40; font-weight:bold; font-size:14px; padding:10px 0px;">我的订单状态</div>
		            <div class="order_1" style="padding:10px 20px;">
		                <div class="body-shoptitle order_1_1">
		                    <span class="order_title"><%=GetResourceString("OrderNo")%>：</span>
					        <%=order.OrderNo%>
					        <span class="order_title"><%=GetResourceString("OrderTime")%>：</span>
					        <%=order.OrderTime%>
					        <%if (order.ShipTime != ""){%><span class="order_title"><%=GetResourceString("DeliverGoodsDate")%>：</span>
					        <%=order.ShipTime%><%}%>
		                </div>

                        <div class="body-shoptitle order_1_1">
		                    <div style="float:left;">
                            <span class="order_title"><%=GetResourceString("OrderStatus")%>：</span>
	                        <span class="order_title"><%=orderStatus%></span>&nbsp;&nbsp;&nbsp;&nbsp;
				            <%if(order.Status < 2) {%>
                            <%if(order.PayNotifyID == 0) {%>
				                <a href='<%=webSite %>PayNotify.aspx?OrderID=<%=Request.QueryString["OrderID"] %>' title="如果您已经付款,可点此链接填写付款信息通知管理员" target=_blank>付款通知</a> <%=order.OrderNo %>
				                <%}else{ %>
				                已填写付款通知，请等待审核．
				                <%} %>
<%--				                <%if(order.PayNotifyID != 0) {%>
				                已填写付款通知，请等待审核．
				                <%} %>		--%>		                
				            <%} %>	
                            </div> 
                            <div style="float:right">
                                <asp:Button ID="btnCancel" CssClass="order_btn1" OnClick="btnCancel_Click" runat="server" Text="取消订单" />
                                <%if (canCombine){%>
                                    <input type=button  id="btnCombine" class="order_btn1"  value="合并订单" />
                                <%} %>
                            </div>       				    
		                    <div class="clear"></div>
		                </div>

                        <div class="body-shoptitle order_1_1">
		                    <div style="float:left;">
	                        <span class="order_title" style="line-height:26px;"><%=tips%>：</span>
                            </div>        				    
		                    <div class="clear"></div>
		                </div>	                
		                <div class="clear"></div>
		            </div>
        		    
		            <div class="order_2" id="order_2">
		                <div class="order_2_top">
		                    <div class="rank_subcat"><span class="menuitem tabon">订单跟踪</span><span class="menuitem tabout">付款信息</span></div>
		                </div>
		                 <div class="salerank1_tabitem" style="padding:20px;">
<%--                            <%if (order.Status >= 6)
                              {%>
			                    <%if (order.ShippingInvoiceID != 0)
                         {%>
			                        快递单号：<%=order.ShippingNo%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;物流公司：<%=order.ShipCompanyName%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=order.QueryUrl %>" target="_blank">快件跟踪</a>&nbsp;&nbsp;&nbsp;
			                    <%}
                         else
                         { %>
			                        暂无发货信息
			                    <%} %>
			                <%} %>--%>
                            <table width="100%" cellspacing="0" cellpadding="0">
                                <tbody>
                                    <tr>
                                        <th width="20%">操作角色</th>
                                        <th width="30%">操作时间</th>
                                        <th width="50%">操作</th>
                                    </tr>
                                    <asp:repeater id="rptOrderOpt" Runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OpRule")%></td>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OPTime")%></td>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OPDesc")%></td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:repeater>
                                    <%if(order.Status==6){ %>
                                        <tr>
                                            <td>顾客</td>
                                            <td>------</td>
                                            <td>
                                                <input type="button" class="order_btn2" id="btnReceived" value="签收" />
                                            </td>
                                        </tr>
                                    <%} %>
<%--                                    <%if(order.Status==7){ %>
                                        <tr>
                                            <td>顾客</td>
                                            <td>------</td>
                                            <td>
                                            <asp:Button ID="Button1" CssClass="order_btn1" OnClick="btnCancel_Click" runat="server" Text="申请退货" />
                                            </td>
                                        </tr>
                                    <%} %>   --%>
                                </tbody>
                            </table>
		                 </div>
		                 <div class="salerank1_tabitem" style="padding:20px;">
                            <table width="100%" cellspacing="0" cellpadding="0" style="line-height:20px;">
                                <%--<%if(order.IsAgentFContent!=""){ %>
			                    <tr>
					                <td width="30%"><%= order.IsAgentFContent%>：<%= order.IsAgentF == 1 ? "Yes" : "No"%></td>
					                <td width="70%"></td>
				                </tr>
				                <%} %>--%>
                                <tr>
				                    <td width="30%">商品总金额：￥<%=string.Format("{0:f}", order.ProductPrice)%></td>
        				            <td width="70%">货到付款手续费：￥<%=string.Format("{0:f}", order.CltCharge)%></td>
				                </tr>
				                <tr>
					                <td>商品运费：￥<%=string.Format("{0:f}", order.ShipPrice)%><%if (order.IsShippingFree == 1)
                                    { %>（<%=GetResourceString("ShippingFree")%>）<%} %>&nbsp;</td>
        					        <td>订单总金额：￥<%=string.Format("{0:f}", order.TotalPrice)%></td>
				                </tr>
				                <tr>
        				            
				                </tr>
				                <tr>
				                    <td>积分抵消金额：￥<%=string.Format("{0:f}", order.ScoreAmount)%></td>
				                    <td>余额支付：￥<%=string.Format("{0:f}", order.AdvancePayment)%></td>
				                </tr>
				                <tr>
				                    <td>发票税金：￥<%=string.Format("{0:f}", order.TaxPrice)%></td>
				                    <td>还需支付金额：<em>￥<%=string.Format("{0:f}", order.NeedPayMoney)%></em></td>
				                </tr>
                            </table>
                        </div>
		            </div>
			        <script type="text/javascript">
                        $('#order_2').ready(function(){
                            SetTab('#order_2 span.menuitem','#order_2 div.salerank1_tabitem');
                        });
                    </script>
                    <div class="mframe">
				        <div class="tl"></div>
				        <div class="tr"></div>
				        <div class="tm">我的订单明细</div>
				        <div class="ml"></div>
				        <div class="mr"></div>
				        <div class="mm" style="padding:0px;">
				            <div id="orderinfo" class="clear">
                                <div class="mc">
                                    <dl class="fore">
                                        <dt><%=GetResourceString("ReceiverInfo")%></dt>
                                        <dd>
                                            <ul>
                                                <li><%=GetResourceString("OrderEmail_ReceiverName")%>：<%=order.ReceiverName%></li>
                                                <li><%=GetResourceString("OrderEmail_ReceiverAddress")%>：<%=order.ReceiverAddress%></li>
                                                <li><%=GetResourceString("OrderEmail_Postalcode")%>：<%=order.ReceiverPostalcode%></li>
                                                <li><%=GetResourceString("OrderEmail_Phone")%>：<%=order.ReceiverPhone%></li>
                                                <li><%=GetResourceString("OrderEmail_Email")%>：<%=order.ReceiverEmail%></li>
                                            </ul>
			                            </dd>
                                    </dl>
                                    
                                    <dl>
                                        <dt>配送方式</dt>
                                        <dd>
                                            <ul>
<%--                                          <li><%=GetResourceString("ShippingWay")%>：<%=GetShippingName(order.ShippingType)%></li>--%>  
                                              <li><%=GetResourceString("ShippingWay")%>：<%=order.ShippingName%></li>
                                                <li><%=GetAD(95)%></li>
                                            </ul>
				                        </dd>
                                    </dl>
                                    
                                    <dl>
                                        <dt>支付方式</dt>
                                        <dd>
                                            <ul>
<%--                                                <li><%=GetResourceString("PaymentInfo")%>：<%=GetPayType(order.PayType)%>&nbsp;&nbsp;&nbsp;<%=order.Status == 0 ? "<a href='ModifyPay.aspx?OrderID=" + order.OrderID + "'>修改支付方式</a>" : ""%></li>
--%>    
                                                <li><%=GetResourceString("PaymentInfo")%>：<%=order.PayMemntName%>&nbsp;&nbsp;&nbsp;<%=order.Status == 0 ? "<a href='ModifyPay-" + order.OrderID + "." + config.html +"' style='font-size:14px;color:red;'>修改支付方式</a>" : ""%></li>
                                        </ul>
				                        </dd>
                                    </dl>
                                    <%if (order.NeedInvoice)
                                      {%>
                                    <dl>
                                        <dt>发票信息</dt>
                                        <dd>
                                            <ul>
                                                <li>发票类型：<%=orderInvoice.InvoiceType == 0 ? "普通发票" : "增值税发票"%> </li>
                                                <li>发票抬头：<%=orderInvoice.InvoiceHead%></li>
                                                <li>发票内容：<%=orderInvoice.IsDetails ? "商品明细" : orderInvoice.InvoiceContent%></li> 
                                            </ul>
				                        </dd>
                                    </dl>
                                    <%} %>                          
                                    <%if (havePdt)
                                      {%>
                                    <dl>
                                        <dt>商品清单</dt>
                                        <dd class="p-list" style="padding:0px;">
                                            <table width="100%" cellspacing="0" cellpadding="0">
				                                <tbody>
					                                <tr class="datagrid-header">
						                                <th width="8%">商品编号</th>
						                                <th width="30%">商品名称</th>						                                
						                                <th width="7%">购买价</th>
						                                <th width="7%">已优惠</th>
						                                <th width="7%">赠送积分</th>
						                                <th width="7%">购买数量</th>
						                                <th width="12%">操作</th>
                                                    </tr>
					                                <asp:repeater id="rptOrderItems" Runat="server">
						                                <ItemTemplate>
							                                <tr>
								                                <td><%#(DataBinder.Eval(Container.DataItem, "ProductNo").ToString())%></td>
								                                <td style="text-align:left;">
								                                    <a href="<%=webSite%>/products/product-<%# DataBinder.Eval(Container.DataItem, "ProductID")%>.<%=config.html %>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "ProductName")%></a>
								                                    <asp:Repeater runat="server" ID="rptCoupon" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("PdtCoupon") %>'>
							                                        <ItemTemplate>
							                                        <div><font color="Red">[赠品]</font><%# DataBinder.Eval(Container.DataItem, "[\"CouponName\"]")%>  <font color="Red">×<%# DataBinder.Eval(Container.DataItem, "[\"Number\"]")%><%# DataBinder.Eval(Container.DataItem, "[\"Status\"]")%></font></div>
							                                        </ItemTemplate>
							                                        </asp:Repeater>
							                                        <asp:Repeater runat="server" ID="rptPresents" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("PdtGift") %>'>
							                                        <ItemTemplate>
							                                        <div><font color="Red">[赠品]</font><%# DataBinder.Eval(Container.DataItem, "[\"PresentName\"]")%>  <font color="Red">×<%# DataBinder.Eval(Container.DataItem, "[\"PresentNum\"]")%></font></div>
							                                        </ItemTemplate>
							                                        </asp:Repeater>					                                        
								                                </td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:f2}")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "LessMoney", "{0:f2}")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "Score")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "Quantity")%></td>
								                                <td>
								                                <%# CreateCommentLink(DataBinder.Eval(Container.DataItem, "orderid").ToString(), DataBinder.Eval(Container.DataItem, "orderProductID").ToString(), DataBinder.Eval(Container.DataItem, "ProductID").ToString(), DataBinder.Eval(Container.DataItem, "CommentStatus").ToString())%>
								                                </td>
							                                </tr>
						                                </ItemTemplate>
					                                </asp:repeater>
				                                </tbody>
			                                </table>
                                        </dd>
                                    </dl>
                                    <%} %>
                                    
                                    <%if (haveGift)
                                      {%>
                                    <dl>
                                        <dt>兑换的礼品</dt>
                                        <dd class="p-list" style="padding:0px;">
                                            <table cellSpacing="0" cellPadding="0" width="100%" border="0">
				                                <tbody>
					                                <tr>
						                                <th width="50%">礼品名称</th>
						                                <th width="10%">数量</th>
						                                <th width="10%">单件积分</th>
						                                <th width="30%">小计</th>
					                                </tr> <!-- BEGIN row --><asp:repeater id="rptGiftItems" Runat="server">
						                                <ItemTemplate>
							                                <tr>
								                                <td><%# DataBinder.Eval(Container.DataItem, "GiftName")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "Quantity")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "GiftScore")%></td>
								                                <td><%# DataBinder.Eval(Container.DataItem, "Total")%></td>
							                                </tr>
						                                </ItemTemplate>
					                                </asp:repeater>
                                					
				                                </tbody>
			                                </table>
                                        </dd>
                                    </dl>
                                    <%} %>
                                    <%if(dtSendCoupon.Rows.Count>0){%>
                                    <dl>
                                        <dt>返券清单</dt>
                                        <dd class="p-list" style="padding:0px;">
                                            <table cellSpacing="0" cellPadding="0" width="100%" border="0">
				                                <tbody>
					                                <tr>
						                                <th width="30%">券名</th>
						                                <th width="10%">面值</th>
						                                <th width="10%">数量</th>
						                                <th width="50%"></th>
					                                </tr>
					                                <%for (int i = 0; i < dtSendCoupon.Rows.Count; i++){%>
					                                <tr>
						                                <td><%=dtSendCoupon.Rows[i]["CouponName"]%><font color="red"><%=dtSendCoupon.Rows[i]["Status"]%></font></td>
						                                <td><%=dtSendCoupon.Rows[i]["CouponValue"]%></td>
						                                <td><%=dtSendCoupon.Rows[i]["SubNumber"]%></td>
						                                <td></td>
					                                </tr>
						                            <%} %>                                					
				                                </tbody>
			                                </table>
                                        </dd>
                                    </dl>
                                    <%} %>
                                    <div class="order-info clear">
										<table cellspacing="0" cellpadding="0">
											<tr>
												<td>商品总金额：￥<%=string.Format("{0:f}", order.ProductPrice+order.LessMoney)%></td>
											</tr>
											<tr>
												<td>+ 商品运费：￥<%=string.Format("{0:f}", order.ShipPrice)%><%if (order.IsShippingFree == 1)
												{ %>（<%=GetResourceString("ShippingFree")%>）<%} %></td>
											</tr>
											<%if (order.PayType==5){ %>
											<tr>
												<td>+ 货到付款手续费：￥<%=string.Format("{0:f}", order.CltCharge)%></td>
											</tr>
											<%} %>
											<tr>
												<td>- 优惠金额：￥<%=string.Format("{0:f}", order.LessMoney)%></td>
											</tr>
											<tr>
												<td>- 积分抵扣金额：￥<%=string.Format("{0:f}", order.ScoreAmount)%></td>
											</tr>
											<tr>
												<td>- 余额支付：￥<%=string.Format("{0:f}", order.AdvancePayment)%></td>
											</tr>	                        
											<tr>
												<td class="order-pay-money">订单支付金额：<em>￥<%=string.Format("{0:f}", order.TotalPrice - order.AdvancePayment)%></em></td>
											</tr>
                                            <%if (order.PayType == 5)
                                              { %>
											<tr>
												<td class="order-pay-money">还需支付金额：<em>￥<%=string.Format("{0:f}", order.NeedPayMoney)%></em></td>
											</tr>
											<%} %>
									    </table>
									</div>
                                    <dl>
                                        <dt><%=GetResourceString("OrderComment")%></dt>
                                        <dd>
                                            <%=order.Remark%>
				                        </dd>
                                    </dl>
                                    
                                </div>
                            </div>
				        </div>
				        <div class="bl"></div>
				        <div class="br"></div>
				        <div class="bm"></div>
				    </div>
				    <div class="mframe">
				        <div class="tl"></div>
				        <div class="tr"></div>
				        <div class="tm">订单留言</div>
				        <div class="ml"></div>
				        <div class="mr"></div>
				        <div class="mm">
			                <iframe src="<%=webSite %>OrderFeedback.aspx?NoCopyright=1&OrderID=<%=order.OrderID%>&type=1" frameborder="0" style="zoom:1;" class="guest" id="frmFeedback" scrolling=no></iframe>
		                </div>
				        <div class="bl"></div>
				        <div class="br"></div>
				        <div class="bm"></div>
				    </div>
		        </form>
		        <asp:literal id="ltrPayment" Runat="server"></asp:literal>
			</div>
			<div style="clear:both;"></div>
		</div>
		<uc1:MemberHelper id="Helper1" runat="server"></uc1:MemberHelper>
		<uc1:memberfooter id="Footer1" runat="server"></uc1:memberfooter>
		
		<div class="lframe popTip" id="ShowCombine">
	        <div class="tl"></div>
	        <div class="tr"></div>
	        <div class="tm" id="popupHead">
	            <div class="poptitle">合并订单</div>
	            <div id="closepop" class="hand popclose">关闭</div>
	        </div>
	        <div class="ml"></div>
	        <div class="mr"></div>
	        <div class="mm tipcontent" style="text-align:center; overflow-y:auto; overflow-x:hidden; height:300px;">
		        <form method="get" action='<%=webSite %>ComCart.<%=config.html %>' target="_blank">
		            <table id="datalist" style="width:580px;">
		                <tr>
		                    <th></th>
		                    <th>订单号</th>
		                    <th>收货人</th>
		                    <th>支付类型</th>
		                    <th>下订时间</th>
		                    <%--<th>状态</th>--%>
		                    <%--<th>商品金额</th>--%>
		                    <th class="textleft">总金额</th>
		                </tr>
		                <tr id="mainorder">
		                    <td class="com_chkbox">主订单</td>
		                    <td class="com_orderno"></td>
		                    <td class="com_receiver"></td>
		                    <td class="com_paytype"></td>
		                    <td class="com_ordertime"></td>
		                    <%--<td class="com_status"></td>--%>
		                    <%--<td class="com_pdtprice"></td>--%>
		                    <td class="com_totalprice textleft"></td>
		                </tr>
		                <tr id="com_pre_sub">
		                    <td colspan="8" style="text-align:left;">请选择要合并到主订单的订单     <input type="submit" id="btnSubmitCom" value="合并选中的订单" /></td>
		                </tr>
		            </table>
		            <input type="hidden" id="OrderID" name="OrderID" value='<%=Request.QueryString["OrderID"] %>' />
		        </form>
	        </div>
	        <div class="bl"></div>
	        <div class="br"></div>
	        <div class="bm"></div>
        </div>
	</body>
</HTML>
