tijiao
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<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 = "https://testapi.nuttyreading.com";
|
||||
// const baseUrl = 'https://api.nuttyreading.com'
|
||||
const baseUrl = 'https://api.nuttyreading.com'
|
||||
// function commonFun() {
|
||||
// console.log("公共方法")
|
||||
// }
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
width="80"
|
||||
width="120"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="操作"
|
||||
@@ -104,10 +104,18 @@
|
||||
<el-button
|
||||
type="text"
|
||||
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)"
|
||||
>删除</el-button
|
||||
>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -123,7 +131,7 @@
|
||||
</el-pagination>
|
||||
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<el-dialog
|
||||
<el-dialog :close-on-click-modal="false"
|
||||
:visible.sync="addVisible"
|
||||
title="添加用户"
|
||||
class="dialog_box"
|
||||
@@ -137,15 +145,14 @@
|
||||
:rules="addFormRule"
|
||||
label-width="140px"
|
||||
>
|
||||
|
||||
<el-form-item label="手机号/邮箱" prop="userKey">
|
||||
<MyElAutocomplete v-if="addVisible"
|
||||
ref="myelautocomplete"
|
||||
:placeholder="'请输入内容'"
|
||||
@model="handValue"
|
||||
@restCode="resetCode"
|
||||
/>
|
||||
|
||||
<MyElAutocomplete
|
||||
v-if="addVisible"
|
||||
ref="myelautocomplete"
|
||||
:placeholder="'请输入内容'"
|
||||
@model="handValue"
|
||||
@restCode="resetCode"
|
||||
/>
|
||||
|
||||
<!-- <el-autocomplete
|
||||
v-model="addForm.userKey"
|
||||
@@ -191,7 +198,7 @@
|
||||
v-model="addForm.name"
|
||||
placeholder="请输入真实姓名"
|
||||
style="width: 400px; "
|
||||
@blur="handleSave"
|
||||
@blur="handleSave('add')"
|
||||
></el-input>
|
||||
<div class="button-group" style="width: 180px;margin-left: 20px;">
|
||||
<el-button
|
||||
@@ -203,7 +210,7 @@
|
||||
编辑
|
||||
</el-button>
|
||||
<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
|
||||
@@ -224,15 +231,16 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="用户身份" class="coin_block" v-if="infoStatus">
|
||||
<div 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-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="大学生">大学生</el-radio> -->
|
||||
</el-radio-group>
|
||||
|
||||
</div>
|
||||
</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">
|
||||
<el-radio-group
|
||||
v-model="addForm.payType"
|
||||
@@ -250,6 +258,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="交易流水号"
|
||||
prop="orderSn"
|
||||
v-if="infoStatus && addForm.payType != '赠送'"
|
||||
>
|
||||
<el-input
|
||||
@@ -270,7 +279,7 @@
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额" v-if="infoStatus">
|
||||
<el-form-item label="金额" v-if="infoStatus&& addForm.payType != '海外'">
|
||||
<el-input
|
||||
style="width: 700px"
|
||||
placeholder="请输入金额"
|
||||
@@ -325,12 +334,102 @@
|
||||
<el-button type="primary" @click="addCate">确 定</el-button>
|
||||
</span>
|
||||
</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>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import MyElAutocomplete from "./MyElAutocomplete";
|
||||
|
||||
import { debounce, throttle } from '@/common/js/debounce';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -358,6 +457,8 @@ export default {
|
||||
dataForm: {
|
||||
tel: ""
|
||||
},
|
||||
editVisible: false,
|
||||
editForm: { name: "", createTime: "",},
|
||||
addForm: {
|
||||
userId: "",
|
||||
userKey: "",
|
||||
@@ -375,7 +476,13 @@ export default {
|
||||
required: true,
|
||||
message: "请输入手机号/邮箱"
|
||||
}
|
||||
]
|
||||
],
|
||||
payType: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择支付方式"
|
||||
}
|
||||
],
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
@@ -403,30 +510,28 @@ export default {
|
||||
},
|
||||
components: {
|
||||
MyElAutocomplete
|
||||
},
|
||||
async created() {
|
||||
this.identityList = [];
|
||||
// this.restaurants =await this.loadAll();
|
||||
console.log('this.restaurants at line 389:', this.restaurants)
|
||||
|
||||
},
|
||||
async activated() {
|
||||
this.identityList = [];
|
||||
async created() {
|
||||
this.identityList = [];
|
||||
// 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.trainingTitle = this.$route.query.title;
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
handValue(val) {
|
||||
console.log(val,'这是点击的');
|
||||
this.checkTitle(val)
|
||||
|
||||
},
|
||||
resetCode(code){
|
||||
this.addForm={
|
||||
console.log(val, "这是点击的");
|
||||
this.checkTitle(val);
|
||||
},
|
||||
resetCode(code) {
|
||||
this.addForm = {
|
||||
userId: "",
|
||||
userKey: "",
|
||||
name: "",
|
||||
@@ -435,10 +540,10 @@ resetCode(code){
|
||||
abroadFee: 0,
|
||||
fee: 0,
|
||||
jf: 0
|
||||
}
|
||||
};
|
||||
this.identityList = [];
|
||||
this.infoStatus = false;
|
||||
},
|
||||
},
|
||||
// 进入编辑模式
|
||||
handleEdit() {
|
||||
// 保存当前数据快照
|
||||
@@ -457,12 +562,28 @@ resetCode(code){
|
||||
},
|
||||
|
||||
// 保存编辑内容
|
||||
async handleSave() {
|
||||
if (!this.addForm.name) {
|
||||
handleSave:throttle(async function (type) {
|
||||
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;
|
||||
}
|
||||
if (this.addForm.name == this.originalData.name) {
|
||||
if (name == this.originalData.name) {
|
||||
this.isEditing = false;
|
||||
return false;
|
||||
|
||||
}
|
||||
try {
|
||||
// 调用保存接口
|
||||
@@ -473,8 +594,8 @@ resetCode(code){
|
||||
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
userId: this.addForm.userId,
|
||||
name: this.addForm.name
|
||||
userId: userId,
|
||||
name: name
|
||||
})
|
||||
});
|
||||
console.log("response.success at line 345:", response);
|
||||
@@ -484,16 +605,19 @@ resetCode(code){
|
||||
this.isEditing = false;
|
||||
} else {
|
||||
this.$message.error(response.message || "保存失败");
|
||||
this.isEditing = false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("保存用户信息失败:", error);
|
||||
this.isEditing = false;
|
||||
}
|
||||
},
|
||||
},500),
|
||||
handlePayMethod(data) {
|
||||
console.log("data at line 254:", data);
|
||||
if (this.addForm.abroadFee) {
|
||||
// if (this.addForm.abroadFee) {
|
||||
this.addForm.abroadFee = 0;
|
||||
}
|
||||
this.addForm.fee = 0;
|
||||
// }
|
||||
if (this.addForm.orderSn) {
|
||||
this.addForm.orderSn = "";
|
||||
}
|
||||
@@ -540,13 +664,21 @@ resetCode(code){
|
||||
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||
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() {
|
||||
this.isEditing=false;
|
||||
this.searchListLoading = false;
|
||||
this.searchList = [];
|
||||
this.infoStatus = false;
|
||||
this.info = {};
|
||||
this.addForm={}
|
||||
this.addForm = {};
|
||||
this.addForm = {
|
||||
userId: "",
|
||||
userKey: "",
|
||||
@@ -565,6 +697,9 @@ this.addForm={}
|
||||
cancleClose() {
|
||||
this.addVisible = false;
|
||||
},
|
||||
editCancleClose() {
|
||||
this.editVisible = false;
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val;
|
||||
@@ -576,10 +711,7 @@ this.addForm={}
|
||||
this.pageIndex = val;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//模糊查询
|
||||
handleSearch(val) {
|
||||
if (val) {
|
||||
@@ -613,15 +745,13 @@ this.addForm={}
|
||||
},
|
||||
//选中模糊值
|
||||
checkTitle(v) {
|
||||
|
||||
this.addForm.userId = v.id;
|
||||
this.addForm.nickname = v.nickname;
|
||||
this.addForm.name = v.name;
|
||||
this.addForm.userKey = v.tel||v.email;
|
||||
this.addForm.userKey = v.tel || v.email;
|
||||
this.showSearch = false;
|
||||
this.$refs.addFormRef.clearValidate("userKey");
|
||||
this.getFinalPriceByUser();
|
||||
|
||||
},
|
||||
//获取角色和价格
|
||||
getFinalPriceByUser() {
|
||||
@@ -635,11 +765,12 @@ this.addForm={}
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
if (data.info) {
|
||||
this.infoStatus = true;this.identityList=[data.info.identity,"大学生"]
|
||||
this.info = data.info;
|
||||
this.infoStatus = true;
|
||||
this.identityList = [data.info.identity, "大学生"];
|
||||
this.info = data.info;
|
||||
this.addForm.identity = data.info.identity;
|
||||
|
||||
this.addForm.fee = data.info.fee;
|
||||
this.maxFee = data.info.fee;
|
||||
} else {
|
||||
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() {
|
||||
console.log("this.addForm at line 406:", this.addForm);
|
||||
|
||||
this.$refs["addFormRef"].validate(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({
|
||||
url: this.$http.adornUrl(
|
||||
"/master/trainingClass/addUserToTrainingClass"
|
||||
|
||||
Reference in New Issue
Block a user