增加VIP管理模块

This commit is contained in:
liuyuan
2024-11-08 16:42:02 +08:00
parent 8a0b0aae88
commit f369993880
7 changed files with 1774 additions and 136 deletions

View File

@@ -23,7 +23,7 @@ module.exports = {
},
// Various Dev Server settings
host: '192.168.110.162', // can be overwritten by process.env.HOST
host: '192.168.110.2', // can be overwritten by process.env.HOST
port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,

1256
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@
</el-table-column> -->
<!-- <el-table-column prop="sex" header-align="center" align="center" label="性别">
<template slot-scope="scope">
<span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span>
<span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span>
</template>
</el-table-column> -->
<el-table-column

View File

@@ -0,0 +1,244 @@
<template>
<div class="vip-personnel">
<el-form :inline="true" :model="dataForm">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.tel" placeholder="手机号码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.email" placeholder="邮箱" clearable></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="dataForm.type" placeholder="请选择类型">
<el-option label="超v" value=1></el-option>
<el-option label="吴门医述v原简易超v" value=2></el-option>
<el-option label="众秒之门vip" value=3></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="dataForm.state" placeholder="请选择状态">
<el-option label="有效" value=0></el-option>
<el-option label="失效" value=1></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
width="70"
label="ID">
<template slot-scope="scope">{{scope.row.user.id}}</template>
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
width="120"
label="用户名称">
<template slot-scope="scope">{{scope.row.user.name}}</template>
</el-table-column>
<el-table-column
prop="tel"
header-align="center"
align="center"
width="120"
label="手机号码">
<template slot-scope="scope">{{scope.row.user.tel}}</template>
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
width="120"
label="邮箱">
<template slot-scope="scope">{{scope.row.user.email}}</template>
</el-table-column>
<el-table-column
prop="type"
header-align="center"
align="center"
width="120"
label="类型">
<template slot-scope="scope">
<span v-if="scope.row.type==1">超v</span>
<span v-if="scope.row.type==2">吴门医述v原简易超v</span>
<span v-if="scope.row.type==3">众秒之门vip</span>
</template>
</el-table-column>
<el-table-column
prop="state"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<span v-if="scope.row.state==0">有效</span>
<span v-if="scope.row.state==1" style=" color: red;">失效</span>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="160"
label="开始时间">
<template slot-scope="scope">{{scope.row.startTime}}</template>
</el-table-column>
<el-table-column
prop="endTime"
header-align="center"
align="center"
width="160"
label="结束时间">
<template slot-scope="scope">{{scope.row.endTime}}</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="130"
label="操作">
<template slot-scope="scope">
<el-popover
placement="right"
width="300"
trigger="click"
@show="getVipMoney(scope.row)"
>
<el-table :data="vipList" class="vip-list-table">
<el-table-column
width="150"
property="title"
label="VIP名称"
></el-table-column>
<el-table-column
width="100"
property="lastFee"
label="开通金额"
></el-table-column>
</el-table>
<el-button slot="reference" size="small">办理金额</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
userName: '',
tel: '',
email: '',
type: '',
state: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
vipList: []
}
},
methods: {
// 获取列表数据
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/master/userVip/listByPage'),
method: 'POST',
data: {
current: this.pageIndex,
limit: this.pageSize,
userName: this.dataForm.userName,
tel: this.dataForm.tel,
email: this.dataForm.email,
type: this.dataForm.type,
state: this.dataForm.state
}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// VIP办理
getVipMoney (data) {
this.$http({
url: this.$http.adornUrl('/master/userVip/getVipProductForUser'),
method: 'POST',
data: this.$http.adornData({
uid: data.userId
})
}).then(({data}) => {
let list = []
if (data && data.code === 0) {
for (let i in data.list) {
if (data.list[i].length > 0) {
list.push([...data.list[i]])
}
}
this.vipList = list.flat(Infinity)
} else {
this.$message.error(data.msg)
this.vipList = []
}
})
}
},
activated () {
this.getDataList()
}
}
</script>
<style scoped>
.vip-personnel .el-form-item:last-child{
margin-right:0;
}
</style>

View File

