parent
26efdc42fc
commit
4e54dc8422
|
|
@ -67,7 +67,11 @@
|
|||
{{ row.gender === '1' ? '男' : row.gender === '2' ? '女' : '未知' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="birthday" label="出生日期" width="110" />
|
||||
<el-table-column prop="birthday" label="出生日期" width="110">
|
||||
<template #default="{ row }">
|
||||
{{ formatBirthday(row.birthday) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="identityType" label="身份类型" width="85" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.identityType === '1' ? 'success' : 'warning'">
|
||||
|
|
@ -180,6 +184,22 @@ const formatRegisterSource = (source) => {
|
|||
return map[source] || source
|
||||
}
|
||||
|
||||
// 格式化出生日期(只显示年月日)
|
||||
const formatBirthday = (birthday) => {
|
||||
if (!birthday) return ''
|
||||
// 如果已经是 YYYY-MM-DD 格式,直接返回前10位
|
||||
if (typeof birthday === 'string' && birthday.length >= 10) {
|
||||
return birthday.substring(0, 10)
|
||||
}
|
||||
// 如果是 Date 对象或时间戳
|
||||
const d = new Date(birthday)
|
||||
if (isNaN(d.getTime())) return birthday
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
// 获取会员列表
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
|
|
|
|||
Loading…
Reference in New Issue