// // BusinessMainViewController.swift // xingchuangke // // Created by 李晓飞 on 2020/8/14. // Copyright © 2020 Virgil. All rights reserved. // import UIKit class BusinessMainViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! // let headerView: CommonHeaderView = { // let headerV = CommonHeaderView.init(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 180)) // headerV.isCycle = true // headerV.dataView.earnTitLbl.text = "本月新增商户(个)" // headerV.dataView.rewardTitLbl.text = "本日新增商户(个)" // // headerV.dataView1.earnTitLbl.text = "本月总交易(元)" // headerV.dataView1.rewardTitLbl.text = "本日总交易(元)" // return headerV // }() let dataList: Array = { return [["团队业绩", "个人业绩"]] }() override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) appDelegate.setNavigationBarHidden(isHidden: false) } override func viewDidLoad() { super.viewDidLoad() initNavLeftBackButton() self.title = "业绩管理" tableView.frame = self.view.bounds tableView.tableFooterView = UIView.init() tableView.delegate = self tableView.dataSource = self self.view.addSubview(tableView) // tableView.tableHeaderView = headerView loadData() } // MARK: - request func loadData() { let url = RequestURL.sumCountByMonthByDay let param = NSMutableDictionary() param.setValue(CommonValue.getUserId(), forKey: "userId") loadDataInfo(url: url, params: param, tag: 1001) } override func returnData(tag: Int) { NSLog("\(dicData)") // headerView.dataView.earnLbl.text = "\(getString(key: "momthCount"))" // headerView.dataView.rewardLbl.text = "\(getString(key: "dayCount"))" // // headerView.dataView1.earnLbl.text = "\(getString(key: "momthTransaction"))" // headerView.dataView1.rewardLbl.text = "\(getString(key: "dayTransaction"))" } override func returnError(tag: Int, type: String) { } // MARK: - tableviewdelegate func numberOfSections(in tableView: UITableView) -> Int { return dataList.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return dataList[section].count } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 60 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = UIView.init() view.backgroundColor = UIColor.init(white: 242/255.0, alpha: 1.0) return view } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if section == 0 { return 0.001 } return 10 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cellId = "businessCellId" var cell = tableView.dequeueReusableCell(withIdentifier: cellId) if cell == nil { cell = UITableViewCell.init(style: .default, reuseIdentifier: cellId) let imgV = UIImageView.init(image: UIImage.init(named: "ion_arrow_right_gray")) cell?.accessoryView = imgV cell?.selectionStyle = .none cell?.textLabel?.font = UIFont.systemFont(ofSize: 15) } cell?.textLabel?.text = dataList[indexPath.section][indexPath.row] return cell! } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let vc = AchiveViewController() // vc.isTeam = "\(indexPath.row)" vc.teamStr = "\(indexPath.row)" self.navigationController?.pushViewController(vc, animated: true) } /* // 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. } */ }