Files
featherVoice/QXLive/Mine(音域)/Controller/钱包/QXWithDrawBindViewController.m
2025-08-08 10:49:36 +08:00

104 lines
3.6 KiB
Objective-C

//
// QXWithDrawBindViewController.m
// QXLive
//
// Created by 启星 on 2025/7/9.
//
#import "QXWithDrawBindViewController.h"
#import "QXSettingCell.h"
#import "QXMineNetwork.h"
#import "QXAliBindViewController.h"
@interface QXWithDrawBindViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableView;;
@end
@implementation QXWithDrawBindViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self getPayType];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"绑定管理");
}
-(void)initSubViews{
[self.view addSubview:self.tableView];
[self getPayType];
}
-(void)getPayType{
MJWeakSelf
[QXMineNetwork walletPayTypeWithUserId:QXGlobal.shareGlobal.loginModel.user_id successBlock:^(QXPayTypeStatusModel * _Nonnull model) {
[weakSelf.dataArray removeAllObjects];
if (model.wx.is_with_draw_open.intValue == 1) {
[weakSelf.dataArray addObject:model.wx];
}
if (model.ali.is_with_draw_open.intValue == 1) {
[weakSelf.dataArray addObject:model.ali];
}
if (model.bank.is_with_draw_open.intValue == 1) {
[weakSelf.dataArray addObject:model.bank];
}
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXSettingCell *cell = [QXSettingCell cellWithTableView:tableView];
cell.cellType = QXSettingCellTypeNormal;
QXPayTypeModel *model = self.dataArray[indexPath.row];
cell.titleLabel.text = model.name;
cell.detailLabel.text = model.is_bind.intValue==1?@"已绑定":@"未绑定";
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXPayTypeModel *model = self.dataArray[indexPath.row];
if ([model.name containsString:@"支付宝"]) {
QXAliBindViewController *aliVC = [[QXAliBindViewController alloc] init];
aliVC.isAli = YES;
aliVC.model = model;
[self.navigationController pushViewController:aliVC animated:YES];
return;
}
if ([model.name containsString:@"银行卡"]) {
QXAliBindViewController *aliVC = [[QXAliBindViewController alloc] init];
aliVC.isAli = NO;
aliVC.model = model;
[self.navigationController pushViewController:aliVC animated:YES];
}
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.rowHeight = 42;
}
return _tableView;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end