ProfitDetailViewController.swift 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // ProfitDetailViewController.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/7/16.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class ProfitDetailViewController: BaseViewController, UITableViewDataSource, UITableViewDelegate {
  10. @IBOutlet weak var tableView: UITableView!
  11. var id = ""
  12. let arrTitle = ["单号", "描述", "类型", "操作金额", "时间", "备注"]
  13. var arrContent = ["", "", "收入", "", "", "详情"]
  14. override func viewDidLoad() {
  15. super.viewDidLoad()
  16. self.title = "收益详情"
  17. initNavLeftBackButton()
  18. tableView.register(UINib(nibName: "ProfitDetailTableViewCell", bundle: nil), forCellReuseIdentifier: "ProfitDetailTableViewCell")
  19. tableView.delegate = self
  20. tableView.dataSource = self
  21. tableView.separatorStyle = .none
  22. tableView.showsVerticalScrollIndicator = false
  23. tableView.estimatedRowHeight = 100
  24. loadData()
  25. }
  26. // MARK: =============加载数据===============
  27. func loadData() {
  28. let url = RequestURL.creditScoreDetail
  29. let params = NSMutableDictionary()
  30. params.setValue(id, forKey: "id")
  31. loadDataInfo(url: url, params: params, tag: 1001)
  32. }
  33. override func returnData(tag: Int) {
  34. if tag == 1001 {
  35. arrContent[0] = getString(key: "no")
  36. arrContent[1] = getString(key: "name")
  37. arrContent[3] = "+\(getDoubleValue(key: "wallet_amount", defaultValue: 0.00))"
  38. arrContent[4] = getString(key: "createtime")
  39. tableView.reloadData()
  40. }
  41. }
  42. override func returnError(tag: Int, type: String) {
  43. }
  44. // MARK: TABLEVLEW 实现
  45. func numberOfSections(in tableView: UITableView) -> Int {
  46. return 1
  47. }
  48. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  49. return arrTitle.count //self.arrData.count;
  50. }
  51. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  52. return 50
  53. }
  54. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  55. let cell = tableView.dequeueReusableCell(withIdentifier: "ProfitDetailTableViewCell", for: indexPath as IndexPath) as! ProfitDetailTableViewCell
  56. //cell.lblTitle.text = getString(indexPath.row, key: "Name")
  57. cell.lblName.text = arrTitle[indexPath.row]
  58. cell.lblContent.text = arrContent[indexPath.row]
  59. return cell
  60. }
  61. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  62. // let view = UIViewController()
  63. // view.oneGoId = self.arrData[indexPath.row]["ItemId"] as! Int
  64. // self.navigationController?.pushViewController(view, animated: true)
  65. }
  66. override func viewWillAppear(_ animated: Bool) {
  67. super.viewWillAppear(animated)
  68. }
  69. override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
  70. super.init(nibName: "ProfitDetailViewController", bundle: nil)
  71. }
  72. required init?(coder aDecoder: NSCoder) {
  73. fatalError("init(coder:) has not been implemented")
  74. }
  75. }