diff --git a/openspec/changes/update-payment-merchant-pool-response-display/proposal.md b/openspec/changes/update-payment-merchant-pool-response-display/proposal.md new file mode 100644 index 0000000..96828c5 --- /dev/null +++ b/openspec/changes/update-payment-merchant-pool-response-display/proposal.md @@ -0,0 +1,11 @@ +# Change: 补齐支付商户池新增响应字段展示 + +## Why + +支付商户池接口新增启用成员数、当前命中商户和最近失败调查字段,前端类型及列表/详情尚未完整展示。 + +## What Changes + +- 扩展商户池响应类型。 +- 商户池列表和详情展示新增运行状态与最近失败字段。 +- 保持现有代理充值新增参数在列表和详情中的展示。 diff --git a/openspec/changes/update-payment-merchant-pool-response-display/specs/payment-merchant-pool/spec.md b/openspec/changes/update-payment-merchant-pool-response-display/specs/payment-merchant-pool/spec.md new file mode 100644 index 0000000..1661035 --- /dev/null +++ b/openspec/changes/update-payment-merchant-pool-response-display/specs/payment-merchant-pool/spec.md @@ -0,0 +1,10 @@ +## ADDED Requirements + +### Requirement: Payment Merchant Pool Runtime Fields + +The merchant pool list and detail pages SHALL display enabled member count, total member count, current routed merchant, and the latest failure investigation fields returned by the backend. + +#### Scenario: Display pool runtime information + +- **WHEN** the pool list or detail response contains runtime fields +- **THEN** the frontend MUST display them without deriving values from stale member data diff --git a/openspec/changes/update-payment-merchant-pool-response-display/tasks.md b/openspec/changes/update-payment-merchant-pool-response-display/tasks.md new file mode 100644 index 0000000..97730d2 --- /dev/null +++ b/openspec/changes/update-payment-merchant-pool-response-display/tasks.md @@ -0,0 +1,9 @@ +## 1. Implementation + +- [x] 1.1 扩展商户池类型。 +- [x] 1.2 更新商户池列表和详情字段。 +- [x] 1.3 校验代理充值列表/详情新增字段展示。 + +## 2. Verification + +- [x] 2.1 运行类型检查、lint、构建和 OpenSpec 校验。 diff --git a/src/types/api/paymentMerchantPools.ts b/src/types/api/paymentMerchantPools.ts index 5ac9351..aacc747 100644 --- a/src/types/api/paymentMerchantPools.ts +++ b/src/types/api/paymentMerchantPools.ts @@ -85,6 +85,10 @@ export interface PaymentMerchantPool { name: string payment_method: PaymentMerchantMethod member_ids: number[] + member_count?: number + enabled_member_count?: number + current_merchant_id?: number | null + current_merchant_name?: string | null enabled: boolean strategy: PaymentPoolStrategy statistic_cycle: PaymentStatisticCycle @@ -97,6 +101,11 @@ export interface PaymentMerchantPool { remark: string created_at: string updated_at: string + last_failure_merchant_id?: number | null + last_failure_payment_id?: number | null + last_failure_payment_no?: string | null + last_failure_reason?: string | null + last_failure_at?: string | null } export interface PaymentMerchantPoolQueryParams extends PaginationParams { diff --git a/src/views/settings/payment-merchant-pools/components/PoolManagement.vue b/src/views/settings/payment-merchant-pools/components/PoolManagement.vue index 0f7723d..c62ba45 100644 --- a/src/views/settings/payment-merchant-pools/components/PoolManagement.vue +++ b/src/views/settings/payment-merchant-pools/components/PoolManagement.vue @@ -286,7 +286,8 @@ ? h( 'span', { - style: 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;', + style: + 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;', onClick: (event: MouseEvent) => { event.stopPropagation() handleNameClick(row) @@ -306,7 +307,22 @@ label: '成员数量', prop: 'member_ids', width: 110, - formatter: (row: PaymentMerchantPool) => `${row.member_ids.length} 个` + formatter: (row: PaymentMerchantPool) => + `${row.enabled_member_count ?? '-'} / ${row.member_count ?? row.member_ids.length}` + }, + { + label: '当前命中商户', + prop: 'current_merchant_name', + minWidth: 150, + showOverflowTooltip: true, + formatter: (row: PaymentMerchantPool) => row.current_merchant_name || '-' + }, + { + label: '最近失败原因', + prop: 'last_failure_reason', + minWidth: 180, + showOverflowTooltip: true, + formatter: (row: PaymentMerchantPool) => row.last_failure_reason || '-' }, { label: '启停状态', diff --git a/src/views/settings/payment-merchant-pools/pool-detail.vue b/src/views/settings/payment-merchant-pools/pool-detail.vue index cef793a..8042fa3 100644 --- a/src/views/settings/payment-merchant-pools/pool-detail.vue +++ b/src/views/settings/payment-merchant-pools/pool-detail.vue @@ -103,7 +103,8 @@ }, { label: '成员数量', - formatter: (_, data) => `${(data.member_ids || []).length} 个` + formatter: (_, data) => + `${data.enabled_member_count ?? '-'} / ${data.member_count ?? (data.member_ids || []).length}` }, { label: '成员商户', @@ -165,7 +166,19 @@ if (!data) return [] const fields: DetailField[] = [ - { label: '路由世代', formatter: (_, row) => `v${row.routing_epoch}` } + { label: '路由世代', formatter: (_, row) => `v${row.routing_epoch}` }, + { label: '当前命中商户', formatter: (_, row) => row.current_merchant_name || '-' }, + { label: '最近失败商户ID', formatter: (_, row) => row.last_failure_merchant_id || '-' }, + { label: '最近失败支付单号', formatter: (_, row) => row.last_failure_payment_no || '-' }, + { + label: '最近失败原因', + formatter: (_, row) => row.last_failure_reason || '-', + fullWidth: true + }, + { + label: '最近失败时间', + formatter: (_, row) => (row.last_failure_at ? formatDateTime(row.last_failure_at) : '-') + } ] if (data.created_at) {