重命名组件名称,增加用户地址查看api和页面、统一组件的props userId 变量名。
parent
f17bb9a7eb
commit
28951fb31d
@ -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 })
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
<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="name" width="150px" />
|
||||||
|
<el-table-column label="手机号" align="center" prop="mobile" width="150px" />
|
||||||
|
<el-table-column label="地区编码" align="center" prop="areaId" width="150px" />
|
||||||
|
<el-table-column label="收件详细地址" align="center" prop="detailAddress" />
|
||||||
|
<el-table-column label="是否默认" align="center" prop="defaultStatus" width="150px">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="Number(scope.row.defaultStatus)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
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'
|
||||||
|
|
||||||
|
const { userId }: { userId: number } = defineProps({
|
||||||
|
userId: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
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
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
queryParams.userId = userId
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@ -1,7 +1,90 @@
|
|||||||
<script setup lang="ts"></script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span>基础信息</span>
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<slot name="header"></slot>
|
||||||
|
</template>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="4">
|
||||||
|
<ElAvatar shape="square" :size="140" :src="user.avatar || undefined" />
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-descriptions :column="2">
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="用户名" icon="ep:user" />
|
||||||
|
</template>
|
||||||
|
{{ user.name || '空' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="昵称" icon="ep:user" />
|
||||||
|
</template>
|
||||||
|
{{ user.nickname }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="手机号">
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="手机号" icon="ep:phone" />
|
||||||
|
</template>
|
||||||
|
{{ user.mobile }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="性别" icon="fa:mars-double" />
|
||||||
|
</template>
|
||||||
|
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="user.sex" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="所在地" icon="ep:location" />
|
||||||
|
</template>
|
||||||
|
{{ user.areaName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="注册 IP" icon="ep:position" />
|
||||||
|
</template>
|
||||||
|
{{ user.registerIp }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="生日" icon="fa:birthday-cake" />
|
||||||
|
</template>
|
||||||
|
{{ user.birthday ? formatDate(user.birthday) : '空' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="注册时间" icon="ep:calendar" />
|
||||||
|
</template>
|
||||||
|
{{ user.createTime ? formatDate(user.createTime) : '空' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<descriptions-item-label label="最后登录时间" icon="ep:calendar" />
|
||||||
|
</template>
|
||||||
|
{{ user.loginDate ? formatDate(user.loginDate) : '空' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
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'
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
const { user }: { user: UserApi.UserVO } = defineProps({
|
||||||
|
user: {
|
||||||
|
type: UserApi.UserVO,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const { label } = defineProps({
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="cell-item">
|
||||||
|
<Icon :icon="icon" />
|
||||||
|
{{ label }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.cell-item {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.cell-item::after {
|
||||||
|
content: ':';
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue