This commit is contained in:
2025-10-22 10:10:29 +08:00
parent cec7b03d71
commit e22007b2e1
2 changed files with 247 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
<script type="text/javascript"> <script type="text/javascript">
const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端 // const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端
// const baseUrl = 'http://59.110.212.44:9100/pb' // const baseUrl = 'http://59.110.212.44:9100/pb'
// const baseUrl = "https://testapi.nuttyreading.com"; // const baseUrl = "https://testapi.nuttyreading.com";
// const baseUrl = 'https://api.nuttyreading.com' const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() { // function commonFun() {
// console.log("公共方法") // console.log("公共方法")
// } // }

View File

@@ -95,7 +95,7 @@
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
width="80" width="120"
header-align="center" header-align="center"
align="center" align="center"
label="操作" label="操作"
@@ -104,10 +104,18 @@
<el-button <el-button
type="text" type="text"
size="small" size="small"
style="color: #FF4D4F;" style="color: rgb(69, 194, 181);"
@click="editHandle(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="small"
style="color: red"
@click="deleteHandle(scope.row)" @click="deleteHandle(scope.row)"
>删除</el-button >删除</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -123,7 +131,7 @@
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<el-dialog <el-dialog :close-on-click-modal="false"
:visible.sync="addVisible" :visible.sync="addVisible"
title="添加用户" title="添加用户"
class="dialog_box" class="dialog_box"
@@ -137,15 +145,14 @@
:rules="addFormRule" :rules="addFormRule"
label-width="140px" label-width="140px"
> >
<el-form-item label="手机号/邮箱" prop="userKey"> <el-form-item label="手机号/邮箱" prop="userKey">
<MyElAutocomplete v-if="addVisible" <MyElAutocomplete
ref="myelautocomplete" v-if="addVisible"
:placeholder="'请输入内容'" ref="myelautocomplete"
@model="handValue" :placeholder="'请输入内容'"
@restCode="resetCode" @model="handValue"
/> @restCode="resetCode"
/>
<!-- <el-autocomplete <!-- <el-autocomplete
v-model="addForm.userKey" v-model="addForm.userKey"
@@ -191,7 +198,7 @@
v-model="addForm.name" v-model="addForm.name"
placeholder="请输入真实姓名" placeholder="请输入真实姓名"
style="width: 400px; " style="width: 400px; "
@blur="handleSave" @blur="handleSave('add')"
></el-input> ></el-input>
<div class="button-group" style="width: 180px;margin-left: 20px;"> <div class="button-group" style="width: 180px;margin-left: 20px;">
<el-button <el-button
@@ -203,7 +210,7 @@
编辑 编辑
</el-button> </el-button>
<template v-if="isEditing"> <template v-if="isEditing">
<el-button size="small" type="primary" @click="handleSave"> <el-button size="small" type="primary" @click="handleSave('add')">
保存 保存
</el-button> </el-button>
<el-button <el-button
@@ -224,15 +231,16 @@
</el-form-item> </el-form-item>
<el-form-item label="用户身份" class="coin_block" v-if="infoStatus"> <el-form-item label="用户身份" class="coin_block" v-if="infoStatus">
<div style="width: 700px"> <div style="width: 700px">
<el-radio-group v-model="addForm.identity" style="width: 700px;" > <el-radio-group v-model="addForm.identity" style="width: 700px;">
<el-radio :label="v" v-for="(v,i) in identityList" :key="i">{{ v }}</el-radio> <el-radio :label="v" v-for="(v, i) in identityList" :key="i">{{
v
}}</el-radio>
<!-- <!--
<el-radio label="大学生">大学生</el-radio> --> <el-radio label="大学生">大学生</el-radio> -->
</el-radio-group> </el-radio-group>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="支付方式" class="coin_block" v-if="infoStatus"> <el-form-item label="支付方式" class="coin_block" v-if="infoStatus" prop="payType">
<div style="width: 700px"> <div style="width: 700px">
<el-radio-group <el-radio-group
v-model="addForm.payType" v-model="addForm.payType"
@@ -250,6 +258,7 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="交易流水号" label="交易流水号"
prop="orderSn"
v-if="infoStatus && addForm.payType != '赠送'" v-if="infoStatus && addForm.payType != '赠送'"
> >
<el-input <el-input
@@ -270,7 +279,7 @@
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="金额" v-if="infoStatus"> <el-form-item label="金额" v-if="infoStatus&& addForm.payType != '海外'">
<el-input <el-input
style="width: 700px" style="width: 700px"
placeholder="请输入金额" placeholder="请输入金额"
@@ -325,12 +334,102 @@
<el-button type="primary" @click="addCate"> </el-button> <el-button type="primary" @click="addCate"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false"
:visible.sync="editVisible"
title="修改用户报名信息"
class="dialog_box"
@close="editCancleClose"
append-to-body
width="880px"
>
<el-form
:model="editForm"
ref="editFormRef"
label-width="140px"
>
<el-form-item label="用户姓名" class="edit-form-item">
<div style="display: flex;align-items: center;width: 700px">
<div class="content-wrapper" v-if="!isEditing">
<span v-if="editForm.name">{{ editForm.name }}</span>
<span v-if="!editForm.name">暂无姓名</span>
</div>
<!-- 编辑模式输入框 -->
<div
class="edit-wrapper"
style="display: flex;align-items: center;max-width: 700px"
>
<el-input
v-if="isEditing"
v-model="editForm.name"
placeholder="请输入真实姓名"
style="width: 400px; "
@blur="handleSave('edit')"
></el-input>
<div class="button-group" style="width: 180px;margin-left: 20px;">
<el-button
size="small"
v-if="!isEditing"
type="text"
@click="handleEdit"
>
编辑
</el-button>
<template v-if="isEditing">
<el-button size="small" type="primary" @click="handleSave('edit')">
保存
</el-button>
<el-button
size="small"
type="text"
@click="handleCancel"
style="margin-left: 10px;color: #888;"
>
取消
</el-button>
</template>
</div>
</div>
</div>
<!-- 显示模式内容 -->
<!-- 操作按钮组 -->
</el-form-item>
<el-form-item label="报名时间" class="coin_block">
<div>
<el-date-picker
size="small"
v-model="editForm.createTime"
type="datetime"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择报名时间"
>
</el-date-picker>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editCancleClose"> </el-button>
<el-button type="primary" @click="editCate"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import MyElAutocomplete from "./MyElAutocomplete"; import MyElAutocomplete from "./MyElAutocomplete";
import { debounce, throttle } from '@/common/js/debounce';
export default { export default {
data() { data() {
return { return {
@@ -358,6 +457,8 @@ export default {
dataForm: { dataForm: {
tel: "" tel: ""
}, },
editVisible: false,
editForm: { name: "", createTime: "",},
addForm: { addForm: {
userId: "", userId: "",
userKey: "", userKey: "",
@@ -375,7 +476,13 @@ export default {
required: true, required: true,
message: "请输入手机号/邮箱" message: "请输入手机号/邮箱"
} }
] ],
payType: [
{
required: true,
message: "请选择支付方式"
}
],
}, },
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
@@ -403,30 +510,28 @@ export default {
}, },
components: { components: {
MyElAutocomplete MyElAutocomplete
},
async created() {
this.identityList = [];
// this.restaurants =await this.loadAll();
console.log('this.restaurants at line 389:', this.restaurants)
}, },
async activated() { async created() {
this.identityList = []; this.identityList = [];
// this.restaurants =await this.loadAll(); // this.restaurants =await this.loadAll();
console.log('this.restaurants at line 389:', this.restaurants) console.log("this.restaurants at line 389:", this.restaurants);
},
async activated() {
this.identityList = [];
// this.restaurants =await this.loadAll();
console.log("this.restaurants at line 389:", this.restaurants);
this.trainingId = this.$route.query.id; this.trainingId = this.$route.query.id;
this.trainingTitle = this.$route.query.title; this.trainingTitle = this.$route.query.title;
this.getDataList(); this.getDataList();
}, },
methods: { methods: {
handValue(val) { handValue(val) {
console.log(val,'这是点击的'); console.log(val, "这是点击的");
this.checkTitle(val) this.checkTitle(val);
},
}, resetCode(code) {
resetCode(code){ this.addForm = {
this.addForm={
userId: "", userId: "",
userKey: "", userKey: "",
name: "", name: "",
@@ -435,10 +540,10 @@ resetCode(code){
abroadFee: 0, abroadFee: 0,
fee: 0, fee: 0,
jf: 0 jf: 0
} };
this.identityList = []; this.identityList = [];
this.infoStatus = false; this.infoStatus = false;
}, },
// 进入编辑模式 // 进入编辑模式
handleEdit() { handleEdit() {
// 保存当前数据快照 // 保存当前数据快照
@@ -457,12 +562,28 @@ resetCode(code){
}, },
// 保存编辑内容 // 保存编辑内容
async handleSave() { handleSave:throttle(async function (type) {
if (!this.addForm.name) { var name=''
var userId=''
if(type=='add'){
name=this.addForm.name
userId= this.addForm.userId
}else{
name=this.editForm.name
userId= this.editForm.userId
}
console.log('userId at line 573:', this.editForm)
if (!name) {
this.$message.error("请输入真实姓名");
return; return;
} }
if (this.addForm.name == this.originalData.name) { if (name == this.originalData.name) {
this.isEditing = false;
return false; return false;
} }
try { try {
// 调用保存接口 // 调用保存接口
@@ -473,8 +594,8 @@ resetCode(code){
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
userId: this.addForm.userId, userId: userId,
name: this.addForm.name name: name
}) })
}); });
console.log("response.success at line 345:", response); console.log("response.success at line 345:", response);
@@ -484,16 +605,19 @@ resetCode(code){
this.isEditing = false; this.isEditing = false;
} else { } else {
this.$message.error(response.message || "保存失败"); this.$message.error(response.message || "保存失败");
this.isEditing = false;
} }
} catch (error) { } catch (error) {
console.error("保存用户信息失败:", error); console.error("保存用户信息失败:", error);
this.isEditing = false;
} }
}, },500),
handlePayMethod(data) { handlePayMethod(data) {
console.log("data at line 254:", data); console.log("data at line 254:", data);
if (this.addForm.abroadFee) { // if (this.addForm.abroadFee) {
this.addForm.abroadFee = 0; this.addForm.abroadFee = 0;
} this.addForm.fee = 0;
// }
if (this.addForm.orderSn) { if (this.addForm.orderSn) {
this.addForm.orderSn = ""; this.addForm.orderSn = "";
} }
@@ -540,13 +664,21 @@ resetCode(code){
const seconds = String(date.getSeconds()).padStart(2, "0"); const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}, },
editHandle(row){
console.log('row at line 663:', row)
this.isEditing=false;
this.editForm={name:row.user.name,userId:row.userId,createTime:row.createTime,id:row.id}
this.editVisible = true;
// this.$refs["editFormRef"].resetFields();
},
//添加用户 //添加用户
addHandle() { addHandle() {
this.isEditing=false;
this.searchListLoading = false; this.searchListLoading = false;
this.searchList = []; this.searchList = [];
this.infoStatus = false; this.infoStatus = false;
this.info = {}; this.info = {};
this.addForm={} this.addForm = {};
this.addForm = { this.addForm = {
userId: "", userId: "",
userKey: "", userKey: "",
@@ -565,6 +697,9 @@ this.addForm={}
cancleClose() { cancleClose() {
this.addVisible = false; this.addVisible = false;
}, },
editCancleClose() {
this.editVisible = false;
},
// 每页数 // 每页数
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val; this.pageSize = val;
@@ -576,10 +711,7 @@ this.addForm={}
this.pageIndex = val; this.pageIndex = val;
this.getDataList(); this.getDataList();
}, },
//模糊查询 //模糊查询
handleSearch(val) { handleSearch(val) {
if (val) { if (val) {
@@ -613,15 +745,13 @@ this.addForm={}
}, },
//选中模糊值 //选中模糊值
checkTitle(v) { checkTitle(v) {
this.addForm.userId = v.id; this.addForm.userId = v.id;
this.addForm.nickname = v.nickname; this.addForm.nickname = v.nickname;
this.addForm.name = v.name; this.addForm.name = v.name;
this.addForm.userKey = v.tel||v.email; this.addForm.userKey = v.tel || v.email;
this.showSearch = false; this.showSearch = false;
this.$refs.addFormRef.clearValidate("userKey"); this.$refs.addFormRef.clearValidate("userKey");
this.getFinalPriceByUser(); this.getFinalPriceByUser();
}, },
//获取角色和价格 //获取角色和价格
getFinalPriceByUser() { getFinalPriceByUser() {
@@ -635,11 +765,12 @@ this.addForm={}
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
if (data.info) { if (data.info) {
this.infoStatus = true;this.identityList=[data.info.identity,"大学生"] this.infoStatus = true;
this.info = data.info; this.identityList = [data.info.identity, "大学生"];
this.info = data.info;
this.addForm.identity = data.info.identity; this.addForm.identity = data.info.identity;
this.addForm.fee = data.info.fee; this.addForm.fee = data.info.fee;
this.maxFee = data.info.fee;
} else { } else {
this.infoStatus = false; this.infoStatus = false;
} }
@@ -648,12 +779,68 @@ this.addForm={}
} }
}); });
}, },
editCate(){
if(!this.editForm.createTime){
this.$message.error("请输入报名时间");
return;
}
this.$http({
url: this.$http.adornUrl(
"/master/trainingClass/trainingClassUpdateCreateTime"
),
method: "post",
data: this.$http.adornData({
id: this.editForm.id,
createTime: this.editForm.createTime
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "修改成功",
type: "success"
});
this.editVisible = false;
this.getDataList();
} else {
this.$message.error(data.msg);
}
})
},
//添加用户 //添加用户
addCate() { addCate() {
console.log("this.addForm at line 406:", this.addForm); console.log("this.addForm at line 406:", this.addForm);
this.$refs["addFormRef"].validate(valid => { this.$refs["addFormRef"].validate(valid => {
if (valid) { if (valid) {
if (this.infoStatus && this.addForm.payType != '赠送') {
if (!this.addForm.orderSn) {
this.$message.error("请输入交易流水号");
return;
}
}
if (this.addForm.payType == "海外") {
if (
Number(this.addForm.fee) + Number(this.addForm.abroadFee) >
this.maxFee
) {
this.$message.error("海外金额加积分 不能大于" + this.maxFee);
return;
}
} else {
if (
Number(this.addForm.fee) + Number(this.addForm.jf) >
this.maxFee
) {
this.$message.error("金额加积分 不能大于" + this.maxFee);
return;
}
}
if(!this.addForm.createTime){
this.$message.error("请输入报名时间");
return;
}
this.$http({ this.$http({
url: this.$http.adornUrl( url: this.$http.adornUrl(
"/master/trainingClass/addUserToTrainingClass" "/master/trainingClass/addUserToTrainingClass"