1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // OrderReadyCell.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/11.
- //
- import UIKit
- class OrderReadyCell: UITableViewCell {
- @IBOutlet weak var backView: UIView!
-
- @IBOutlet weak var headHeight: NSLayoutConstraint!
- @IBOutlet weak var typeLab: UILabel!
-
- @IBOutlet weak var nameLab: UILabel!
-
- @IBOutlet weak var foodImg: UIImageView!
-
- @IBOutlet weak var peopleNumLab: UILabel!
-
- @IBOutlet weak var priceLab: UILabel!
- @IBOutlet weak var timeLab: UILabel!
- @IBOutlet var foodLabList: [UILabel]!
-
- var dataModel : ShopMealMsgDetailModel?
- override func awakeFromNib() {
- super.awakeFromNib()
- // Initialization code
- }
- override func setSelected(_ selected: Bool, animated: Bool) {
- super.setSelected(selected, animated: animated)
- // self.typeLab.isHidden = true
- // Configure the view for the selected state
- // self.headHeight.constant = 0
- }
-
- func configModel(model : ShopMealMsgDetailModel? , isfirstLine : Bool){
- self.dataModel = model
- self.typeLab.text = "\(model?.supplyType ?? "")"
- self.nameLab.text = "\(model?.name ?? "")"
- self.foodImg.sd_setImage(url: URL.init(string: model?.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
- self.priceLab.text = "s$\(model?.price ?? "")"
- self.peopleNumLab.text = LanguagesUtil.createTextBy(Ctext: "\(model?.numPeople ?? "")人", Etext: "number of people \(model?.numPeople ?? "")")
- let star = "\(model?.deliveryStart ?? "")".prefix(5)
- let end = "\(model?.deliveryEnd ?? "")".prefix(5)
- self.timeLab.text = LanguagesUtil.createTextBy(Ctext: "约\(star)~\(end)送达", Etext: "Delivery around \(star)~\(end)")
-
- if isfirstLine{
- self.typeLab.isHidden = false
- headHeight.constant = 30
- // self.backView.addCorner(YDRectCorner(topLeft: 25, topRight: 25, bottomRight: 0))
- }else{
- self.typeLab.isHidden = true
- headHeight.constant = 0
- }
- for item in self.foodLabList {
- item.text = ""
- item.isHidden = true
- }
-
- if let _ = model?.mealFoodMsgs{
- for i in 0..<model!.mealFoodMsgs!.count{
- let model : MealFoodMsgModel = model!.mealFoodMsgs![i]
- let foodLab = self.foodLabList[i]
- foodLab.isHidden = false
-
- foodLab.text = "\(model.name ?? "")(\(model.comment ?? ""))"
-
- if model.comment.isEmptyStr{
- foodLab.text = "\(model.name ?? "")"
- }
- }
- }
-
- }
- }
|