Commit 1aee84a5 authored by David黄金龙's avatar David黄金龙

上传过关证件 接口 及逻辑

parent 98c3fb47
......@@ -265,6 +265,7 @@ extension YHServiceOrderListView : UITableViewDelegate,UITableViewDataSource {
} else if model.type == 27 {
//上传过关证件
let vc = YHUploadCertificateVC()
vc.orderId = orderID
navigationController?.pushViewController(vc)
}
}
......
......@@ -11,6 +11,13 @@ import UIKit
class YHUploadCertificateVC: YHBaseViewController {
var items: [String] = ["1", "1"]
lazy var viewModel: YHUploadCertificateViewModel = {
let vm = YHUploadCertificateViewModel()
return vm
}()
var orderId : Int = 0
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -62,10 +69,23 @@ class YHUploadCertificateVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
}
private extension YHUploadCertificateVC {
func loadData() {
viewModel.getUploadCertificateList(orderId) { success, error in
if success {
} else {
}
self.tableView.reloadData()
}
}
func setupUI() {
gk_navTitle = "上传过关证件"
gk_navBarAlpha = 1.0
......@@ -73,11 +93,6 @@ private extension YHUploadCertificateVC {
view.backgroundColor = UIColor.contentBkgColor
view.addSubview(tableView)
// view.addSubview(bottomView)
// bottomView.snp.makeConstraints { make in
// make.bottom.left.right.equalToSuperview()
// make.height.equalTo(98)
// }
tableView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin)
......@@ -103,11 +118,31 @@ private extension YHUploadCertificateVC {
extension YHUploadCertificateVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
if let model = viewModel.uploadCertificateDataListModel {
var session = 0
if !model.small_whites.isEmpty {
session += 1
}
if !model.id_cards.isEmpty {
session += 1
}
return session
}
return 0
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4 //for test hjl
if let model = viewModel.uploadCertificateDataListModel {
if section == 0 {
return model.small_whites.count
} else if section == 1 {
return model.id_cards.count
}
}
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -118,19 +153,33 @@ extension YHUploadCertificateVC: UITableViewDelegate, UITableViewDataSource {
} else {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHUploadCertificateDetailCell.cellReuseIdentifier, for: indexPath) as! YHUploadCertificateDetailCell
if indexPath.row == 3 {
approveCell.isLastCell = true
} else {
approveCell.isLastCell = false
if let model = viewModel.uploadCertificateDataListModel {
if indexPath.section == 0 {
let tmp = model.small_whites[indexPath.row - 1]
approveCell.dataModel = tmp
if indexPath.row == model.small_whites.count {
approveCell.isLastCell = true
} else {
approveCell.isLastCell = false
}
} else if indexPath.section == 1 {
let tmp = model.id_cards[indexPath.row - 1]
approveCell.dataModel = tmp
if indexPath.row == model.id_cards.count {
approveCell.isLastCell = true
} else {
approveCell.isLastCell = false
}
}
}
return approveCell
}
}
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHVisaPayTypeCell.cellReuseIdentifier, for: indexPath)
let approveCell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
return approveCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......
......@@ -11,6 +11,12 @@ class YHUploadCertificateDetailCell: UITableViewCell {
static let cellReuseIdentifier = "YHUploadCertificateDetailCell"
static let cellH : CGFloat = 69.0
var dataModel : YHUploadCertificateModel? {
didSet {
updataUI()
}
}
lazy var whiteContentView: UIView = {
let view = UIView()
......@@ -68,6 +74,24 @@ class YHUploadCertificateDetailCell: UITableViewCell {
}
private extension YHUploadCertificateDetailCell {
func updataUI() {
guard let model = dataModel else { return }
titleLable.text = model.apply_name
//状态 1-已上传 2-未上传
if model.status == 1 {
statusLable.text = "已上传"
statusLable.textColor = UIColor.successColor
statusImageView.image = UIImage(named: "green_right_arrow")
} else {
statusLable.text = "待上传"
statusLable.textColor = UIColor.brandMainColor
statusImageView.image = UIImage(named: "blue_right_arrow")
}
}
func updateCell() {
if isLastCell {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
......
......@@ -19,9 +19,9 @@ class YHUploadCertificateViewModel: YHBaseViewModel {
extension YHUploadCertificateViewModel {
//获取上传列表
func getUploadCertificateList(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.UploadCertificate.getDocListApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
func getUploadCertificateList(_ orderId: Int,callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.UploadCertificate.getDocListApi + "?order_id=\(orderId)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment