refactor(sql): 移除兑换码相关SQL文件并优化前端界面
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
- 删除兑换码菜单配置SQL文件 (redeem_code_menu.sql) - 删除兑换码建表SQL文件 (redeem_code_tables.sql) - 在application.yaml中添加租户过滤忽略表配置 - 优化兑换码管理前端界面,简化搜索表单和表格显示 - 移除用户端兑换相关API接口 - 调整状态显示逻辑,使用本地映射替代字典组件
This commit is contained in:
@@ -10,15 +10,8 @@ export const getRedeemRecord = async (id: number) => {
|
||||
return await request.get({ url: `/muye/redeem-record/get?id=` + id })
|
||||
}
|
||||
|
||||
// 查询我的兑换记录(用户端)
|
||||
export const getMyRedeemRecords = async (params) => {
|
||||
return await request.get({ url: `/app-api/muye/redeem-record/my-page`, params })
|
||||
}
|
||||
|
||||
// 用户兑换
|
||||
export const redeemCode = async (code: string) => {
|
||||
return await request.post({ url: `/app-api/muye/redeem-code/redeem`, data: { code } })
|
||||
}
|
||||
|
||||
|
||||
// 导出兑换记录 Excel
|
||||
export const exportRedeemRecord = async (params) => {
|
||||
|
||||
@@ -1,42 +1,19 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||
<el-form-item label="兑换码" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入兑换码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input v-model="queryParams.code" placeholder="请输入兑换码" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||
<el-option label="禁用" :value="0" />
|
||||
<el-option label="未使用" :value="1" />
|
||||
<el-option label="启用" :value="1" />
|
||||
<el-option label="已用完" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号" prop="batchNo">
|
||||
<el-input
|
||||
v-model="queryParams.batchNo"
|
||||
placeholder="请输入批次号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input v-model="queryParams.batchNo" placeholder="请输入批次号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
@@ -52,39 +29,16 @@
|
||||
<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"
|
||||
plain
|
||||
@click="openGenerateForm"
|
||||
v-hasPermi="['muye:redeem-code:create']"
|
||||
>
|
||||
<el-button type="primary" plain @click="openGenerateForm" v-hasPermi="['muye:redeem-code:create']">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 批量生成
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['muye:redeem-code:export']"
|
||||
>
|
||||
<el-button type="success" plain @click="handleExport" :loading="exportLoading" v-hasPermi="['muye:redeem-code:export']">
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出Excel
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="handleExportPlain"
|
||||
:disabled="!queryParams.batchNo"
|
||||
v-hasPermi="['muye:redeem-code:export']"
|
||||
>
|
||||
<el-button type="warning" plain @click="handleExportPlain" :disabled="!queryParams.batchNo" v-hasPermi="['muye:redeem-code:export']">
|
||||
<Icon icon="ep:document" class="mr-5px" /> 导出纯文本
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
:disabled="checkedIds.length === 0"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['muye:redeem-code:delete']"
|
||||
>
|
||||
<el-button type="danger" plain :disabled="checkedIds.length === 0" @click="handleDeleteBatch" v-hasPermi="['muye:redeem-code:delete']">
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
@@ -93,67 +47,48 @@
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table row-key="id" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="40" />
|
||||
<el-table-column label="兑换码" align="center" prop="code" width="180" />
|
||||
<el-table-column label="积分面额" align="center" prop="points" width="100">
|
||||
<el-table-column label="积分" align="center" prop="points" width="80">
|
||||
<template #default="scope">
|
||||
<el-tag type="warning">{{ scope.row.points }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="码类型" align="center" prop="codeType" width="100">
|
||||
<el-table-column label="类型" align="center" prop="codeType" width="80">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.REDEEM_CODE_TYPE" :value="scope.row.codeType" />
|
||||
<el-tag :type="scope.row.codeType === 'single' ? 'info' : 'success'">
|
||||
{{ scope.row.codeType === 'single' ? '单次' : '多次' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<el-table-column label="状态" align="center" prop="status" width="80">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === 0" type="danger">禁用</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 1" type="success">未使用</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 2" type="info">已用完</el-tag>
|
||||
<el-tag v-else type="warning">未知</el-tag>
|
||||
<el-tag :type="getStatusType(scope.row.status)">
|
||||
{{ getStatusLabel(scope.row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="批次号" align="center" prop="batchNo" width="160" />
|
||||
<el-table-column label="使用者ID" align="center" prop="userId" width="100" />
|
||||
<el-table-column label="使用次数" align="center" width="100">
|
||||
<el-table-column label="批次号" align="center" prop="batchNo" width="150" />
|
||||
<el-table-column label="来源" align="center" prop="source" width="80">
|
||||
<template #default="scope">
|
||||
{{ scope.row.usedCount }} / {{ scope.row.maxUseCount }}
|
||||
{{ sourceMap[scope.row.source] || scope.row.source }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="过期时间" align="center" prop="expireTime" width="180" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" fixed="right" width="120">
|
||||
<el-table-column label="使用" align="center" width="80">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['muye:redeem-code:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
{{ scope.row.usedCount }}/{{ scope.row.maxUseCount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="过期时间" align="center" prop="expireTime" width="160" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="160" />
|
||||
<el-table-column label="操作" align="center" fixed="right" width="80">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['muye:redeem-code:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 批量生成表单 -->
|
||||
@@ -169,7 +104,25 @@ import RedeemCodeGenerateForm from './RedeemCodeGenerateForm.vue'
|
||||
defineOptions({ name: 'RedeemCode' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
// 状态映射
|
||||
const statusMap: Record<number, { label: string; type: 'danger' | 'success' | 'info' }> = {
|
||||
0: { label: '禁用', type: 'danger' },
|
||||
1: { label: '启用', type: 'success' },
|
||||
2: { label: '已用完', type: 'info' }
|
||||
}
|
||||
const getStatusLabel = (status: number) => statusMap[status]?.label || '未知'
|
||||
const getStatusType = (status: number) => statusMap[status]?.type || 'info'
|
||||
|
||||
// 来源映射
|
||||
const sourceMap: Record<string, string> = {
|
||||
admin: '后台',
|
||||
pay: '支付',
|
||||
gift: '礼包',
|
||||
taobao: '淘宝',
|
||||
xianyu: '闲鱼',
|
||||
activity: '活动'
|
||||
}
|
||||
|
||||
const loading = ref(true)
|
||||
const list = ref([])
|
||||
@@ -226,7 +179,7 @@ const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await RedeemCodeApi.deleteRedeemCode(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
message.success('删除成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
@@ -236,7 +189,7 @@ const handleDeleteBatch = async () => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await RedeemCodeApi.deleteRedeemCodeList(checkedIds.value)
|
||||
message.success(t('common.delSuccess'))
|
||||
message.success('删除成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user