//
|
// CourseBookingTCell.swift
|
// WanPai
|
//
|
// Created by 无故事王国 on 2023/6/25.
|
//
|
|
import UIKit
|
|
class CourseBookingTCell: UITableViewCell {
|
|
var weeklyCourseItemModel:WeeklyCourseItemModel!{
|
didSet{
|
label_title.text = weeklyCourseItemModel.name
|
label_time.text = weeklyCourseItemModel.time.joined(separator: "|")
|
label_info.text = String(format: "%@/会员扣%ld课时", weeklyCourseItemModel.money.currency(),weeklyCourseItemModel.num)
|
|
if weeklyCourseItemModel.type == 1{
|
btn_handle.setTitle("请假", for: .normal)
|
btn_handle.isEnabled = true
|
btn_handle.isHidden = weeklyCourseItemModel.isType == 1
|
}
|
|
if weeklyCourseItemModel.type == 2{
|
btn_handle.setTitle("报名", for: .normal)
|
btn_handle.isEnabled = true
|
btn_handle.backgroundColor = UIColor(hexStr: "#6CC366")
|
}
|
|
if weeklyCourseItemModel.type == 3{
|
btn_handle.setTitle("已请假", for: .normal)
|
btn_handle.isEnabled = false
|
btn_handle.backgroundColor = UIColor(hexStr: "#C0C0C0")
|
}
|
|
btn_handle.isHidden = weeklyCourseItemModel.courseType != 1 && weeklyCourseItemModel.type == 2 || weeklyCourseItemModel.type == 1 && weeklyCourseItemModel.type == 2
|
|
if weeklyCourseItemModel.isType == 3{
|
btn_handle.setTitle("已取消", for: .normal)
|
btn_handle.isEnabled = false
|
btn_handle.isHidden = false
|
btn_handle.backgroundColor = UIColor(hexStr: "#C0C0C0")
|
}
|
|
}
|
}
|
@IBOutlet weak var label_title: UILabel!
|
@IBOutlet weak var label_time: UILabel!
|
@IBOutlet weak var label_info: UILabel!
|
@IBOutlet weak var btn_handle: UIButton!
|
@IBOutlet weak var view_corner: UIView!
|
|
var clickClouse:((WeeklyCourseItemModel)->Void)?
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
selectionStyle = .none
|
backgroundColor = .white
|
contentView.backgroundColor = .white
|
}
|
|
@IBAction func bookingAction(_ sender: UIButton) {
|
clickClouse?(weeklyCourseItemModel)
|
|
}
|
}
|