| | |
| | | class PersonalWalletVC: BaseViewController { |
| | | |
| | | @IBOutlet weak var label_account: UILabel! |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var label_unpaid: UILabel! |
| | | @IBOutlet weak var label_paid: UILabel! |
| | | @IBOutlet weak var tableView: BaseTableView! |
| | | @IBOutlet weak var label_billNumber: UILabel! |
| | | |
| | | private var model:UserWalletModel? |
| | | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "Wallet" |
| | | |
| | | Services.getMeWallet().subscribe(onNext: { [weak self] data in |
| | | if let model = data.data{ |
| | | self?.model = model |
| | | self?.label_account.text = model.allTotal.currency() |
| | | self?.label_unpaid.text = String(format: "Total unpaid:%.2lf", model.unpaid) |
| | | self?.label_paid.text = String(format: "Total paid:%.2lf", model.unpaid) |
| | | self?.label_billNumber.text = String(format: "The bill number:%@ days", model.billNumber) |
| | | self?.tableView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "WalletTCell", bundle: nil), forCellReuseIdentifier: "_WalletTCell") |
| | | |
| | | tableView.jq_setEmptyView("Not data", image: UIImage(named: "empty"), foregroundColor: .gray, clouse: nil) |
| | | label_account.font = UIFont(name: "Impact", size: 36) |
| | | label_account.text = 1.currency() |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | extension PersonalWalletVC:UITableViewDataSource{ |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_WalletTCell") as! WalletTCell |
| | | cell.model = model!.list[indexPath.row] |
| | | return cell |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | return 5 |
| | | return model?.list.count ?? 0 |
| | | } |
| | | } |