code review:用户详情
This commit is contained in:
parent
415309469c
commit
1b6c9b2e29
@ -10,31 +10,6 @@ export interface AddressVO {
|
||||
}
|
||||
|
||||
// 查询用户收件地址列表
|
||||
export const getAddressPage = async (params) => {
|
||||
return await request.get({ url: `/member/address/page`, params })
|
||||
}
|
||||
|
||||
// 查询用户收件地址详情
|
||||
export const getAddress = async (id: number) => {
|
||||
return await request.get({ url: `/member/address/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增用户收件地址
|
||||
export const createAddress = async (data: AddressVO) => {
|
||||
return await request.post({ url: `/member/address/create`, data })
|
||||
}
|
||||
|
||||
// 修改用户收件地址
|
||||
export const updateAddress = async (data: AddressVO) => {
|
||||
return await request.put({ url: `/member/address/update`, data })
|
||||
}
|
||||
|
||||
// 删除用户收件地址
|
||||
export const deleteAddress = async (id: number) => {
|
||||
return await request.delete({ url: `/member/address/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出用户收件地址 Excel
|
||||
export const exportAddress = async (params) => {
|
||||
return await request.download({ url: `/member/address/export-excel`, params })
|
||||
export const getAddressList = async (params) => {
|
||||
return await request.get({ url: `/member/address/list`, params })
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface UserVO {
|
||||
areaId: number | undefined
|
||||
areaName: string | undefined
|
||||
id: number
|
||||
avatar: string | undefined
|
||||
birthday: number | undefined
|
||||
createTime: number | undefined
|
||||
id: number
|
||||
loginDate: number | undefined
|
||||
loginIp: string
|
||||
mark: string
|
||||
@ -16,26 +14,8 @@ export interface UserVO {
|
||||
registerIp: string
|
||||
sex: number
|
||||
status: number
|
||||
}
|
||||
|
||||
// TODO @梦:和 UserVO 搞成一个把。
|
||||
export interface UserBaseInfoVO {
|
||||
id: number | undefined | null
|
||||
mobile: string
|
||||
password: string | null | undefined
|
||||
status: number
|
||||
registerIp: string | null | undefined
|
||||
loginIp: string | null | undefined
|
||||
loginDate: Date | null | undefined
|
||||
nickname: string | null | undefined
|
||||
avatar: string | null | undefined
|
||||
name: string | null | undefined
|
||||
sex: number
|
||||
areaId: number | null | undefined
|
||||
areaName: string | null | undefined
|
||||
birthday: Date | null | undefined
|
||||
mark: string | null | undefined
|
||||
createTime: Date | null | undefined
|
||||
areaId: number | undefined
|
||||
areaName: string | undefined
|
||||
}
|
||||
|
||||
// 查询会员用户列表
|
||||
|
3
src/components/Card/index.ts
Normal file
3
src/components/Card/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import CardTitle from './src/CardTitle.vue'
|
||||
|
||||
export { CardTitle }
|
@ -1,3 +1,4 @@
|
||||
import Descriptions from './src/Descriptions.vue'
|
||||
import DescriptionsItemLabel from './src/DescriptionsItemLabel.vue'
|
||||
|
||||
export { Descriptions }
|
||||
export { Descriptions, DescriptionsItemLabel }
|
||||
|
@ -434,7 +434,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
meta: { hidden: true },
|
||||
children: [
|
||||
{
|
||||
path: 'user/detail/:userId',
|
||||
path: 'user/detail/:id',
|
||||
name: 'MemberUserDetail',
|
||||
meta: {
|
||||
title: '会员详情',
|
||||
|
@ -46,11 +46,6 @@
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
defineComponent({
|
||||
name: 'AccountInfo'
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.cell-item {
|
||||
display: inline;
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="收件地址编号" align="center" prop="id" width="150px" />
|
||||
<el-table-column label="地址编号" align="center" prop="id" width="150px" />
|
||||
<el-table-column label="收件人名称" align="center" prop="name" width="150px" />
|
||||
<el-table-column label="手机号" align="center" prop="mobile" width="150px" />
|
||||
<el-table-column label="地区编码" align="center" prop="areaId" width="150px" />
|
||||
@ -18,21 +18,9 @@
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
defineComponent({
|
||||
name: 'AddressList'
|
||||
})
|
||||
import { defineComponent } from 'vue'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as AddressApi from '@/api/member/address'
|
||||
|
||||
@ -46,25 +34,12 @@ const { userId }: { userId: number } = defineProps({
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userId: NaN,
|
||||
name: null,
|
||||
mobile: null,
|
||||
areaId: null,
|
||||
detailAddress: null,
|
||||
defaultStatus: null,
|
||||
createTime: []
|
||||
})
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await AddressApi.getAddressPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
list.value = await AddressApi.getAddressList({ userId })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@ -72,7 +47,6 @@ const getList = async () => {
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
queryParams.userId = userId
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -72,7 +72,7 @@
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import * as UserApi from '@/api/member/user'
|
||||
import DescriptionsItemLabel from '@/views/member/user/components/descriptions/DescriptionsItemLabel.vue'
|
||||
import { DescriptionsItemLabel } from '@/components/Descriptions/index'
|
||||
|
||||
const { user }: { user: UserApi.UserVO } = defineProps({
|
||||
user: {
|
@ -17,7 +17,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE)"
|
||||
:key="dict.value as number"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
@ -67,7 +67,6 @@
|
||||
:formatter="dateFormatter"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column label="用户" align="center" prop="nickname" width="200" />
|
||||
<el-table-column label="获得积分" align="center" prop="point" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.point > 0" class="ml-2" type="success" effect="dark">
|
||||
@ -101,8 +100,6 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as RecordApi from '@/api//member/point/record'
|
||||
|
||||
defineOptions({ name: 'PointList' })
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
@ -48,7 +48,6 @@
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="签到用户" align="center" prop="nickname" />
|
||||
<el-table-column
|
||||
label="签到天数"
|
||||
align="center"
|
||||
@ -84,8 +83,6 @@
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as SignInRecordApi from '@/api/member/signin/record'
|
||||
|
||||
defineOptions({ name: 'SignList' })
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
@ -7,13 +7,7 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<CardTitle title="基本信息" />
|
||||
<el-button
|
||||
v-if="user.id"
|
||||
type="primary"
|
||||
size="small"
|
||||
text
|
||||
@click="openForm('update', user.id)"
|
||||
>
|
||||
<el-button type="primary" size="small" text @click="openForm('update')">
|
||||
编辑
|
||||
</el-button>
|
||||
</div>
|
||||
@ -26,26 +20,26 @@
|
||||
<template #header>
|
||||
<CardTitle title="账户信息" />
|
||||
</template>
|
||||
<AccountInfo />
|
||||
<UserAccountInfo />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- 下边:账户明细 -->
|
||||
<!-- TODO 芋艿:【收货地址】【订单管理】【售后管理】【收藏记录】【优惠劵】 -->
|
||||
<!-- TODO 芋艿:【订单管理】【售后管理】【收藏记录】【优惠劵】 -->
|
||||
<el-card header="账户明细" style="width: 100%; margin-top: 20px" shadow="never">
|
||||
<template #header>
|
||||
<CardTitle title="账户明细" />
|
||||
</template>
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="积分" name="point">
|
||||
<PointList v-if="user.id" :user-id="user.id" />
|
||||
<UserPointList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="签到" name="sign">
|
||||
<SignList v-if="user.id" :user-id="user.id" />
|
||||
<UserSignList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="成长值" name="third">成长值(WIP)</el-tab-pane>
|
||||
<el-tab-pane label="余额" name="fourth">余额(WIP)</el-tab-pane>
|
||||
<el-tab-pane label="收货地址" name="address">
|
||||
<AddressList v-if="user.id" :user-id="user.id" />
|
||||
<UserAddressList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="订单管理" name="fourth">订单管理(WIP)</el-tab-pane>
|
||||
<el-tab-pane label="售后管理" name="fourth">售后管理(WIP)</el-tab-pane>
|
||||
@ -55,45 +49,33 @@
|
||||
</el-card>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<UserForm ref="formRef" v-if="user.id" @success="getUserData(user.id)" />
|
||||
<UserForm ref="formRef" @success="getUserData(id)" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
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'
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import UserBasicInfo from './UserBasicInfo.vue'
|
||||
import UserForm from '@/views/member/user/UserForm.vue'
|
||||
import AccountInfo from '@/views/member/user/components/AccountInfo.vue'
|
||||
import UserBasicInfo from '@/views/member/user/components/UserBasicInfo.vue'
|
||||
import AddressList from '@/views/member/user/components/AddressList.vue'
|
||||
import UserAccountInfo from './UserAccountInfo.vue'
|
||||
import UserAddressList from './UserAddressList.vue'
|
||||
import UserPointList from './UserPointList.vue'
|
||||
import UserSignList from './UserSignList.vue'
|
||||
import { CardTitle } from '@/components/Card/index'
|
||||
|
||||
defineOptions({ name: 'MemberDetail' })
|
||||
|
||||
const activeName = ref('point') // 账户明细 选中的 tabs
|
||||
const loading = ref(true) // 加载中
|
||||
let user = ref<UserApi.UserVO>({
|
||||
areaId: undefined,
|
||||
avatar: undefined,
|
||||
birthday: undefined,
|
||||
createTime: undefined,
|
||||
id: NaN,
|
||||
loginDate: undefined,
|
||||
loginIp: '',
|
||||
mark: '',
|
||||
mobile: '',
|
||||
name: '',
|
||||
nickname: '',
|
||||
registerIp: '',
|
||||
sex: 0,
|
||||
status: 0,
|
||||
areaName: ''
|
||||
})
|
||||
let user = ref<UserApi.UserVO>({})
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
const openForm = (type: string) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 获得用户 */
|
||||
const getUserData = async (id: number) => {
|
||||
loading.value = true
|
||||
@ -105,21 +87,20 @@ const getUserData = async (id: number) => {
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
const { push, currentRoute } = useRouter() // 路由
|
||||
const { delView } = useTagsViewStore() // 视图操作
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const member_id = Number(route.params.userId as string)
|
||||
const id = route.params.id as number
|
||||
onMounted(() => {
|
||||
if (!member_id) {
|
||||
// TODO
|
||||
if (!id) {
|
||||
ElMessage.warning('参数错误,会员编号不能为空!')
|
||||
router.back()
|
||||
delView(unref(currentRoute))
|
||||
return
|
||||
}
|
||||
getUserData(member_id)
|
||||
getUserData(id)
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="css">
|
||||
/** TODO 这 3 个 css 貌似没用? */
|
||||
.detail-info-item:first-child {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
@ -109,15 +109,9 @@
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="140px" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="180px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="goMemberDetail(scope.row.id)"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="openDetail(scope.row.id)">详情</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@ -204,9 +198,10 @@ const resetQuery = () => {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 打开会员详情 */
|
||||
const { push } = useRouter()
|
||||
const goMemberDetail = (id: number) => {
|
||||
push({ name: 'MemberUserDetail', params: { member_id: id } })
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'MemberUserDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
|
Loading…
Reference in New Issue
Block a user