// // AllocatedListVC.swift // xingchuangke // // Created by apple on 2021/5/14. // Copyright © 2021 Virgil. All rights reserved. // import UIKit class AllocatedListVC: BaseViewController, UITableViewDelegate, UITableViewDataSource { let tableView: UITableView = { let tableV = UITableView.init(frame: UIScreen.main.bounds, style: .plain) tableV.tableFooterView = UIView.init() return tableV }() let contentV = CommonViewUntils.getViewForXIB(xibName: "BillFlowMenuContent") as! BillFlowMenuContent var menuView: XF_RightMenu = { let menuView = XF_RightMenu.init(frame: UIScreen.main.bounds) return menuView }() // 品牌id var machineTypeId: String? // 收益类型 var profitType: String = "999" override func viewDidLoad() { super.viewDidLoad() self.title = "待划拨金额" initNavLeftBackButton() initNavRightButtonForTitle(title: "筛选", color: UIColor.white) tableView.delegate = self tableView.dataSource = self tableView.frame = self.view.bounds tableView.separatorStyle = .none self.view.addSubview(tableView) tableView.register(UINib(nibName: "BillFlowCell", bundle: nil), forCellReuseIdentifier: "BillFlowCell") tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {[weak self] in self!.currentPage = 1 self!.loadData() }) tableView.mj_header?.lastUpdatedTimeKey = "ShowTableViewCell" tableView.mj_footer = MJRefreshBackNormalFooter(refreshingBlock: {[weak self] in self!.currentPage += 1 self!.loadData() }) self.view.addSubview(menuView) menuView.contentView = contentV contentV.billFlowBlock = { (str) in self.profitType = str self.menuView.hiddenView() self.currentPage = 1 self.loadData() } loadData() } // MARK: - action override func btnRightMenuClick() { self.menuView.showView() } // MARK: - request func loadData() { let url = RequestURL.newwalletList let params = NSMutableDictionary() params.setValue(self.machineTypeId, forKey: "machineTypeId") params.setValue(profitType, forKey: "type") params.setValue("0", forKey: "status") loadDataList(url: url, params: params, tableView: tableView, tag: 1001) } override func returnData(tag: Int) { if tag == 1001 { tableView.reloadData() } } override func returnError(tag: Int, type: String) { } // MARK: - delegate func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return arrData.count } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 60 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "BillFlowCell", for: indexPath as IndexPath) as! BillFlowCell cell.selectionStyle = .none cell.titleLabel.text = getString(current: indexPath.row, key: "name") cell.timeLabel.text = getString(current: indexPath.row, key: "createtime") let value: Double = getDoubleValue(current: indexPath.row, key: "wallet_amount", defaultValue: 0.0) if value >= 0 { cell.earnLabel.text = "+\(getDoubleValue(current: indexPath.row, key: "wallet_amount", defaultValue: 0.0))" } else { cell.earnLabel.text = "\(getDoubleValue(current: indexPath.row, key: "wallet_amount", defaultValue: 0.0))" } cell.totalLabel.text = "交易总额:\(getDoubleValue(current: indexPath.row, key: "amount_total", defaultValue: 0.0))" return cell } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }