java网上图书商城(8)订单模块3

时间:2022-04-10 10:46:29

继续上一篇进行学习。

3.查询订单详细信息

OrderServlet

java" id="highlighter_973747">
?
1
2
3
4
5
6
7
8
9
public String load(HttpServletRequest req, HttpServletResponse resp)
  throws ServletException, IOException {
 String oid = req.getParameter("oid");
 Order order = orderService.load(oid);
 req.setAttribute("order", order);
 String btn = req.getParameter("btn");//btn说明了用户点击哪个超链接来访问本方法的
 req.setAttribute("btn", btn);
 return "/jsps/order/desc.jsp";
}

desc.jsp

 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<div class="divOrder">
 <span>订单号:${order.oid }
 <c:choose>
  <c:when test="${order.status eq 1 }">(等待付款)</c:when>
  <c:when test="${order.status eq 2 }">(准备发货)</c:when>
  <c:when test="${order.status eq 3 }">(等待确认)</c:when>
  <c:when test="${order.status eq 4 }">(交易成功)</c:when>
  <c:when test="${order.status eq 5 }">(已取消)</c:when>
 </c:choose>
 下单时间:${order.ordertime }</span>
</div>
<div class="divContent">
 <div class="div2">
  <dl>
   <dt>收货人信息</dt>
   <dd>${order.address }</dd>
  </dl>
 </div>
 <div class="div2">
  <dl>
   <dt>商品清单</dt>
   <dd>
    <table cellpadding="0" cellspacing="0">
     <tr>
      <th class="tt">商品名称</th>
      <th class="tt" align="left">单价</th>
      <th class="tt" align="left">数量</th>
      <th class="tt" align="left">小计</th>
     </tr>
 
     <c:forEach items="${order.orderItemList }" var="item">
      <tr style="padding-top: 20px; padding-bottom: 20px;">
       <td class="td" width="400px">
        <div class="bookname">
         <img align="middle" width="70" src="<c:url value='/${item.book.image_b }'/>"/>
         <a href="<c:url value='/BookServlet?method=load&bid=${item.book.bid }'/>">${item.book.bname }</a>
        </div>
       </td>
       <td class="td" >
        <span>¥${item.book.currPrice }</span>
       </td>
       <td class="td">
        <span>${item.quantity }</span>
       </td>
       <td class="td">
        <span>¥${item.subtotal }</span>
       </td
      </tr>
     </c:forEach>
 
    </table>
   </dd>
  </dl>
 </div>
 <div style="margin: 10px 10px 10px 550px;">
  <span style="font-weight: 900; font-size: 15px;">合计金额:</span>
  <span class="price_t">¥${order.total }</span><br/>
  <c:if test="${order.status eq 1 }">
   <a href="<c:url value='/OrderServlet?method=paymentPre&oid=${order.oid }'/>" class="pay"></a><br/>
  </c:if>
  <c:if test="${order.status eq 1 and btn eq 'cancel'}">
   <a id="cancel" href="<c:url value='/OrderServlet?method=cancel&oid=${order.oid }'/>">取消订单</a><br/>
  </c:if>
  <c:if test="${order.status eq 3 and btn eq 'confirm'}">
   <a id="confirm" href="<c:url value='/OrderServlet?method=confirm&oid=${order.oid }'/>">确认收货</a><br/>
  </c:if>
 </div>
</div>

java网上图书商城(8)订单模块3

4.取消订单、确认收货

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。