完善号主订单交接待办入口
This commit is contained in:
@@ -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<Order[]>([])
|
||||
const payingOrderId = ref<number | null>(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 '-'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -55,6 +63,9 @@ function readError(error: unknown, fallback: string) {
|
||||
<el-table-column prop="title" label="账号" min-width="180" />
|
||||
<el-table-column prop="rent_amount" label="订单金额" width="100" />
|
||||
<el-table-column prop="deposit_amount" label="押金" width="100" />
|
||||
<el-table-column label="身份" width="80">
|
||||
<template #default="{ row }">{{ orderRole(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="140">
|
||||
<template #default="{ row }">{{ orderStatusLabel(row.status) }}</template>
|
||||
</el-table-column>
|
||||
@@ -64,6 +75,7 @@ function readError(error: unknown, fallback: string) {
|
||||
v-if="row.status === 'pending_payment'"
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="row.renter_id !== session.userId"
|
||||
:loading="payingOrderId === row.id"
|
||||
@click="handlePay(row)"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user