注册码,优化功能

main
王宇航 2024-06-28 20:16:52 +08:00
parent 7077951b76
commit 154a7e43cc
9 changed files with 299 additions and 5 deletions

View File

@ -163,4 +163,10 @@ public class AppUserController extends BaseController
public AjaxResult vipById(@PathVariable("id") Long id) {
return AjaxResult.success(appUserService.vipById(id));
}
public static void main(String[] args) {
String s = "12";
System.out.println(s.length());
}
}

View File

@ -57,6 +57,14 @@ public class AppVip extends BaseEntity
return price;
}
public Long getStatus() {
return status;
}
public void setStatus(Long status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -66,6 +74,7 @@ public class AppVip extends BaseEntity
.append("remark", getRemark())
.append("level", getLevel())
.append("price", getPrice())
.append("status", getStatus())
.toString();
}
}

View File

@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectAppExchangeCodeList" parameterType="AppExchangeCode" resultMap="AppExchangeCodeResult">
select e.id, e.code, e.user_id, e.create_time, e.update_time, e.create_by, e.updateBy, e.remark, e.user_time , u.username as userName
select e.id, e.code, e.level, e.user_id, e.create_time, e.update_time, e.create_by, e.updateBy, e.remark, e.user_time , u.username as userName
from app_exchange_code e left join app_user u on u.id = e.user_id
<where>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询用户注册码列表
export function listCode(query) {
return request({
url: '/app/appCode/list',
method: 'get',
params: query
})
}
// 查询用户注册码详细
export function getCode(id) {
return request({
url: '/app/appCode/' + id,
method: 'get'
})
}
// 新增用户注册码
export function addCode(data) {
return request({
url: '/app/appCode/add',
method: 'post',
data: data
})
}
// 修改用户注册码
export function updateCode(data) {
return request({
url: '/app/appCode/edit',
method: 'put',
data: data
})
}
// 删除用户注册码
export function delCode(id) {
return request({
url: '/app/appCode/' + id,
method: 'delete'
})
}

View File

@ -20,7 +20,7 @@ export function getCode(id) {
// 新增兑换码
export function addCode(data) {
return request({
url: '/app/code',
url: '/app/code/add',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addCode(data) {
// 修改兑换码
export function updateCode(data) {
return request({
url: '/app/code',
url: '/app/code/edit',
method: 'put',
data: data
})

View File

@ -0,0 +1,227 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="兑换码" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入兑换码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['app:code:add']"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
<el-table-column label="兑换码" align="center" prop="code" />
<el-table-column label="使用者" align="center" prop="userId" />
<el-table-column label="使用时间" align="center" prop="userTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.userTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['app:code:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['app:code:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改用户注册码对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="兑换码" prop="code">
<el-input v-model="form.code" placeholder="请输入兑换码" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCode, getCode, delCode, addCode, updateCode } from "@/api/app/appcode";
export default {
name: "Code",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
codeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
userId: null,
updateBy: null,
userTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询用户注册码列表 */
getList() {
this.loading = true;
listCode(this.queryParams).then(response => {
this.codeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
code: null,
userId: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null,
userTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加用户注册码";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCode(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改用户注册码";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCode(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCode(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除用户注册码编号为"' + ids + '"的数据项?').then(function() {
return delCode(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('app/code/export', {
...this.queryParams
}, `code_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -301,7 +301,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="用户名称" class="userId">
<el-tag type="success" class="rotate-text">{{ userDetail.username }}</el-tag>
<el-tag type="success" >{{ userDetail.username }}</el-tag>
</el-form-item>
</el-col>
<el-col :span="12">

View File

@ -64,6 +64,11 @@
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="兑换码" align="center" prop="code" />
<el-table-column label="会员级别" align="center" prop="level" >
<template slot-scope="scope">
<el-tag :type="scope.row.level === 1 ? 'primary' : scope.row.level === 2 ? 'warning' : scope.row.level === 3 ? 'success' : scope.row.level === 4 ? 'info' : 'danger'">{{scope.row.level === 1 ? '7天试用' : scope.row.level === 2 ? '连续包月' : scope.row.level === 3 ? '连续包年' : scope.row.level === 4 ? '试用三个月' : '等级不存在'}}</el-tag>
</template>
</el-table-column>
<el-table-column label="使用者" align="center" prop="userName" />
<el-table-column label="使用时间" align="center" prop="userTime" width="180">
<template slot-scope="scope">
@ -106,6 +111,7 @@
<el-option label="7天试用" value="1"></el-option>
<el-option label="连续包月" value="2"></el-option>
<el-option label="连续包年" value="3"></el-option>
<el-option label="试用三个月" value="4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数量" prop="level" width="500px">

View File

@ -164,7 +164,8 @@ export default {
pageNum: 1,
pageSize: 10,
level: null,
price: null
price: null,
status: 0
},
//
form: {},
@ -180,6 +181,7 @@ export default {
/** 查询会员信息列表 */
getList() {
this.loading = true;
this.queryParams.status = 0;
listVip(this.queryParams).then(response => {
this.vipList = response.rows;
this.total = response.total;