From a2ca0e4e77e880eb328c82a37e7ae67fb09198bc Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 23 五月 2023 18:30:28 +0800 Subject: [PATCH] 新增 --- OKProject/Class/LeftMenu/Controller/MineWalletVC.swift | 69 ++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 8 deletions(-) diff --git a/OKProject/Class/LeftMenu/Controller/MineWalletVC.swift b/OKProject/Class/LeftMenu/Controller/MineWalletVC.swift index 400f90d..0e94580 100644 --- a/OKProject/Class/LeftMenu/Controller/MineWalletVC.swift +++ b/OKProject/Class/LeftMenu/Controller/MineWalletVC.swift @@ -34,7 +34,13 @@ /// 数据源 private let dataSource = ["消费记录","打车红包","企业额度"] - + private var viewModel = EnterpriseViewModel() + private var model:EnterpriseInfoModel?{ + didSet{ + tableView.reloadData() + } + } + override func viewDidLoad() { super.viewDidLoad() @@ -43,12 +49,13 @@ let attribute2 = NSAttributedString(string: "申请", attributes: [NSAttributedString.Key.underlineStyle:1]) btn_apply.setAttributedTitle(attribute2, for: .normal) + getData() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) label_balance.text = "\(app.userInfo.balance.remain2Digits())" -// yy_nav_back_img = UIImage.init(named: "icon_back_white")! + label_credit_balance.text = "\(app.userInfo.balanceQuota.remain2Digits())" self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.color(light: UIColor.color(hexString: "#000000"), dark: UIColor.color(hexString: "#FFFFFF")),NSAttributedString.Key.font: UIFont.init(name: Medium, size: 18) ?? UIFont.systemFont(ofSize: 18)] self.navigationController?.navigationBar.barTintColor = UIColor.color(light: UIColor.color(hexString: "#FFFFFF"), dark: UIColor.color(hexString: "#191919")) self.navigationController?.navigationBar.barTintColor = ThemeColor @@ -59,19 +66,33 @@ self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.color(light: UIColor.color(hexString: "#000000"), dark: UIColor.color(hexString: "#FFFFFF")),NSAttributedString.Key.font: UIFont.init(name: Medium, size: 18) ?? UIFont.systemFont(ofSize: 18)] self.navigationController?.navigationBar.barTintColor = UIColor.color(light: UIColor.color(hexString: "#FFFFFF"), dark: UIColor.color(hexString: "#191919")) } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + label_balance.text = app.userInfo.balance.remain2Digits() + label_credit_balance.text = app.userInfo.balanceQuota.remain2Digits() + } + //MARK: - UI override func setupViews() { super.setupViews() navigationItem.title = "钱包" -// navigationItem.rightBarButtonItem = UIBarButtonItem.yy_creat(title: "提现", UIFont.systemFont(ofSize: 14), .black, target: self, action: #selector(withdrawal)).item -// label_balanceDesc.attributedText = AttributedStringbuilder.build() -// .add(string: "余额", withFont: UIFont.systemFont(ofSize: 14), withColor: .white) -// .add(string: "(元)", withFont: UIFont.systemFont(ofSize: 12), withColor: .white).mutableAttributedString tableView.delegate = self tableView.dataSource = self tableView.tableFooterView = UIView() tableView.register(UITableViewCell.self, forCellReuseIdentifier: "item") tableView.separatorColor = UIColor.color(light: UIColor.color(hexString: "#F6F6F6"), dark: UIColor.color(hexString: "#F6F6F6")) + } + + private func getData(){ + viewModel.queryEnterpriseInfo { status in + switch status{ + case .success(let m): + self.model = m + + case .error(let error):break + } + } } //MARK: - Rx @@ -89,8 +110,37 @@ } @IBAction func applyAction(_ sender: Any) { - let vc = MineCreditApplyVC() - self.yy_push(vc: vc) + guard let m = model else { + alert(text: "数据获取失败,请稍候") + getData() + return + } + + switch m.authStatus{ + case .Pass: + let vc = MineCreditApplyVC() + self.yy_push(vc: vc) + case .Pending: + alert(popup: .single, title: "提示", text: "请先进行企业认证", submitTitle: "确定",cancelTitle: nil) { + + } cancelClick: { + + } + case .Reject: + alert(popup: .single, title: "提示", text: "企业认证审核失败,请重新提交", submitTitle: "确定",cancelTitle: nil) { + + } cancelClick: { + + } + case .none:break + case .Review: + alert(popup: .single, title: "提示", text: "请耐心等待,审核通过后会通过短信的形式通知", submitTitle: "确定",cancelTitle: nil) { + + } cancelClick: { + + } + } + } } @@ -123,6 +173,9 @@ // MARK: - UITableViewDelegate extension MineWalletVC:UITableViewDataSource{ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if model == nil{ + return 2 + } return dataSource.count } -- Gitblit v1.7.1