This commit is contained in:
liuyuan
2025-04-16 16:11:22 +08:00
parent 032a32915e
commit 9ae57c0989
2 changed files with 34 additions and 10 deletions

View File

@@ -55,10 +55,10 @@
align="center" align="center"
width="60"> width="60">
</el-table-column> </el-table-column>
<el-table-column label="培训日期" width="110" align="center" sortable="custom" :sort-orders="['ascending', 'descending']"> <el-table-column label="培训日期" width="180" align="center" sortable="custom" :sort-orders="['ascending', 'descending']">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.trainingDate"> <span v-if="scope.row.trainingDate&&scope.row.endDate">
{{ scope.row.trainingDate.substring(0, 10) }} {{ scope.row.trainingDate }} - {{ scope.row.endDate }}
</span> </span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
@@ -171,10 +171,13 @@
</el-form-item> </el-form-item>
<el-form-item label="培训日期" prop="trainingDate"> <el-form-item label="培训日期" prop="trainingDate">
<el-date-picker <el-date-picker
v-model="addForm.trainingDate" class="custom-flatpickr"
type="date" v-model="dateRange"
value-format="yyyy-MM-dd" type="daterange"
placeholder="请选择日期"> range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleDateChange">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="原价" prop="fee"> <el-form-item label="原价" prop="fee">
@@ -287,7 +290,8 @@ export default {
type: 1, //1线上 2线下 type: 1, //1线上 2线下
icon: '', icon: '',
year: '', year: '',
trainingDate: '', trainingDate: '', //开始日期
endDate: '', //截止日期
fee: '', fee: '',
vipType: '', vipType: '',
vipFee: '', vipFee: '',
@@ -320,6 +324,7 @@ export default {
}, },
], ],
}, },
dateRange: [], //日期
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
@@ -366,6 +371,18 @@ export default {
}, },
//时间选择器
handleDateChange(val){
this.addForm.trainingDate = this.formatDate(val[0]);
this.addForm.endDate = this.formatDate(val[1]);
},
//日期格式转换
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零
const day = String(date.getDate()).padStart(2, '0'); // 日期补零
return `${year}-${month}-${day}`;
},
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
@@ -407,6 +424,7 @@ export default {
icon: '', icon: '',
year: '', year: '',
trainingDate: '', trainingDate: '',
endDate: '',
fee: '', fee: '',
vipType: '', vipType: '',
vipFee: '', vipFee: '',
@@ -450,6 +468,7 @@ export default {
type: data.type, type: data.type,
year: data.year, year: data.year,
trainingDate: data.trainingDate, trainingDate: data.trainingDate,
endDate: data.endDate,
singupFlag: data.singupFlag, singupFlag: data.singupFlag,
icon: icon, icon: icon,
fee: data.fee, fee: data.fee,
@@ -502,6 +521,7 @@ export default {
title: this.addForm.title, title: this.addForm.title,
type: String(this.addForm.type), type: String(this.addForm.type),
trainingDate: this.addForm.trainingDate, trainingDate: this.addForm.trainingDate,
endDate: this.addForm.endDate,
singupFlag: String(this.addForm.singupFlag), singupFlag: String(this.addForm.singupFlag),
icon: icon, icon: icon,
fee: this.addForm.fee, fee: this.addForm.fee,
@@ -541,6 +561,7 @@ export default {
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.trainingDate = data.trainingDate;
this.addForm.endDate = data.endDate;
this.addForm.singupFlag = Number(data.singupFlag); this.addForm.singupFlag = Number(data.singupFlag);
this.addForm.icon = data.icon; this.addForm.icon = data.icon;
//图片赋值 //图片赋值
@@ -668,4 +689,7 @@ export default {
font-size: 12px; font-size: 12px;
} }
} }
.custom-flatpickr .el-range-input{
margin-left: 5px;
}
</style> </style>

View File

@@ -44,9 +44,9 @@
<el-table-column label="报名时间" align="center" prop="createTime" width="170" sortable="custom" :sort-orders="['ascending', 'descending']"> <el-table-column label="报名时间" align="center" prop="createTime" width="170" sortable="custom" :sort-orders="['ascending', 'descending']">
</el-table-column> </el-table-column>
<el-table-column label="订单编号" align="center" prop="orderSn"></el-table-column> <el-table-column label="订单编号" align="center" prop="orderSn"></el-table-column>
<el-table-column label="名" align="center"> <el-table-column label="培训姓名" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.user.name ? scope.row.user.nickname : "暂无用户名" }}</span> <span>{{ scope.row.user.name ? scope.row.user.name : "暂无名" }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="联系方式" align="center"> <el-table-column label="联系方式" align="center">