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"
width="60">
</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">
<span v-if="scope.row.trainingDate">
{{ scope.row.trainingDate.substring(0, 10) }}
<span v-if="scope.row.trainingDate&&scope.row.endDate">
{{ scope.row.trainingDate }} - {{ scope.row.endDate }}
</span>
<span v-else>-</span>
</template>
@@ -171,10 +171,13 @@
</el-form-item>
<el-form-item label="培训日期" prop="trainingDate">
<el-date-picker
v-model="addForm.trainingDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择日期">
class="custom-flatpickr"
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleDateChange">
</el-date-picker>
</el-form-item>
<el-form-item label="原价" prop="fee">
@@ -287,7 +290,8 @@ export default {
type: 1, //1线上 2线下
icon: '',
year: '',
trainingDate: '',
trainingDate: '', //开始日期
endDate: '', //截止日期
fee: '',
vipType: '',
vipFee: '',
@@ -320,6 +324,7 @@ export default {
},
],
},
dateRange: [], //日期
dataList: [],
pageIndex: 1,
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() {
this.dataListLoading = true;
@@ -407,6 +424,7 @@ export default {
icon: '',
year: '',
trainingDate: '',
endDate: '',
fee: '',
vipType: '',
vipFee: '',
@@ -450,6 +468,7 @@ export default {
type: data.type,
year: data.year,
trainingDate: data.trainingDate,
endDate: data.endDate,
singupFlag: data.singupFlag,
icon: icon,
fee: data.fee,
@@ -502,6 +521,7 @@ export default {
title: this.addForm.title,
type: String(this.addForm.type),
trainingDate: this.addForm.trainingDate,
endDate: this.addForm.endDate,
singupFlag: String(this.addForm.singupFlag),
icon: icon,
fee: this.addForm.fee,
@@ -541,6 +561,7 @@ export default {
this.addForm.type = Number(data.type);
this.addForm.year = data.year;
this.addForm.trainingDate = data.trainingDate;
this.addForm.endDate = data.endDate;
this.addForm.singupFlag = Number(data.singupFlag);
this.addForm.icon = data.icon;
//图片赋值
@@ -668,4 +689,7 @@ export default {
font-size: 12px;
}
}
.custom-flatpickr .el-range-input{
margin-left: 5px;
}
</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>
<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">
<span>{{ scope.row.user.name ? scope.row.user.nickname : "暂无用户名" }}</span>
<span>{{ scope.row.user.name ? scope.row.user.name : "暂无名" }}</span>
</template>
</el-table-column>
<el-table-column label="联系方式" align="center">