后台订单管理异步加载订单项的操作

25 篇文章 0 订阅
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${pageContext.request.contextPath}/css/Style1.css"
	rel="stylesheet" type="text/css" />
<script language="javascript"
	src="${pageContext.request.contextPath}/js/public.js"></script>
<script type="text/javascript">
	function showDetail(oid) {
		//获得按钮对象
		var but = document.getElementById("but"+oid);
		//获得div对象
		var div1 = document.getElementById("div"+oid);
		if(but.value == "订单详情"){
		
			//1,创建异步加载对象
			var xhr = createXmlHttp();
			//2,设置监听
			xhr.onreadystatechange = function(){
				if(xhr.readyState == 4){
					if(xhr.status == 200){
						//获得div对象
						div1.innerHTML = xhr.responseText;
					}
				}
			};
			//3,打开链接
			xhr.open("GET","${pageContext.request.contextPath}/adminOrder_findOrderItem.action?time="+new Date().getTime()+"&id="+oid,true);
			//4,发送
			xhr.send(null);
			but.value="关闭";
		}else{
			but.value="订单详情";
			div1.innerHTML = "";
			
		}
	}

	// 创建异步加载方法
	function createXmlHttp() {
		var xmlHttp;
		try {
			xmlHttp = new XMLHttpRequest();
		} catch (e) {
			try {
				xmlHttp = new ActiveXobject("Msxm12.XMLHTTP");
			} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
				}
			}
		}
		return xmlHttp;
	}
</script>
</HEAD>
<body>
	<br>
	<form id="Form1" name="Form1"
		action="${pageContext.request.contextPath}/user/list.jsp"
		method="post">
		<table cellSpacing="1" cellPadding="0" width="100%" align="center"
			bgColor="#f5fafe" border="0">
			<TBODY>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3"><strong>订单列表</strong>
					</TD>
				</tr>
				<tr>
					<td class="ta_01" align="center" bgColor="#f5fafe">
						<table cellspacing="0" cellpadding="1" rules="all"
							bordercolor="gray" border="1" id="DataGrid1"
							style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
							<tr
								style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

								<td align="center" width="10%">序号</td>
								<td align="center" width="10%">订单编号</td>
								<td align="center" width="10%">总金额</td>
								<td align="center" width="10%">收货人</td>
								<td align="center" width="10%">订单状态</td>
								<td width="*" align="center">订单详情</td>
							</tr>
							<%-- 商品信息 --%>
							<s:iterator var="order" value="pageBean.list" status="status">
								<tr οnmοuseοver="this.style.backgroundColor = 'white'"
									οnmοuseοut="this.style.backgroundColor = '#F5FAFE';">
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="18%">
										<%-- (当前页-1)*每页个数+1 --%> <s:property
											value="#status.index+(pageBean.page-1)*pageBean.limit+1" />
									</td>

									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="17%">
										<%-- 订单编号 --%> <s:property value="#order.id" />
									</td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="17%">
										<%-- 总金额 --%> <s:property value="#order.total" />
									</td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="17%">
										<%-- 收货人 --%> <s:property value="#order.address" />
									</td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="17%">
										<%-- 订单状态 1未付款,2发货,3未确认收货,4交易完成 --%> <s:if
											test="#order.state == 1">
														未付款
													</s:if> <s:if test="#order.state == 2">
											<s:a action="">
												<font color="blue">发货</font>
											</s:a>
										</s:if> <s:if test="#order.state == 3">
														未确认收货
													</s:if> <s:if test="#order.state == 4">
														交易完成 
													</s:if>
									</td>

									<td align="center" style="HEIGHT: 22px"><input
										id="but<s:property value="#order.id"/>" type="button"
										value="订单详情"
										οnclick="showDetail(<s:property value="#order.id"/>)" />
										<div id="div<s:property value="#order.id"/>"></div>
									</td>
								</tr>
							</s:iterator>
						</table>
					</td>
				</tr>

				<%-- 分页信息 --%>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3">第<s:property
							value="pageBean.page" />/<s:property value="pageBean.totalPage" />页    
						<s:if test="pageBean.page != 1">
							<s:a action="adminOrder_findAll.action?page=1">首页</s:a>|
								<s:a action="adminOrder_findAll.action?page=%{page-1}">上一页</s:a>|
							</s:if> <s:if test="pageBean.page != pageBean.totalPage">
							<s:a action="adminOrder_findAll.action?page=%{pageBean.page+1}">下一页</s:a>|
								<s:a
								action="adminOrder_findAll.action?page=%{pageBean.totalPage}">尾页</s:a>
						</s:if>
					</TD>
				</tr>

			</TBODY>
		</table>
	</form>
</body>
</HTML>


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<table>
	<tr>
		<s:iterator var="orderItem" value="list">
			<td><img width="40" height="45" alt="订单项图片" src="${pageContext.request.contextPath}/<s:property value="#orderItem.product.image"/>" />
			</td>
			<td><s:property value="#orderItem.count"/></td><!-- 总数量 -->
			<td><s:property value="#orderItem.subtotal"/></td><!-- 小计 -->
		</s:iterator>
	</tr>
</table>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值