younger_times
2023-08-15 2ebbafa4b4a2994ae979fed38e1266d9efd5657e
BrokerDriver/Home/VC/HomeDetailContentVC.swift
@@ -28,7 +28,7 @@
    private(set) var type:Int!
    private var model:OrderDetailModel?{
        didSet{
            if let m = model{
         if let m = model?.data{
                label_type.text = m.orderType
                label_id.text = m.orderId
                icon_id.image = m.status.transImage
@@ -37,60 +37,8 @@
                contentTableView.reloadData()
                cargoTableview.reloadData()
                view_btn.isHidden = true
                var startCoordinate:CLLocationCoordinate2D?
                var endCoordinate:CLLocationCoordinate2D?
                if m.lat != 0 && m.lon != 0 {
                    startCoordinate = CLLocationCoordinate2D(latitude: m.lat, longitude: m.lon)
                }
                if m.eLat != 0 && m.eLon != 0{
                    endCoordinate = CLLocationCoordinate2D(latitude: m.eLat, longitude: m.eLon)
                }
                let tuple = (startCoordinate,endCoordinate)
                NotificationCenter.default.post(name: UpdateMap_Noti, object: tuple)
            NotificationCenter.default.post(name: UpdateMap_Noti, object: model)
                view_btn.isHidden = m.button == 2
//                switch m.status.rawValue{
//                    case 2,3,4,5,12,14:type = 1
//                    case 6,7,8,15:type = 2
//                    case 9,10:type = 3
//                    case 11:type = 4
//                    default:break
//                }
//
//                switch type{
//                    case 1:
//                        switch m.status.rawValue{
//                            case 2,3,4,5,12,14:view_btn.isHidden = false
//                            default:view_btn.isHidden = true
//                        }
//                    case 2:
//                        switch m.status.rawValue{
//                            case 6,7,8,15:
//                                view_btn.isHidden = false
//                            default:view_btn.isHidden = true
//                        }
//                    case 3:
//                        switch m.status.rawValue{
//                            case 9,10:
//                                view_btn.isHidden = false
//                                if m.orderType != "Live Unload" && m.status.rawValue == 9{
//                                    view_btn.isHidden = true
//                                }
//                            default:view_btn.isHidden = true
//                        }
//                    case 4:
//                        switch m.status.rawValue{
//                            case 11:view_btn.isHidden = false
//                            default:view_btn.isHidden = true
//                        }
//                    default:view_btn.isHidden = true
//                }
            }
        }
    }
@@ -155,7 +103,7 @@
        //到达码头:提示上传
        //运输中:上传POD
        //运回码头:提示上传
        guard let m = model else { return }
      guard let m = model?.data else { return }
        if m.nextStatus == .ArrivedPort{
            CommonAlertView.show(title: "Prompt!", content: "You need to upload gate out ticket", bt1: "Not upload yet", bt2: "To upload") { [weak self] in
                AttachTypeView.show(orderId: m.orderId,recordEnum: .GetOutTicket) {
@@ -237,21 +185,21 @@
        if cargoTableview == tableView{
            return 1
        }
        return model?.list.count ?? 0
      return model?.data?.list.count ?? 0
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if cargoTableview == tableView{
            let cell = tableView.dequeueReusableCell(withIdentifier: "_CargoInfoTCell") as! CargoInfoTCell
            cell.l1.text = model?.tGoods?.containerNumber ?? ""
            cell.l2.text = "\(model?.tGoods?.weight ?? 0)"
            cell.l3.text = model?.tGoods?.size ?? ""
            cell.l4.text = String(format: "%@\n%@", model?.tGoods?.type ?? "" ,model?.tGoods?.typeClass ?? "")
         cell.l1.text = model?.data?.tGoods?.containerNumber ?? ""
         cell.l2.text = "\(model?.data?.tGoods?.weight ?? 0)"
         cell.l3.text = model?.data?.tGoods?.size ?? ""
         cell.l4.text = String(format: "%@\n%@", model?.data?.tGoods?.type ?? "" ,model?.data?.tGoods?.typeClass ?? "")
            return cell
        }
        let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeDetailContentTCell") as! HomeDetailContentTCell
        if let dict = model?.list[indexPath.row]{
      if let dict = model?.data?.list[indexPath.row]{
            cell.dicts = dict
        }