From 1693ee31677b2ad8764adc28d6b932bff9820d71 Mon Sep 17 00:00:00 2001 From: yml Date: Sun, 24 May 2026 16:38:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E8=AE=A2=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E4=B8=8E=E9=92=B1=E5=8C=85=E5=85=85=E5=80=BC=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/orders.ts | 5 ++ frontend/src/api/wallet.ts | 5 ++ frontend/src/utils/statusLabels.ts | 1 + .../src/views/account/OrderDetailView.vue | 22 ++++++++- frontend/src/views/account/OrdersView.vue | 38 ++++++++++++-- frontend/src/views/account/WalletView.vue | 49 ++++++++++++++++++- frontend/src/views/admin/AdminOrdersView.vue | 1 + .../views/mobile/MobileListingDetailView.vue | 2 +- .../src/views/mobile/MobileOrdersView.vue | 39 ++++++++++++++- .../src/views/public/ListingDetailView.vue | 4 +- 10 files changed, 155 insertions(+), 11 deletions(-) diff --git a/frontend/src/api/orders.ts b/frontend/src/api/orders.ts index b15b8ff..e5dba1e 100644 --- a/frontend/src/api/orders.ts +++ b/frontend/src/api/orders.ts @@ -50,6 +50,11 @@ export async function createOrder(listingId: number) { return data.data } +export async function payOrder(id: number) { + const { data } = await apiClient.post>(`/orders/${id}/pay`) + return data.data +} + export async function fetchOrders() { const { data } = await apiClient.get>('/orders') return data.data.items diff --git a/frontend/src/api/wallet.ts b/frontend/src/api/wallet.ts index 7ada290..781d248 100644 --- a/frontend/src/api/wallet.ts +++ b/frontend/src/api/wallet.ts @@ -37,3 +37,8 @@ export async function fetchWalletLedger() { const { data } = await apiClient.get>('/wallet/ledger') return data.data.items } + +export async function rechargeWallet(amount: number) { + const { data } = await apiClient.post>('/wallet/recharge', { amount }) + return data.data +} diff --git a/frontend/src/utils/statusLabels.ts b/frontend/src/utils/statusLabels.ts index 099a43e..f6594e4 100644 --- a/frontend/src/utils/statusLabels.ts +++ b/frontend/src/utils/statusLabels.ts @@ -15,6 +15,7 @@ const listingReviewStatusMap: Record = { const orderStatusMap: Record = { pending_confirm: '待确认', + pending_payment: '待支付', pending_handoff: '待交接', renting: '使用中', overdue: '已逾期', diff --git a/frontend/src/views/account/OrderDetailView.vue b/frontend/src/views/account/OrderDetailView.vue index a2f7aa1..e3ac2ca 100644 --- a/frontend/src/views/account/OrderDetailView.vue +++ b/frontend/src/views/account/OrderDetailView.vue @@ -11,6 +11,7 @@ import { confirmReturn, fetchHandoffRecords, fetchOrder, + payOrder, submitHandoff, submitReturn, type HandoffRecord, @@ -25,6 +26,7 @@ const router = useRouter() const session = useSessionStore() const loading = ref(false) const cancelling = ref(false) +const paying = ref(false) const handoffing = ref(false) const confirming = ref(false) const returning = ref(false) @@ -72,6 +74,20 @@ async function handleCancel() { } } +async function handlePay() { + if (!order.value) return + paying.value = true + try { + await payOrder(order.value.id) + ElMessage.success('支付成功,等待号主交接') + await loadOrder() + } catch (error) { + ElMessage.error(readError(error, '支付失败')) + } finally { + paying.value = false + } +} + async function handleSubmitHandoff() { if (!order.value) return handoffing.value = true @@ -210,7 +226,11 @@ function readError(error: unknown, fallback: string) {

开始:{{ formatDateTime(order.rent_start_at, '未开始') }}

预计截止:{{ formatDateTime(order.rent_end_at, '未设置') }}

- +

订单待支付,支付后账号进入交接流程。

+ + 支付订单 + + 取消订单并释放账号
diff --git a/frontend/src/views/account/OrdersView.vue b/frontend/src/views/account/OrdersView.vue index 5278081..199bcac 100644 --- a/frontend/src/views/account/OrdersView.vue +++ b/frontend/src/views/account/OrdersView.vue @@ -1,11 +1,13 @@