修复(用户详情): 会员状态按中文展示名渲染
- membershipDisplay 新增 formatMembershipStatus(normal→非会员、active→生效中,未知值原样返回) - AdminUserDetailDialog 不再直接渲染后端 status token
This commit is contained in:
@@ -29,6 +29,7 @@ import type {
|
||||
import {
|
||||
formatMembershipCycleKind,
|
||||
formatMembershipPlan,
|
||||
formatMembershipStatus,
|
||||
} from '../config/membershipDisplay';
|
||||
import { useAdminWriteConfirm } from './useAdminWriteConfirm';
|
||||
|
||||
@@ -541,7 +542,7 @@ function MembershipSection({
|
||||
}) {
|
||||
const metrics: Array<[string, string]> = [
|
||||
['档位', `${formatMembershipPlan(membership.plan)}(${membership.plan})`],
|
||||
['状态', membership.status || '-'],
|
||||
['状态', formatMembershipStatus(membership.status) || '-'],
|
||||
[
|
||||
'账期',
|
||||
`${formatMembershipCycleKind(membership.cycleKind)} 第 ${membership.cycleIndex}/${membership.cycleCount} 期`,
|
||||
|
||||
@@ -21,6 +21,12 @@ export const membershipCycleKindLabels: Record<
|
||||
yearly: '年付',
|
||||
};
|
||||
|
||||
/** 会员状态展示名;与后端 `RuntimeProfileMembershipStatus` 的 `normal` / `active` 对齐。 */
|
||||
export const membershipStatusLabels: Record<string, string> = {
|
||||
normal: '非会员',
|
||||
active: '生效中',
|
||||
};
|
||||
|
||||
/** 把后端的档位 code 映射成展示名,未知值原样返回。 */
|
||||
export function formatMembershipPlan(plan: string): string {
|
||||
return membershipPlanLabels[plan as ProfileMembershipPlan] ?? plan;
|
||||
@@ -30,3 +36,8 @@ export function formatMembershipPlan(plan: string): string {
|
||||
export function formatMembershipCycleKind(kind: string): string {
|
||||
return membershipCycleKindLabels[kind as ProfileMembershipCycleKind] ?? kind;
|
||||
}
|
||||
|
||||
/** 把后端的会员状态 code 映射成展示名,未知值原样返回。 */
|
||||
export function formatMembershipStatus(status: string): string {
|
||||
return membershipStatusLabels[status] ?? status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user