宽窄优行-由【嘉易行】项目成品而来
无故事王国
2023-05-25 dc1998fc1ac124f6b9a0e434ccf91103dd936409
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
//  MerchantCouponRecordVC.swift
//  OKProject
//
//  Created by 无故事王国 on 2022/2/14.
//  Copyright © 2022 yangwang. All rights reserved.
//
 
import UIKit
 
class MerchantCouponRecordVC: YYTableViewController {
 
    let viewModel = MerchantHistoryViewModel()
    var id = 0
    var activityId = 0
 
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "核销历史"
        view.backgroundColor = UIColor(hexString: "#F3F4F5")
        viewModel.id.accept(id)
        viewModel.activityId.accept(activityId)
    }
 
    //MARK: - UI
    override func setupViews() {
        super.setupViews()
        tableView.separatorStyle = .none
        tableView.delegate = self
        tableView.dataSource = self
        tableView.register(cellName: "Common_SingleText_TCell", identifier: "_Common_SingleText_TCell")
        viewModel.configure(tableView: tableView)
        tableView.beginRefreshing()
    }
 
 
    //MARK: - Layouts
    override func defineLayouts() {
        super.defineLayouts()
        tableView.snp.remakeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
 
    //MARK: - Rx
    override func bindRx() {
        super.bindRx()
 
    }
}
 
 
// MARK: - UITableViewDelegate
extension MerchantCouponRecordVC:UITableViewDelegate{
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableView.automaticDimension
    }
}
 
// MARK: - UITableViewDelegate
extension MerchantCouponRecordVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return viewModel.dataSource.value.count
    }
 
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "_Common_SingleText_TCell", for: indexPath) as! Common_SingleText_TCell
        cell.selectionStyle = .none
        cell.merchantCouponRecordModel = viewModel.dataSource.value[indexPath.row]
        return cell
    }
}