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
class="mx-auto mb-5"
outlined
>
<v-list-item three-line>
<v-list-item-content>
@@ -19,7 +18,7 @@
{{ card.orderItemNames }}
</div>
<div class="text--primary">
합계 : <b>{{ card.orderPrice }}</b>
합계 : <b>{{ card.orderPrice | currency }}</b>
</div>
</v-list-item-content>
@@ -33,11 +32,15 @@
</v-list-item>
<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 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>
</template>
@@ -47,12 +50,24 @@ export default {
name: "OrderHistoryCard",
props: {
card: {
storeId: Number,
storeName: String,
orderTime: String,
orderStatus: String,
orderItemNames: String,
orderPrice: String
}
},
methods: {
clickReOrder: function() {
this.$router.push({
name: "store",
params: {storeId: this.card.storeId}
})
},
clickDetail: function() {
alert("준비 중입니다.");
}
}
}
</script>

View File

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

View File

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

View File

@@ -60,6 +60,7 @@ public class OrderCustomerApiController {
private Long orderId;
private String orderTime;
private OrderStatus orderStatus;
private Long storeId;
private String storeName;
private Long orderPrice;
private List<_OrderItemResponse> orderItems;
@@ -69,6 +70,7 @@ public class OrderCustomerApiController {
this.orderTime = orderHistoryDto.getOrderTime()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
this.orderStatus = orderHistoryDto.getOrderStatus();
this.storeId = orderHistoryDto.getStoreId();
this.storeName = orderHistoryDto.getStoreName();
this.orderPrice = orderHistoryDto.getPrice();
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[*].orderPrice").description("합계"),
fieldWithPath("data.orders[*].orderStatus").description("주문 상태"),
fieldWithPath("data.orders[*].orderStatus").description("매장 고유번호"),
fieldWithPath("data.orders[*].storeName").description("매장 이름"),
fieldWithPath("data.orders[*].orderItems[*].orderItemId").description("주문 아이템 고유번호"),
fieldWithPath("data.orders[*].orderItems[*].orderItemName").description("주문 아이템 이름"),