123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- //
- // SPSBOrderBalanceTableViewController.m
- // 我的社保
- //
- // Created by shanp on 2021/6/19.
- //
- #import "SPSBOrderBalanceTableViewController.h"
- #import "SPSBUIGeneralHeader.h"
- #import "SPSBOrderListTableViewCell.h"
- #import "SPSBOrderBalanceModel.h"
- #import "UITableView+SPSBDefault.h"
- #import "SPSBConfirmAlertViewController.h"
- #import "SPSBOrderBalancePayViewController.h"
- @interface SPSBOrderBalanceTableViewController ()
- @end
- @implementation SPSBOrderBalanceTableViewController
- - (instancetype)init {
- self = [super initWithStyle:UITableViewStyleGrouped];
- if (!self) return nil;
- return self;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setupTableView];
- }
- #pragma mark - Action
- - (void)cellAction:(SPSBOrderListTableViewCell *)cell type:(SPSBOrderListTableActionType)type {
- NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
- if (!indexPath || indexPath.row >= _spsb_dataArray.count) return;
- SPSBOrderBalanceModel *model = _spsb_dataArray[indexPath.row];
- switch (type) {
- case SPSBOrderListTableActionTypeDetails:
- [self showOrderBalanceMonthWithData:model];
- break;
- case SPSBOrderListTableActionTypePay:
- [self payOrder:model];
-
- default:
- break;
- }
- }
- - (void)payOrder:(SPSBOrderBalanceModel *)model {
- SPSBOrderBalancePayViewController *vc = SPSBOrderBalancePayViewController.new;
- vc.spsb_data = model;
- [self presentViewController:vc animated:false completion:nil];
- }
- - (void)showOrderBalanceMonthWithData:(SPSBOrderBalanceModel *)model {
- SPSBConfirmAlertViewController *vc = [SPSBConfirmAlertViewController alertWithTitle:@"补缴月份" content:model.spsb_months];
- [vc setConfirmButtonTitle:@"我知道了" titleColor:nil action:^{
- }];
- [self presentViewController:vc animated:false completion:nil];
- }
- - (void)setSpsb_dataArray:(NSArray *)spsb_dataArray {
- _spsb_dataArray = spsb_dataArray;
- [self judgeData];
- [self.tableView reloadData];
- }
- - (void)judgeData {
- if (_spsb_dataArray.count == 0) {
- self.tableView.backgroundColor = spsb_FFFFFF_color(1.f);
- [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(buchae_qs) height:jxh_viewHeight(self.tableView) action:^{
- }];
- } else {
- self.tableView.backgroundColor = spsb_F5F5F5_color();
- [self.tableView removeDefaultFootView];
- }
- }
- #pragma mark - Network Action
- #pragma mark - Delegate & DataSource
- static NSString * const reuseIdentifier = @"SPSBOrderBalanceTableViewCell";
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- SPSBOrderListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
- if (!cell) {
- cell = [[SPSBOrderListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier orderType:SPSBOrderTypeOrderBalance];
- @weakify(self)
- cell.spsb_action = ^(SPSBOrderListTableViewCell * _Nonnull cell, SPSBOrderListTableActionType type) {
- @strongify(self)
- [self cellAction:cell type:type];
- };
- }
- SPSBOrderBalanceModel *model = _spsb_dataArray[indexPath.row];
- [cell reloadOrderBalanceData:model];
- return cell;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return _spsb_dataArray.count;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:false];
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 10;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- return UIView.new;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- return 10;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- return UIView.new;
- }
- #pragma mark - UI
- - (void)setupTableView {
- self.tableView.estimatedRowHeight = 100.f;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.showsHorizontalScrollIndicator = false;
- self.tableView.showsVerticalScrollIndicator = false;
- self.tableView.alwaysBounceVertical = true;
- }
- @end
|