From b8694dc00a9d006a0a3a7f3045a426e0b4e72568 Mon Sep 17 00:00:00 2001 From: 1that Date: Sat, 21 Dec 2024 17:57:05 +0300 Subject: [PATCH] fix order detail --- frontend/src/ui/uikit/items/OrderDetail.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/ui/uikit/items/OrderDetail.vue b/frontend/src/ui/uikit/items/OrderDetail.vue index ac48f47..bfe921b 100644 --- a/frontend/src/ui/uikit/items/OrderDetail.vue +++ b/frontend/src/ui/uikit/items/OrderDetail.vue @@ -2,31 +2,33 @@ import { ref, onMounted } from 'vue' import { useRoute } from 'vue-router' import Order from '../../../api/models/order' -import { getOrderById } from '../../../api/request'; +import { getOrderById } from '../../../api/request' -const route = useRoute(); -const orderId = route.params.id as string; -const order = ref(); +const route = useRoute() +const orderId = route.params.order_id as string +const order = ref(null) onMounted(() => { getOrderById(orderId) .then((response) => { order.value = response console.log(order.value) + const date = new Date(order.value.date_time) + order.value.date_time = date }) }) function formatDate(dateTime: string): string { - const date = new Date(dateTime); - const month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1; - const minutes = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes(); - return `${date.getDate()}.${month}.${date.getFullYear()} ${date.getHours()}:${minutes}`; + const date = new Date(dateTime) + const month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1 + const minutes = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes() + return `${date.getDate()}.${month}.${date.getFullYear()} ${date.getHours()}:${minutes}` }