fix: some

This commit is contained in:
luo
2026-09-17 12:16:20 +08:00
parent 2308d82d0f
commit 76d4e4ec02
126 changed files with 11671 additions and 294 deletions

View File

@@ -34,7 +34,7 @@
import { ArrowLeft, Loading } from '@element-plus/icons-vue'
import { formatDateTime } from '@/utils/business/format'
import DetailPage from '@/components/common/DetailPage.vue'
import type { DetailSection } from '@/components/common/DetailPage.vue'
import type { DetailField, DetailSection } from '@/components/common/DetailPage.vue'
defineOptions({ name: 'ExchangeDetail' })
@@ -62,6 +62,16 @@
return types[status] || 'info'
}
const getMigrationStatusType = (migrationStatus?: string): TagProps['type'] => {
const types: Record<string, TagProps['type']> = {
not_migrated: 'info',
pending: 'warning',
migrated: 'success',
failed: 'danger'
}
return types[migrationStatus || ''] || 'info'
}
// 根据流程类型动态生成详情页配置
const detailSections = computed<DetailSection[]>(() => {
if (!exchangeDetail.value) return []
@@ -70,9 +80,7 @@
const sections: DetailSection[] = []
// 基本信息
sections.push({
title: '基本信息',
fields: [
const basicFields: DetailField[] = [
{ label: '换货单号', prop: 'exchange_no' },
{
label: '状态',
@@ -112,9 +120,28 @@
label: '继承归属店铺',
formatter: (_, data) =>
formatExchangeShopName(data.inherited_shop_name, data.inherited_shop_id)
},
{
label: '迁移状态',
render: (data) =>
data.migration_status
? h(
ElTag,
{ type: getMigrationStatusType(data.migration_status) },
() => data.migration_status_name || data.migration_status
)
: h('span', '--')
}
]
})
]
if (exchangeDetail.value.migration_status === 'failed') {
basicFields.push({
label: '迁移失败原因',
prop: 'migration_failure_reason',
formatter: (value) => value || '--',
fullWidth: true
})
}
sections.push({ title: '基本信息', fields: basicFields })
// 收货信息(仅物流换货显示)
if (flowType === 'shipping') {

View File

@@ -987,6 +987,19 @@
formatter: (row: ExchangeResponse) =>
h(ElTag, { type: getStatusType(row.status) }, () => row.status_name || '--')
},
{
prop: 'migration_status',
label: '迁移状态',
width: 130,
formatter: (row: ExchangeResponse) =>
row.migration_status
? h(
ElTag,
{ type: getMigrationStatusType(row.migration_status) },
() => row.migration_status_name || '--'
)
: '--'
},
{
prop: 'created_at',
label: '创建时间',
@@ -1006,6 +1019,18 @@
return types[status] || 'info'
}
const getMigrationStatusType = (
migrationStatus?: string
): 'success' | 'info' | 'warning' | 'danger' | 'primary' => {
const types: Record<string, 'success' | 'info' | 'warning' | 'danger' | 'primary'> = {
not_migrated: 'info',
pending: 'warning',
migrated: 'success',
failed: 'danger'
}
return types[migrationStatus || ''] || 'info'
}
const getAssetTypeName = (assetType?: string | null) => {
if (assetType === 'iot_card') return '物联网卡'
if (assetType === 'device') return '设备'
@@ -1638,7 +1663,9 @@
// 状态3(已发货待确认):确认完成
if (status === 3) {
if (hasAuth('exchange:complete')) {
// migration_status=failed 的重试仅超管/平台账号可操作,代理/企业不渲染入口(后端以 403/1005 兜底)
const canRetryFailed = row.migration_status !== 'failed' || userType === 1 || userType === 2
if (hasAuth('exchange:complete') && canRetryFailed) {
actions.push({
label: '确认完成',
handler: () => handleCompleteExchange(row),