java網上圖書商城(8)訂單模組3_java

來源:互聯網
上載者:User

繼續上一篇進行學習。

3.查詢訂單詳細資料

OrderServlet

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

<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>


4.取消訂單、確認收貨

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援雲棲社區。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.