优化支付日志和配置删除提示

This commit is contained in:
yml
2026-06-18 22:16:09 +08:00
parent fa14e0e36d
commit 9b06673efb
15 changed files with 381 additions and 92 deletions
@@ -19,6 +19,7 @@ export interface PaymentConfig {
status: string
environment: string
business_tags: string[] | null
reference_count: number
total_transactions: number
total_amount_cent: number
last_used_at: string | null
@@ -289,11 +289,12 @@ function tableRowClassName({ row }: { row: PaymentConfig }) {
}
function canDeleteConfig(row: PaymentConfig) {
return row.total_transactions <= 0
return (row.reference_count || 0) <= 0
}
function deleteDisabledReason(row: PaymentConfig) {
return canDeleteConfig(row) ? '删除配置' : '已有交易记录,需要保留用于退款、查询和回调验签'
if (canDeleteConfig(row)) return '删除配置'
return `已有 ${row.reference_count || 0} 条支付记录引用,需要保留用于退款、查询和回调验签`
}
</script>
@@ -420,10 +421,13 @@ function deleteDisabledReason(row: PaymentConfig) {
<span v-else class="standby-badge">备用</span>
</template>
</el-table-column>
<el-table-column label="成功支付" min-width="150">
<el-table-column label="支付记录" min-width="150">
<template #default="{ row }">
<div class="usage-cell">
<div>成功: {{ row.total_transactions }} </div>
<div :class="{ 'usage-reference-locked': (row.reference_count || 0) > 0 }">
引用: {{ row.reference_count || 0 }}
</div>
<div>金额: ¥{{ formatAmount(row.total_amount_cent) }}</div>
</div>
</template>
@@ -661,6 +665,11 @@ function deleteDisabledReason(row: PaymentConfig) {
white-space: nowrap;
}
.usage-reference-locked {
color: #dc2626;
font-weight: 600;
}
.action-buttons {
display: flex;
align-items: center;