DeliveryTimeItem.swift 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // DeliveryTimeItem.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/10/26.
  6. //
  7. import UIKit
  8. class DeliveryTimeItem: UICollectionViewCell {
  9. @IBOutlet weak var backView: UIView!
  10. @IBOutlet weak var titleLab: UILabel!
  11. override func awakeFromNib() {
  12. super.awakeFromNib()
  13. // Initialization code
  14. }
  15. func configModel(model : DeliveryTimeModel){
  16. if (model.startTime?.count ?? 0) > 4 && (model.endTime?.count ?? 0) > 4{
  17. let startStr = "\(model.startTime ?? "")".prefix(5)
  18. let endStr = "\(model.endTime ?? "")".prefix(5)
  19. self.titleLab.text = "\(startStr)~\(endStr)"
  20. }else{
  21. self.titleLab.text = ""
  22. }
  23. if model.status == "1"{
  24. self.backView.backgroundColor = UIColor.color(hex: "#D8D8D8")
  25. self.titleLab.textColor = UIColor.white
  26. }else{
  27. self.backView.backgroundColor = UIColor.white
  28. self.titleLab.textColor = UIColor.color(hex: "#1C304F")
  29. }
  30. if model.quota == "0"{
  31. self.backView.backgroundColor = UIColor.color(hex: "#D8D8D8")
  32. self.titleLab.textColor = UIColor.white
  33. }else{
  34. self.backView.backgroundColor = UIColor.white
  35. self.titleLab.textColor = UIColor.color(hex: "#1C304F")
  36. }
  37. if model.selected{
  38. self.backView.layer.borderColor = kThemeColor.cgColor
  39. }else{
  40. self.backView.layer.borderColor = UIColor.color(hex: "#D8D8D8").cgColor
  41. }
  42. }
  43. }