<%@page contentType="text/html;charset=GBK" %>
<jsp:useBean id="fgorderForm" class="com.keyshop.shop.order.controller.OrderForm" scope="request"/>
<%
	Order bean = (Order)fgorderForm.getBean();
	if(bean!=null){
	OrderAddress orderAddress = bean.getOrderAddress();
	OrderConsigneeAddress orderConsigneeAddress = bean.getOrderConsigneeAddress();
	ShipType shipType = OrderHelper.getShipType(bean.getShipType());
%>
<%
	if(request.getAttribute("no_right_delte") != null) {
%>
<script>
	alert("您没有权限取消该订单。")
</script>	
<%
	} 
%>
<%
	if(request.getAttribute("delte_success") != null) {
%>
<script>
	alert("订单取消成功。")
	if(window.opener.fgorderSearchForm != null) {
		window.opener.fgorderSearchForm.submit();
	}
	window.close();
	</script>
<%
}  else {
%>
	<html:form action="/fg/order/order">
	<html:hidden property="channelId" value="<%=currentChannel.getId()%>"/>
	<html:hidden property="bean.id"/>
	<html:hidden property="actionType"/>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i01.gif" width="10" height="10"></td>
    <td  background="<%=CONTEXT%>/img/QQ/i03.gif"></td>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i02.gif" width="10" height="10"></td>
  </tr>
  <tr>
    <td  background="<%=CONTEXT%>/img/QQ/i04.gif">&nbsp;</td>
    <td>

			<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr>
			    <td height="25" align="center" bgcolor="2B579E"><font color=white size=2><b>订单查询</b></font></td>
			  </tr>
			</table>
			<table width="640" border="1" align="center" cellpadding="0" cellspacing="0" 
				bordercolorlight="#D4D4D4" bordercolordark="white">
			  <tr>
			    <td align="center" bgcolor="f2f2f2">  
			    	<table width="96%"  border="0" cellpadding="3">
			        <tr>
			          <td align="left">
			          	<b>订单号：<%=bean.getSerialNo()%> &nbsp;&nbsp;
			          		总价格:<%=bean.getTotalCost()-shipType.getAmount()%>元</b> &nbsp;
			          		其中配送费：<%=shipType.getAmount()%>元 &nbsp;
			          		应付总额：<%=bean.getTotalCost()%>元&nbsp;<br>
			          		当前状态-<%=OrderHelper.statusNames.get(bean.getStatus())%></b>
			          </td>
			        </tr>
			      </table>
			      <br>
			      <table width="96%"  border="1" cellpadding="0" cellspacing="0" 
			      	bordercolordark="white" bordercolorlight="#088489">
			        <tr>
			          <td>
			          	<table width="100%"  border="0" cellpadding="2" cellspacing="1">
			              <tr>
			                <td width="23%" align="right" bgcolor="#116FBB">
			                	<font color=white><b>订购人：</b></font>
			                </td>
			                <td width="77%" align="left" bgcolor="#E6F5F3"><bean:write  name="fgorderForm" 
			                	property="bean.orderAddress.name"/>
			                <% if(orderAddress.isSex()) {%>
			                	男 
			                <%
			                	} else {
			                %>
			                女
			                <%
			                	}
			                %>
			                </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>购买方式：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<%	
				                	PayType payType = OrderHelper.getPayType(bean.getPayType());
				                	if(payType != null) {
				                %>
				                 <%=payType.getName()%>
				                  <%
				                	}
				                %> 
				              </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>交货方式：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<%
				                	if(shipType != null) {
				                %>
				                <%=shipType.getName()%> 
				                 <%
				                	}
				                %> 
				              </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>送货地址：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3"><bean:write  name="fgorderForm" 
			                	property="bean.orderAddress.address"/></td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>邮政编码：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3"><bean:write  name="fgorderForm" 
			                	property="bean.orderAddress.zipCode"/></td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>联系电话：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3"><bean:write  name="fgorderForm"
			                	 property="bean.orderAddress.areaNo"/> 
			                	  -<bean:write  name="fgorderForm" property="bean.orderAddress.telephone"/>
													&nbsp;&nbsp;
					                手机： 
					                <bean:write  name="fgorderForm" property="bean.orderAddress.mobileTelephone"/>
					            </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>E-mail：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3"><bean:write  name="fgorderForm" 
			                	property="bean.orderAddress.emailAddress"/>
			                </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>收货人：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<bean:write  name="fgorderForm" property="bean.orderAddress.name"/>
								                    <% if(orderAddress.isSex()) {%>
								                    	男 
								                    <%
								                    	} else {
								                    %>
								                    女
								                    <%
								                    	}
								                    %>
								      </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>地址：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.address"/></td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>邮政编码：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.zipCode"/></td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>联系电话：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.areaNo"/>-
									      <bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.telephone"/>
												&nbsp;&nbsp;
									      手机： 
									      <bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.mobileTelephone"/>
									    </td>
			              </tr>
			              <tr>
			                <td align="right" bgcolor="#116FBB"><font color=white><b>邮箱：</b></font></td>
			                <td align="left" bgcolor="#E6F5F3">
			                	<bean:write  name="fgorderForm" property="bean.orderConsigneeAddress.emailAddress"/></td>
			              </tr>
			              <tr bgcolor="#E6F5F3">
			                <td align="right" bgcolor="#116FBB"><font color=white><b>备注：</b></font></td>
			                <td align="left"><bean:write  name="fgorderForm" property="bean.note"/></td>
			              </tr>
			            </table>
			          </td>
			        </tr>
			      </table>
			      <br>
			      <table width="96%" border="0" cellspacing="1" cellpadding="2">
			        <tr>
			          <td height="1" colspan="4" bgcolor="e2e2e2"></td>
			        </tr>
			        <tr bgcolor="#116FBB">
			          <td align="center"><b><font color="#FFFFFF">商品名称</font></b></td>
			          <td align="center"><b><font color="#FFFFFF">售价</font></b></td>
			          <td align="center"><b><font color="#FFFFFF">数量</font></b></td>
			          <td align="center"><b><font color="#FFFFFF">小计</font></b></td>
			        </tr>
			        <tr>
			          <td height="1" colspan="4" bgcolor="e2e2e2"></td>
			        </tr>
			        <%
			     		if(bean.getChildList() != null && bean.getChildList().size() > 0) {
			     			double alltotoal = 0;
			     			Iterator it = bean.getChildList().iterator();
			     			while(it.hasNext()) {
			     				OrderDetail  result = (OrderDetail)it.next();
				       	%>
			        <tr>
			          <td align="center">
			          	<a href="<%=CONTEXT%>/fg/product/product.do?actionType=view&bean.id=<%=result.getProductId()%>">
			              <%=result.getProductName()%> 
			            </a>
			          </td>
			          <td align="center">￥<%=result.getUnitPrice()%><br></td>
			          <td align="center"><%=result.getQuantity()%></td>
			          <td align="center">￥<%=result.getQuantity() * result.getUnitPrice()%></td>
			          <%
			          	alltotoal = alltotoal  + result.getQuantity() * result.getUnitPrice();
			          %>
			        </tr>
			        <tr >
			          <td colspan="4" align="center" height=1 background="<%=CONTEXT%>/img/pic0515.gif"></td>
			        </tr>
			        <%
			        		}
			        	}
			        %>
			      </table>
			      <table width="96%" border="0" cellspacing="1" cellpadding="2">
			        <tr>
			          <td height="1" colspan="4" bgcolor="e2e2e2"></td>
			        </tr>
			        <tr bgcolor="#116FBB">
			          <td align="center"><b><font color="#FFFFFF">状态</font></b></td>
			          <td align="center"><b><font color="#FFFFFF">操作人</font></b></td>
			          <td align="center"><b><font color="#FFFFFF">时间</font></b></td>
			        </tr>
			        <%
			       		if(bean.getTraces() != null && bean.getTraces().size() > 0) {
			       			Iterator it = bean.getTraces().iterator();
			       			while(it.hasNext()) {
			       				OrderTracer  result = (OrderTracer)it.next();
			       	%>
							<tr>
			          <td align="center"><%=OrderHelper.statusNames.get(result.getStatus())%></td>
			          <td align="center">￥<%=result.getCreator()%><br></td>
			          <td align="center"><%=result.getCreateDate()%></td>
			         
			        </tr>			       	
			        <%
			        		}
			        	}
			        %>
							<script>
			      		function orderCancel() {
			      			fgorderForm.actionType.value = 'cancel';
			      			fgorderForm.submit();
			      		}
			      	</script>			        
			      </table>
			      <input type="button" name="Submit322222" onclick="javascript:orderCancel()" value="取消订单" class="i05">
						<input type="button" onclick="javascript:window.print()" name="Submit322222" value="打印" class="i05">	
			      <br>
			     </td>
			  </tr>
			</table>
    </td>
    <td background="<%=CONTEXT%>/img/QQ/i05.gif"></td>
  </tr>
  <tr>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i06.gif" width="10" height="10"></td>
    <td background="<%=CONTEXT%>/img/QQ/i08.gif"></td>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i07.gif" width="10" height="10"></td>
  </tr>
</table>

</html:form>
<%
	}
}else{
%>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i01.gif" width="10" height="10"></td>
    <td  background="<%=CONTEXT%>/img/QQ/i03.gif"></td>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i02.gif" width="10" height="10"></td>
  </tr>
  <tr>
    <td  background="<%=CONTEXT%>/img/QQ/i04.gif">&nbsp;</td>
    <td>
			<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr>
			    <td height="40" align="center" bgcolor="2B579E">
			    	<font color=white size=2>
			    		<b>没有查询到相关的订单记录<br>请确定你的查询无误，如有疑问请直接联系商家</b></font>
			    </td>
			  </tr>
			</table> 
    </td>
    <td background="<%=CONTEXT%>/img/QQ/i05.gif"></td>
  </tr>
  <tr>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i06.gif" width="10" height="10"></td>
    <td background="<%=CONTEXT%>/img/QQ/i08.gif"></td>
    <td width="10" height="10"><img src="<%=CONTEXT%>/img/QQ/i07.gif" width="10" height="10"></td>
  </tr>
</table>
<%
}
%>