From a2ca0e4e77e880eb328c82a37e7ae67fb09198bc Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 23 五月 2023 18:30:28 +0800 Subject: [PATCH] 新增 --- OKProject/Class/Home/Controller/EnterpriseAuthVC.swift | 81 ++++++++++++++++++++++++++++++++++------ 1 files changed, 69 insertions(+), 12 deletions(-) diff --git a/OKProject/Class/Home/Controller/EnterpriseAuthVC.swift b/OKProject/Class/Home/Controller/EnterpriseAuthVC.swift index d16d35c..9066d45 100644 --- a/OKProject/Class/Home/Controller/EnterpriseAuthVC.swift +++ b/OKProject/Class/Home/Controller/EnterpriseAuthVC.swift @@ -1,26 +1,83 @@ -// -// EnterpriseAuthVC.swift -// OKProject -// -// Created by 无故事王国 on 2023/4/10. -// Copyright © 2023 yangwang. All rights reserved. -// + // + // EnterpriseAuthVC.swift + // OKProject + // + // Created by 无故事王国 on 2023/4/10. + // Copyright © 2023 yangwang. All rights reserved. + // import UIKit +let EnterPriseAuth_Noti = Notification.Name.init("EnterPriseAuth_Noti") + class EnterpriseAuthVC: YYViewController { + + private var viewModel = EnterpriseViewModel() + + @IBOutlet weak var label_authStatus: UILabel! + @IBOutlet weak var btn_authStatus: TapButton! + @IBOutlet weak var btn_enterprisename: TapButton! + @IBOutlet weak var btn_enterpriseMembers: TapButton! + @IBOutlet weak var btn_enterpriseInfo: TapButton! + @IBOutlet weak var btn_apply: TapButton! + @IBOutlet weak var label_apply: UILabel! + + private var model:EnterpriseInfoModel!{ + didSet{ + label_authStatus.text = model.authStatus.rawString + btn_authStatus.isHidden = model.authStatus == .Pass + btn_enterprisename.isHidden = model.authStatus != .Pass + btn_enterpriseMembers.isHidden = model.authStatus != .Pass + btn_enterpriseInfo.isHidden = model.authStatus != .Pass + btn_apply.isHidden = model.moneyLimit == 0 + label_apply.text = String(format: "额度申请(%ld)", model.moneyLimitCount) + } + } override func viewDidLoad() { super.viewDidLoad() title = "企业认证" - + + btn_enterprisename.isHidden = true + btn_enterpriseMembers.isHidden = true + btn_enterpriseInfo.isHidden = true + btn_apply.isHidden = true + + getData() + } + + override func bindRx() { + NotificationCenter.default.rx.notification(EnterPriseAuth_Noti).takeUntil(self.rx.deallocated).subscribe(onNext: {noti in + self.getData() + }).disposed(by: disposeBag) + } + + private func getData(){ + viewModel.queryEnterpriseInfo { status in + switch status { + case .success(let model): + self.model = model + case .error(let error): + alert(text: error.localizedDescription) + } + } } @IBAction func handleAction(_ sender: TapButton) { - print("--->\(sender.tag)") if sender.tag == 10{ - let vc = EnterpriseAuthApplyVC() - yy_push(vc: vc) + + switch model.authStatus{ + case .Pending: + let vc = EnterpriseAuthApplyVC() + yy_push(vc: vc) + case .Review: + alert(popup: .single, title: "提示", text: "请耐心等待,审核通过后会通过短信的形式通知", submitTitle: "确定",cancelTitle: nil) { + + } cancelClick: { + + } + default:break + } } if sender.tag == 12{ @@ -29,7 +86,7 @@ } if sender.tag == 13{ - let vc = EnterpriseInfoVC() + let vc = EnterpriseInfoVC(model: model) yy_push(vc: vc) } -- Gitblit v1.7.1