|
|
@ -37,7 +37,7 @@ |
|
|
|
<view class="timeCon" v-if="timerArr.length||timerArr2.length"> |
|
|
|
<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="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: (FormData.courseArr.findIndex(val=>val.id==item.id))!=-1, disable: item.status!=0}" > |
|
|
|
<!-- <view class="flex" v-if="item.status==0"> |
|
|
|
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </view> |
|
|
|
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount"> |
|
|
@ -50,7 +50,7 @@ |
|
|
|
</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="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: (FormData.courseArr.findIndex(val=>val.id==item.id))!=-1, disable: item.status!=0}"> |
|
|
|
<!-- <view class="flex" v-if="item.status==0"> |
|
|
|
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </view> |
|
|
|
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount"> |
|
|
@ -132,10 +132,19 @@ |
|
|
|
methods: { |
|
|
|
// 获得排课 |
|
|
|
async scheduleClassFn() { |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在加载...' |
|
|
|
}) |
|
|
|
this.FormData.courseArr = [] |
|
|
|
let obj = { "coachId": this.FormData.coachId, "trainType": this.FormData.trainType, "subject": this.FormData.subject, "classDate": this.chooseDay, "studentId": this.FormData.studentId} |
|
|
|
const {data: res} = await scheduleClass(obj) |
|
|
|
this.timerArr2 = res.afternoonScheduleClass |
|
|
|
this.timerArr = res.morningScheduleClass |
|
|
|
uni.hideLoading() |
|
|
|
this.timerArr2 = res.afternoonScheduleClass.sort((a,b)=>{ |
|
|
|
return parseInt(a.classTime.slice(0,2)) - parseInt(b.classTime.slice(0,2)) |
|
|
|
}) |
|
|
|
this.timerArr = res.morningScheduleClass.sort((a,b)=>{ |
|
|
|
return parseInt(a.classTime.slice(0,2)) - parseInt(b.classTime.slice(0,2)) |
|
|
|
}) |
|
|
|
// 如果是今天的日期检查有没有过期 |
|
|
|
if(this.chooseDay==this.dateArr[0][0].date) { |
|
|
|
let arr = [...this.timerArr,...this.timerArr2] |
|
|
@ -192,15 +201,24 @@ |
|
|
|
}, |
|
|
|
chooseCourse(item) { |
|
|
|
if(item.status!=0) return |
|
|
|
this.FormData.courseIds = this.courseIds = item.id |
|
|
|
this.FormData.classDate = item.classDate |
|
|
|
this.FormData.classTime = item.classTime |
|
|
|
this.FormData.carNumber = item.carNumber |
|
|
|
this.FormData.siteName = item.siteName |
|
|
|
this.FormData.siteAddress = item.siteAddress |
|
|
|
this.FormData.latitude = item.latitude |
|
|
|
this.FormData.longitude = item.longitude |
|
|
|
this.FormData.photoPath = item.photoPath |
|
|
|
let index = this.FormData.courseArr.findIndex(val=>val.id==item.id) |
|
|
|
if( index==-1) { |
|
|
|
// 最大可预约次数 |
|
|
|
let arr = [...this.timerArr,...this.timerArr2] |
|
|
|
let status4 = arr.reduce((p,v)=>{ |
|
|
|
if(v.status==4) p++ |
|
|
|
return p |
|
|
|
},0) |
|
|
|
|
|
|
|
if((status4+this.FormData.courseArr.length)>=4 ){ |
|
|
|
this.$u.toast('一天最多能约四节课') |
|
|
|
}else { |
|
|
|
this.FormData.courseArr.push(item) |
|
|
|
} |
|
|
|
}else { |
|
|
|
this.FormData.courseArr.splice(index,1) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|