123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- //
- // 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)
- }
- }
- }
|