@@ -0,0 +1,214 @@
<template>
<div class="vip-product">
<el-form :inline="true">
<el-form-item class="el-form-item">
<el-button type="primary" @click="addProduct()">新增</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="type"
header-align="center"
align="center"
label="类型">
<template slot-scope="scope">
<span v-if="scope.row.type==1">超级vip</span>
<span v-if="scope.row.type==2">医学vip</span>
<span v-if="scope.row.type==3">国学vip</span>
</template>
</el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
width="140"
label="title">
</el-table-column>
<el-table-column
prop="year"
header-align="center"
align="center"
label="有效期">
<template slot-scope="scope">
<span>{{ scope.row.year }} </span>
</template>
</el-table-column>
<el-table-column
prop="dateType"
header-align="center"
align="center"
label="有效时长">
<template slot-scope="scope">
<span v-if="scope.row.dateType==0">长期有效</span>
<span v-if="scope.row.dateType==1">短期有效</span>
</template>
</el-table-column>
<el-table-column
prop="fee"
header-align="center"
align="center"
label="价格">
</el-table-column>
<el-table-column
prop="rebateFee"
header-align="center"
align="center"
label="折扣价格">
</el-table-column>
<el-table-column
prop="startTime"
header-align="center"
align="center"
width="160"
label="开始时间">
</el-table-column>
<el-table-column
prop="endTime"
header-align="center"
align="center"
width="160"
label="结束时间">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="delFlag"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- label="状态">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.delFlag==0">正常</span>-->
<!-- <span v-if="scope.row.delFlag!=0">&#45;&#45;</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="updateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<update-product v-if="updateState" ref="updateProduct" @refreshDataList="getDataList"></update-product>
</div>
</template>
<script>
import UpdateProduct from './update-product'
export default {
data () {
return {
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
updateState: false
}
},
components: {
UpdateProduct
},
methods: {
// 获取列表数据
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/getVipBuyConfigList'),
method: 'POST',
data: {
page: this.pageIndex,
limit: this.pageSize
}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 新增
addProduct () {
this.updateState = true
this.$nextTick(() => {
this.$refs.updateProduct.init()
})
},
// 修改
updateHandle (id) {
this.updateState = true
this.$nextTick(() => {
this.$refs.updateProduct.init(id)
})
},
// 删除
deleteHandle (id) {
this.$confirm(`确定对[id=${id}]进行[删除]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/delVipBuyConfig'),
method: 'POST',
data: {id: id}
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
this.getDataList()
} else {
this.$message.error(data.msg)
}
})
})
}
},
activated () {
this.getDataList()
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,188 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择商品类型">
<el-option label="超级vip" value=1></el-option>
<el-option label="医学vip" value=2></el-option>
<el-option label="国学vip" value=3></el-option>
</el-select>
</el-form-item>
<el-form-item label="title" prop="title">
<el-input v-model="dataForm.title" placeholder="请输入title"></el-input>
</el-form-item>
<el-form-item label="有效期" prop="year">
<el-input v-model="dataForm.year" placeholder="请输入有效期"></el-input>
</el-form-item>
<el-form-item label="有效时长" prop="dateType">
<el-radio v-model="dataForm.dateType" :label='0'>长期有效</el-radio>
<el-radio v-model="dataForm.dateType" :label='1'>短期有效</el-radio>
</el-form-item>
<el-form-item label="价格" prop="fee">
<el-input v-model="dataForm.fee" placeholder="请输入价格"></el-input>
</el-form-item>
<el-form-item label="折扣价格" prop="rebateFee">
<el-input v-model="dataForm.rebateFee" placeholder="请输入折扣价格"></el-input>
</el-form-item>
<el-form-item label="开始时间" prop="startTime" v-if="dataForm.dateType==1">
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="dataForm.startTime"
type="datetime"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime" v-if="dataForm.dateType==1">
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="dataForm.endTime"
type="datetime"
placeholder="选择结束时间">
</el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
type: '',
title: '',
year: '',
dateType: 0,
fee: '',
rebateFee: '',
startTime: '',
endTime: ''
},
type: 1,
year: 0,
dataRule: {
type: [
{ required: true, message: '类型不能为空', trigger: 'blur' }
],
title: [
{ required: true, message: 'title不能为空', trigger: 'blur' }
],
year: [
{ required: true, message: '有效期不能为空', trigger: 'blur' }
],
fee: [
{ required: true, message: '价格不能为空', trigger: 'blur' }
],
rebateFee: [
{ required: true, message: '折扣价格不能为空', trigger: 'blur' }
],
startTime: [
{ required: true, message: '开始时间不能为空', trigger: 'blur' }
],
endTime: [
{ required: true, message: '结束时间不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.visible = true
this.dataForm.id = id
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/getVipBuyConfigById'),
method: 'POST',
data: {id: id}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.type = this.setType(data.data.type)
this.dataForm.title = data.data.title
this.dataForm.year = data.data.year + '年'
this.dataForm.fee = data.data.fee
this.dataForm.rebateFee = data.data.rebateFee
this.dataForm.startTime = data.data.startTime
this.dataForm.endTime = data.data.endTime
this.dataForm.dateType = data.data.dateType
}
})
} else {
this.$refs['dataForm'].resetFields()
}
},
// 设置类型字符串
setType (type) {
if (type === 1) {
return '1'
} else if (type === 2) {
return '2'
} else {
return '3'
}
},
// 数字
extractNumbers (str) {
return str.replace(/\D/g, '')
},
// 提交表单
dataFormSubmit () {
if (this.dataForm.type === '1') {
this.type = 1
} else if (this.dataForm.type === '2') {
this.type = 2
} else {
this.type = 3
}
// 数字
if (this.dataForm.year) {
this.year = this.extractNumbers(this.dataForm.year)
}
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/saveOrUpdateVipBuyConfig'),
method: 'POST',
data: {
id: this.dataForm.id,
type: this.type,
title: this.dataForm.title,
year: Number(this.year),
dateType: this.dataForm.dateType,
fee: Number(this.dataForm.fee),
rebateFee: Number(this.dataForm.rebateFee),
startTime: this.dataForm.startTime,
endTime: this.dataForm.endTime
}
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -5,10 +5,10 @@
window.SITE_CONFIG = {};
// api接口请求地址
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';//张川川
window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';//张川川
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb';
// window.SITE_CONFIG['baseUrl'] = 'https://testapi.nuttyreading.com'; // 线上测试环境11
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
// window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb';//磊哥
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb';
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';