|
@@ -8,10 +8,28 @@
|
|
|
|
|
|
import Foundation
|
|
|
import UIKit
|
|
|
+import MJRefresh
|
|
|
|
|
|
class JDDepositRecordsViewController: BaseViewController {
|
|
|
|
|
|
|
|
|
+ lazy var accountList : [JDTradeAccountModel] = { //账户列表
|
|
|
+
|
|
|
+ let arr: [JDTradeAccountModel] = [JDTradeAccountModel]()
|
|
|
+ return arr
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ lazy var cashRecordList:[JDCashRecordModel] = {
|
|
|
+ let arr = [JDCashRecordModel]()
|
|
|
+ return arr
|
|
|
+ }()
|
|
|
+
|
|
|
+ var pageNum : Int = 1
|
|
|
+
|
|
|
+
|
|
|
+ lazy var statusList : [String] = ["待审核" ,"已审核" ,"待处理","处理中","已完成","已驳回","待撤销","已撤销"]
|
|
|
+
|
|
|
var type : RecordType = .Depoist
|
|
|
lazy var tableView : UITableView = {
|
|
|
|
|
@@ -23,23 +41,48 @@ class JDDepositRecordsViewController: BaseViewController {
|
|
|
v.register(JDDepositRecordCell.self, forCellReuseIdentifier: JDDepositRecordCell.description())
|
|
|
v.register(JDExchangeRecordCell.self, forCellReuseIdentifier: JDExchangeRecordCell.description())
|
|
|
v.register(JDTransferRecordCell.self, forCellReuseIdentifier: JDTransferRecordCell.description())
|
|
|
+
|
|
|
+ v.ly_emptyView = emptyView
|
|
|
return v
|
|
|
|
|
|
}()
|
|
|
|
|
|
+ lazy var emptyView:HDEmptyView = {
|
|
|
+ let emptyV:HDEmptyView = HDEmptyView.emptyActionViewWithImageStr(image: NO_DATA_IMAGE, titleStr: switchLanguage("暂无数据") as NSString, detailStr: "", btnTitleStr: "") {
|
|
|
+ // Dlog("点击刷新按钮")
|
|
|
+ }
|
|
|
+ emptyV.titleLabFont = _PFSR(16)
|
|
|
+ emptyV.titleLabTextColor = TitleTextColor
|
|
|
+ emptyV.backgroundColor = .clear
|
|
|
+ emptyV.autoShowEmptyView = true
|
|
|
+ return emptyV
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
lazy var categoryBtn : UIButton = {
|
|
|
let v = UIButton(type: .custom)
|
|
|
v.backgroundColor = .white
|
|
|
- v.setTitle("所有币种", for: .normal)
|
|
|
- v.titleLabel?.font = .systemFont(ofSize: 14)
|
|
|
- v.setTitleColor(UIColor.pg_color(withHexString: "333333"), for: .normal)
|
|
|
- v.setImage(UIImage(named: "record_arrow"), for: .normal)
|
|
|
+ v.setTitle(switchLanguage("所有币种"), for: .normal)
|
|
|
+
|
|
|
+ v.setTextFont(.PFSR, 14)
|
|
|
+ v.setTitleColor(_color("#333333񑘕"), for: .normal)
|
|
|
+ v.setImage(_image("record_arrow&record_arrow"), for: .normal)
|
|
|
v.layer.masksToBounds = true
|
|
|
v.layer.cornerRadius = 17
|
|
|
v.layer.borderColor = UIColor.pg_color(withHexString: "E8E8E8").cgColor
|
|
|
+ v.addTarget(self, action: #selector(showAccountListAction), for: .touchUpInside)
|
|
|
+
|
|
|
return v
|
|
|
}()
|
|
|
|
|
|
+ @objc func showAccountListAction() ->Void {
|
|
|
+
|
|
|
+ let pop = JDSelectAccountTypePopView()
|
|
|
+ pop.showPopupView(source: self.accountList) { index in
|
|
|
+ print(index)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
lazy var statusBtn : UIButton = {
|
|
|
let v = UIButton(type: .custom)
|
|
|
v.backgroundColor = .white
|
|
@@ -50,26 +93,41 @@ class JDDepositRecordsViewController: BaseViewController {
|
|
|
v.layer.masksToBounds = true
|
|
|
v.layer.cornerRadius = 17
|
|
|
v.layer.borderColor = UIColor.pg_color(withHexString: "E8E8E8").cgColor
|
|
|
+
|
|
|
+ v.addTarget(self, action: #selector(showStatusListAction), for: .touchUpInside)
|
|
|
+
|
|
|
return v
|
|
|
}()
|
|
|
|
|
|
+ @objc func showStatusListAction() ->Void {
|
|
|
+
|
|
|
+ let pop = JDSelectStatusTypePopView()
|
|
|
+ pop.showPopupView(source: self.statusList) { index in
|
|
|
+ print(index)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
lazy var exchangeBtn : UIButton = {
|
|
|
let v = UIButton(type: .custom)
|
|
|
v.backgroundColor = .white
|
|
|
- v.setTitle("所有兑换方向", for: .normal)
|
|
|
+ v.setTitle("所有账户", for: .normal)
|
|
|
v.titleLabel?.font = .systemFont(ofSize: 14)
|
|
|
v.setTitleColor(UIColor.pg_color(withHexString: "333333"), for: .normal)
|
|
|
v.setImage(UIImage(named: "record_arrow"), for: .normal)
|
|
|
v.layer.masksToBounds = true
|
|
|
v.layer.cornerRadius = 17
|
|
|
v.layer.borderColor = UIColor.pg_color(withHexString: "E8E8E8").cgColor
|
|
|
+
|
|
|
+ v.addTarget(self, action: #selector(showAccountListAction), for: .touchUpInside)
|
|
|
+
|
|
|
return v
|
|
|
}()
|
|
|
|
|
|
lazy var transferBtn : UIButton = {
|
|
|
let v = UIButton(type: .custom)
|
|
|
v.backgroundColor = .white
|
|
|
- v.setTitle("所有转转账方向", for: .normal)
|
|
|
+ v.setTitle("所有转账方向", for: .normal)
|
|
|
v.titleLabel?.font = .systemFont(ofSize: 14)
|
|
|
v.setTitleColor(UIColor.pg_color(withHexString: "333333"), for: .normal)
|
|
|
v.setImage(UIImage(named: "record_arrow"), for: .normal)
|
|
@@ -88,6 +146,45 @@ class JDDepositRecordsViewController: BaseViewController {
|
|
|
make.edges.equalTo(view)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ tableView.mj_header = MJRefreshHeader(refreshingBlock: { [weak self] in
|
|
|
+
|
|
|
+ self?.pageNum = 1
|
|
|
+ if self?.type == .Exchange || self?.type == .Transfer {
|
|
|
+
|
|
|
+ self?.netCashRecordList()
|
|
|
+ }else {
|
|
|
+
|
|
|
+ self?.netPayRecordList()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ tableView.mj_footer = MJRefreshAutoFooter(refreshingBlock: { [weak self] in
|
|
|
+
|
|
|
+ self?.pageNum += 1
|
|
|
+ if self?.type == .Exchange || self?.type == .Transfer {
|
|
|
+
|
|
|
+ self?.netCashRecordList()
|
|
|
+ }else {
|
|
|
+
|
|
|
+ self?.netPayRecordList()
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ netAccountList()
|
|
|
+
|
|
|
+ if type == .Exchange || type == .Transfer {
|
|
|
+
|
|
|
+ netCashRecordList()
|
|
|
+ }else {
|
|
|
+ netPayRecordList()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -95,7 +192,115 @@ class JDDepositRecordsViewController: BaseViewController {
|
|
|
|
|
|
|
|
|
extension JDDepositRecordsViewController {
|
|
|
+ func netAccountList() -> Void {
|
|
|
+ NetWork.NetWorkInstance.requestData(requestType: .Post, URLString: netForGetAccountList, success: { (code, result) in
|
|
|
+ ProgressHUD.hideHud()
|
|
|
+ if let dict:NSDictionary = result as? NSDictionary {
|
|
|
+ if let list:[NSDictionary] = dict["list"] as? [NSDictionary]{
|
|
|
+
|
|
|
+ self.accountList.removeAll()
|
|
|
+ for dic in list {
|
|
|
+ let model = JDTradeAccountModel.deserialize(from: dic)!
|
|
|
+
|
|
|
+ self.accountList.append(model)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }) { (code, result) in
|
|
|
+ ProgressHUD.showError(status: result as! String)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ func netCashRecordList() -> Void {
|
|
|
+
|
|
|
+ let param : [String : Any] = [
|
|
|
+ "pageNum" : pageNum,
|
|
|
+ "pageSize" : "10",
|
|
|
+ "type" : type == .Exchange ? ["1","2","3","4"] : ["200"]
|
|
|
+ ]
|
|
|
+
|
|
|
+ NetWork.NetWorkInstance.requestData(requestType: .Post, URLString: netForGetCashRecordList, parameters: param, success: { (code, result) in
|
|
|
+ ProgressHUD.hideHud()
|
|
|
+ if let dict:NSDictionary = result as? NSDictionary {
|
|
|
+ if let list:[NSDictionary] = dict["list"] as? [NSDictionary]{
|
|
|
+
|
|
|
+ if self.pageNum == 1 {
|
|
|
+ self.cashRecordList.removeAll()
|
|
|
+ }
|
|
|
+ for dic in list {
|
|
|
+ let model = JDCashRecordModel.deserialize(from: dic)!
|
|
|
+
|
|
|
+ self.cashRecordList.append(model)
|
|
|
+ }
|
|
|
+
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
+
|
|
|
+ }) { (code, result) in
|
|
|
+
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ ProgressHUD.showError(status: result as! String)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ func netPayRecordList() -> Void {
|
|
|
+
|
|
|
+ let param : [String : Any] = [
|
|
|
+ "pageNum" : pageNum,
|
|
|
+ "pageSize" : "10",
|
|
|
+ "type" : type == .Depoist ? ["1","2","3","4"] : ["200"]
|
|
|
+ ]
|
|
|
+
|
|
|
+ NetWork.NetWorkInstance.requestData(requestType: .Post, URLString: netForGetPayRecordList, parameters: param, success: { (code, result) in
|
|
|
+ ProgressHUD.hideHud()
|
|
|
+ if let dict:NSDictionary = result as? NSDictionary {
|
|
|
+ if let list:[NSDictionary] = dict["list"] as? [NSDictionary]{
|
|
|
+
|
|
|
+ if self.pageNum == 1 {
|
|
|
+ self.cashRecordList.removeAll()
|
|
|
+ }
|
|
|
+ for dic in list {
|
|
|
+ let model = JDCashRecordModel.deserialize(from: dic)!
|
|
|
+
|
|
|
+ self.cashRecordList.append(model)
|
|
|
+ }
|
|
|
+
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
+
|
|
|
+ }) { (code, result) in
|
|
|
+
|
|
|
+ self.tableView.mj_header?.endRefreshing()
|
|
|
+ self.tableView.mj_footer?.endRefreshing()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ ProgressHUD.showError(status: result as! String)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -109,6 +314,14 @@ extension JDDepositRecordsViewController : UITableViewDataSource{
|
|
|
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
|
|
|
+ if type == .Exchange || type == .Transfer{
|
|
|
+
|
|
|
+ return cashRecordList.count
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return cashRecordList.count
|
|
|
+ }
|
|
|
+
|
|
|
return 10
|
|
|
}
|
|
|
|
|
@@ -171,7 +384,7 @@ extension JDDepositRecordsViewController : UITableViewDataSource{
|
|
|
}else if type == .Exchange {
|
|
|
|
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: JDExchangeRecordCell.description()) as! JDExchangeRecordCell
|
|
|
-
|
|
|
+ cell.setupCellByExchangeRecord(model: cashRecordList[indexPath.row])
|
|
|
return cell
|
|
|
}else{
|
|
|
|
|
@@ -190,9 +403,7 @@ extension JDDepositRecordsViewController : UITableViewDelegate{
|
|
|
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
|
|
|
|
return 54
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
|
|