//
|
// 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
|
}
|
}
|