会员中心代码

1.合并积分模块只member module
3.添加会员中/会员积分、会员签到/xxx层级目录
4.删除无用的接口代码

(cherry picked from commit 4251dc5d61)
This commit is contained in:
xiaqing 2023-06-28 22:50:31 +08:00 committed by shizhong
parent 341dcaf665
commit 195ae79bfc
11 changed files with 104 additions and 425 deletions

View File

@ -8,32 +8,12 @@ export interface ConfigVO {
tradeGivePoint: number
}
// 查询积分设置列表
export const getConfigPage = async (params) => {
return await request.get({ url: `/point/config/page`, params })
}
// 查询积分设置详情
export const getConfig = async (id: number) => {
return await request.get({ url: `/point/config/get?id=` + id })
export const getConfig = async () => {
return await request.get({ url: `/point/config/get` })
}
// 新增积分设置
export const createConfig = async (data: ConfigVO) => {
return await request.post({ url: `/point/config/create`, data })
}
// 修改积分设置
export const updateConfig = async (data: ConfigVO) => {
return await request.put({ url: `/point/config/update`, data })
}
// 删除积分设置
export const deleteConfig = async (id: number) => {
return await request.delete({ url: `/point/config/delete?id=` + id })
}
// 导出积分设置 Excel
export const exportConfig = async (params) => {
return await request.download({ url: `/point/config/export-excel`, params })
// 新增修改积分设置
export const saveConfig = async (data: ConfigVO) => {
return await request.put({ url: `/point/config/save`, data })
}

View File

@ -148,8 +148,8 @@ export enum DICT_TYPE {
// ========== MALL - 会员模块 ==========
// 积分模块 TODO 芋艿:改成 member_ 前缀;包括枚举和值;
POINT_BIZ_TYPE = 'point_biz_type',
POINT_STATUS = 'point_status',
MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type',
MEMBER_POINT_STATUS = 'member_point_status',
// ========== MALL - 商品模块 ==========
PRODUCT_UNIT = 'product_unit', // 商品单位

View File

@ -0,0 +1,88 @@
<template>
<ContentWrap>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<el-form-item label="hideId" v-show="false">
<el-input v-model="formData.id" />
</el-form-item>
<el-form-item label="积分抵扣" prop="tradeDeductEnable">
<el-switch v-model="formData.tradeDeductEnable" />
</el-form-item>
<el-form-item label="抵扣单位(分)" prop="tradeDeductUnitPrice">
<el-input-number
v-model="formData.tradeDeductUnitPrice"
placeholder="请输入抵扣单位(分)"
style="width: 300px"
/>
</el-form-item>
<el-form-item label="积分抵扣最大值" prop="tradeDeductMaxPrice">
<el-input-number
v-model="formData.tradeDeductMaxPrice"
placeholder="请输入积分抵扣最大值"
style="width: 300px"
/>
</el-form-item>
<el-form-item label="1元赠送多少分" prop="tradeGivePoint">
<el-input-number
v-model="formData.tradeGivePoint"
placeholder="请输入1元赠送多少积分"
style="width: 300px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交</el-button>
</el-form-item>
</el-form>
</ContentWrap>
</template>
<script lang="ts" setup>
import * as ConfigApi from '@/api/point/config'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formData = ref({
id: undefined,
tradeDeductEnable: undefined,
tradeDeductUnitPrice: undefined,
tradeDeductMaxPrice: undefined,
tradeGivePoint: undefined
})
const formRules = reactive({})
const formRef = ref() // Ref
const onSubmit = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as ConfigApi.ConfigVO
await ConfigApi.saveConfig(data)
message.success(t('common.updateSuccess'))
dialogVisible.value = false
} finally {
formLoading.value = false
}
}
const getConfig = async () => {
try {
const data = await ConfigApi.getConfig()
formData.value = data
} finally {
}
}
onMounted(() => {
getConfig()
})
</script>

View File

@ -13,7 +13,7 @@
<el-form-item label="业务类型" prop="bizType">
<el-select v-model="formData.bizType" placeholder="请选择业务类型">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)"
v-for="dict in getStrDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -41,7 +41,7 @@
<el-form-item label="积分状态" prop="status">
<el-select v-model="formData.status" placeholder="积分状态">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_POINT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"

View File

