会员:后台调整会员等级
This commit is contained in:
parent
f1735a4010
commit
7bef240926
@ -21,6 +21,11 @@ export const getLevel = async (id: number) => {
|
|||||||
return await request.get({ url: `/member/level/get?id=` + id })
|
return await request.get({ url: `/member/level/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询会员等级 - 精简信息列表
|
||||||
|
export const getSimpleLevelList = async () => {
|
||||||
|
return await request.get({ url: `/member/level/list-all-simple` })
|
||||||
|
}
|
||||||
|
|
||||||
// 新增会员等级
|
// 新增会员等级
|
||||||
export const createLevel = async (data: LevelVO) => {
|
export const createLevel = async (data: LevelVO) => {
|
||||||
return await request.post({ url: `/member/level/create`, data })
|
return await request.post({ url: `/member/level/create`, data })
|
||||||
|
46
src/views/member/level/components/MemberLevelSelect.vue
Normal file
46
src/views/member/level/components/MemberLevelSelect.vue
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<el-select v-model="levelId" placeholder="请选择用户等级" clearable class="!w-240px">
|
||||||
|
<el-option
|
||||||
|
v-for="level in levelOptions"
|
||||||
|
:key="level.id"
|
||||||
|
:label="level.name"
|
||||||
|
:value="level.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import * as LevelApi from '@/api/member/level'
|
||||||
|
|
||||||
|
/** 会员等级选择框 **/
|
||||||
|
defineOptions({ name: 'MemberLevelSelect' })
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
/** 下拉框选中值 **/
|
||||||
|
modelValue: {
|
||||||
|
type: Array,
|
||||||
|
default: undefined
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
const levelId = computed({
|
||||||
|
get() {
|
||||||
|
return props.modelValue
|
||||||
|
},
|
||||||
|
set(value: any) {
|
||||||
|
emit('update:modelValue', value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const levelOptions = ref<LevelApi.LevelVO[]>([])
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
levelOptions.value = await LevelApi.getSimpleLevelList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
@ -60,6 +60,22 @@
|
|||||||
<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="mark">
|
<el-form-item label="会员备注" prop="mark">
|
||||||
<el-input type="textarea" v-model="formData.mark" placeholder="请输入会员备注" />
|
<el-input type="textarea" v-model="formData.mark" placeholder="请输入会员备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -76,6 +92,7 @@ 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'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -87,6 +104,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
mobile: undefined,
|
mobile: undefined,
|
||||||
|
password: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
nickname: undefined,
|
nickname: undefined,
|
||||||
avatar: undefined,
|
avatar: undefined,
|
||||||
@ -95,14 +113,18 @@ const formData = ref({
|
|||||||
areaId: undefined,
|
areaId: undefined,
|
||||||
birthday: undefined,
|
birthday: undefined,
|
||||||
mark: undefined,
|
mark: undefined,
|
||||||
tagIds: []
|
tagIds: [],
|
||||||
|
levelId: undefined,
|
||||||
|
levelReason: 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) => {
|
||||||
@ -115,6 +137,7 @@ 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
|
||||||
}
|
}
|
||||||
@ -158,9 +181,6 @@ const resetForm = () => {
|
|||||||
mobile: undefined,
|
mobile: undefined,
|
||||||
password: undefined,
|
password: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
registerIp: undefined,
|
|
||||||
loginIp: undefined,
|
|
||||||
loginDate: undefined,
|
|
||||||
nickname: undefined,
|
nickname: undefined,
|
||||||
avatar: undefined,
|
avatar: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@ -168,8 +188,9 @@ const resetForm = () => {
|
|||||||
areaId: undefined,
|
areaId: undefined,
|
||||||
birthday: undefined,
|
birthday: undefined,
|
||||||
mark: undefined,
|
mark: undefined,
|
||||||
createTime: undefined,
|
tagIds: [],
|
||||||
tagIds: []
|
levelId: undefined,
|
||||||
|
levelReason: undefined
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@
|
|||||||
<el-form-item label="用户标签" prop="tagIds">
|
<el-form-item label="用户标签" prop="tagIds">
|
||||||
<MemberTagSelect v-model="queryParams.tagIds" />
|
<MemberTagSelect v-model="queryParams.tagIds" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="用户等级" prop="levelId">
|
||||||
|
<MemberLevelSelect v-model="queryParams.levelId" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
@ -69,8 +72,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="手机号" align="center" prop="mobile" width="120px" />
|
<el-table-column label="手机号" align="center" prop="mobile" width="120px" />
|
||||||
<el-table-column label="昵称" align="center" prop="nickname" width="80px" />
|
<el-table-column label="昵称" align="center" prop="nickname" width="80px" />
|
||||||
|
<el-table-column label="等级" align="center" prop="levelName" width="100px" />
|
||||||
<!-- TODO 芋艿:待接入 -->
|
<!-- TODO 芋艿:待接入 -->
|
||||||
<el-table-column label="等级" align="center" width="100px" />
|
|
||||||
<el-table-column label="分组" align="center" width="100px" />
|
<el-table-column label="分组" align="center" width="100px" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="用户标签"
|
label="用户标签"
|
||||||
@ -133,12 +136,10 @@ import * as UserApi from '@/api/member/user'
|
|||||||
import UserForm from './UserForm.vue'
|
import UserForm from './UserForm.vue'
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
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'
|
||||||
|
|
||||||
defineOptions({ name: 'MemberUser' })
|
defineOptions({ name: 'MemberUser' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
@ -149,10 +150,10 @@ const queryParams = reactive({
|
|||||||
mobile: null,
|
mobile: null,
|
||||||
loginDate: [],
|
loginDate: [],
|
||||||
createTime: [],
|
createTime: [],
|
||||||
tagIds: []
|
tagIds: [],
|
||||||
|
levelId: null
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user