培训班

This commit is contained in:
liuyuan
2025-04-16 13:57:33 +08:00
parent c5749400c7
commit 5772a8ae9d
5 changed files with 472 additions and 156 deletions

View File

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

View File

@@ -19,25 +19,7 @@
<template v-if="pageType == 'label'"> <template v-if="pageType == 'label'">
<el-form-item label="手机号/邮箱:" prop="userKey" class="form_item"> <el-form-item label="手机号/邮箱:" prop="userKey" class="form_item">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-autocomplete
v-if="!isEdit"
style="width: 400px;"
v-model="addCertificateForm.userKey"
:fetch-suggestions="loadAll"
placeholder="请输入手机号/邮箱"
@select="handleSelect"
>
<template #default="{ item }">
<div class="custom-item">
<span>{{ item.tel ? item.tel : item.email }}</span>
<span
style="color: gray; margin-left: 10px;"
v-if="item.name"
>({{ item.name }})</span
>
</div>
</template>
</el-autocomplete>
<span v-if="isEdit">{{ addCertificateForm.userKey }}</span> <span v-if="isEdit">{{ addCertificateForm.userKey }}</span>
</div> </div>
</el-form-item> </el-form-item>

View File

@@ -13,7 +13,7 @@
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="年份"> <el-form-item label="培训年份">
<el-input <el-input
v-model="dataForm.year" v-model="dataForm.year"
placeholder="请输入年份(YYYY)" placeholder="请输入年份(YYYY)"
@@ -47,33 +47,62 @@
border border
v-loading="dataListLoading" v-loading="dataListLoading"
style="width: 100%" style="width: 100%"
@sort-change="handleSortChange"
> >
<el-table-column label="标题" align="center"> <el-table-column
label="序号"
type="index"
align="center"
width="60">
</el-table-column>
<el-table-column label="培训日期" width="110" align="center" sortable="custom" :sort-orders="['ascending', 'descending']">
<template slot-scope="scope">
<span v-if="scope.row.trainingDate">
{{ scope.row.trainingDate.substring(0, 10) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="创建时间" width="110" align="center" sortable="custom" :sort-orders="['ascending', 'descending']">
<template slot-scope="scope">
<span v-if="scope.row.createTime">
{{ scope.row.createTime.substring(0, 10) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="标题" align="center" width="160">
<template slot-scope="scope">{{ scope.row.title }}</template> <template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column> </el-table-column>
<el-table-column label="年份" align="center"> <el-table-column label="海报" align="center" width="90">
<template slot-scope="scope">{{ scope.row.year }}</template> <template slot-scope="scope">
<img width="50px" :src="scope.row.icon" v-if="scope.row.icon" alt="" />
</template>
</el-table-column> </el-table-column>
<el-table-column label="原价" align="center"> <el-table-column label="年份" align="center" prop="year" width="90"></el-table-column>
<el-table-column label="原价" align="center" width="80">
<template slot-scope="scope">{{ scope.row.fee }}</template> <template slot-scope="scope">{{ scope.row.fee }}</template>
</el-table-column> </el-table-column>
<el-table-column label="vip价格" align="center"> <el-table-column label="vip价格" align="center" width="80">
<template slot-scope="scope">{{ scope.row.vipFee }}</template> <template slot-scope="scope">{{ scope.row.vipFee }}</template>
</el-table-column> </el-table-column>
<el-table-column label="svip价格" align="center"> <el-table-column label="svip价格" align="center" width="80">
<template slot-scope="scope">{{ scope.row.svipFee }}</template> <template slot-scope="scope">{{ scope.row.svipFee }}</template>
</el-table-column> </el-table-column>
<el-table-column label="湖粉价格" align="center"> <el-table-column label="湖粉价格" align="center" width="130">
<template slot-scope="scope">{{ scope.row.huFee }}</template> <template slot-scope="scope">
三星湖粉 {{ scope.row.threeHuFee }}<br/>
五星湖粉 {{ scope.row.fiveHuFee }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="活动类型" align="center" prop="type"> <el-table-column label="活动类型" align="center" prop="type" width="90">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.type==1">线上</span> <span v-if="scope.row.type==1">线上</span>
<span v-else-if="scope.row.type==2">线下</span> <span v-else-if="scope.row.type==2">线下</span>
<span v-else>--</span> <span v-else>--</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报名状态" align="center" width="220"> <el-table-column label="报名状态" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
@change="changeSingupFlag(scope.row)" @change="changeSingupFlag(scope.row)"
@@ -87,13 +116,13 @@
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
</el-table-column> <el-table-column label="排序" align="center" prop="sort" width="90"></el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
header-align="center" header-align="center"
align="center" align="center"
width="120"
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@@ -107,7 +136,6 @@
<el-button <el-button
type="text" type="text"
size="small" size="small"
@click="userHandle(scope.row)"
>用户列表</el-button >用户列表</el-button
> >
</router-link> </router-link>
@@ -141,21 +169,47 @@
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="addForm.title" placeholder="请输入标题"></el-input> <el-input v-model="addForm.title" placeholder="请输入标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="年份" prop="year"> <el-form-item label="培训日期" prop="trainingDate">
<el-input v-model="addForm.year" placeholder="请输入年份(YYYY)"></el-input> <el-date-picker
v-model="addForm.trainingDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择日期">
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="原价" prop="fee"> <el-form-item label="原价" prop="fee">
<el-input v-model="addForm.fee" placeholder="请输入原价"></el-input> <el-input v-model="addForm.fee" placeholder="请输入原价"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="addForm.sort" placeholder="请输入排序"></el-input>
</el-form-item>
<el-form-item label="vip类型">
<el-checkbox-group v-model="vipType" @change="handleCheckedVip" class="checkbox-group">
<el-checkbox v-for="item in vipList" :label="item.type" :key="item.type">{{item.title}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="vip价格" prop="vipFee"> <el-form-item label="vip价格" prop="vipFee">
<el-input v-model="addForm.vipFee" placeholder="请输入vip价格"></el-input> <el-input v-model="addForm.vipFee" placeholder="请输入vip价格"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="svip类型">
<el-checkbox-group v-model="svipType" @change="handleCheckedSvip" class="checkbox-group">
<el-checkbox v-for="item in svipList" :label="item.type" :key="item.type">{{item.title}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="svip价格" prop="svipFee"> <el-form-item label="svip价格" prop="svipFee">
<el-input v-model="addForm.svipFee" placeholder="请输入svip价格"></el-input> <el-input v-model="addForm.svipFee" placeholder="请输入svip价格"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="湖粉价格" prop="huFee"> <el-form-item label="湖粉价格">
<el-input v-model="addForm.huFee" placeholder="请输入湖粉价格"></el-input> <div class="hufen_block">
<span>三星湖粉</span>
<el-input v-model="addForm.threeHuFee" placeholder="请输入湖粉价格(90湖分以上)"></el-input>
</div>
<div class="hufen_block">
<span>五星湖粉</span>
<el-input v-model="addForm.fiveHuFee" placeholder="请输入湖粉价格(150湖分以上)"></el-input>
</div>
</el-form-item> </el-form-item>
<el-form-item label="活动类型" prop="type"> <el-form-item label="活动类型" prop="type">
<el-radio-group v-model="addForm.type"> <el-radio-group v-model="addForm.type">
<el-radio :label="1">线上</el-radio> <el-radio :label="1">线上</el-radio>
@@ -174,6 +228,25 @@
> >
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="上传海报" prop="icon">
<el-upload
:limit="1"
class="el-uploadfeng"
:action="baseUrl + '/oss/fileoss'"
list-type="picture-card"
:on-preview="handlePreview"
:file-list="fileList"
:on-success="handleSuccess"
accept=".jpeg,.jpg,.gif,.png"
:on-remove="handleRemove"
>
<i class="el-icon-plus"></i>
</el-upload>
<span>支持图片类型.jpeg,.jpg,.gif,.png</span>
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<img width="100%" :src="addForm.icon" alt="" />
</el-dialog>
</el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button> <el-button @click="cancleClose"> </el-button>
@@ -183,12 +256,13 @@
</div> </div>
</template> </template>
<script> <script>
import global from "../../common/common.vue"; //引入共用组间
export default { export default {
data() { data() {
// 通用校验规则:正数且大于 0 // 通用校验规则:正数且大于 0
const validatePositiveNumber = (rule, value, callback) => { const validatePositiveNumber = (rule, value, callback) => {
if (!value) { if (!value) {
return callback(new Error('不能为空')); return callback(new Error('原价不能为空'));
} }
if (!/^\d+(\.\d+)?$/.test(value)) { if (!/^\d+(\.\d+)?$/.test(value)) {
return callback(new Error('必须是正数或小数')); return callback(new Error('必须是正数或小数'));
@@ -199,10 +273,12 @@ export default {
callback(); callback();
}; };
return { return {
baseUrl: global.baseUrl,
dataForm: { dataForm: {
title: '', title: '',
type: '', //1线上 2线下 type: '', //1线上 2线下
year: '', year: '', //日期
trainingDate: '',
singupFlag: '', //1可报名 0不可报名 singupFlag: '', //1可报名 0不可报名
}, },
addForm: { addForm: {
@@ -211,12 +287,16 @@ export default {
type: 1, //1线上 2线下 type: 1, //1线上 2线下
icon: '', icon: '',
year: '', year: '',
trainingDate: '',
fee: '', fee: '',
vipType: '',
vipFee: '', vipFee: '',
svipType: '',
svipFee: '', svipFee: '',
huFee: '', threeHuFee: '',
fiveHuFee: '',
singupFlag: 1, //1可报名 0不可报名 singupFlag: 1, //1可报名 0不可报名
sort: 0 sort: ''
}, },
editId: "", editId: "",
addFormRule: { addFormRule: {
@@ -226,10 +306,11 @@ export default {
message: "请输入标题", message: "请输入标题",
}, },
], ],
year: [ trainingDate: [
{ {
required: true, required: true,
message: "请输入年份", message: "请选择日期",
trigger: 'change'
}, },
], ],
fee: [ fee: [
@@ -247,12 +328,44 @@ export default {
addOrUpdateVisible: false, addOrUpdateVisible: false,
titlesub: '新增', titlesub: '新增',
statusType: 0, //区分新增还是修改 statusType: 0, //区分新增还是修改
value: '', //选择日期
fileList: [], //图片数组
dialogVisible: false,
//保存数据
vipList: [],
svipList: [],
//勾选值
vipType: [],
svipType: [],
//日期排序
sortParams: {
date1: '',
date2: ''
}
}; };
}, },
created() { activated(){
this.getDataList(); this.getDataList();
this.getVipData();
}, },
methods: { methods: {
//排序变化事件
handleSortChange({ column, prop, order }) {
// 更新当前列的排序状态
var name = column.label;
if(name=='培训日期'){
this.sortParams.date1 = order
? (order === 'ascending' ? '2' : '1')
: null;
}else{
this.sortParams.date2 = order
? (order === 'ascending' ? '2' : '1')
: null;
}
this.getDataList();
},
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
@@ -262,6 +375,8 @@ export default {
data: this.$http.adornData({ data: this.$http.adornData({
current: this.pageIndex, current: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
trainingDateSort: this.sortParams.date1,
createTimeSort: this.sortParams.date2,
title: this.dataForm.title, title: this.dataForm.title,
type: this.dataForm.type, type: this.dataForm.type,
year: this.dataForm.year, year: this.dataForm.year,
@@ -291,35 +406,41 @@ export default {
type: 1, //1线上 2线下 type: 1, //1线上 2线下
icon: '', icon: '',
year: '', year: '',
trainingDate: '',
fee: '', fee: '',
vipType: '',
vipFee: '', vipFee: '',
svipType: '',
svipFee: '', svipFee: '',
huFee: '', threeHuFee: '',
fiveHuFee: '',
singupFlag: 1, //1可报名 0不可报名 singupFlag: 1, //1可报名 0不可报名
sort: 0 sort: ''
} }
this.fileList = [];
this.vipType = [];
this.svipType = [];
}, },
//关闭 //点击确定
cancleClose(){
this.addOrUpdateVisible = false;
},
addOrEditCate(){ addOrEditCate(){
//如果是新增 if(this.statusType==0){ //如果是新增
if(this.statusType==0){
this.addCate(); this.addCate();
}else if(this.statusType==1){ //如果是修改 }else if(this.statusType==1){ //如果是修改
this.editCate(this.addForm); this.editCate(this.addForm);
} }
}, },
//取消 //取消
cancleClose(){ cancleClose(){
this.addOrUpdateVisible = false; this.addOrUpdateVisible = false;
}, },
//确定 //修改
editCate(data){ editCate(data){
this.$refs["addFormRef"].validate(valid => { this.$refs["addFormRef"].validate(valid => {
if (valid) { if (valid) {
var icon = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
}
this.$http({ this.$http({
url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"), url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"),
method: "post", method: "post",
@@ -328,12 +449,16 @@ export default {
title: data.title, title: data.title,
type: data.type, type: data.type,
year: data.year, year: data.year,
trainingDate: data.trainingDate,
singupFlag: data.singupFlag, singupFlag: data.singupFlag,
icon: data.icon, icon: icon,
fee: data.fee, fee: data.fee,
vipType: String(this.vipType),
vipFee: data.vipFee, vipFee: data.vipFee,
svipType: String(this.svipType),
svipFee: data.svipFee, svipFee: data.svipFee,
huFee: data.huFee, threeHuFee: data.threeHuFee,
fiveHuFee: data.fiveHuFee,
sort: data.sort sort: data.sort
}), }),
}).then(({ data }) => { }).then(({ data }) => {
@@ -365,6 +490,10 @@ export default {
addCate(){ addCate(){
this.$refs["addFormRef"].validate(valid => { this.$refs["addFormRef"].validate(valid => {
if (valid) { if (valid) {
var icon = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
}
this.$http({ this.$http({
url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"), url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"),
method: "post", method: "post",
@@ -372,13 +501,16 @@ export default {
id: this.addForm.id, id: this.addForm.id,
title: this.addForm.title, title: this.addForm.title,
type: String(this.addForm.type), type: String(this.addForm.type),
year: this.addForm.year, trainingDate: this.addForm.trainingDate,
singupFlag: String(this.addForm.singupFlag), singupFlag: String(this.addForm.singupFlag),
icon: this.addForm.icon, icon: icon,
fee: this.addForm.fee, fee: this.addForm.fee,
vipType: String(this.vipType),
vipFee: this.addForm.vipFee, vipFee: this.addForm.vipFee,
svipType: String(this.svipType),
svipFee: this.addForm.svipFee, svipFee: this.addForm.svipFee,
huFee: this.addForm.huFee, threeHuFee: this.addForm.threeHuFee,
fiveHuFee: this.addForm.fiveHuFee,
sort: this.addForm.sort sort: this.addForm.sort
}), }),
}).then(({ data }) => { }).then(({ data }) => {
@@ -399,6 +531,7 @@ export default {
//操作 //操作
//点击修改 //点击修改
editHandle(data){ editHandle(data){
this.fileList = [];
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.titlesub = '修改'; this.titlesub = '修改';
this.statusType = 1; //修改 this.statusType = 1; //修改
@@ -407,17 +540,69 @@ export default {
this.addForm.title = data.title; this.addForm.title = data.title;
this.addForm.type = Number(data.type); this.addForm.type = Number(data.type);
this.addForm.year = data.year; this.addForm.year = data.year;
this.addForm.trainingDate = data.trainingDate;
this.addForm.singupFlag = Number(data.singupFlag); this.addForm.singupFlag = Number(data.singupFlag);
this.addForm.icon = data.icon; this.addForm.icon = data.icon;
//图片赋值
if(data.icon){
this.fileList.push({
url: data.icon
});
}
this.addForm.fee = data.fee; this.addForm.fee = data.fee;
this.vipType = data.vipType.split(',').map(item => parseInt(item, 10));
this.addForm.vipFee = data.vipFee; this.addForm.vipFee = data.vipFee;
this.svipType = data.svipType.split(',').map(item => parseInt(item, 10));
this.addForm.svipFee = data.svipFee; this.addForm.svipFee = data.svipFee;
this.addForm.huFee = data.huFee; this.addForm.threeHuFee = data.threeHuFee;
this.addForm.fiveHuFee = data.fiveHuFee;
this.addForm.sort = data.sort; this.addForm.sort = data.sort;
}, },
//点击用户列表 //上传图片
userHandle(data){ handlePreview(file) {
console.log('用户列表') this.fileList = [];
this.addForm.icon = file.url;
this.fileList.push({
url: file.url
});
this.dialogVisible = true;
},
//图片上传成功
handleSuccess(res, file) {
if (res.msg == "success") {
this.fileList.push({
url: res.url
});
this.$message.success("图片上传成功");
} else {
this.$message.error("图片上传失败");
}
},
//图片删除操作
handleRemove(file, fileList) {
this.fileList = [];
},
//获取vip数据
getVipData(){
this.$http({
url: this.$http.adornUrl("/master/trainingClass/getVipBuyConfigList"),
method: "post",
data: this.$http.adornData({}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.vipList = data.vipBuyConfigList.filter(item => item.type >= 4 && item.type <= 9);
this.svipList = data.vipBuyConfigList.filter(item => item.type === 1 || item.type === 2);
}
});
},
//勾选vip
handleCheckedVip(value){
console.log('vip的值', value)
},
//勾选svip
handleCheckedSvip(value){
console.log('svip的值', value)
}, },
}, },
}; };
@@ -440,7 +625,7 @@ export default {
.dialog_box { .dialog_box {
.el-form-item__content { .el-form-item__content {
width: calc(100% - 90px) !important; width: calc(100% - 120px) !important;
} }
.form_item { .form_item {
width: 100%; width: 100%;
@@ -452,4 +637,35 @@ export default {
} }
} }
} }
.checkbox-group .el-checkbox{
margin-left: 0;
margin-right: 20px;
.el-checkbox__label{
padding-left: 6px;
font-size: 13px;
}
}
.hufen_block{
display: flex;
align-items: center;
span{
width: 70px;
display: inline-block;
}
.el-input{
width: 90%;
line-height: 34px;
}
.el-input__inner{
width: 220px;
height: 30px;
line-height: 34px;
padding: 0 8px;
}
.el-input__inner::placeholder {
font-size: 12px;
}
}
</style> </style>

View File

@@ -5,17 +5,9 @@
:model="dataForm" :model="dataForm"
@keyup.enter.native="getDataList()" @keyup.enter.native="getDataList()"
> >
<el-form-item label="名称">
<el-input
v-model="dataForm.title"
placeholder="请输入名称"
clearable
>
</el-input>
</el-form-item>
<el-form-item label="手机号"> <el-form-item label="手机号">
<el-input <el-input
v-model="dataForm.title" v-model="dataForm.tel"
placeholder="请输入手机号" placeholder="请输入手机号"
clearable clearable
> >
@@ -31,8 +23,8 @@
> >
<el-button <el-button
type="primary" type="primary"
@click="addOrUpdateHandle()" @click="addHandle()"
>新增</el-button >报名</el-button
> >
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -41,32 +33,36 @@
border border
v-loading="dataListLoading" v-loading="dataListLoading"
style="width: 100%" style="width: 100%"
@sort-change="handleSortChange"
> >
<el-table-column label="用户ID" align="center" prop="id"></el-table-column> <el-table-column
<el-table-column label="姓名" align="center" prop="nickname"> label="序号"
type="index"
align="center"
width="60">
</el-table-column>
<el-table-column label="报名时间" align="center" prop="createTime" width="170" sortable="custom" :sort-orders="['ascending', 'descending']">
</el-table-column>
<el-table-column label="订单编号" align="center" prop="orderSn"></el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.nickname ? scope.row.nickname : "暂无用户名" }}</span> <span>{{ scope.row.user.name ? scope.row.user.nickname : "暂无用户名" }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="头像" align="center" prop="avatar"> <el-table-column label="联系方式" align="center">
<template slot-scope="scope">{{ scope.row.user.tel||'-' }}</template>
</el-table-column>
<el-table-column label="用户身份" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<img {{ scope.row.identity }}
v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="50"
height="50"
/>
<img
v-else
src="../../../../static/img/morenAvavter.png"
width="50"
height="50"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="电话" align="center" prop="tel"></el-table-column>
<el-table-column label="邮箱" align="center" prop="email"></el-table-column> <el-table-column label="支付方式" align="center">
<el-table-column label="创建时间" align="center" prop="createTime"> <template slot-scope="scope">{{ scope.row.payMethod }}{{ scope.row.realMoney }}</template>
</el-table-column>
<el-table-column label="抵扣方式" align="center">
<template slot-scope="scope">积分{{ scope.row.jfDeduction }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
@@ -78,7 +74,9 @@
<el-button <el-button
type="text" type="text"
size="small" size="small"
>修改</el-button> @click="deleteHandle(scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -95,24 +93,34 @@
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<el-dialog <el-dialog
:visible.sync="addOrUpdateVisible" :visible.sync="addVisible"
:title="titlesub" title="添加用户"
class="dialog_box" class="dialog_box"
@close="cancleClose" @close="cancleClose"
width="600px"
> >
<el-form <el-form
:model="addForm" :model="addForm"
ref="addFormRef" ref="addFormRef"
:rules="addFormRule" :rules="addFormRule"
label-width="90px" label-width="100px"
> >
<el-form-item label="姓名" prop="nickname"> <el-form-item label="手机号/邮箱" prop="userKey" style="width: 530px;">
<el-input v-model="addForm.nickname" placeholder="请输入姓名"></el-input> <el-input v-model="addForm.userKey" placeholder="请输入手机号/邮箱" clearable @input="handleSearch"></el-input>
<div class="data-list" v-if="showSearch" v-loading="searchListLoading">
<span v-for="(v,i) in searchList" :key="i" @click="checkTitle(v)">{{ v.tel }}</span>
</div>
</el-form-item>
<el-form-item label="用户身份" v-if="infoStatus">
{{ info.identity }}
</el-form-item>
<el-form-item label="最终价格" v-if="infoStatus">
{{ info.fee }}
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button> <el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOrEditCate"> </el-button> <el-button type="primary" @click="addCate"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@@ -123,26 +131,18 @@ export default {
return { return {
trainingId: null, trainingId: null,
dataForm: { dataForm: {
title: '', tel: ''
}, },
addForm: { addForm: {
id: "", //新增不传 userId: '',
title: "", //标题 userKey: ''
}, },
editId: "", editId: "",
addFormRule: { addFormRule: {
title: [ userKey: [
{ {
required: true, required: true,
message: "请输入标题", message: "请输入手机号/邮箱",
}, },
] ]
}, },
@@ -151,16 +151,36 @@ export default {
pageSize: 10, pageSize: 10,
totalPage: 0, totalPage: 0,
dataListLoading: false, dataListLoading: false,
addOrUpdateVisible: false, searchListLoading: false,
titlesub: '新增', addVisible: false,
statusType: 0, //区分新增还是修改 //新增-模糊查询
showSearch: false,
searchList: [],
sortParams: { // 排序参数
field: 'date', // 默认排序字段
order: 'desc' // 默认降序
},
//获取身份和价格
infoStatus: false,
info: {},
//日期排序
sortParams: {
date: ''
}
}; };
}, },
created() { activated(){
this.trainingId=this.$route.query.id; this.trainingId = this.$route.query.id;
this.getDataList(); this.getDataList();
}, },
methods: { methods: {
//排序变化事件
handleSortChange({ column, prop, order }) {
this.sortParams.date = order
? (order === 'ascending' ? '2' : '1')
: null;
this.getDataList();
},
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
@@ -170,7 +190,9 @@ export default {
data: this.$http.adornData({ data: this.$http.adornData({
current: this.pageIndex, current: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
trainingId: this.trainingId trainingId: this.trainingId,
tel: this.dataForm.tel,
createTimeSort: this.sortParams.date
}), }),
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@@ -180,27 +202,20 @@ export default {
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
//新增 //添加用户
addOrUpdateHandle(){ addHandle(){
this.addOrUpdateVisible = true; this.addVisible = true;
this.statusType = 0; //新增
this.titlesub = '新增';
this.$refs["addFormRef"].resetFields(); this.$refs["addFormRef"].resetFields();
this.addForm = { this.addForm = {
title: "", //标题 userId:'',
userKey: ''
} }
this.infoStatus = false;
this.info = {};
}, },
//关闭
cancleClose(){
this.addOrUpdateVisible = false;
},
addOrEditCate(){
this.addCate();
},
//取消 //取消
cancleClose(){ cancleClose(){
this.addOrUpdateVisible = false; this.addVisible = false;
}, },
// 每页数 // 每页数
sizeChangeHandle(val) { sizeChangeHandle(val) {
@@ -213,40 +228,121 @@ export default {
this.pageIndex = val; this.pageIndex = val;
this.getDataList(); this.getDataList();
}, },
//新增 //模糊查询
handleSearch(val){
if(val){
this.showSearch = true;
this.searchListLoading = true;
this.infoStatus = false;
this.info = {}
this.$http({
url: this.$http.adornUrl("/book/user/getUserList"),
method: "post",
data: this.$http.adornData({
page: 1,
limit: 9999,
key: val
})
}).then(({ data }) => {
if (data && data.code === 0) {
if(data.user.records&&data.user.records.length>0){
this.searchList = data.user.records;
}else{
this.searchList = [];
}
this.searchListLoading = false;
}
});
}else{
console.log('输入框已被清空');
this.infoStatus = false;
this.info = {}
}
},
//选中模糊值
checkTitle(v){
this.addForm.userId = v.id;
this.addForm.userKey = v.tel;
this.showSearch = false;
this.getFinalPriceByUser();
},
//获取角色和价格
getFinalPriceByUser(){
this.$http({
url: this.$http.adornUrl("/common/trainingClass/getFinalPriceByUser"),
method: "post",
data: this.$http.adornData({
userId: this.addForm.userId,
classId: Number(this.trainingId)
}),
}).then(({ data }) => {
if (data && data.code === 0) {
if(data.info){
this.infoStatus = true;
this.info = data.info;
}else{
this.infoStatus = false;
}
}else{
this.$message.error(data.msg);
}
});
},
//添加用户
addCate(){ addCate(){
this.$refs["addFormRef"].validate(valid => { this.$refs["addFormRef"].validate(valid => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"), url: this.$http.adornUrl("/master/trainingClass/addUserToTrainingClass"),
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
id: this.addForm.id, userId: this.addForm.userId,
title: this.addForm.title, trainingId: this.trainingId,
type: String(this.addForm.type), identity: this.info.identity+''+this.info.fee
year: this.addForm.year,
singupFlag: String(this.addForm.singupFlag),
icon: this.addForm.icon,
fee: this.addForm.fee,
vipFee: this.addForm.vipFee,
svipFee: this.addForm.svipFee,
huFee: this.addForm.huFee,
sort: this.addForm.sort
}), }),
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: "操作成功", message: "添加成功",
type: "success" type: "success"
}); });
this.addOrUpdateVisible = false; this.addVisible = false;
this.getDataList(); this.getDataList();
}else{
this.$message.error(data.msg);
} }
}); });
} }
}) })
} },
//删除
deleteHandle(row){
this.$confirm("确定要删除该用户?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$http({
url: this.$http.adornUrl("/master/trainingClass/delUserToTrainingClass"),
method: "post",
data: this.$http.adornData({
id: row.id
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.getDataList();
}
});
})
.catch(() => {});
},
}, },
}; };
</script> </script>
@@ -280,4 +376,26 @@ export default {
} }
} }
} }
.data-list{
min-height: 200px;
width: 100%;
border-radius: 4px;
background: #fff;
position: absolute;
z-index: 99;
top: 40px;
left: 0;
padding: 10px 20px;
cursor: pointer;
max-height: 280px;
overflow-y: scroll;
span{
color: #606266;
line-height: 36px;
font-size: 14px;
display: block;
}
}
</style> </style>

View File

@@ -5,9 +5,9 @@
window.SITE_CONFIG = {}; window.SITE_CONFIG = {};
// api接口请求地址 // api接口请求地址
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境 //window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
// 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://192.168.110.110:9200/pb'; //本地 //window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb'; //本地
// cdn地址 = 域名 + 版本号 // cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './'; // 域名 window.SITE_CONFIG['domain'] = './'; // 域名