商品已完成优化
This commit is contained in:
@@ -473,6 +473,7 @@ function formatQuantity(value: number) {
|
||||
<el-option label="已上架" value="published" />
|
||||
<el-option label="已锁定" value="rented" />
|
||||
<el-option label="已下架" value="offline" />
|
||||
<el-option label="已完成" value="completed" />
|
||||
<el-option label="异常" value="abnormal" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -190,6 +190,11 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
loading.value = true
|
||||
try {
|
||||
const listing = await fetchSellerListing(editListingID.value)
|
||||
if (listing.status === 'completed') {
|
||||
options.notifyError('该商品订单已完成,不能再次编辑')
|
||||
await router.push(options.submitSuccessPath)
|
||||
return
|
||||
}
|
||||
applyListingToForm(listing)
|
||||
} catch (error) {
|
||||
options.notifyError(readError(error, '商品信息加载失败'))
|
||||
|
||||
@@ -44,6 +44,11 @@ const stats = computed(() => [
|
||||
label: '已下架',
|
||||
value: listings.value.filter(item => item.status === 'offline').length,
|
||||
},
|
||||
{
|
||||
key: 'completed',
|
||||
label: '已完成',
|
||||
value: listings.value.filter(item => item.status === 'completed').length,
|
||||
},
|
||||
])
|
||||
|
||||
onMounted(loadListings)
|
||||
@@ -124,15 +129,15 @@ function coinText(row: Listing) {
|
||||
}
|
||||
|
||||
function canSubmit(row: Listing) {
|
||||
return !isPendingReview(row) && row.status !== 'rented' && row.status !== 'published'
|
||||
return !isTerminalListing(row) && !isPendingReview(row) && row.status !== 'published'
|
||||
}
|
||||
|
||||
function canEdit(row: Listing) {
|
||||
return !isPendingReview(row) && row.status !== 'rented' && row.status !== 'published'
|
||||
return !isTerminalListing(row) && !isPendingReview(row) && row.status !== 'published'
|
||||
}
|
||||
|
||||
function canOffline(row: Listing) {
|
||||
return row.status !== 'rented' && row.status !== 'offline'
|
||||
return !isTerminalListing(row) && row.status !== 'offline'
|
||||
}
|
||||
|
||||
function editPath(row: Listing) {
|
||||
@@ -146,6 +151,7 @@ function statusTone(status: string) {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
offline: 'muted',
|
||||
completed: 'success',
|
||||
rented: 'warning',
|
||||
abnormal: 'danger',
|
||||
}
|
||||
@@ -166,8 +172,16 @@ function effectiveReviewStatus(row: Listing) {
|
||||
return row.status === 'offline' ? 'none' : row.review_status
|
||||
}
|
||||
|
||||
function showReviewStatus(row: Listing) {
|
||||
return row.status !== 'completed'
|
||||
}
|
||||
|
||||
function isTerminalListing(row: Listing) {
|
||||
return row.status === 'rented' || row.status === 'completed'
|
||||
}
|
||||
|
||||
function isPendingReview(row: Listing) {
|
||||
return row.status !== 'offline' && row.review_status === 'pending'
|
||||
return !isTerminalListing(row) && row.status !== 'offline' && row.review_status === 'pending'
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -218,7 +232,11 @@ function isPendingReview(row: Listing) {
|
||||
<span class="status-pill" :class="statusTone(item.status)">{{
|
||||
listingStatusLabel(item.status)
|
||||
}}</span>
|
||||
<span class="status-pill" :class="reviewTone(effectiveReviewStatus(item))">
|
||||
<span
|
||||
v-if="showReviewStatus(item)"
|
||||
class="status-pill"
|
||||
:class="reviewTone(effectiveReviewStatus(item))"
|
||||
>
|
||||
{{ listingReviewStatusLabel(effectiveReviewStatus(item)) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
export const listingStatuses = ['draft', 'published', 'rented', 'offline', 'abnormal'] as const
|
||||
export const listingStatuses = [
|
||||
'draft',
|
||||
'published',
|
||||
'rented',
|
||||
'offline',
|
||||
'completed',
|
||||
'abnormal',
|
||||
] as const
|
||||
export type ListingStatus = (typeof listingStatuses)[number]
|
||||
|
||||
export const listingReviewStatuses = ['none', 'pending', 'approved', 'rejected'] as const
|
||||
|
||||
@@ -18,6 +18,7 @@ const listingStatusMap: Record<ListingStatus, string> = {
|
||||
published: '已上架',
|
||||
rented: '租用中',
|
||||
offline: '已下架',
|
||||
completed: '已完成',
|
||||
abnormal: '异常',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user