Merge remote-tracking branch 'yudao/dev' into dev-to-dev
This commit is contained in:
commit
6b487c7e68
@ -12,8 +12,8 @@ export interface LevelVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询会员等级列表
|
// 查询会员等级列表
|
||||||
export const getLevelPage = async (params) => {
|
export const getLevelList = async (params) => {
|
||||||
return await request.get({ url: `/member/level/page`, params })
|
return await request.get({ url: `/member/level/list`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询会员等级详情
|
// 查询会员等级详情
|
||||||
|
@ -51,3 +51,8 @@ export const getUser = async (id: number) => {
|
|||||||
export const updateUser = async (data: UserVO) => {
|
export const updateUser = async (data: UserVO) => {
|
||||||
return await request.put({ url: `/member/user/update`, data })
|
return await request.put({ url: `/member/user/update`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改会员用户等级
|
||||||
|
export const updateUserLevel = async (data: any) => {
|
||||||
|
return await request.put({ url: `/member/user/update-level`, data })
|
||||||
|
}
|
||||||
|
@ -96,13 +96,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
@ -122,11 +115,8 @@ const message = useMessage() // 消息弹窗
|
|||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
name: null,
|
name: null,
|
||||||
status: null
|
status: null
|
||||||
})
|
})
|
||||||
@ -136,9 +126,7 @@ const queryFormRef = ref() // 搜索的表单
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await LevelApi.getLevelPage(queryParams)
|
list.value = await LevelApi.getLevelList(queryParams)
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@ -146,7 +134,6 @@ const getList = async () => {
|
|||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
101
src/views/member/user/UpdateLevelForm.vue
Normal file
101
src/views/member/user/UpdateLevelForm.vue
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog title="修改用户等级" v-model="dialogVisible" width="600">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="用户编号" prop="id">
|
||||||
|
<el-input v-model="formData.id" placeholder="请输入用户昵称" class="!w-240px" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户昵称" prop="nickname">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.nickname"
|
||||||
|
placeholder="请输入用户昵称"
|
||||||
|
class="!w-240px"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户等级" prop="levelId">
|
||||||
|
<MemberLevelSelect v-model="formData.levelId" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="修改原因" prop="reason">
|
||||||
|
<el-input type="textarea" v-model="formData.reason" placeholder="请输入修改原因" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import * as UserApi from '@/api/member/user'
|
||||||
|
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
nickname: undefined,
|
||||||
|
levelId: undefined,
|
||||||
|
reason: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
reason: [{ required: true, message: '修改原因不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await UserApi.getUser(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
await UserApi.updateUserLevel(formData.value)
|
||||||
|
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
nickname: undefined,
|
||||||
|
levelId: undefined,
|
||||||
|
reason: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -60,22 +60,6 @@
|
|||||||
<el-form-item label="用户标签" prop="tagIds">
|
<el-form-item label="用户标签" prop="tagIds">
|
||||||
<MemberTagSelect v-model="formData.tagIds" show-add />
|
<MemberTagSelect v-model="formData.tagIds" show-add />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="用户等级" prop="levelId">
|
|
||||||
<MemberLevelSelect v-model="formData.levelId" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item
|
|
||||||
label="修改原因"
|
|
||||||
prop="levelReason"
|
|
||||||
v-if="formData.levelId !== originLevelId"
|
|
||||||
>
|
|
||||||
<el-input type="text" v-model="formData.levelReason" placeholder="请输入修改原因" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-form-item label="用户分组" prop="groupId">
|
<el-form-item label="用户分组" prop="groupId">
|
||||||
<MemberGroupSelect v-model="formData.groupId" />
|
<MemberGroupSelect v-model="formData.groupId" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -95,7 +79,6 @@ import * as UserApi from '@/api/member/user'
|
|||||||
import * as AreaApi from '@/api/system/area'
|
import * as AreaApi from '@/api/system/area'
|
||||||
import { defaultProps } from '@/utils/tree'
|
import { defaultProps } from '@/utils/tree'
|
||||||
import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue'
|
import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue'
|
||||||
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
|
|
||||||
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
@ -118,18 +101,14 @@ const formData = ref({
|
|||||||
birthday: undefined,
|
birthday: undefined,
|
||||||
mark: undefined,
|
mark: undefined,
|
||||||
tagIds: [],
|
tagIds: [],
|
||||||
levelId: undefined,
|
|
||||||
levelReason: undefined,
|
|
||||||
groupId: undefined
|
groupId: undefined
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
mobile: [{ required: true, message: '手机号不能为空', trigger: 'blur' }],
|
mobile: [{ required: true, message: '手机号不能为空', trigger: 'blur' }],
|
||||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||||
levelReason: [{ required: true, message: '修改原因不能为空', trigger: 'blur' }]
|
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const areaList = ref([]) // 地区列表
|
const areaList = ref([]) // 地区列表
|
||||||
const originLevelId = ref() // 修改前的会员等级
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
@ -142,7 +121,6 @@ const open = async (type: string, id?: number) => {
|
|||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await UserApi.getUser(id)
|
formData.value = await UserApi.getUser(id)
|
||||||
originLevelId.value = formData.value.levelId
|
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@ -194,8 +172,6 @@ const resetForm = () => {
|
|||||||
birthday: undefined,
|
birthday: undefined,
|
||||||
mark: undefined,
|
mark: undefined,
|
||||||
tagIds: [],
|
tagIds: [],
|
||||||
levelId: undefined,
|
|
||||||
levelReason: undefined,
|
|
||||||
groupId: undefined
|
groupId: undefined
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center" width="140px" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
@ -119,6 +119,15 @@
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- todo 放到更多菜单中 -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="updateLevelFormRef.open(scope.row.id)"
|
||||||
|
v-hasPermi="['member:user:update-level']"
|
||||||
|
>
|
||||||
|
修改等级
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -133,6 +142,8 @@
|
|||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<UserForm ref="formRef" @success="getList" />
|
<UserForm ref="formRef" @success="getList" />
|
||||||
|
<!-- 修改用户等级弹窗 -->
|
||||||
|
<UpdateLevelForm ref="updateLevelFormRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
@ -142,6 +153,7 @@ import { DICT_TYPE } from '@/utils/dict'
|
|||||||
import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue'
|
import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue'
|
||||||
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
|
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
|
||||||
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
||||||
|
import UpdateLevelForm from '@/views/member/user/UpdateLevelForm.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'MemberUser' })
|
defineOptions({ name: 'MemberUser' })
|
||||||
|
|
||||||
@ -160,6 +172,7 @@ const queryParams = reactive({
|
|||||||
groupId: null
|
groupId: null
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const updateLevelFormRef = ref() // 修改会员等级表单
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user