|
|
@ -19,7 +19,7 @@ |
|
|
|
</view> |
|
|
|
<view class="cl-btns"> |
|
|
|
<block v-if="getCourseType(e.kind) === 0"> |
|
|
|
<view hover-class="hover-active" @click="orderCourseBtn">预约上课</view> |
|
|
|
<view hover-class="hover-active" @click="orderCourseBtn(e)">预约上课</view> |
|
|
|
<view hover-class="hover-active" @click="toClass(e)">班级</view> |
|
|
|
</block> |
|
|
|
<view hover-class="hover-active" v-if="getCourseType(e.kind) === 1">详情</view> |
|
|
@ -42,18 +42,18 @@ |
|
|
|
<view class="cl-modal"> |
|
|
|
<view class="cm-line"> |
|
|
|
<view>选择班级</view> |
|
|
|
<picker> |
|
|
|
<picker mode="selector" :range="orderClassList" range-key="class_name" @change="modalClassChange"> |
|
|
|
<view class="cl-frame"> |
|
|
|
<input disabled placeholder="请选择班级" /> |
|
|
|
<input disabled placeholder="请选择班级" v-model="orderInfo.classInfo.class_name" /> |
|
|
|
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
<view class="cm-line"> |
|
|
|
<view>选择日期</view> |
|
|
|
<picker mode="date"> |
|
|
|
<picker mode="date" @change="modalDateChange"> |
|
|
|
<view class="cl-frame"> |
|
|
|
<input disabled placeholder="请选择日期" /> |
|
|
|
<input disabled placeholder="请选择日期" v-model="orderInfo.date" /> |
|
|
|
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
@ -61,16 +61,16 @@ |
|
|
|
<view class="cm-line"> |
|
|
|
<view>选择时间</view> |
|
|
|
<view class="cl-content"> |
|
|
|
<picker mode="time"> |
|
|
|
<picker mode="time" @change="modalStartTime"> |
|
|
|
<view class="cc-frame"> |
|
|
|
<input disabled placeholder="请选择时间"/> |
|
|
|
<input disabled placeholder="请选择时间" v-model="orderInfo.startTime"/> |
|
|
|
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
|
<view>-</view> |
|
|
|
<picker mode="time"> |
|
|
|
<picker mode="time" @change="modalEndTime"> |
|
|
|
<view class="cc-frame"> |
|
|
|
<input disabled placeholder="请选择时间"/> |
|
|
|
<input disabled placeholder="请选择时间" v-model="orderInfo.endTime"/> |
|
|
|
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
@ -78,7 +78,7 @@ |
|
|
|
</view> |
|
|
|
<view class="cm-btns"> |
|
|
|
<view hover-class="hover-active" @click="isOrderCourseModal = false">取消</view> |
|
|
|
<view hover-class="hover-active" @click="isOrderCourseModal = false">确定</view> |
|
|
|
<view hover-class="hover-active" @click="orderModalConfirm" >确定</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -100,12 +100,67 @@ export default { |
|
|
|
curTabIdx: 0, |
|
|
|
courseList: [], |
|
|
|
isOrderCourseModal: false, |
|
|
|
orderClassList: [], // 预约上课班级列表 |
|
|
|
orderInfo: { // 预约信息 |
|
|
|
classInfo: { |
|
|
|
id: '', |
|
|
|
class_name: '', |
|
|
|
}, |
|
|
|
date: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(){ |
|
|
|
this.getCourseList({}); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
orderModalConfirm: util.debounce(function(){ |
|
|
|
let { orderInfo } = this; |
|
|
|
util.showLoad(); |
|
|
|
this.isOrderCourseModal = false; |
|
|
|
servers.post({ |
|
|
|
url: API.course.addCoachBooking, |
|
|
|
data: { |
|
|
|
course_id: orderInfo.classInfo.course_id, |
|
|
|
class_id: orderInfo.classInfo.id, |
|
|
|
date: orderInfo.date || '', |
|
|
|
start_duration: orderInfo.startTime || '', |
|
|
|
end_duration: orderInfo.endTime || '' |
|
|
|
}, |
|
|
|
isDefaultGet: false |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
if(res.data.code == 0){ |
|
|
|
util.showNone(res.data.message || '操作成功!'); |
|
|
|
}else{ |
|
|
|
util.showNone(res.data.message || '操作失败!'); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, 300, 300), |
|
|
|
modalStartTime(e){ |
|
|
|
console.warn(e); |
|
|
|
this.orderInfo.startTime = e.detail.value; |
|
|
|
this.$nextTick(_=>this.$forceUpdate()); |
|
|
|
}, |
|
|
|
modalEndTime(e){ |
|
|
|
console.warn(e); |
|
|
|
this.orderInfo.endTime = e.detail.value; |
|
|
|
this.$nextTick(_=>this.$forceUpdate()); |
|
|
|
}, |
|
|
|
modalDateChange(e){ |
|
|
|
console.warn(e); |
|
|
|
this.orderInfo.date = e.detail.value; |
|
|
|
this.$nextTick(_=>this.$forceUpdate()); |
|
|
|
}, |
|
|
|
// |
|
|
|
modalClassChange(e){ |
|
|
|
let { orderClassList } = this; |
|
|
|
this.orderInfo.classInfo = orderClassList[e.detail.value]; |
|
|
|
this.$nextTick(_=>this.$forceUpdate()); |
|
|
|
}, |
|
|
|
// 体验 |
|
|
|
toExInfo(){ |
|
|
|
util.routeTo(`/pages/course/experience/experience`, 'nT'); |
|
|
@ -118,9 +173,32 @@ export default { |
|
|
|
} |
|
|
|
util.routeTo(`/pages/course/class_list/class_list?query=${util.jsonStr(_query)}`, 'nT'); |
|
|
|
}, |
|
|
|
orderCourseBtn(){ |
|
|
|
this.isOrderCourseModal = true; |
|
|
|
}, |
|
|
|
orderCourseBtn: util.debounce(function(e){ |
|
|
|
this.orderInfo = { // 预约信息 |
|
|
|
classInfo: { |
|
|
|
id: '', |
|
|
|
class_name: '', |
|
|
|
}, |
|
|
|
date: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
} |
|
|
|
util.showLoad(); |
|
|
|
servers.get({ |
|
|
|
url: API.course.getClassList, |
|
|
|
data: { |
|
|
|
course_id: e.id, |
|
|
|
type: 0, // 0教练的班级,1换班的班级 |
|
|
|
}, |
|
|
|
failMsg: '加载班级失败!' |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
this.orderClassList = res.list || []; |
|
|
|
this.isOrderCourseModal = true; |
|
|
|
}) |
|
|
|
|
|
|
|
}, 300, 300), |
|
|
|
// 课程类型映射 成班课(0)/私教课(1); |
|
|
|
getCourseType(type = ''){ |
|
|
|
return ['成班课', '私教课'].findIndex(e=>e===type); |
|
|
|