@ -25,7 +25,7 @@
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)"
v-for="dict in getStrDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -50,7 +50,7 @@
<el-form-item label="积分状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_POINT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -71,18 +71,6 @@
<el-form-item>
<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 type="primary" @click="openForm('create')" v-hasPermi="['point:record:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['point:record:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
@ -94,7 +82,7 @@
<el-table-column label="业务编码" align="center" prop="bizId" />
<el-table-column label="业务类型" align="center" prop="bizType">
<template #default="scope">
<dict-tag :type="DICT_TYPE.POINT_BIZ_TYPE" :value="scope.row.bizType" />
<dict-tag :type="DICT_TYPE.MEMBER_POINT_BIZ_TYPE" :value="scope.row.bizType" />
</template>
</el-table-column>
<el-table-column
@ -113,7 +101,7 @@
<el-table-column label="变动后的积分" align="center" prop="totalPoint" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.POINT_STATUS" :value="scope.row.status" />
<dict-tag :type="DICT_TYPE.MEMBER_POINT_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="用户id" align="center" prop="userId" />
@ -135,26 +123,6 @@
prop="createDate"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['point:record:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['point:record:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
@ -169,14 +137,13 @@
<RecordForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts" name="PointRecord">
<script lang="ts" setup>
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as RecordApi from '@/api/point/record'
import RecordForm from './RecordForm.vue'
const message = useMessage() //
const { t } = useI18n() //
defineOptions({ name: 'PointRecord' })
const loading = ref(true) //
const total = ref(0) //
@ -192,7 +159,6 @@ const queryParams = reactive({
createDate: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
@ -218,40 +184,6 @@ const resetQuery = () => {
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RecordApi.deleteRecord(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await RecordApi.exportRecord(queryParams)
download.excel(data, '用户积分记录.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()

View File

@ -1,122 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" style="width: 600px">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<el-form-item label="积分抵扣" prop="tradeDeductEnable">
<el-select v-model="formData.tradeDeductEnable" placeholder="请选择是否开启">
<el-option
v-for="dict in options"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="抵扣单位(元)" prop="tradeDeductUnitPrice">
<el-input v-model="formData.tradeDeductUnitPrice" placeholder="请输入抵扣单位(元)" />
</el-form-item>
<el-form-item label="积分抵扣最大值" prop="tradeDeductMaxPrice">
<el-input v-model="formData.tradeDeductMaxPrice" placeholder="请输入积分抵扣最大值" />
</el-form-item>
<el-form-item label="1元赠送多少分" prop="tradeGivePoint">
<el-input v-model="formData.tradeGivePoint" placeholder="请输入1元赠送多少分" />
</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 ConfigApi from '@/api/point/config'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
tradeDeductEnable: undefined,
tradeDeductUnitPrice: undefined,
tradeDeductMaxPrice: undefined,
tradeGivePoint: undefined
})
const formRules = reactive({})
const formRef = ref() // Ref
const options = [
{
value: '1',
label: '是'
},
{
value: '0',
label: '否'
}
]
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await ConfigApi.getConfig(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 {
const data = formData.value as unknown as ConfigApi.ConfigVO
if (formType.value === 'create') {
await ConfigApi.createConfig(data)
message.success(t('common.createSuccess'))
} else {
await ConfigApi.updateConfig(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
tradeDeductEnable: undefined,
tradeDeductUnitPrice: undefined,
tradeDeductMaxPrice: undefined,
tradeGivePoint: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -1,199 +0,0 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="是否开启" prop="tradeDeductEnable">
<el-select
v-model="queryParams.tradeDeductEnable"
placeholder="请选择是否开启"
clearable
class="!w-240px"
>
<el-option
v-for="dict in options"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<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 type="primary" @click="openForm('create')" v-hasPermi="['point:config:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['point:config:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="序号" align="center" prop="id" />
<el-table-column
label="积分抵扣(是否开启)"
align="center"
prop="tradeDeductEnable"
:formatter="tradeDeductFormat"
/>
<el-table-column label="抵扣单位(元)" align="center" prop="tradeDeductUnitPrice" />
<el-table-column label="积分抵扣最大值" align="center" prop="tradeDeductMaxPrice" />
<el-table-column label="1元赠送多少分" align="center" prop="tradeGivePoint" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
/>
<el-table-column
label="变更时间"
align="center"
prop="updateTime"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['point:config:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['point:config:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ConfigForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts" name="PointConfig">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ConfigApi from '@/api/point/config'
import ConfigForm from './ConfigForm.vue'
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
tradeDeductEnable: null
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const options = [
{
value: '1',
label: '是'
},
{
value: '0',
label: '否'
}
]
const tradeDeductFormat = (row, column, cellValue) => {
return cellValue === 1 ? '是' : '否'
}
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ConfigApi.getConfigPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ConfigApi.deleteConfig(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ConfigApi.exportConfig(queryParams)
download.excel(data, '积分设置.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>