ludu-admin-vue3/src/views/member/user/detail/index.vue

130 lines
4.2 KiB
Vue
Raw Normal View History

<template>
<div v-loading="loading">
<el-row :gutter="10">
2023-08-23 01:41:25 +08:00
<!-- 左上角基本信息 -->
<el-col :span="14" class="detail-info-item">
<UserBasicInfo :user="user">
<template #header>
<div class="card-header">
<CardTitle title="基本信息" />
2023-08-26 01:59:36 +08:00
<el-button type="primary" size="small" text @click="openForm('update')">
2023-08-23 01:41:25 +08:00
编辑
</el-button>
</div>
</template>
</UserBasicInfo>
</el-col>
2023-08-23 01:41:25 +08:00
<!-- 右上角账户信息 -->
<el-col :span="10" class="detail-info-item">
2023-09-30 13:55:42 +08:00
<el-card shadow="never" class="h-full">
<template #header>
2023-08-23 01:41:25 +08:00
<CardTitle title="账户信息" />
</template>
<UserAccountInfo :user="user" />
</el-card>
</el-col>
2023-08-23 01:41:25 +08:00
<!-- 下边账户明细 -->
2023-09-30 13:55:42 +08:00
<!-- TODO 芋艿订单管理售后管理收藏记录-->
<el-card header="账户明细" style="width: 100%; margin-top: 20px" shadow="never">
<template #header>
<CardTitle title="账户明细" />
</template>
2023-09-30 13:55:42 +08:00
<el-tabs>
<el-tab-pane label="积分">
2023-08-26 01:59:36 +08:00
<UserPointList :user-id="id" />
</el-tab-pane>
2023-09-30 13:55:42 +08:00
<el-tab-pane label="签到" lazy>
2023-08-26 01:59:36 +08:00
<UserSignList :user-id="id" />
</el-tab-pane>
2023-09-30 13:55:42 +08:00
<el-tab-pane label="成长值" lazy>
<UserExperienceRecordList :user-id="id" />
</el-tab-pane>
2023-09-27 23:30:09 +08:00
<!-- TODO @jason增加一个余额变化 -->
2023-09-30 13:55:42 +08:00
<el-tab-pane label="余额" lazy>余额(WIP)</el-tab-pane>
<el-tab-pane label="收货地址" lazy>
2023-08-26 01:59:36 +08:00
<UserAddressList :user-id="id" />
</el-tab-pane>
2023-09-30 13:55:42 +08:00
<el-tab-pane label="订单管理" lazy>
2023-09-09 10:06:32 +08:00
<UserOrderList :user-id="id" />
2023-09-05 10:15:12 +08:00
</el-tab-pane>
2023-09-30 13:55:42 +08:00
<el-tab-pane label="售后管理" lazy>售后管理(WIP)</el-tab-pane>
<el-tab-pane label="收藏记录" lazy>收藏记录(WIP)</el-tab-pane>
<el-tab-pane label="优惠劵" lazy>
<UserCouponList :user-id="id" />
</el-tab-pane>
2023-09-27 23:30:09 +08:00
<!-- TODO @疯狂增加获得分校用户直接查询出所有需要体现出是一级还是二级用户编号昵称级别绑定时间 -->
</el-tabs>
</el-card>
</el-row>
</div>
2023-08-26 01:59:36 +08:00
<!-- 表单弹窗添加/修改 -->
2023-08-26 01:59:36 +08:00
<UserForm ref="formRef" @success="getUserData(id)" />
</template>
<script setup lang="ts">
2023-08-23 13:40:57 +08:00
import * as UserApi from '@/api/member/user'
2023-08-26 01:59:36 +08:00
import { useTagsViewStore } from '@/store/modules/tagsView'
import UserForm from '@/views/member/user/UserForm.vue'
2023-08-26 01:59:36 +08:00
import UserAccountInfo from './UserAccountInfo.vue'
import UserAddressList from './UserAddressList.vue'
2023-09-30 13:55:42 +08:00
import UserBasicInfo from './UserBasicInfo.vue'
import UserCouponList from './UserCouponList.vue'
import UserExperienceRecordList from './UserExperienceRecordList.vue'
import UserOrderList from './UserOrderList.vue'
2023-08-26 01:59:36 +08:00
import UserPointList from './UserPointList.vue'
import UserSignList from './UserSignList.vue'
import { CardTitle } from '@/components/Card/index'
2023-09-11 17:08:39 +08:00
import { ElMessage } from 'element-plus'
2023-08-23 01:41:25 +08:00
defineOptions({ name: 'MemberDetail' })
2023-08-23 01:41:25 +08:00
const loading = ref(true) // 加载中
2023-09-30 13:55:42 +08:00
const user = ref<UserApi.UserVO>({} as UserApi.UserVO)
2023-08-26 01:59:36 +08:00
/** 添加/修改操作 */
const formRef = ref()
2023-08-26 01:59:36 +08:00
const openForm = (type: string) => {
formRef.value.open(type, id)
}
2023-08-26 01:59:36 +08:00
2023-08-23 01:41:25 +08:00
/** 获得用户 */
const getUserData = async (id: number) => {
loading.value = true
try {
2023-08-23 13:40:57 +08:00
user.value = await UserApi.getUser(id)
} finally {
loading.value = false
}
}
2023-08-23 01:41:25 +08:00
/** 初始化 */
const { currentRoute } = useRouter() // 路由
2023-08-26 01:59:36 +08:00
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const id = Number(route.params.id)
onMounted(() => {
2023-08-26 01:59:36 +08:00
if (!id) {
2023-08-23 01:41:25 +08:00
ElMessage.warning('参数错误,会员编号不能为空!')
2023-08-26 01:59:36 +08:00
delView(unref(currentRoute))
return
}
2023-08-26 01:59:36 +08:00
getUserData(id)
})
</script>
<style scoped lang="css">
.detail-info-item:first-child {
padding-left: 0 !important;
}
2023-09-11 17:08:39 +08:00
/* first-child 不生效有没有大佬给看下q.q */
.detail-info-item:nth-child(2) {
padding-right: 0 !important;
}
2023-09-11 17:08:39 +08:00
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>