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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"
isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />
<!DOCTYPE html >
<html>
<head>
<meta charset="utf-8">
<script>
function fn_cancel_order(order_id){
var answer=confirm("주문을 취소하시겠습니까?");
if(answer==true){
var formObj=document.createElement("form");
var i_order_id = document.createElement("input");
i_order_id.name="order_id";
i_order_id.value=order_id;
formObj.appendChild(i_order_id);
document.body.appendChild(formObj);
formObj.method="post";
formObj.action="${contextPath}/mypage/cancelMyOrder.do";
formObj.submit();
}
}
</script>
</head>
<body>
<div class="clear"></div>
<table class="list_view">
<tbody align=center >
<tr style="background:#33ff00" >
<td class="fixed" >주문번호</td>
<td class="fixed">주문일자</td>
<td>주문내역</td>
<td>주문금액/수량</td>
<td>주문상태</td>
<td>주문자</td>
<td>수령자</td>
<td>주문취소</td>
</tr>
<c:forEach var="item" items="${myOrderHistList }" varStatus="i">
<tr>
<td>
<a href="${contextPath}/mypage/myOrderDetail.do?order_id=${item.order_id }"><strong>${item.order_id }</strong> </a>
</td>
<td >
<strong>${item.pay_order_time }</strong>
</td>
<td>
<strong>
<a href="${contextPath}/goods/goodsDetail.do?goods_id=${item2.goods_id }">${item2.goods_title }</a><br>
</strong>
</td>
<td>
<strong>
${item.goods_sales_price*item.order_goods_qty }원/${item.order_goods_qty }<br>
</strong>
</td>
<td>
<strong>
<c:choose>
<c:when test="${item.delivery_state=='delivery_prepared' }">
배송준비중
</c:when>
<c:when test="${item.delivery_state=='delivering' }">
배송중
</c:when>
<c:when test="${item.delivery_state=='finished_delivering' }">
배송완료
</c:when>
<c:when test="${item.delivery_state=='cancel_order' }">
주문취소
</c:when>
<c:when test="${item.delivery_state=='returning_goods' }">
반품
</c:when>
</c:choose>
</strong>
</td>
<td>
<strong>${item.orderer_name }</strong>
</td>
<td>
<strong>${item.receiver_name }</strong>
</td>
<td>
<c:choose>
<c:when test="${item.delivery_state=='delivery_prepared'}">
<input type="button" onClick="fn_cancel_order('${item.order_id}')" value="주문취소" />
</c:when>
<c:otherwise>
<input type="button" onClick="fn_cancel_order('${item.order_id}')" value="주문취소" disabled />
</c:otherwise>
</c:choose>
</td>
</tr>
<c:set var="pre_order_id" value="${item.order_id }" />
</c:forEach>
</tbody>
</table>
<div class="clear"></div>
</body>
</html>
@Override
@RequestMapping(value="/cancelMyOrder.do" ,method = RequestMethod.POST)
public ModelAndView cancelMyOrder(@RequestParam("order_id") String order_id,
HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView mav = new ModelAndView();
myPageService.cancelOrder(order_id);
mav.addObject("message", "cancel_order");
mav.setViewName("redirect:/mypage/myPageMain.do");
return mav;
}
@Override
@RequestMapping(value="/myPageMain.do" ,method = RequestMethod.GET)
public ModelAndView myPageMain(@RequestParam(required = false,value="message") String message,
HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession session=request.getSession();
session=request.getSession();
session.setAttribute("side_menu", "my_page"); //마이페이지 사이드 메뉴로 설정한다.
String viewName=(String)request.getAttribute("viewName");
ModelAndView mav = new ModelAndView(viewName);
memberVO=(MemberVO)session.getAttribute("memberInfo");
String member_id=memberVO.getMember_id();
List<OrderVO> myOrderList=myPageService.listMyOrderGoods(member_id);
mav.addObject("message", message);
mav.addObject("myOrderList", myOrderList);
return mav;
}
<update id="updateMyOrderCancel" parameterType="String">
update t_shopping_order
set delivery_state='cancel_order'
where order_id=#{order_id}
</update>
--------------------------------------------------------------------------
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"
isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<c:if test="${message=='cancel_order'}">
<script>
window.onload=function()
{
init();
}
function init(){
alert("주문을 취소했습니다.");
}
</script>
</c:if>
<script>
function fn_cancel_order(order_id){
var answer=confirm("주문을 취소하시겠습니까?");
if(answer==true){
var formObj=document.createElement("form");
var i_order_id = document.createElement("input");
i_order_id.name="order_id";
i_order_id.value=order_id;
formObj.appendChild(i_order_id);
document.body.appendChild(formObj);
formObj.method="post";
formObj.action="${contextPath}/mypage/cancelMyOrder.do";
formObj.submit();
}
}
</script>
</head>
<body>
<h1>최근주문내역
<A href="#"> <IMG src="${contextPath}/resources/image/btn_more_see.jpg"> </A>
</h1>
<table class="list_view">
<tbody align=center >
<tr style="background:#33ff00" >
<td>주문번호zzzzzzzzzzzzzzz</td>
<td>주문일자</td>
<td>주문상품</td>
<td>주문상태</td>
<td>주문취소</td>
</tr>
<c:forEach var="item" items="${myOrderList }" varStatus="i">
<c:choose>
<c:when test="${item.delivery_state=='delivery_prepared' }">
<tr bgcolor="lightgreen">
</c:when>
<c:when test="${item.delivery_state=='finished_delivering' }">
<tr bgcolor="lightgray">
</c:when>
<c:otherwise>
<tr bgcolor="orange">
</c:otherwise>
</c:choose>
<tr>
<td>
<a href="${contextPath}/mypage/myOrderDetail.do?order_id=${item.order_id }"><span>${item.order_id }</span> </a>
</td>
<td><span>${item.pay_order_time }</span></td>
<td align="left">
<strong>
<c:forEach var="item2" items="${myOrderList}" varStatus="j">
<c:if test="${item.order_id ==item2.order_id}" >
<a href="${contextPath}/goods/goodsDetail.do?goods_id=${item2.goods_id }">${item2.goods_title }/${item.order_goods_qty }개</a><br>
</c:if>
</c:forEach>
</strong>
</td>
<td>
<c:choose>
<c:when test="${item.delivery_state=='delivery_prepared' }">
배송준비중
</c:when>
<c:when test="${item.delivery_state=='delivering' }">
배송중
</c:when>
<c:when test="${item.delivery_state=='finished_delivering' }">
배송완료
</c:when>
<c:when test="${item.delivery_state=='cancel_order' }">
주문취소
</c:when>
<c:when test="${item.delivery_state=='returning_goods' }">
반품완료
</c:when>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${item.delivery_state=='delivery_prepared'}">
<input type="button" onClick="fn_cancel_order('${item.order_id}')" value="주문취소" />
</c:when>
<c:otherwise>
<input type="button" onClick="fn_cancel_order('${item.order_id}')" value="주문취소" disabled />
</c:otherwise>
</c:choose>
</td>
</tr>
<c:set var="pre_order_id" value="${item.order_id}" />
</c:forEach>
</tbody>
</table>
</body>
</html>
|
cs |
'기존 > 🏀Spring' 카테고리의 다른 글
[스프링]Spring 카카오 로그인하기 , DB저장 (0) | 2022.07.14 |
---|---|
(스프링) 일반배송 만들기 주문상태현황,배송중,배송대기,결제완료 (0) | 2022.07.11 |
(스프링) 관리자 배송조회 하기 등록하기 배송현황 (0) | 2022.07.11 |
(스프링)배송현황 배송관리 등록하기 ajax, (2) | 2022.07.11 |
(스프링) 배송상태 설정 등록,수정,삭제 (0) | 2022.07.11 |