diff --git a/src/api/member/address/index.ts b/src/api/member/address/index.ts new file mode 100644 index 00000000..cc16980d --- /dev/null +++ b/src/api/member/address/index.ts @@ -0,0 +1,40 @@ +import request from '@/config/axios' + +export interface AddressVO { + id: number + name: string + mobile: string + areaId: number + detailAddress: string + defaultStatus: boolean +} + +// 查询用户收件地址列表 +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 }) +} diff --git a/src/api/member/user/index.ts b/src/api/member/user/index.ts index 432a0fb5..8deae4a9 100644 --- a/src/api/member/user/index.ts +++ b/src/api/member/user/index.ts @@ -1,21 +1,21 @@ import request from '@/config/axios' export interface UserVO { + areaId: number | undefined + areaName: string | undefined + avatar: string | undefined + birthday: number | undefined + createTime: number | undefined id: number - mobile: string - password: string - status: number - registerIp: string + loginDate: number | undefined loginIp: string - loginDate: Date - nickname: string - avatar: string - name: string - sex: number - areaId: number - birthday: Date mark: string - createTime: Date + mobile: string + name: string | undefined + nickname: string | undefined + registerIp: string + sex: number + status: number } // TODO @梦:和 UserVO 搞成一个把。 @@ -32,6 +32,7 @@ export interface UserBaseInfoVO { 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 diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 602fbb58..8bd56119 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -434,7 +434,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ meta: { hidden: true }, children: [ { - path: 'user/detail/:member_id', + path: 'user/detail/:userId', name: 'MemberUserDetail', meta: { title: '会员详情', diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 5e5c854d..87409260 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -11,7 +11,7 @@ import dayjs from 'dayjs' * @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ" * @returns 返回拼接后的时间字符串 */ -export function formatDate(date: Date, format?: string): string { +export function formatDate(date: Date | number, format?: string): string { // 日期不存在,则返回空 if (!date) { return '' diff --git a/src/views/member/user/components/AddressList.vue b/src/views/member/user/components/AddressList.vue new file mode 100644 index 00000000..af6ef83d --- /dev/null +++ b/src/views/member/user/components/AddressList.vue @@ -0,0 +1,80 @@ + + + + diff --git a/src/views/member/user/components/PointList.vue b/src/views/member/user/components/PointList.vue index 2b2b98e4..a98a622f 100644 --- a/src/views/member/user/components/PointList.vue +++ b/src/views/member/user/components/PointList.vue @@ -17,7 +17,7 @@ > @@ -112,7 +112,7 @@ const queryParams = reactive({ bizType: undefined, title: null, createDate: [], - userId: null + userId: NaN }) const queryFormRef = ref() // 搜索的表单 @@ -140,9 +140,8 @@ const resetQuery = () => { handleQuery() } -// TODO @梦:改成 userId 哈 -const { memberId } = defineProps({ - memberId: { +const { userId } = defineProps({ + userId: { type: Number, required: true } @@ -150,7 +149,7 @@ const { memberId } = defineProps({ /** 初始化 **/ onMounted(() => { - queryParams.userId = memberId + queryParams.userId = userId getList() }) diff --git a/src/views/member/user/components/SignList.vue b/src/views/member/user/components/SignList.vue index 479e18a7..47fbd155 100644 --- a/src/views/member/user/components/SignList.vue +++ b/src/views/member/user/components/SignList.vue @@ -92,6 +92,7 @@ const list = ref([]) // 列表的数据 const queryParams = reactive({ pageNo: 1, pageSize: 10, + userId: NaN, nickname: null, day: null, createTime: [] @@ -122,9 +123,8 @@ const resetQuery = () => { handleQuery() } -// TODO @梦:改成 userId 哈 -const { memberId } = defineProps({ - memberId: { +const { userId } = defineProps({ + userId: { type: Number, required: true } @@ -132,7 +132,7 @@ const { memberId } = defineProps({ /** 初始化 **/ onMounted(() => { - queryParams.userId = memberId + queryParams.userId = userId getList() }) diff --git a/src/views/member/user/components/UserBasicInfo.vue b/src/views/member/user/components/UserBasicInfo.vue index c6449d3a..50d16413 100644 --- a/src/views/member/user/components/UserBasicInfo.vue +++ b/src/views/member/user/components/UserBasicInfo.vue @@ -1,7 +1,90 @@ - - + + diff --git a/src/views/member/user/components/address-list.vue b/src/views/member/user/components/address-list.vue deleted file mode 100644 index 6d47bda5..00000000 --- a/src/views/member/user/components/address-list.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue b/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue new file mode 100644 index 00000000..35783351 --- /dev/null +++ b/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/member/user/detail/index.vue b/src/views/member/user/detail/index.vue index 569277d4..967a4110 100644 --- a/src/views/member/user/detail/index.vue +++ b/src/views/member/user/detail/index.vue @@ -1,12 +1,11 @@ - + - + 成长值(WIP) 余额(WIP) + + + + 订单管理(WIP) + 售后管理(WIP) + 收藏记录(WIP) + 优惠劵(WIP) @@ -150,34 +63,37 @@ 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 { formatDate } from '@/utils/formatTime' -import { DICT_TYPE } from '@/utils/dict' import UserForm from '@/views/member/user/UserForm.vue' -// TODO @梦:把用户信息,也抽成一个组件,类似 AccountInfo 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' defineOptions({ name: 'MemberDetail' }) const activeName = ref('point') // 账户明细 选中的 tabs const loading = ref(true) // 加载中 -let user = ref({ +let user = ref({ areaId: undefined, avatar: undefined, birthday: undefined, createTime: undefined, - id: undefined, + id: NaN, loginDate: undefined, loginIp: '', mark: '', mobile: '', name: '', nickname: '', - password: null, - registerIp: undefined, + registerIp: '', sex: 0, - status: 0 + status: 0, + areaName: '' }) - +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (type: string, id?: number) => { + formRef.value.open(type, id) +} /** 获得用户 */ const getUserData = async (id: number) => { loading.value = true @@ -188,16 +104,10 @@ const getUserData = async (id: number) => { } } -/** 添加/修改操作 */ -const formRef = ref() -const openForm = (type: string, id?: number) => { - formRef.value.open(type, id) -} - /** 初始化 */ const route = useRoute() const router = useRouter() -const member_id = route.params.member_id as number +const member_id = Number(route.params.userId as string) onMounted(() => { if (!member_id) { // TODO @@ -222,11 +132,4 @@ onMounted(() => { justify-content: space-between; align-items: center; } -.cell-item { - display: inline; -} -/** TODO 下面 css 貌似没啥用? */ -.cell-item::after { - content: ':'; -}