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:
@@ -336,30 +336,3 @@ CREATE TABLE `member_user_permission` (
|
|||||||
-- INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
-- INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
||||||
-- VALUES (5022, '兑换记录导出', 'muye:redeem-record:export', 3, 2, 5020, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0')
|
-- VALUES (5022, '兑换记录导出', 'muye:redeem-record:export', 3, 2, 5020, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0')
|
||||||
|
|
||||||
-- 兑换码表
|
|
||||||
CREATE TABLE `muye_redemption_code` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
`code` varchar(32) NOT NULL COMMENT '兑换码',
|
|
||||||
`type` varchar(20) NOT NULL DEFAULT 'points' COMMENT '类型: points-积分',
|
|
||||||
`amount` int NOT NULL COMMENT '面额(积分数)',
|
|
||||||
`price` decimal(10,2) DEFAULT NULL COMMENT '原价金额(元)',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态: 0-未使用 1-已使用 2-已过期',
|
|
||||||
`batch_no` varchar(32) DEFAULT NULL COMMENT '批次号',
|
|
||||||
`batch_remark` varchar(200) DEFAULT NULL COMMENT '批次备注',
|
|
||||||
`user_id` bigint DEFAULT NULL COMMENT '使用者用户ID',
|
|
||||||
`used_time` datetime DEFAULT NULL COMMENT '使用时间',
|
|
||||||
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
|
|
||||||
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
|
||||||
UNIQUE KEY `uk_code` (`code`) USING BTREE,
|
|
||||||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
|
||||||
KEY `idx_batch_no` (`batch_no`) USING BTREE,
|
|
||||||
KEY `idx_status` (`status`) USING BTREE,
|
|
||||||
KEY `idx_user_id` (`user_id`) USING BTREE,
|
|
||||||
KEY `idx_expire_time` (`expire_time`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='兑换码表';
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
-- ===============================================
|
|
||||||
-- 兑换码管理菜单配置 SQL
|
|
||||||
-- 注意:parent_id 需要根据实际情况调整
|
|
||||||
-- 请先查询 muye 积分管理的 parent_id: SELECT id FROM system_menu WHERE name = '积分管理';
|
|
||||||
-- ===============================================
|
|
||||||
|
|
||||||
-- 假设 muye 积分管理的 parent_id 为 5000,请根据实际情况修改
|
|
||||||
|
|
||||||
-- 1. 兑换码管理菜单(目录)
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换码管理', '', 2, 20, 0, '/redeemcode', 'ep:tickets', 'muye/redeemcode/index', 'RedeemCode', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 获取刚插入的菜单ID(兑换码管理)
|
|
||||||
SET @redeem_code_menu_id = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 1.1 兑换码查询
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换码查询', 'muye:redeem-code:query', 3, 1, @redeem_code_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 1.2 兑换码创建
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换码创建', 'muye:redeem-code:create', 3, 2, @redeem_code_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 1.3 兑换码删除
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换码删除', 'muye:redeem-code:delete', 3, 3, @redeem_code_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 1.4 兑换码导出
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换码导出', 'muye:redeem-code:export', 3, 4, @redeem_code_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 2. 兑换记录菜单(目录)
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换记录', '', 2, 21, 0, '/redeemrecord', 'ep:document', 'muye/redeemrecord/index', 'RedeemRecord', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 获取刚插入的菜单ID(兑换记录)
|
|
||||||
SET @redeem_record_menu_id = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 2.1 兑换记录查询
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换记录查询', 'muye:redeem-record:query', 3, 1, @redeem_record_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
|
|
||||||
-- 2.2 兑换记录导出
|
|
||||||
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
|
||||||
VALUES ('兑换记录导出', 'muye:redeem-record:export', 3, 2, @redeem_record_menu_id, '', '', '', NULL, 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0');
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
-- ===============================================
|
|
||||||
-- 兑换码系统建表 SQL
|
|
||||||
-- 执行此文件前请确保数据库连接正确
|
|
||||||
-- ===============================================
|
|
||||||
|
|
||||||
-- 1. 兑换码表
|
|
||||||
CREATE TABLE IF NOT EXISTS `muye_redeem_code` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
`code` varchar(32) NOT NULL COMMENT '兑换码',
|
|
||||||
`code_type` tinyint NOT NULL DEFAULT 1 COMMENT '码类型: 1-单次 2-多次',
|
|
||||||
`points` int NOT NULL COMMENT '积分数',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态: 0-未使用 1-已使用 2-已过期 3-已禁用',
|
|
||||||
`batch_no` varchar(32) DEFAULT NULL COMMENT '批次号',
|
|
||||||
`source` varchar(50) DEFAULT NULL COMMENT '来源',
|
|
||||||
`max_use_count` int NOT NULL DEFAULT 1 COMMENT '最大使用次数',
|
|
||||||
`used_count` int NOT NULL DEFAULT 0 COMMENT '已使用次数',
|
|
||||||
`user_id` bigint DEFAULT NULL COMMENT '使用者用户ID',
|
|
||||||
`used_time` datetime DEFAULT NULL COMMENT '使用时间',
|
|
||||||
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
|
|
||||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
|
||||||
`operator_id` bigint DEFAULT NULL COMMENT '操作人ID',
|
|
||||||
`operator_name` varchar(64) DEFAULT NULL COMMENT '操作人名称',
|
|
||||||
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
|
||||||
UNIQUE KEY `uk_code` (`code`) USING BTREE,
|
|
||||||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
|
||||||
KEY `idx_batch_no` (`batch_no`) USING BTREE,
|
|
||||||
KEY `idx_status` (`status`) USING BTREE,
|
|
||||||
KEY `idx_user_id` (`user_id`) USING BTREE,
|
|
||||||
KEY `idx_expire_time` (`expire_time`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='兑换码表';
|
|
||||||
|
|
||||||
-- 2. 兑换记录表
|
|
||||||
CREATE TABLE IF NOT EXISTS `muye_redeem_record` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
`user_id` bigint NOT NULL DEFAULT 0 COMMENT '用户编号',
|
|
||||||
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
|
|
||||||
`code_id` bigint NOT NULL DEFAULT 0 COMMENT '兑换码ID',
|
|
||||||
`code` varchar(32) NOT NULL COMMENT '兑换码',
|
|
||||||
`points` int NOT NULL DEFAULT 0 COMMENT '获得积分',
|
|
||||||
`balance_after` int NOT NULL DEFAULT 0 COMMENT '兑换后积分余额',
|
|
||||||
`source` varchar(50) NOT NULL DEFAULT '' COMMENT '来源',
|
|
||||||
`source_id` varchar(64) NOT NULL DEFAULT '' COMMENT '来源关联ID',
|
|
||||||
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '备注',
|
|
||||||
`creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
|
||||||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
|
||||||
KEY `idx_user_id` (`user_id`) USING BTREE,
|
|
||||||
KEY `idx_code_id` (`code_id`) USING BTREE,
|
|
||||||
KEY `idx_create_time` (`create_time`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='兑换记录表';
|
|
||||||
@@ -331,6 +331,8 @@ yudao:
|
|||||||
- /admin-api/system/user/profile/**
|
- /admin-api/system/user/profile/**
|
||||||
- /admin-api/system/auth/**
|
- /admin-api/system/auth/**
|
||||||
ignore-tables:
|
ignore-tables:
|
||||||
|
- muye_redeem_code # 兑换码表,不需要租户过滤
|
||||||
|
- muye_redeem_record # 兑换记录表,不需要租户过滤
|
||||||
ignore-caches:
|
ignore-caches:
|
||||||
- user_role_ids
|
- user_role_ids
|
||||||
- permission_menu_ids
|
- permission_menu_ids
|
||||||
|
|||||||
@@ -10,15 +10,8 @@ export const getRedeemRecord = async (id: number) => {
|
|||||||
return await request.get({ url: `/muye/redeem-record/get?id=` + id })
|
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
|
// 导出兑换记录 Excel
|
||||||
export const exportRedeemRecord = async (params) => {
|
export const exportRedeemRecord = async (params) => {
|
||||||
|
|||||||
@@ -1,42 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||||
class="-mb-15px"
|
|
||||||
:model="queryParams"
|
|
||||||
ref="queryFormRef"
|
|
||||||
:inline="true"
|
|
||||||
label-width="68px"
|
|
||||||
>
|
|
||||||
<el-form-item label="兑换码" prop="code">
|
<el-form-item label="兑换码" prop="code">
|
||||||
<el-input
|
<el-input v-model="queryParams.code" placeholder="请输入兑换码" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.code"
|
|
||||||
placeholder="请输入兑换码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||||
v-model="queryParams.status"
|
|
||||||
placeholder="请选择状态"
|
|
||||||
clearable
|
|
||||||
class="!w-240px"
|
|
||||||
>
|
|
||||||
<el-option label="禁用" :value="0" />
|
<el-option label="禁用" :value="0" />
|
||||||
<el-option label="未使用" :value="1" />
|
<el-option label="启用" :value="1" />
|
||||||
<el-option label="已用完" :value="2" />
|
<el-option label="已用完" :value="2" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="批次号" prop="batchNo">
|
<el-form-item label="批次号" prop="batchNo">
|
||||||
<el-input
|
<el-input v-model="queryParams.batchNo" placeholder="请输入批次号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.batchNo"
|
|
||||||
placeholder="请输入批次号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" prop="createTime">
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -52,39 +29,16 @@
|
|||||||
<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>
|
||||||
<el-button
|
<el-button type="primary" plain @click="openGenerateForm" v-hasPermi="['muye:redeem-code:create']">
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
@click="openGenerateForm"
|
|
||||||
v-hasPermi="['muye:redeem-code:create']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 批量生成
|
<Icon icon="ep:plus" class="mr-5px" /> 批量生成
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading" v-hasPermi="['muye:redeem-code:export']">
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
@click="handleExport"
|
|
||||||
:loading="exportLoading"
|
|
||||||
v-hasPermi="['muye:redeem-code:export']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出Excel
|
<Icon icon="ep:download" class="mr-5px" /> 导出Excel
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button type="warning" plain @click="handleExportPlain" :disabled="!queryParams.batchNo" v-hasPermi="['muye:redeem-code:export']">
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
@click="handleExportPlain"
|
|
||||||
:disabled="!queryParams.batchNo"
|
|
||||||
v-hasPermi="['muye:redeem-code:export']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:document" class="mr-5px" /> 导出纯文本
|
<Icon icon="ep:document" class="mr-5px" /> 导出纯文本
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button type="danger" plain :disabled="checkedIds.length === 0" @click="handleDeleteBatch" v-hasPermi="['muye:redeem-code:delete']">
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
:disabled="checkedIds.length === 0"
|
|
||||||
@click="handleDeleteBatch"
|
|
||||||
v-hasPermi="['muye:redeem-code:delete']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -93,67 +47,48 @@
|
|||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table
|
<el-table row-key="id" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||||
row-key="id"
|
|
||||||
v-loading="loading"
|
|
||||||
:data="list"
|
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
>
|
|
||||||
<el-table-column type="selection" width="40" />
|
<el-table-column type="selection" width="40" />
|
||||||
<el-table-column label="兑换码" align="center" prop="code" width="180" />
|
<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">
|
<template #default="scope">
|
||||||
<el-tag type="warning">{{ scope.row.points }}</el-tag>
|
<el-tag type="warning">{{ scope.row.points }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.status === 0" type="danger">禁用</el-tag>
|
<el-tag :type="getStatusType(scope.row.status)">
|
||||||
<el-tag v-else-if="scope.row.status === 1" type="success">未使用</el-tag>
|
{{ getStatusLabel(scope.row.status) }}
|
||||||
<el-tag v-else-if="scope.row.status === 2" type="info">已用完</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else type="warning">未知</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="批次号" align="center" prop="batchNo" width="160" />
|
<el-table-column label="批次号" align="center" prop="batchNo" width="150" />
|
||||||
<el-table-column label="使用者ID" align="center" prop="userId" width="100" />
|
<el-table-column label="来源" align="center" prop="source" width="80">
|
||||||
<el-table-column label="使用次数" align="center" width="100">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.usedCount }} / {{ scope.row.maxUseCount }}
|
{{ sourceMap[scope.row.source] || scope.row.source }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="过期时间" align="center" prop="expireTime" width="180" />
|
<el-table-column label="使用" align="center" width="80">
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180"
|
|
||||||
/>
|
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="120">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
{{ scope.row.usedCount }}/{{ scope.row.maxUseCount }}
|
||||||
link
|
</template>
|
||||||
type="danger"
|
</el-table-column>
|
||||||
@click="handleDelete(scope.row.id)"
|
<el-table-column label="过期时间" align="center" prop="expireTime" width="160" />
|
||||||
v-hasPermi="['muye:redeem-code:delete']"
|
<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>
|
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['muye:redeem-code:delete']">删除</el-button>
|
||||||
</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" />
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 批量生成表单 -->
|
<!-- 批量生成表单 -->
|
||||||
@@ -169,7 +104,25 @@ import RedeemCodeGenerateForm from './RedeemCodeGenerateForm.vue'
|
|||||||
defineOptions({ name: 'RedeemCode' })
|
defineOptions({ name: 'RedeemCode' })
|
||||||
|
|
||||||
const message = useMessage()
|
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 loading = ref(true)
|
||||||
const list = ref([])
|
const list = ref([])
|
||||||
@@ -226,7 +179,7 @@ const handleDelete = async (id: number) => {
|
|||||||
try {
|
try {
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
await RedeemCodeApi.deleteRedeemCode(id)
|
await RedeemCodeApi.deleteRedeemCode(id)
|
||||||
message.success(t('common.delSuccess'))
|
message.success('删除成功')
|
||||||
await getList()
|
await getList()
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
@@ -236,7 +189,7 @@ const handleDeleteBatch = async () => {
|
|||||||
try {
|
try {
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
await RedeemCodeApi.deleteRedeemCodeList(checkedIds.value)
|
await RedeemCodeApi.deleteRedeemCodeList(checkedIds.value)
|
||||||
message.success(t('common.delSuccess'))
|
message.success('删除成功')
|
||||||
await getList()
|
await getList()
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user