OrderReadyCell.swift 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // OrderReadyCell.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/10/11.
  6. //
  7. import UIKit
  8. class OrderReadyCell: UITableViewCell {
  9. @IBOutlet weak var backView: UIView!
  10. @IBOutlet weak var headHeight: NSLayoutConstraint!
  11. @IBOutlet weak var typeLab: UILabel!
  12. @IBOutlet weak var nameLab: UILabel!
  13. @IBOutlet weak var foodImg: UIImageView!
  14. @IBOutlet weak var peopleNumLab: UILabel!
  15. @IBOutlet weak var priceLab: UILabel!
  16. @IBOutlet weak var timeLab: UILabel!
  17. @IBOutlet var foodLabList: [UILabel]!
  18. var dataModel : ShopMealMsgDetailModel?
  19. override func awakeFromNib() {
  20. super.awakeFromNib()
  21. // Initialization code
  22. }
  23. override func setSelected(_ selected: Bool, animated: Bool) {
  24. super.setSelected(selected, animated: animated)
  25. // self.typeLab.isHidden = true
  26. // Configure the view for the selected state
  27. // self.headHeight.constant = 0
  28. }
  29. func configModel(model : ShopMealMsgDetailModel? , isfirstLine : Bool){
  30. self.dataModel = model
  31. self.typeLab.text = "\(model?.supplyType ?? "")"
  32. self.nameLab.text = "\(model?.name ?? "")"
  33. self.foodImg.sd_setImage(url: URL.init(string: model?.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
  34. self.priceLab.text = "s$\(model?.price ?? "")"
  35. self.peopleNumLab.text = LanguagesUtil.createTextBy(Ctext: "\(model?.numPeople ?? "")人", Etext: "number of people \(model?.numPeople ?? "")")
  36. let star = "\(model?.deliveryStart ?? "")".prefix(5)
  37. let end = "\(model?.deliveryEnd ?? "")".prefix(5)
  38. self.timeLab.text = LanguagesUtil.createTextBy(Ctext: "约\(star)~\(end)送达", Etext: "Delivery around \(star)~\(end)")
  39. if isfirstLine{
  40. self.typeLab.isHidden = false
  41. headHeight.constant = 30
  42. // self.backView.addCorner(YDRectCorner(topLeft: 25, topRight: 25, bottomRight: 0))
  43. }else{
  44. self.typeLab.isHidden = true
  45. headHeight.constant = 0
  46. }
  47. for item in self.foodLabList {
  48. item.text = ""
  49. item.isHidden = true
  50. }
  51. if let _ = model?.mealFoodMsgs{
  52. for i in 0..<model!.mealFoodMsgs!.count{
  53. let model : MealFoodMsgModel = model!.mealFoodMsgs![i]
  54. let foodLab = self.foodLabList[i]
  55. foodLab.isHidden = false
  56. foodLab.text = "\(model.name ?? "")(\(model.comment ?? ""))"
  57. if model.comment.isEmptyStr{
  58. foodLab.text = "\(model.name ?? "")"
  59. }
  60. }
  61. }
  62. }
  63. }