diff --git a/src/js/api.js b/src/js/api.js index 9142958..8ca16a5 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -16,6 +16,8 @@ export const API = { student_review: `${ORIGIN}/upload/file/student_review`, // 上传文件 - 学员点评 getCoachList: `${ORIGIN}/stadium/coach/getCoachList`, // 小程序-某个品牌的教练列表 getShiftWorkClassTimes: `${ORIGIN}/stadium/coach/getShiftWorkClassTimes`, // 小程序-教练换班-未进行的课程时间 + addShiftWorkRecord: `${ORIGIN}/stadium/coach/addShiftWorkRecord`, // 小程序-教练换班-申请换班 + getShiftWorkList: `${ORIGIN}/stadium/coach/getShiftWorkList`, // 小程序-教练换班记录 } diff --git a/src/pages/course/experience/experience.vue b/src/pages/course/experience/experience.vue index 5ecde1e..e7d9758 100644 --- a/src/pages/course/experience/experience.vue +++ b/src/pages/course/experience/experience.vue @@ -1,11 +1,12 @@ @@ -45,6 +56,11 @@ import util from '../../../utils/util'; export default { computed: { ...mapState([ 'storeInfo' ]), + selectedTimeTxt(){ + let { selectTimeIDS, timeList } = this; + let txtArr = timeList.filter(e=>selectTimeIDS.includes(e.id)).map(e=>e._time); + return txtArr.join(',') || ''; + } }, data(){ return { @@ -52,6 +68,9 @@ export default { classList: [], // 班级列表 coachList: [], // 教练列表 timeList: [], // 时间列表 + selectTimeIDS: [], // 已选时间 + tempSelectTimeID: [], // 临时选中 + isShowTimeModal: false, selectInfo: { courseInfo: { name: '' @@ -72,25 +91,115 @@ export default { this.getCourseList({}); }, methods: { - timeChange(e){ + submitBtn: util.debounce(function(){ + let { courseInfo, classInfo, coachInfo, dateInfo } = this.selectInfo; + let { selectTimeIDS } = this; + if(!courseInfo.id || !classInfo.id || !coachInfo.id || selectTimeIDS.length<=0 )return util.showNone('请选择完整!'); + util.showLoad(); + servers.post({ + url: API.addShiftWorkRecord, + data: { + course_id: courseInfo.id, + class_id: classInfo.id, + accept_coach_id: coachInfo.id, + course_duration_ids: selectTimeIDS, + }, + isDefaultGet: false, + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showModal({ + title: '提示', + content: res.data.message || '操作成功!', + success: ele=>{ + if(ele.confirm)util.routeTo(`/pages/shift/record/record`, 'nT') + } + }) + }else{ + util.showModal({ + title: '提示', + content: res.data.message || '操作失败!' + }) + } + }) + .catch(util.hideLoad) + + }, 300, 300), + showTimeModal(){ + this.isShowTimeModal = true; + this.tempSelectTimeID = [...this.selectTimeIDS]; + }, + timeSelect(e){ + let { tempSelectTimeID } = this; + this.tempSelectTimeID = tempSelectTimeID.includes(e.id) ? + tempSelectTimeID.filter(el=>el!=e.id) : + [...tempSelectTimeID, e.id]; + }, + confirmTimeSelected(){ + this.selectTimeIDS = [...this.tempSelectTimeID]; + this.isShowTimeModal = false; + }, + // 日期切换 + timeChange(e){ + console.warn(e) + let { timeList, selectInfo } = this; + if(!selectInfo.coachInfo.id)return util.showNone('请选择教练!'); + let _timeInfo = timeList[e.detail.value] || {}; + this.selectInfo = { + ...selectInfo, + dateInfo: _timeInfo + }; }, + // 教练切换 coachChange(e){ let { coachList, selectInfo } = this; + if(!selectInfo.classInfo.id)return util.showNone('请选择班级!'); let _coachInfo = coachList[e.detail.value] || {}; - this.selectInfo.coachInfo = _coachInfo; + this.selectInfo = { + ...selectInfo, + coachInfo: _coachInfo, + dateInfo: { + _time: '' + } + }; + this.getShiftWorkClassTimes(selectInfo.courseInfo.id); }, + // 班级切换 classChange(e){ - let { classList } = this; + let { classList, selectInfo } = this; + if(!selectInfo.courseInfo.id)return util.showNone('请选择课程!'); let _classInfo = classList[e.detail.value] || {}; - this.selectInfo.classInfo = _classInfo; + this.selectInfo = { + ...selectInfo, + classInfo: _classInfo, + coachInfo: { + name: '' + }, + dateInfo: { + _time: '' + } + }; this.getCoachList(); }, + // 课程切换 courseChange(e){ let { courseList } = this; let _courseInfo = courseList[e.detail.value] || {}; - this.selectInfo.courseInfo = _courseInfo; + this.selectInfo = { + courseInfo: _courseInfo, + classInfo: { + class_name: '' + }, + coachInfo: { + name: '' + }, + dateInfo: { + _time: '' + } + }; this.getClassList( _courseInfo.id ); }, @@ -113,7 +222,6 @@ export default { _time: `${e.date} ${e.start_duration}` } }); - console.warn(_list) }) }, // 教练列表 @@ -174,6 +282,64 @@ export default { \ No newline at end of file diff --git a/src/pages/shift/record/record.vue b/src/pages/shift/record/record.vue index b25def3..15cd61d 100644 --- a/src/pages/shift/record/record.vue +++ b/src/pages/shift/record/record.vue @@ -1,37 +1,76 @@ @@ -55,6 +94,9 @@ export default { &.active{ color: $themeColor; } + &.red{ + color: #FF4444; + } } .i-top{ padding-bottom: 20upx;