1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // DeliveryTimeItem.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/26.
- //
- import UIKit
- class DeliveryTimeItem: UICollectionViewCell {
- @IBOutlet weak var backView: UIView!
- @IBOutlet weak var titleLab: UILabel!
- override func awakeFromNib() {
- super.awakeFromNib()
- // Initialization code
- }
- func configModel(model : DeliveryTimeModel){
- if (model.startTime?.count ?? 0) > 4 && (model.endTime?.count ?? 0) > 4{
- let startStr = "\(model.startTime ?? "")".prefix(5)
- let endStr = "\(model.endTime ?? "")".prefix(5)
- self.titleLab.text = "\(startStr)~\(endStr)"
- }else{
- self.titleLab.text = ""
- }
-
- if model.status == "1"{
- self.backView.backgroundColor = UIColor.color(hex: "#D8D8D8")
- self.titleLab.textColor = UIColor.white
- }else{
- self.backView.backgroundColor = UIColor.white
- self.titleLab.textColor = UIColor.color(hex: "#1C304F")
- }
-
- if model.quota == "0"{
- self.backView.backgroundColor = UIColor.color(hex: "#D8D8D8")
- self.titleLab.textColor = UIColor.white
- }else{
- self.backView.backgroundColor = UIColor.white
- self.titleLab.textColor = UIColor.color(hex: "#1C304F")
- }
-
- if model.selected{
- self.backView.layer.borderColor = kThemeColor.cgColor
- }else{
- self.backView.layer.borderColor = UIColor.color(hex: "#D8D8D8").cgColor
- }
-
- }
- }
|