feat(customer-vue, order): 주문 내역 페이지 재주문하기 버튼 로직 추가

- 재주문하기 버튼 클릭시 해당 매장으로 이동
- 합계 3자리수 콤마 추가
- 자세히보기 버튼 클릭 시 준비중입니다 알림창 표시
This commit is contained in:
bum12ark
2022-03-17 16:51:10 +09:00
parent 66a15b2beb
commit 9d43a18d82
5 changed files with 30 additions and 9 deletions

View File

@@ -2,7 +2,6 @@
<v-card <v-card
class="mx-auto mb-5" class="mx-auto mb-5"
outlined outlined
> >
<v-list-item three-line> <v-list-item three-line>
<v-list-item-content> <v-list-item-content>
@@ -19,7 +18,7 @@
{{ card.orderItemNames }} {{ card.orderItemNames }}
</div> </div>
<div class="text--primary"> <div class="text--primary">
합계 : <b>{{ card.orderPrice }}</b> 합계 : <b>{{ card.orderPrice | currency }}</b>
</div> </div>
</v-list-item-content> </v-list-item-content>
@@ -33,11 +32,15 @@
</v-list-item> </v-list-item>
<v-card-actions class="pb-1"> <v-card-actions class="pb-1">
<v-btn block color="primary">재주문하기</v-btn> <v-btn block color="primary" @click="clickReOrder">
재주문하기
</v-btn>
</v-card-actions> </v-card-actions>
<v-card-actions class="pt-1"> <v-card-actions class="pt-1">
<v-btn block outlined color="primary">자세히보기</v-btn> <v-btn block outlined color="primary" @click="clickDetail">
자세히보기
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>
@@ -47,12 +50,24 @@ export default {
name: "OrderHistoryCard", name: "OrderHistoryCard",
props: { props: {
card: { card: {
storeId: Number,
storeName: String, storeName: String,
orderTime: String, orderTime: String,
orderStatus: String, orderStatus: String,
orderItemNames: String, orderItemNames: String,
orderPrice: String orderPrice: String
} }
},
methods: {
clickReOrder: function() {
this.$router.push({
name: "store",
params: {storeId: this.card.storeId}
})
},
clickDetail: function() {
alert("준비 중입니다.");
}
} }
} }
</script> </script>

View File

@@ -82,6 +82,7 @@ export default {
this.cards.push({ this.cards.push({
orderId: order.orderId, orderId: order.orderId,
orderTime: order.orderTime, orderTime: order.orderTime,
storeId: order.storeId,
storeName: order.storeName, storeName: order.storeName,
orderPrice: order.orderPrice, orderPrice: order.orderPrice,
orderStatus: this.getOrderStatusName(order.orderStatus), orderStatus: this.getOrderStatusName(order.orderStatus),
@@ -90,9 +91,11 @@ export default {
}); });
}, },
getOrderStatusName(orderStatus) { getOrderStatusName(orderStatus) {
if (orderStatus === "REJECT") return "주문 거절"; if (orderStatus === "PLACED") return "주문신청";
if (orderStatus === "ORDER") return "주문"; if (orderStatus === "REJECTED") return "주문거절";
if (orderStatus === "PLACED") return "주문 수락"; if (orderStatus === "ACCEPTED") return "주문수락";
if (orderStatus === "WAITING") return "픽업대기";
if (orderStatus === "FINISHED") return "픽업완료";
return orderStatus; return orderStatus;
}, },
getOrderItemName(orderItems) { getOrderItemName(orderItems) {
@@ -100,7 +103,7 @@ export default {
if (itemSize == 1) return orderItems[0].orderItemName; if (itemSize == 1) return orderItems[0].orderItemName;
else if (itemSize > 1) return orderItems[0].orderItemName + " 외 " + (itemSize - 1) + "건"; else if (itemSize > 1) return orderItems[0].orderItemName + " 외 " + (itemSize - 1) + "건";
else return "없음"; else return "없음";
} },
} }
} }
</script> </script>

View File

@@ -66,7 +66,7 @@ public class OrderHistoryDto {
orderHistoryDto.orderTime = order.getOrderTime(); orderHistoryDto.orderTime = order.getOrderTime();
orderHistoryDto.price = order.getOrderPrice(); orderHistoryDto.price = order.getOrderPrice();
orderHistoryDto.orderStatus = order.getOrderStatus(); orderHistoryDto.orderStatus = order.getOrderStatus();
orderHistoryDto.storeId = order.getUserId(); orderHistoryDto.storeId = order.getStoreId();
orderHistoryDto.orderItems = order.getOrderItems().stream() orderHistoryDto.orderItems = order.getOrderItems().stream()
.map(_OrderHistoryItem::of) .map(_OrderHistoryItem::of)

View File

@@ -60,6 +60,7 @@ public class OrderCustomerApiController {
private Long orderId; private Long orderId;
private String orderTime; private String orderTime;
private OrderStatus orderStatus; private OrderStatus orderStatus;
private Long storeId;
private String storeName; private String storeName;
private Long orderPrice; private Long orderPrice;
private List<_OrderItemResponse> orderItems; private List<_OrderItemResponse> orderItems;
@@ -69,6 +70,7 @@ public class OrderCustomerApiController {
this.orderTime = orderHistoryDto.getOrderTime() this.orderTime = orderHistoryDto.getOrderTime()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
this.orderStatus = orderHistoryDto.getOrderStatus(); this.orderStatus = orderHistoryDto.getOrderStatus();
this.storeId = orderHistoryDto.getStoreId();
this.storeName = orderHistoryDto.getStoreName(); this.storeName = orderHistoryDto.getStoreName();
this.orderPrice = orderHistoryDto.getPrice(); this.orderPrice = orderHistoryDto.getPrice();
this.orderItems = orderHistoryDto.getOrderItems() this.orderItems = orderHistoryDto.getOrderItems()

View File

@@ -92,6 +92,7 @@ class OrderCustomerApiControllerTest {
fieldWithPath("data.orders[*].orderTime").description("주문 시간 [yyyy-MM-dd HH:mm]"), fieldWithPath("data.orders[*].orderTime").description("주문 시간 [yyyy-MM-dd HH:mm]"),
fieldWithPath("data.orders[*].orderPrice").description("합계"), fieldWithPath("data.orders[*].orderPrice").description("합계"),
fieldWithPath("data.orders[*].orderStatus").description("주문 상태"), fieldWithPath("data.orders[*].orderStatus").description("주문 상태"),
fieldWithPath("data.orders[*].orderStatus").description("매장 고유번호"),
fieldWithPath("data.orders[*].storeName").description("매장 이름"), fieldWithPath("data.orders[*].storeName").description("매장 이름"),
fieldWithPath("data.orders[*].orderItems[*].orderItemId").description("주문 아이템 고유번호"), fieldWithPath("data.orders[*].orderItems[*].orderItemId").description("주문 아이템 고유번호"),
fieldWithPath("data.orders[*].orderItems[*].orderItemName").description("주문 아이템 이름"), fieldWithPath("data.orders[*].orderItems[*].orderItemName").description("주문 아이템 이름"),