2023-08-22 16:14:25 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div v-loading="loading">
|
|
|
|
|
<el-row :gutter="10" class="detail-info-warp">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<!-- 左上角:基本信息 -->
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-col :span="14" class="detail-info-item">
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="card-header">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<!-- TODO @梦:如果不要小蓝线,是不是直接用 el-card 自带的 title 即可? -->
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<CardTitle title="基本信息" />
|
|
|
|
|
<el-button
|
2023-08-23 01:41:25 +08:00
|
|
|
|
v-if="user.id"
|
2023-08-22 16:14:25 +08:00
|
|
|
|
type="primary"
|
2023-08-23 01:41:25 +08:00
|
|
|
|
size="small"
|
2023-08-22 16:14:25 +08:00
|
|
|
|
text
|
2023-08-23 01:41:25 +08:00
|
|
|
|
@click="openForm('update', user.id)"
|
2023-08-22 16:14:25 +08:00
|
|
|
|
>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
编辑
|
|
|
|
|
</el-button>
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="4">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<ElAvatar shape="square" :size="140" :src="user.avatar || undefined" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="20">
|
|
|
|
|
<el-descriptions :column="2">
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:user" />
|
|
|
|
|
用户名
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.name || '空' }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:user" />
|
|
|
|
|
昵称
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.nickname }}
|
|
|
|
|
</el-descriptions-item>
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-descriptions-item label="手机号">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:phone" />
|
|
|
|
|
手机号
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.mobile }}
|
|
|
|
|
</el-descriptions-item>
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="fa:mars-double" />
|
|
|
|
|
性别
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="user.sex" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:location" />
|
|
|
|
|
所在地
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<!-- TODO @梦:这里后端返回的时候,要返回 areaName -->
|
|
|
|
|
{{ user.areaId }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:position" />
|
2023-08-23 01:41:25 +08:00
|
|
|
|
注册 IP
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.registerIp }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="fa:birthday-cake" />
|
|
|
|
|
生日
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.birthday ? formatDate(user.birthday) : '空' }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:calendar" />
|
|
|
|
|
注册时间
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.createTime ? formatDate(user.createTime) : '空' }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="cell-item">
|
|
|
|
|
<Icon icon="ep:calendar" />
|
|
|
|
|
最后登录时间
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
{{ user.loginDate ? formatDate(user.loginDate) : '空' }}
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
|
|
|
|
|
<!-- 右上角:账户信息 -->
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-col :span="10" class="detail-info-item">
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<CardTitle title="账户信息" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</template>
|
|
|
|
|
<AccountInfo />
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
|
|
|
|
|
<!-- 下边:账户明细 -->
|
|
|
|
|
<!-- TODO 芋艿:【收货地址】【订单管理】【售后管理】【收藏记录】【优惠劵】 -->
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-card header="账户明细" style="width: 100%; margin-top: 20px" shadow="never">
|
|
|
|
|
<template #header>
|
|
|
|
|
<CardTitle title="账户明细" />
|
|
|
|
|
</template>
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<el-tabs v-model="activeName">
|
2023-08-22 16:14:25 +08:00
|
|
|
|
<el-tab-pane label="积分" name="point">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<PointList v-if="user.id" :member-id="user.id" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="签到" name="sign">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
<SignList v-if="user.id" :member-id="user.id" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="成长值" name="third">成长值(WIP)</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="余额" name="fourth">余额(WIP)</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
2023-08-23 13:40:57 +08:00
|
|
|
|
<UserForm ref="formRef" v-if="user.id" @success="getUserData(user.id)" />
|
2023-08-22 16:14:25 +08:00
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2023-08-23 13:40:57 +08:00
|
|
|
|
import PointList from '@/views/member/user/components/PointList.vue'
|
|
|
|
|
import SignList from '@/views/member/user/components/SignList.vue'
|
|
|
|
|
import CardTitle from '@/views/member/user/components/CardTitle.vue'
|
|
|
|
|
import * as UserApi from '@/api/member/user'
|
2023-08-22 16:14:25 +08:00
|
|
|
|
import { formatDate } from '@/utils/formatTime'
|
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import UserForm from '@/views/member/user/UserForm.vue'
|
2023-08-23 01:41:25 +08:00
|
|
|
|
// TODO @梦:把用户信息,也抽成一个组件,类似 AccountInfo
|
2023-08-23 13:40:57 +08:00
|
|
|
|
import AccountInfo from '@/views/member/user/components/AccountInfo.vue'
|
2023-08-23 01:41:25 +08:00
|
|
|
|
|
2023-08-22 16:14:25 +08:00
|
|
|
|
defineOptions({ name: 'MemberDetail' })
|
|
|
|
|
|
2023-08-23 01:41:25 +08:00
|
|
|
|
const activeName = ref('point') // 账户明细 选中的 tabs
|
|
|
|
|
const loading = ref(true) // 加载中
|
2023-08-23 13:40:57 +08:00
|
|
|
|
let user = ref<UserApi.UserBaseInfoVO>({
|
2023-08-22 16:14:25 +08:00
|
|
|
|
areaId: undefined,
|
|
|
|
|
avatar: undefined,
|
|
|
|
|
birthday: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
|
id: undefined,
|
|
|
|
|
loginDate: undefined,
|
|
|
|
|
loginIp: '',
|
|
|
|
|
mark: '',
|
|
|
|
|
mobile: '',
|
|
|
|
|
name: '',
|
|
|
|
|
nickname: '',
|
|
|
|
|
password: null,
|
|
|
|
|
registerIp: undefined,
|
|
|
|
|
sex: 0,
|
|
|
|
|
status: 0
|
|
|
|
|
})
|
|
|
|
|
|
2023-08-23 01:41:25 +08:00
|
|
|
|
/** 获得用户 */
|
|
|
|
|
const getUserData = async (id: number) => {
|
2023-08-22 16:14:25 +08:00
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
2023-08-23 13:40:57 +08:00
|
|
|
|
user.value = await UserApi.getUser(id)
|
2023-08-22 16:14:25 +08:00
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-23 01:41:25 +08:00
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const openForm = (type: string, id?: number) => {
|
|
|
|
|
formRef.value.open(type, id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化 */
|
2023-08-22 16:14:25 +08:00
|
|
|
|
const route = useRoute()
|
2023-08-23 01:41:25 +08:00
|
|
|
|
const router = useRouter()
|
2023-08-23 13:12:05 +08:00
|
|
|
|
const member_id = route.params.member_id as number
|
2023-08-22 16:14:25 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
if (!member_id) {
|
2023-08-23 01:41:25 +08:00
|
|
|
|
// TODO
|
|
|
|
|
ElMessage.warning('参数错误,会员编号不能为空!')
|
2023-08-22 16:14:25 +08:00
|
|
|
|
router.back()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
getUserData(member_id)
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped lang="css">
|
2023-08-23 01:41:25 +08:00
|
|
|
|
/** TODO 这 3 个 css 貌似没用? */
|
2023-08-22 16:14:25 +08:00
|
|
|
|
.detail-info-item:first-child {
|
|
|
|
|
padding-left: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
/* first-child 不生效有没有大佬给看下q.q */
|
|
|
|
|
.detail-info-item:nth-child(2) {
|
|
|
|
|
padding-right: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
.card-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.cell-item {
|
|
|
|
|
display: inline;
|
|
|
|
|
}
|
2023-08-23 01:41:25 +08:00
|
|
|
|
/** TODO 下面 css 貌似没啥用? */
|
2023-08-22 16:14:25 +08:00
|
|
|
|
.cell-item::after {
|
|
|
|
|
content: ':';
|
|
|
|
|
}
|
|
|
|
|
</style>
|