feat: 预计最终到期时间展示新增具体
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m49s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m49s
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
import { formatDateTime } from './format'
|
||||
import type { ExpiryEstimateStatus } from '@/types/api'
|
||||
|
||||
export interface ExpiryEstimate {
|
||||
estimated_final_expires_at?: string | null
|
||||
days_until_final_expiry?: number | null
|
||||
expiry_estimate_status?: string | null
|
||||
expiry_estimate_status?: ExpiryEstimateStatus | null
|
||||
expiry_estimate_status_name?: string | null
|
||||
is_expiring?: boolean
|
||||
}
|
||||
|
||||
export const getExpiryEstimateText = (estimate: ExpiryEstimate): string => {
|
||||
if (estimate.expiry_estimate_status === 'exact') {
|
||||
return estimate.estimated_final_expires_at
|
||||
? formatDateTime(estimate.estimated_final_expires_at)
|
||||
: '-'
|
||||
switch (estimate.expiry_estimate_status) {
|
||||
case 'exact':
|
||||
return estimate.estimated_final_expires_at
|
||||
? formatDateTime(estimate.estimated_final_expires_at)
|
||||
: '-'
|
||||
case 'waiting_activation':
|
||||
return '待激活后起算'
|
||||
case 'invalid_data':
|
||||
return '数据异常'
|
||||
case 'none':
|
||||
default:
|
||||
return '-'
|
||||
}
|
||||
|
||||
return estimate.expiry_estimate_status ? '待激活后起算' : '-'
|
||||
}
|
||||
|
||||
export const getExpiryEstimateTooltip = (estimate: ExpiryEstimate): string => {
|
||||
|
||||
Reference in New Issue
Block a user