| | |
| | | // |
| | | |
| | | import UIKit |
| | | import QMUIKit |
| | | |
| | | class LineOfCreditDetailVC: YYViewController { |
| | | |
| | | @IBOutlet weak var label_name: UILabel! |
| | | @IBOutlet weak var label_phone: UILabel! |
| | | @IBOutlet weak var label_applyQuota: UILabel! |
| | | @IBOutlet weak var textView_reason: QMUITextView! |
| | | @IBOutlet weak var stackView_handle: UIStackView! |
| | | @IBOutlet weak var btn_reject: UIButton! |
| | | @IBOutlet weak var btn_agreen: UIButton! |
| | | @IBOutlet weak var label_textLen: UILabel! |
| | | |
| | | let viewModel = EnterpriseViewModel() |
| | | private var id:Int! |
| | | |
| | | init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "申请详情" |
| | | textView_reason.isEditable = false |
| | | |
| | | viewModel.getCompanyLimitDetail(id: id) { [weak self] status in |
| | | guard let weakSelf = self else { return } |
| | | switch status { |
| | | case .success(let m): |
| | | weakSelf.label_name.text = m?.staffName ?? "" |
| | | weakSelf.label_phone.text = m?.phone ?? "" |
| | | weakSelf.label_applyQuota.text = m?.applyQuota.remain2Digits() ?? "" |
| | | weakSelf.textView_reason.text = m?.applyReason ?? "" |
| | | weakSelf.label_textLen.text = String(format: "%ld/50", m?.applyReason.length ?? 0) |
| | | weakSelf.stackView_handle.isHidden = (m?.status == .pass || m?.status == .reject) |
| | | case .error(let error): |
| | | alert(text: error.localizedDescription) |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func agreenAction(_ sender: UIButton) { |
| | | viewModel.companyLimitApprove(id: id, status: 1) { status in |
| | | switch status { |
| | | case .success(_): |
| | | alert(text: "审核成功") |
| | | self.stackView_handle.isHidden = true |
| | | NotificationCenter.default.post(name: RefreshLineOfCredit_Noti, object: nil) |
| | | case .error(let error): |
| | | alert(text: error.localizedDescription) |
| | | } |
| | | } |
| | | } |
| | | |
| | | @IBAction func rejectAction(_ sender: UIButton) { |
| | | RejectReasonView.show { [weak self] text in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.viewModel.companyLimitApprove(id: weakSelf.id,remark: text, status: 2) { status in |
| | | switch status { |
| | | case .success(_): |
| | | alert(text: "审核成功") |
| | | weakSelf.stackView_handle.isHidden = true |
| | | NotificationCenter.default.post(name: RefreshLineOfCredit_Noti, object: nil) |
| | | case .error(let error): |
| | | alert(text: error.localizedDescription) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |