// // MyDelegateDetailViewController.swift // xingchuangke // // Created by Virgil on 2019/4/21. // Copyright © 2019 Virgil. All rights reserved. // import UIKit class MyShopDetailTypeViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! @IBOutlet weak var lblDate: UILabel! @IBOutlet weak var lblName: UILabel! @IBOutlet weak var imgIcon: UIImageView! var id = "" var arrTitle = [["商户编号", "商户名", "所在地区", "营业地址", "营业范围", "行业类别", "Mcc类型", "签约费率"], ["姓名", "身份证号码", "结算卡号", "结算银行名称", "开户地区", "结算银行支行名称", "银行预留手机号", "本人信用卡卡号", "信用卡预留手机号"], ["品牌名称", "产品类型", "设备SN号", "激活状态"]] var arrContent = [["", "", "", "", "", "", "", ""], ["", "", "", "", "", "", "", "", ""], ["", "", "", ""]] override func viewDidLoad() { super.viewDidLoad() self.title = "商户详情" initNavLeftBackButton() tableView.register(UINib(nibName: "TiXianDetailTableViewCell", bundle: nil), forCellReuseIdentifier: "TiXianDetailTableViewCell") tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none tableView.showsVerticalScrollIndicator = false tableView.estimatedRowHeight = 100 loadData() } // MARK: =============加载数据=============== func loadData() { let url = RequestURL.myMerchantDetailQyb let params = NSMutableDictionary() params.setValue(id, forKey: "id") loadDataInfo(url: url, params: params, tag: 1001) } override func returnData(tag: Int) { if tag == 1001 { lblName.text = getString(key: "mercName") lblDate.text = "开通时间:\(getString(key: "createtime"))" //"商户编号","商户名","所在地区","营业地址","营业范围","行业类别","Mcc类型","签约费率" arrContent[0][0] = getString(key: "mercNum") arrContent[0][1] = getString(key: "mercName") arrContent[0][2] = "\(getString(key: "provCodeCN")) \(getString(key: "cityCodeCN")) \(getString(key: "areaCodeCN"))" arrContent[0][3] = getString(key: "addrDetail") arrContent[0][4] = getString(key: "bizScope") arrContent[0][5] = "\(getString(key: "customMccTypeCN"))" arrContent[0][6] = getString(key: "mccName") arrContent[0][7] = "\(getDoubleValue(key: "qybRate"))%" //"结算卡姓名","法人证件号","结算卡号","银行预留手机号","结算银行名称","结算银行支行名称","开户地区","TS认证信用卡","信用卡预留手机号" //"结算卡姓名","法人证件号","结算卡号","结算银行名称","开户地区","结算银行支行名称","银行预留手机号","TS认证信用卡","信用卡预留手机号" arrContent[1][0] = getString(key: "settleName") arrContent[1][1] = CommonValue.formatCardNum(str: getString(key: "bankcardID")) arrContent[1][2] = CommonValue.formatCardNum(str: getString(key: "accNum")) arrContent[1][3] = getString(key: "bankName") arrContent[1][4] = "\(getString(key: "bankCardProvCodeCN")) \(getString(key: "bankCardCityCodeCN"))" arrContent[1][5] = getString(key: "bankNameBranch") arrContent[1][6] = CommonValue.formatPhone(phone: getString(key: "phoneShow")) arrContent[1][7] = CommonValue.formatCardNum(str: getString(key: "verifyDebitCardNum")) arrContent[1][8] = CommonValue.formatPhone(phone: getString(key: "verifyDebitPhoneYL")) arrContent[2][0] = getString(key: "machineTypeCN") arrContent[2][1] = getString(key: "productTypeCN") arrContent[2][2] = getString(key: "machineSnCode") let bindStatus = getIntValue(key: "bindStatus") if bindStatus == 0 { arrContent[2][3] = "未绑定" } else if bindStatus == 1 { arrContent[2][3] = "已绑定" } else if bindStatus == 2 { arrContent[2][3] = "已激活" } tableView.reloadData() } } override func returnError(tag: Int, type: String) { } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 55 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = CommonViewUntils.getViewForXIB(xibName: "OpenDetailTableViewHeaderView") as! OpenDetailTableViewHeaderView view.initView(section: section) view.lblRemark.isHidden = true if section == 0 { view.lblName.text = "基本信息" } else if section == 1 { view.lblName.text = "结算信息" } else if section == 2 { view.lblName.text = "绑定设备信息" } return view } // func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { // return 12; // } // func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { // let view = UIView(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: 12)) // view.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xf0f0f2, alpha: 1.0); // return view; // } // MARK: TABLEVLEW 实现 func numberOfSections(in tableView: UITableView) -> Int { return self.arrTitle.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.arrTitle[section].count } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 55 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "TiXianDetailTableViewCell", for: indexPath as IndexPath) as! TiXianDetailTableViewCell cell.lblTitle.text = arrTitle[indexPath.section][indexPath.row] cell.lblContent.text = arrContent[indexPath.section][indexPath.row] return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // let view = UIViewController() // view.oneGoId = self.arrData[indexPath.row]["ItemId"] as! Int // self.navigationController?.pushViewController(view, animated: true) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: "MyShopDetailTypeViewController", bundle: nil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }