diff --git a/src/views/martial/order/index.vue b/src/views/martial/order/index.vue index 55f3704..89e5a62 100644 --- a/src/views/martial/order/index.vue +++ b/src/views/martial/order/index.vue @@ -60,8 +60,8 @@ @@ -252,6 +252,19 @@ export default { return `${start} ~ ${end}` }, + // 根据时间计算赛事状态 + calculateStatus(row) { + const now = new Date() + const regStart = row.registrationStartTime ? new Date(row.registrationStartTime) : null + const regEnd = row.registrationEndTime ? new Date(row.registrationEndTime) : null + const compStart = row.competitionStartTime ? new Date(row.competitionStartTime) : null + const compEnd = row.competitionEndTime ? new Date(row.competitionEndTime) : null + if (compEnd && now > compEnd) return 4 + if (compStart && now >= compStart) return 3 + if (regStart && regEnd && now >= regStart && now <= regEnd) return 2 + return 1 + }, + getStatusType(status) { const statusMap = { 1: 'info', // 未开始