OrderAddressCell.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // OrderAddressCell.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/11/4.
  6. //
  7. import UIKit
  8. class OrderAddressCell: UITableViewCell {
  9. @IBOutlet weak var isDefualLab: UILabel!
  10. @IBOutlet weak var selectBtn: UIButton!
  11. @IBOutlet weak var nameLab: UILabel!
  12. @IBOutlet weak var phoneLab: UILabel!
  13. @IBOutlet weak var addressLab: UILabel!
  14. @IBOutlet weak var postCodeLab: UILabel!
  15. var addressModel : AddressModel?
  16. var selectBlock : (()->Void)?
  17. var editBlock : (()->Void)?
  18. override func awakeFromNib() {
  19. super.awakeFromNib()
  20. // Initialization code
  21. }
  22. override func setSelected(_ selected: Bool, animated: Bool) {
  23. super.setSelected(selected, animated: animated)
  24. // Configure the view for the selected state
  25. }
  26. func configModel(model : AddressModel){
  27. self.addressModel = model
  28. self.nameLab.text = "\(model.receiving ?? "")"
  29. self.phoneLab.text = "\(model.phoneNum ?? "")"
  30. if model.isDefault == "1"{
  31. self.isDefualLab.isHidden = false
  32. self.selectBtn.isSelected = true
  33. }else{
  34. self.isDefualLab.isHidden = true
  35. self.selectBtn.isSelected = false
  36. }
  37. self.addressLab.text = "\(model.street ?? "")\(model.detailAddress ?? "")"
  38. self.postCodeLab.text = "\(model.postcode ?? "")"
  39. }
  40. @IBAction func editAction(_ sender: UIButton) {
  41. if self.editBlock != nil{
  42. self.editBlock!()
  43. }
  44. }
  45. @IBAction func selectAction(_ sender: UIButton) {
  46. }
  47. }