fetch(add): 账户管理
This commit is contained in:
@@ -183,3 +183,15 @@ export function formatDateTime(
|
||||
.replace('mm', minutes)
|
||||
.replace('ss', seconds)
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化费率(基点 -> 百分比)
|
||||
* @param basisPoints 费率基点(100基点=1%)
|
||||
* @param decimal 保留小数位数
|
||||
*/
|
||||
export function formatFeeRate(basisPoints: number | undefined, decimal = 2): string {
|
||||
if (basisPoints === undefined || basisPoints === null) return '-'
|
||||
|
||||
const percentage = (basisPoints / 100).toFixed(decimal)
|
||||
return `${percentage}%`
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@ export function validateEmail(email: string): boolean {
|
||||
* @param idCard 身份证号
|
||||
*/
|
||||
export function validateIdCard(idCard: string): boolean {
|
||||
return /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(
|
||||
idCard
|
||||
)
|
||||
return /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(idCard)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user