diff --git a/niucloud/app/api/controller/apiController/Course.php b/niucloud/app/api/controller/apiController/Course.php index 1ef4e696..3b97438b 100644 --- a/niucloud/app/api/controller/apiController/Course.php +++ b/niucloud/app/api/controller/apiController/Course.php @@ -109,8 +109,8 @@ class Course extends BaseApiService ["schedule_id",''], ["course_date",''], ["time_slot",''], - ["schedule_type", 1], // 1=正式位, 2=等待位 - ["course_type", 1], // 1=正式课, 2=体验课, 3=等待位 + ["schedule_type", 1], // 1=临时课, 2=固定课 + ["course_type", 1], // 1=正式课, 2=补课, 3=等待位 ["position", ''], // 位置信息 ["remark", ''] // 备注 ]); diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 3a44b585..eb1c39d8 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -562,11 +562,11 @@ Route::group(function () { // 学员签到 - Route::post('checkin', 'student.AttendanceController/checkin'); + Route::post('student/attendance/checkin', 'student.AttendanceController/checkin'); // 学员请假 - Route::post('leave', 'student.AttendanceController/leave'); + Route::post('student/attendance/leave', 'student.AttendanceController/leave'); // 学员取消 - Route::post('cancel', 'student.AttendanceController/cancel'); + Route::post('student/attendance/cancel', 'student.AttendanceController/cancel'); })->middleware(ApiChannel::class) ->middleware(ApiPersonnelCheckToken::class, true) ->middleware(ApiLog::class); diff --git a/niucloud/app/service/api/apiService/CourseScheduleService.php b/niucloud/app/service/api/apiService/CourseScheduleService.php index 84e0f8a5..3d894dd4 100644 --- a/niucloud/app/service/api/apiService/CourseScheduleService.php +++ b/niucloud/app/service/api/apiService/CourseScheduleService.php @@ -273,7 +273,7 @@ class CourseScheduleService extends BaseApiService ->leftJoin($this->prefix . 'customer_resources cr', 'pcs.resources_id = cr.id') ->leftJoin($this->prefix . 'member m', 'cr.member_id = m.member_id') ->where('pcs.schedule_id', $scheduleId) - ->where('pcs.status', 0) // 只统计未请假的学员(status=0) + ->where('pcs.status', '<>', 2) // 排除请假的学员,包含待上课(0)和已上课(1) ->where('pcs.deleted_at', 0) ->field([ 'pcs.*', diff --git a/niucloud/app/service/api/apiService/CourseService.php b/niucloud/app/service/api/apiService/CourseService.php index 6e8dd95d..c2f168c5 100644 --- a/niucloud/app/service/api/apiService/CourseService.php +++ b/niucloud/app/service/api/apiService/CourseService.php @@ -440,7 +440,8 @@ class CourseService extends BaseApiService $studentCourse = StudentCourses::where('student_id', $student->id) ->order('id', 'desc') ->find(); - if ($studentCourse) { + $student_status = $studentCourse && $this->handeStudentStatus($studentCourse); + if ($student_status) { $person_type = 'student'; } else { $person_type = 'customer_resource'; @@ -455,25 +456,7 @@ class CourseService extends BaseApiService ]; $course = $personCourseSchedule->where($checkWhere)->find(); if ($course) { - if ($course->schedule_type == 2 && $course->course_type == 1) { - $course->schedule_type == 1; - $course->save(); - } else { - return fail("重复添加"); - } - } - - // 判断课程类型: - // - 如果person_type是customer_resource则course_type设为3(等待位) - // - 如果person_type是customer_resource且schedule_type是1(正式位),则course_type设为2(体验课学员) - // - 如果person_type是student,则course_type设为1(正式学员) - $courseType = 1; // 默认正式学员 - if ($person_type == 'customer_resource') { - if (($data['schedule_type'] ?? 1) == 2) { - $courseType = 3; // 等待位 - } else { - $courseType = 2; // 体验课学员 - } + return fail("重复添加"); } $insertData = [ @@ -485,8 +468,9 @@ class CourseService extends BaseApiService 'course_date' => $data['course_date'], 'time_slot' => $data['time_slot'], 'schedule_type' => $data['schedule_type'] ?? 1, // 1=正式位, 2=等待位 - 'course_type' => $courseType, // 根据上面的逻辑设置课程类型 - 'remark' => $data['remark'] ?? '' // 备注 + 'course_type' => $data['course_type'], // 根据上面的逻辑设置课程类型 + 'remark' => $data['remark'] ?? '', // 备注 + 'student_course_id' => $studentCourse->id ?? 0 ]; $personCourseSchedule->insert($insertData); @@ -750,10 +734,10 @@ class CourseService extends BaseApiService ]; } - // 获取已安排的学员列表(包括正式学员和等待位),只显示未请假的学员(status=0) + // 获取已安排的学员列表(包括正式学员和等待位),排除请假的学员(status!=2) $students = $PersonCourseSchedule ->where('schedule_id', $scheduleId) - ->where('status', 0) // 只获取未请假的学员 + ->where('status', '<>', 2) // 排除请假的学员,包含待上课(0)和已上课(1) ->where(function ($query) { $query->where('deleted_at', 0)->whereOr('deleted_at', null); }) @@ -1596,5 +1580,16 @@ class CourseService extends BaseApiService return $courseTypeMap[$courseType] ?? '未知'; } + private function handeStudentStatus($studentCourse) + { + $now = time(); + if (strtotime($studentCourse->end_date) > $now) { + $total = $studentCourse->total_hours + $studentCourse->gift_hours - $studentCourse->use_total_hours - $studentCourse->use_gift_hours; + if ($total > 0) { + return true; + } + } + return false; + } } diff --git a/niucloud/app/service/api/student/AttendanceService.php b/niucloud/app/service/api/student/AttendanceService.php index 130d46a7..70598a92 100644 --- a/niucloud/app/service/api/student/AttendanceService.php +++ b/niucloud/app/service/api/student/AttendanceService.php @@ -28,8 +28,12 @@ class AttendanceService extends BaseApiService { $schedule_id = $data['schedule_id']; $student_id = $data['student_id']; - $resources_id = $data['resources_id'] ?? 0; - $person_id = $data['person_id']; + + $student = (new SchoolStudent()) + ->where('id', $student_id) + ->find(); + $resources_id = $student->user_id; + $person_id = $this->member_id; if (empty($schedule_id)) { throw new \Exception('参数错误:缺少课程安排ID'); @@ -41,23 +45,11 @@ class AttendanceService extends BaseApiService // 1. 查询课程安排记录 - 支持学员和客户资源两种类型 $where = [ ['schedule_id', '=', $schedule_id], - ['person_id', '=', $person_id], + ['student_id', '=', $student_id], + ['resources_id', '=', $resources_id], ['deleted_at', '=', 0] ]; - // 根据传入的参数决定查询条件 - if (!empty($student_id) && $student_id > 0) { - // 正式学员 - $where[] = ['student_id', '=', $student_id]; - $where[] = ['person_type', '=', 'student']; - } elseif (!empty($resources_id) && $resources_id > 0) { - // 客户资源 - $where[] = ['resources_id', '=', $resources_id]; - $where[] = ['person_type', '=', 'customer_resource']; - } else { - throw new \Exception('参数错误:必须提供学员ID或资源ID'); - } - $schedule = (new SchoolPersonCourseSchedule()) ->where($where) ->find(); diff --git a/niucloud/app/service/api/student/CourseBookingService.php b/niucloud/app/service/api/student/CourseBookingService.php index b3550a05..30291a9d 100644 --- a/niucloud/app/service/api/student/CourseBookingService.php +++ b/niucloud/app/service/api/student/CourseBookingService.php @@ -92,6 +92,9 @@ class CourseBookingService extends BaseService ->select() ->toArray(); + // 获取学员预约资格信息 + $studentQualification = $this->checkStudentQualification($studentId); + // 处理每个课程的预约状态 foreach ($availableCourses as &$course) { // 计算已预约人数 @@ -109,7 +112,7 @@ class CourseBookingService extends BaseService ->where('student_id', $studentId) ->where('schedule_id', $course['id']) ->where('deleted_at', 0) - ->where('status', '!=', 3) // 3-取消 + ->where('status', '<>', 3) // 3-取消 ->find(); // 确定课程状态 @@ -117,6 +120,9 @@ class CourseBookingService extends BaseService $course['booking_status'] = 'booked'; } elseif ($bookedCount >= $course['max_students']) { $course['booking_status'] = 'full'; + } elseif (!$studentQualification['can_book']) { + $course['booking_status'] = 'no_permission'; + $course['no_permission_reason'] = $studentQualification['reason']; } else { $course['booking_status'] = 'available'; } @@ -144,6 +150,12 @@ class CourseBookingService extends BaseService // 验证学员权限 $this->checkStudentPermission($studentId); + // 检查学员预约资格 + $studentQualification = $this->checkStudentQualification($studentId); + if (!$studentQualification['can_book']) { + throw new CommonException($studentQualification['reason']); + } + // 检查课程安排是否存在 $courseSchedule = Db::table('school_course_schedule') ->where('id', $scheduleId) @@ -169,7 +181,7 @@ class CourseBookingService extends BaseService $bookedCount = Db::table('school_person_course_schedule') ->where('schedule_id', $scheduleId) ->where('deleted_at', 0) - ->where('status', '!=', 3) // 非取消状态 + ->where('status', '<>', 3) // 非取消状态 ->count(); $maxStudents = $courseSchedule['max_students'] ?: 10; @@ -182,44 +194,64 @@ class CourseBookingService extends BaseService ->where('student_id', $studentId) ->where('schedule_id', $scheduleId) ->where('deleted_at', 0) - ->where('status', '!=', 3) + ->where('status', '<>', 3) ->find(); if ($existingBooking) { throw new CommonException('您已预约过此课程'); } - // 创建预约记录 - $bookingData = [ - 'student_id' => $studentId, - 'schedule_id' => $scheduleId, - 'course_date' => $data['course_date'], - 'time_slot' => $data['time_slot'], - 'person_type' => 'student', - 'course_type' => 3, // 3-预约课程 - 'status' => 0, // 0-待上课 - 'remark' => $data['note'] ?? '', - 'created_at' => date('Y-m-d H:i:s'), - 'updated_at' => date('Y-m-d H:i:s'), - 'deleted_at' => 0 - ]; + // 判断预约类型(正式课程或试听课) + $bookingType = $studentQualification['has_valid_course'] ? 1 : 4; // 1-正式课程, 4-试听课 + // 开启事务 + Db::startTrans(); try { + // 创建预约记录 + $bookingData = [ + 'student_id' => $studentId, + 'schedule_id' => $scheduleId, + 'course_date' => $data['course_date'], + 'time_slot' => $data['time_slot'], + 'person_type' => 'student', + 'course_type' => $bookingType, + 'status' => 0, // 0-待上课 + 'remark' => $data['remark'] ?? '', + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + 'deleted_at' => 0 + ]; + $bookingId = Db::table('school_person_course_schedule')->insertGetId($bookingData); if (!$bookingId) { throw new CommonException('预约创建失败'); } + // 预约时不扣减课时,等实际上课时再扣减 + // 只记录预约信息,包含关联的课程ID(用于后续课时扣减) + if ($bookingType == 1 && !empty($studentQualification['best_course'])) { + // 更新预约记录,关联学员课程ID + Db::table('school_person_course_schedule') + ->where('id', $bookingId) + ->update(['student_course_id' => $studentQualification['best_course']['id']]); + } + + // 提交事务 + Db::commit(); + // TODO: 发送预约成功消息通知 return [ 'booking_id' => $bookingId, 'status' => 'success', - 'message' => '预约创建成功' + 'message' => '预约创建成功', + 'booking_type' => $bookingType == 1 ? 'formal' : 'trial' ]; } catch (\Exception $e) { + // 回滚事务 + Db::rollback(); throw new CommonException('预约创建失败:' . $e->getMessage()); } } @@ -239,8 +271,8 @@ class CourseBookingService extends BaseService // 构建查询条件 $where = [ ['pcs.student_id', '=', $studentId], - ['pcs.deleted_at', '=', 0], - ['pcs.course_type', '=', 3] // 3-预约课程 + ['pcs.deleted_at', '=', 0] + // 移除course_type限制,因为我们改成了1(正式课程)和4(试听课) ]; // 状态筛选 @@ -330,7 +362,13 @@ class CourseBookingService extends BaseService } // 检查取消时间限制(上课前6小时) - $courseDateTime = $booking['course_date'] . ' ' . ($booking['start_time'] ?: '09:00'); + // 从time_slot中提取开始时间 + $startTime = '09:00'; // 默认开始时间 + if (!empty($booking['time_slot']) && preg_match('/^(\d{2}:\d{2})-\d{2}:\d{2}$/', $booking['time_slot'], $matches)) { + $startTime = $matches[1]; + } + + $courseDateTime = $booking['course_date'] . ' ' . $startTime; $courseTimestamp = strtotime($courseDateTime); $currentTimestamp = time(); @@ -338,22 +376,38 @@ class CourseBookingService extends BaseService throw new CommonException('上课前6小时内不允许取消预约'); } - // 更新预约状态为取消 - $result = Db::table('school_person_course_schedule') - ->where('id', $bookingId) - ->update([ - 'status' => 3, // 3-取消 - 'cancel_reason' => $cancelReason, - 'updated_at' => date('Y-m-d H:i:s') - ]); - - if ($result === false) { - throw new CommonException('取消预约失败'); + // 开启事务 + Db::startTrans(); + try { + // 更新预约状态为取消 + $result = Db::table('school_person_course_schedule') + ->where('id', $bookingId) + ->update([ + 'status' => 3, // 3-取消 + 'cancel_reason' => $cancelReason, + 'updated_at' => date('Y-m-d H:i:s') + ]); + + if ($result === false) { + throw new CommonException('取消预约失败'); + } + + // 预约时不扣减课时,取消预约时也不需要恢复课时 + // 课时只在实际签到上课时扣减 + // 这里只需要更新预约状态为取消即可 + + // 提交事务 + Db::commit(); + + // TODO: 发送取消预约消息通知 + + return true; + + } catch (\Exception $e) { + // 回滚事务 + Db::rollback(); + throw new CommonException('取消预约失败:' . $e->getMessage()); } - - // TODO: 发送取消预约消息通知 - - return true; } /** @@ -373,7 +427,7 @@ class CourseBookingService extends BaseService ->where('course_date', $bookingDate) ->where('time_slot', $timeSlot) ->where('deleted_at', 0) - ->where('status', '!=', 3) // 非取消状态 + ->where('status', '<>', 3) // 非取消状态 ->find(); return [ @@ -452,4 +506,193 @@ class CourseBookingService extends BaseService // 如果都没有,抛出异常 throw new CommonException('用户未登录'); } + + /** + * 检查学员预约资格 + * @param int $studentId + * @return array + */ + public function checkStudentQualification($studentId) + { + // 查询学员有效的正式课程 + $validCourses = Db::table('school_student_courses') + ->where('student_id', $studentId) + ->where('status', 1) // 有效状态 + ->where('start_date', '<=', date('Y-m-d')) + ->where('end_date', '>=', date('Y-m-d')) + ->select() + ->toArray(); + + // 检查是否有剩余课时的课程 + $hasValidCourse = false; + $bestCourse = null; + $totalRemainingHours = 0; + + foreach ($validCourses as $course) { + $totalHours = $course['total_hours'] + $course['gift_hours']; + $usedHours = $course['use_total_hours'] + $course['use_gift_hours']; + $remainingHours = $totalHours - $usedHours; + + if ($remainingHours > 0) { + $hasValidCourse = true; + $totalRemainingHours += $remainingHours; + + // 选择剩余课时最多的课程 + if (!$bestCourse || $remainingHours > ($bestCourse['remaining_hours'] ?? 0)) { + $bestCourse = $course; + $bestCourse['remaining_hours'] = $remainingHours; + } + } + } + + // 如果有有效课程,直接允许预约 + if ($hasValidCourse) { + return [ + 'can_book' => true, + 'has_valid_course' => true, + 'total_remaining_hours' => $totalRemainingHours, + 'best_course' => $bestCourse, + 'reason' => '' + ]; + } + + // 没有有效课程,检查试听课次数 + $student = Db::table('school_student') + ->where('id', $studentId) + ->where('deleted_at', 0) + ->find(); + + if (!$student) { + return [ + 'can_book' => false, + 'has_valid_course' => false, + 'trial_class_count' => 0, + 'reason' => '学员信息不存在' + ]; + } + + $trialClassCount = $student['trial_class_count'] ?? 0; + + if ($trialClassCount > 0) { + return [ + 'can_book' => true, + 'has_valid_course' => false, + 'trial_class_count' => $trialClassCount, + 'reason' => '' + ]; + } + + // 既没有有效课程,也没有试听课次数 + return [ + 'can_book' => false, + 'has_valid_course' => false, + 'trial_class_count' => 0, + 'reason' => '课时不足且无试听课次数,请联系客服购买课程' + ]; + } + + /** + * 扣减正式课课时 + * @param int $studentId + * @param array $courseInfo + * @return bool + */ + private function deductCourseHours($studentId, $courseInfo) + { + $courseId = $courseInfo['id']; + + // 优先扣减赠课课时,再扣减购买课时 + if ($courseInfo['gift_hours'] > $courseInfo['use_gift_hours']) { + // 扣减赠课课时 + $result = Db::table('school_student_courses') + ->where('id', $courseId) + ->inc('use_gift_hours', 1) + ->update(); + } else { + // 扣减购买课时 + $result = Db::table('school_student_courses') + ->where('id', $courseId) + ->inc('use_total_hours', 1) + ->update(); + } + + if ($result === false) { + throw new CommonException('扣减课时失败'); + } + + return true; + } + + /** + * 扣减试听课次数 + * @param int $studentId + * @return bool + */ + private function deductTrialClassCount($studentId) + { + $result = Db::table('school_student') + ->where('id', $studentId) + ->where('trial_class_count', '>', 0) + ->dec('trial_class_count', 1) + ->update(); + + if ($result === false) { + throw new CommonException('扣减试听课次数失败'); + } + + return true; + } + + /** + * 恢复正式课课时 + * @param int $studentId + * @param int $studentCourseId + * @return bool + */ + private function restoreCourseHours($studentId, $studentCourseId) + { + if (!$studentCourseId) { + return false; // 如果没有关联的学员课程ID,无法恢复 + } + + $courseInfo = Db::table('school_student_courses') + ->where('id', $studentCourseId) + ->find(); + + if (!$courseInfo) { + return false; + } + + // 优先恢复赠课课时,再恢复购买课时 + if ($courseInfo['use_gift_hours'] > 0) { + // 恢复赠课课时 + $result = Db::table('school_student_courses') + ->where('id', $studentCourseId) + ->dec('use_gift_hours', 1) + ->update(); + } else { + // 恢复购买课时 + $result = Db::table('school_student_courses') + ->where('id', $studentCourseId) + ->dec('use_total_hours', 1) + ->update(); + } + + return $result !== false; + } + + /** + * 恢复试听课次数 + * @param int $studentId + * @return bool + */ + private function restoreTrialClassCount($studentId) + { + $result = Db::table('school_student') + ->where('id', $studentId) + ->inc('trial_class_count', 1) + ->update(); + + return $result !== false; + } } \ No newline at end of file diff --git a/niucloud/app/service/api/student/StudentService.php b/niucloud/app/service/api/student/StudentService.php index 4b5e8396..0a944408 100644 --- a/niucloud/app/service/api/student/StudentService.php +++ b/niucloud/app/service/api/student/StudentService.php @@ -83,6 +83,13 @@ class StudentService extends BaseService // 获取用户基本信息 $member = (new CustomerResources())->where('id', $student['user_id'])->find(); + // 获取课程统计信息 + $courseStats = $this->getStudentCourseStats($studentId); + + // 获取预约资格信息 + $bookingService = new \app\service\api\student\CourseBookingService(); + $qualification = $bookingService->checkStudentQualification($studentId); + return [ 'student_id' => $student['id'], 'name' => $student['name'], @@ -93,7 +100,17 @@ class StudentService extends BaseService 'member_name' => $member['name'] ?? '', 'created_at' => $student['created_at'], 'create_year_month' => date('Y年m月', strtotime($student['created_at'])), - 'week_day' => '星期' . ['日', '一', '二', '三', '四', '五', '六'][date('w')] + 'week_day' => '星期' . ['日', '一', '二', '三', '四', '五', '六'][date('w')], + // 课程统计信息 + 'course_stats' => $courseStats, + // 预约资格信息 + 'booking_qualification' => [ + 'can_book' => $qualification['can_book'], + 'has_valid_course' => $qualification['has_valid_course'], + 'remaining_courses' => $qualification['total_remaining_hours'] ?? 0, + 'trial_class_count' => $qualification['trial_class_count'] ?? 0, + 'reason' => $qualification['reason'] + ] ]; } diff --git a/uniapp/api/apiRoute.js b/uniapp/api/apiRoute.js index 74571582..7d9c9109 100644 --- a/uniapp/api/apiRoute.js +++ b/uniapp/api/apiRoute.js @@ -918,6 +918,29 @@ export default { } }, + // 获取学员汇总信息 + async getStudentSummary(student_id) { + try { + const response = await http.get(`/student/summary/${student_id}`); + return response; + } catch (error) { + console.error('获取学员汇总信息错误:', error); + // 返回模拟数据 + return { + code: 1, + data: { + student_id: student_id, + name: '学员姓名', + booking_qualification: { + can_book: false, + remaining_courses: 0, + reason: '接口调用失败' + } + } + }; + } + }, + // 检查预约冲突 async checkBookingConflict(data = {}) { try { diff --git a/uniapp/components/study-plan-popup/study-plan-popup.vue b/uniapp/components/study-plan-popup/study-plan-popup.vue index 00716b63..d14b3587 100644 --- a/uniapp/components/study-plan-popup/study-plan-popup.vue +++ b/uniapp/components/study-plan-popup/study-plan-popup.vue @@ -10,21 +10,10 @@ 计划名称 - + - - - 计划类型 - - - - {{ planData.plan_type || '请选择计划类型' }} - - - - - + 开始日期 @@ -51,16 +40,16 @@ - - 状态 - - - - {{ getStatusText(planData.status) || '请选择状态' }} - - - - + + + + + + + + + + @@ -87,14 +76,11 @@ export default { planData: { id: null, plan_name: '', - plan_type: '', start_date: '', end_date: '', plan_content: '', status: 'pending' }, - planTypes: ['学习计划', '训练计划', '康复计划', '体能提升', '技能培养', '其他'], - typeIndex: 0, statusOptions: ['pending', 'active', 'completed', 'expired'], statusIndex: 0 } @@ -114,7 +100,6 @@ export default { this.planData = { id: plan.id, plan_name: plan.plan_name || '', - plan_type: plan.plan_type || '', start_date: plan.start_date || '', end_date: plan.end_date || '', plan_content: plan.plan_content || '', @@ -122,7 +107,6 @@ export default { } // 设置选择器索引 - this.typeIndex = this.planTypes.indexOf(this.planData.plan_type) this.statusIndex = this.statusOptions.indexOf(this.planData.status) this.isVisible = true @@ -142,13 +126,11 @@ export default { this.planData = { id: null, plan_name: '', - plan_type: '', start_date: '', end_date: '', plan_content: '', status: 'pending' } - this.typeIndex = 0 this.statusIndex = 0 }, @@ -164,13 +146,7 @@ export default { return } - if (!this.planData.plan_type) { - uni.showToast({ - title: '请选择计划类型', - icon: 'none' - }) - return - } + if (!this.planData.start_date) { uni.showToast({ @@ -205,7 +181,6 @@ export default { const params = { student_id: this.studentId, plan_name: this.planData.plan_name, - plan_type: this.planData.plan_type, start_date: this.planData.start_date, end_date: this.planData.end_date, plan_content: this.planData.plan_content, @@ -237,11 +212,7 @@ export default { } }, - // 计划类型选择 - onTypeChange(e) { - this.typeIndex = e.detail.value - this.planData.plan_type = this.planTypes[this.typeIndex] - }, + // 状态选择 onStatusChange(e) { diff --git a/uniapp/pages-coach/coach/schedule/schedule_table.vue b/uniapp/pages-coach/coach/schedule/schedule_table.vue index ed2d736f..c07f2787 100644 --- a/uniapp/pages-coach/coach/schedule/schedule_table.vue +++ b/uniapp/pages-coach/coach/schedule/schedule_table.vue @@ -589,9 +589,9 @@ export default { // 生成默认时间段 generateDefaultTimeSlots() { this.timeSlots = [] - // 生成常用时间段,包含半小时间隔 + // 生成常用时间段,包含半小时间隔,从 08:00 开始 const timeSlots = [ - '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', + '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00' diff --git a/uniapp/pages-market/clue/class_arrangement_detail.vue b/uniapp/pages-market/clue/class_arrangement_detail.vue index 3d957360..0449e33e 100644 --- a/uniapp/pages-market/clue/class_arrangement_detail.vue +++ b/uniapp/pages-market/clue/class_arrangement_detail.vue @@ -31,6 +31,12 @@ 课程状态:{{ stu.courseStatus }} 上课情况:{{ stu.course_progress.used }}/{{ stu.course_progress.total }}节 到期时间:{{ stu.student_course_info.end_date || '未设置' }} + + 已签到 + + + 未签到 + diff --git a/uniapp/pages-student/course-booking/index.vue b/uniapp/pages-student/course-booking/index.vue index 5db4e326..5220e781 100644 --- a/uniapp/pages-student/course-booking/index.vue +++ b/uniapp/pages-student/course-booking/index.vue @@ -14,7 +14,7 @@ {{ studentInfo.name }} - 剩余课时:{{ studentInfo.remaining_courses || 0 }}节 + 剩余课时:{{ studentInfo.booking_qualification ? studentInfo.booking_qualification.remaining_courses : 0 }}节 可预约:{{ availableBookings }}节 @@ -219,7 +219,7 @@ availableBookings() { // 根据业务规则计算可预约课时数 - const remaining = this.studentInfo.remaining_courses || 0 + const remaining = this.studentInfo.booking_qualification ? this.studentInfo.booking_qualification.remaining_courses : 0 const pending = this.myBookings.filter(b => b.status === 'pending').length return Math.max(0, remaining - pending) }