|
|
@ -33,26 +33,14 @@ |
|
|
|
<view class="h2" v-if="timerArr.length">上午</view> |
|
|
|
<view class="time_box"> |
|
|
|
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" > |
|
|
|
<view class="flex" v-if="item.status==0"> |
|
|
|
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}}</view> |
|
|
|
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount"> |
|
|
|
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="lab" v-else>{{ statusTxt[item.status] }}</view> |
|
|
|
<view class="lab">{{ statusTxt[item.status] }}</view> |
|
|
|
<view class="time">{{ item.classTime }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="h2" v-if="timerArr2.length">下午</view> |
|
|
|
<view class="time_box"> |
|
|
|
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}"> |
|
|
|
<view class="flex" v-if="item.status==0"> |
|
|
|
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view> |
|
|
|
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount"> |
|
|
|
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="lab" v-else>{{ statusTxt[item.status] }}</view> |
|
|
|
<view class="lab">{{ statusTxt[item.status] }}</view> |
|
|
|
<view class="time">{{ item.classTime }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -92,7 +80,7 @@ |
|
|
|
chooseDay: '', |
|
|
|
chooseMonth: '', |
|
|
|
timerArr: [], |
|
|
|
statusTxt: ['可预约', '已过期', '已约满', ], //状态0、正常 2、已过期 3、已约满 |
|
|
|
statusTxt: ['可预约', '未开放', '已过期', '已约满', '已约过'], //状态0、未过期 1、无排课,2、已过期,3已约满 |
|
|
|
timerArr2: [], |
|
|
|
chooseTimerId: '', |
|
|
|
endDate: null, |
|
|
@ -129,13 +117,14 @@ |
|
|
|
methods: { |
|
|
|
// 获得排课 |
|
|
|
async simulationClassFn() { |
|
|
|
// let id = this.vuex_userInfo.id |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在加载...' |
|
|
|
}) |
|
|
|
let obj = { "pointId": this.FormData.pointId, "trainType": this.FormData.trainType, "classDate":this.chooseDay, "studentId": this.FormData.studentId} |
|
|
|
const {data: res} = await simulationClass(obj) |
|
|
|
this.timerArr2 = res.afternoonSimulationClass |
|
|
|
this.timerArr = res.morningSimulationClass |
|
|
|
console.log('this.timerArr') |
|
|
|
console.log(this.timerArr) |
|
|
|
uni.hideLoading() |
|
|
|
// 如果是今天的日期检查有没有过期 |
|
|
|
if(this.chooseDay==this.dateArr[0][0].date) { |
|
|
|
let arr = [...this.timerArr,...this.timerArr2] |
|
|
@ -144,9 +133,6 @@ |
|
|
|
let date = this.chooseDay+' '+(item.classTime.split('-')[0]) |
|
|
|
date = date.replace(/-/g,'/'); |
|
|
|
let timer2 = new Date(date).getTime(); |
|
|
|
// console.log(timer) |
|
|
|
// console.log(timer2) |
|
|
|
// console.log(date) |
|
|
|
if(timer>timer2) { |
|
|
|
item.status = 2 |
|
|
|
} |
|
|
@ -156,12 +142,16 @@ |
|
|
|
// 初始化日期 |
|
|
|
async initDate() { |
|
|
|
this.startDate = this.$u.timeFormat(new Date()*1, 'yyyy-mm-dd'); |
|
|
|
this.maxDate = this.endDate = new Date('2023-11-30')*1 |
|
|
|
let startArr = this.startDate.split('-') |
|
|
|
startArr[1] = startArr[1]*1+1 |
|
|
|
let startStr = startArr.join('-') |
|
|
|
this.maxDate = this.endDate = new Date(startStr)*1 |
|
|
|
this.minDate = new Date()*1 |
|
|
|
|
|
|
|
this.dateArr = getDates(this.startDate, this.endDate); |
|
|
|
this.chooseDay = this.dateArr[0][0].date |
|
|
|
console.log(this.dateArr) |
|
|
|
console.log(this.startDate) |
|
|
|
console.log(this.endDate) |
|
|
|
this.simulationClassFn() |
|
|
|
}, |
|
|
|
// 点击月份 |
|
|
@ -180,6 +170,7 @@ |
|
|
|
}, |
|
|
|
// 选择日期 |
|
|
|
chooseDate(item) { |
|
|
|
this.FormData.courseIds = [] |
|
|
|
this.chooseDay = item.date |
|
|
|
this.simulationClassFn() |
|
|
|
console.log('*****') |
|
|
@ -190,6 +181,8 @@ |
|
|
|
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期') |
|
|
|
this.currentDay = this.currentDay + num |
|
|
|
this.chooseDay = this.dateArr[this.currentDay][0].date |
|
|
|
this.FormData.courseIds = [] |
|
|
|
this.simulationClassFn() |
|
|
|
}, |
|
|
|
chooseCourse(item) { |
|
|
|
if(item.status!=0) return |
|
|
|