优化发布等各种状态

This commit is contained in:
yml2213
2026-05-23 15:52:44 +08:00
parent f2492d5e40
commit b101415e9d
25 changed files with 368 additions and 70 deletions
@@ -3,6 +3,7 @@ import { ElMessage } from 'element-plus'
import { onMounted, ref } from 'vue'
import { fetchSellerListings, offlineListing, submitListingReview, type Listing } from '@/api/listings'
import { listingReviewStatusLabel, listingStatusLabel } from '@/utils/statusLabels'
const loading = ref(false)
const listings = ref<Listing[]>([])
@@ -19,8 +20,12 @@ async function loadListings() {
}
async function submitReview(id: number) {
await submitListingReview(id)
ElMessage.success('已提交审核,等待后台处理')
const listing = await submitListingReview(id)
ElMessage.success(
listing.status === 'published' && listing.review_status === 'approved'
? '已上架'
: '已提交审核,等待后台处理',
)
await loadListings()
}
@@ -56,12 +61,20 @@ function listingPrice(row: Listing) {
<template #default="{ row }">{{ listingPrice(row) }}</template>
</el-table-column>
<el-table-column prop="deposit_amount" label="押金" width="100" />
<el-table-column prop="status" label="状态" width="110" />
<el-table-column prop="review_status" label="审核" width="110" />
<el-table-column label="状态" width="110">
<template #default="{ row }">{{ listingStatusLabel(row.status) }}</template>
</el-table-column>
<el-table-column label="审核" width="110">
<template #default="{ row }">{{ listingReviewStatusLabel(row.review_status) }}</template>
</el-table-column>
<el-table-column prop="review_reason" label="审核原因" min-width="160" show-overflow-tooltip />
<el-table-column label="操作" width="190">
<template #default="{ row }">
<el-button size="small" :disabled="row.review_status === 'pending' || row.status === 'rented'" @click="submitReview(row.id)">
<el-button
size="small"
:disabled="row.review_status === 'pending' || row.status === 'rented' || row.status === 'published'"
@click="submitReview(row.id)"
>
提审
</el-button>
<el-button size="small" type="danger" :disabled="row.status === 'rented'" @click="offline(row.id)">下架</el-button>