无故事王国
2023-09-20 2834569133090d46dd3f28a30100fa74661ef1e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
//  CourseBooking_1_TCell.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/27.
//
 
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
            btn_qrCode.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!
    @IBOutlet weak var btn_qrCode: 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)
            }
        }
    }
 
    @IBAction func QRCodeAction(_ sender: UIButton) {
        QRPreview.show("1231122")
    }
}