From 3e3bfd1ad307ec2ea42f66e298ccb24cec26955f Mon Sep 17 00:00:00 2001 From: younger_times <841720330@qq.com> Date: 星期三, 26 七月 2023 18:13:33 +0800 Subject: [PATCH] 新增 --- WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift b/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift index 8942f1a..11d2a86 100644 --- a/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift +++ b/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift @@ -7,17 +7,59 @@ import UIKit import JQTools +import RxSwift class CourseBooking_1_TCell: UITableViewCell { + var indexPath:IndexPath! + + var studentAppointModel:StudentAppointModel!{ + didSet{ + label_title.text = studentAppointModel.coursePackageName + label_courseNum.text = "\(studentAppointModel.courseHours)课时" + label_address.text = studentAppointModel.storeNameAddr + label_datetime.text = studentAppointModel.timeFrame + label_status.text = studentAppointModel.status.strTitle + + btn_exercise.isHidden = studentAppointModel.status != .complete + btn_cancel.isHidden = studentAppointModel.status != .pedding + + switch studentAppointModel.status{ + case .pedding:label_status.textColor = UIColor(hexStr: "#FD7402") + default:label_status.textColor = UIColor(hexStr: "#3D3E45") + } + } + } + + @IBOutlet weak var label_title: UILabel! + @IBOutlet weak var label_courseNum: UILabel! + @IBOutlet weak var label_address: UILabel! + @IBOutlet weak var label_datetime: UILabel! @IBOutlet weak var btn_exercise: UIButton! + @IBOutlet weak var label_status: UILabel! + @IBOutlet weak var btn_cancel: UIButton! + + private var disposeBag = DisposeBag() override func awakeFromNib() { super.awakeFromNib() selectionStyle = .none } + + @IBAction func exerciseAction(_ sender: UIButton) { let vc = CourseExerciseSubListVC() JQ_currentViewController().jq_push(vc: vc) } + + @IBAction func cancelAction(_ sender: UIButton) { + CommonAlertView.show(title: "取消预约", content: "是否取消当前预约?") {[weak self] status in + guard let weakSelf = self else { return } + if status{ + Services.cancelCourse(courseStuRecordId: weakSelf.studentAppointModel.courseStuRecordId).subscribe(onNext: { data in + NotificationCenter.default.post(name: CourseBooking_Noti, object: weakSelf.indexPath) + }).disposed(by: weakSelf.disposeBag) + } + } + } } -- Gitblit v1.7.1