
// 格式化金额显示
export const formatCurrency = (value: number) => {
	return Number(value || 0)?.toLocaleString();
};

export const formatIdCard = (idCard: string, showFull: boolean = false) => {
	if (showFull) return idCard;
	if (!idCard) return '';
	if (idCard.length < 8) return idCard;
	return `${idCard.substring(0, 4)}********${idCard.substring(idCard.length - 4)}`;
};

export const formatBankCard = (bankCard: string, showFull: boolean = false) => {
	if (showFull) return bankCard;
	if (!bankCard) return '';
	if (bankCard.length < 4) return bankCard;
	return `**** **** **** ${bankCard.substring(bankCard.length - 4)}`;
};

export const formatPhone = (phone: string, showFull: boolean = false) => {
	if (showFull) return phone;
	if (!phone) return '';
	if (phone.length < 4) return phone;
	return `${phone.substring(0, 3)}****${phone.substring(phone.length - 4)}`;
};
