From 8c619b37c89d070ed1844ab4eda123071be35121 Mon Sep 17 00:00:00 2001 From: yml Date: Sun, 24 May 2026 19:18:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8F=B7=E4=B8=BB=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BA=A4=E6=8E=A5=E5=BE=85=E5=8A=9E=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/modules/order/repository.go | 2 +- frontend/src/views/account/OrdersView.vue | 12 ++ .../src/views/mobile/MobileOrdersView.vue | 4 +- .../src/views/seller/SellerHandoffsView.vue | 125 +++++++++++++++++- 4 files changed, 137 insertions(+), 6 deletions(-) diff --git a/backend/internal/modules/order/repository.go b/backend/internal/modules/order/repository.go index 40814e5..2a19edb 100644 --- a/backend/internal/modules/order/repository.go +++ b/backend/internal/modules/order/repository.go @@ -605,7 +605,7 @@ func (r *Repository) AcceptCheckout(userID uint64, orderID uint64) error { func (r *Repository) ListForUser(userID uint64) ([]OrderDTO, error) { var rows []orderRow err := r.baseQuery(). - Where("o.renter_id = ?", userID). + Where("o.renter_id = ? OR o.owner_id = ?", userID, userID). Order("o.id DESC"). Scan(&rows).Error if err != nil { diff --git a/frontend/src/views/account/OrdersView.vue b/frontend/src/views/account/OrdersView.vue index 199bcac..2b6196a 100644 --- a/frontend/src/views/account/OrdersView.vue +++ b/frontend/src/views/account/OrdersView.vue @@ -3,11 +3,13 @@ import { onMounted, ref } from 'vue' import { ElMessage } from 'element-plus' import { fetchOrders, payOrder, type Order } from '@/api/orders' +import { useSessionStore } from '@/stores/session' import { orderStatusLabel } from '@/utils/statusLabels' const loading = ref(false) const orders = ref([]) const payingOrderId = ref(null) +const session = useSessionStore() onMounted(loadOrders) @@ -40,6 +42,12 @@ function readError(error: unknown, fallback: string) { } return fallback } + +function orderRole(order: Order) { + if (order.renter_id === session.userId) return '买家' + if (order.owner_id === session.userId) return '号主' + return '-' +}