// // OderDetailHeadView.swift // ADHTuanCan // // Created by 敖德亨 on 2023/11/4. // import UIKit class OderDetailHeadView: UIView { /// 时间提示View @IBOutlet weak var timeView: UIView! /// 待支付View @IBOutlet weak var willPayView: UIView! /// 待接单 @IBOutlet weak var pendingOrderView: UIView! /// 已完成 @IBOutlet weak var finishView: UIView! /// 配送 @IBOutlet weak var deliveryView: UIView! /// 超时取消 @IBOutlet weak var timeOutView: UIView! /// 去支付BtnV @IBOutlet weak var payBtnView: UIView! /// 地址BtnV @IBOutlet weak var addressBtnView: UIView! /// 再次购买BtnV @IBOutlet weak var buyAgainBtnView: UIView! /// 确认收货BtnV @IBOutlet weak var receivingBtnView: UIView! /// 去评价BtnV @IBOutlet weak var evaluateBtnView: UIView! /// 联系商家BtnV @IBOutlet weak var callBtnView: UIView! /// 取消订单BtnV @IBOutlet weak var cancelBtnView: UIView! /// 订单状态 @IBOutlet weak var typeLab: UILabel! /// 下单时间 @IBOutlet weak var makeOrdrtTime: UILabel! /// 配送时间 @IBOutlet weak var deliveryTme: UILabel! /// 地址 @IBOutlet weak var addressLab: UILabel! /// 邮编 @IBOutlet weak var postCodeLab: UILabel! /// 电话 @IBOutlet weak var phoneLab: UILabel! /// 收货人 @IBOutlet weak var nameLab: UILabel! /// 1去支付 2修改地址 3再来一单 4确认收货 5去评价 6联系商家 7取消订单 var headBtnBlock : ((Int)->Void)? override func awakeFromNib() { super.awakeFromNib() } func configModel(model : OrderOutDetailModel){ self.makeOrdrtTime.text = "\(model.createTime ?? "")" // self.makeOrdrtTime.text = "\(model. ?? "")" self.addressLab.text = "\(model.street ?? "")\(model.detailAddress ?? "")" // self.addressLab.sizeToFit() self.postCodeLab.text = "\(model.postcode ?? "")" self.phoneLab.text = "\(model.phoneNum ?? "")" self.nameLab.text = "\(model.receiving ?? "")" let labHeight : CGFloat = (self.addressLab.frame.size.height) self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = true self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = true self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = true self.cancelBtnView.isHidden = true let status : String = "\(model.orderStatus ?? "")" if status === 1{ //待付款 self.timeView.isHidden = false self.willPayView.isHidden = false self.pendingOrderView.isHidden = true self.finishView.isHidden = true self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = false self.addressBtnView.isHidden = false self.buyAgainBtnView.isHidden = true self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = true self.cancelBtnView.isHidden = false if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 30 + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 30 + 100 + 100 + 100)) } self.typeLab.text = "待支付" } if status === 2{ //待接单 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = false self.finishView.isHidden = true self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = false self.buyAgainBtnView.isHidden = true self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = true self.cancelBtnView.isHidden = false if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = LanguagesUtil.createTextBy(Ctext: "待商家接单", Etext: "Waiting fo accept the order") } if status === 3{ //待配送 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = true self.deliveryView.isHidden = false self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = false self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = false self.cancelBtnView.isHidden = true if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = "订单待配送" } if status === 4{ //已完成未评价 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = false self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = false self.callBtnView.isHidden = true self.cancelBtnView.isHidden = false if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = "订单已完成" } if status === 5{ //已取消 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = true self.deliveryView.isHidden = true self.timeOutView.isHidden = false //超时 self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = false self.cancelBtnView.isHidden = true if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 50 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 50 + 100 + 100)) } self.typeLab.text = "订单已取消" } if status === 6{ //退款中 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = false self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = false self.cancelBtnView.isHidden = true if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = "订单退款中" } if status === 7{ //已退款 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = false self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = false self.cancelBtnView.isHidden = true if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = "订单已退款" } if status === 8{ //完成已评价 self.timeView.isHidden = true self.willPayView.isHidden = true self.pendingOrderView.isHidden = true self.finishView.isHidden = false self.deliveryView.isHidden = true self.timeOutView.isHidden = true self.payBtnView.isHidden = true self.addressBtnView.isHidden = true self.buyAgainBtnView.isHidden = false self.receivingBtnView.isHidden = true self.evaluateBtnView.isHidden = true self.callBtnView.isHidden = false self.cancelBtnView.isHidden = true if self.addressLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:135 + labHeight + 100 + 100 + 100)) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:155 + 100 + 100 + 100)) } self.typeLab.text = "订单已完成" } } /// 去支付 /// - Parameter sender: <#sender description#> @IBAction func goToPayAction(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(1) } } /// 修改地址 /// - Parameter sender: <#sender description#> @IBAction func addressAction(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(2) } } /// 再来一单 /// - Parameter sender: <#sender description#> @IBAction func oneMoreAgain(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(3) } } /// 确认收货 /// - Parameter sender: <#sender description#> @IBAction func confirmReceipt(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(4) } } /// 去评价 /// - Parameter sender: <#sender description#> @IBAction func goToEvaluate(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(5) } } /// 联系商家 /// - Parameter sender: <#sender description#> @IBAction func phoneCall(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(6) } } /// 取消订单 /// - Parameter sender: <#sender description#> @IBAction func cancelOrderAction(_ sender: UIButton) { if self.headBtnBlock != nil{ self.headBtnBlock!(7) } } }