184 lines
6.8 KiB
Objective-C
184 lines
6.8 KiB
Objective-C
//
|
|
// QXWalletViewController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/5/9.
|
|
//
|
|
|
|
#import "QXWalletViewController.h"
|
|
#import "QXRechargeViewcController.h"
|
|
#import "QXWalletHomeTopView.h"
|
|
#import "QXWalletHomeCell.h"
|
|
#import "QXWithDrawViewController.h"
|
|
#import "QXDiamondViewController.h"
|
|
#import "QXCornRecordViewController.h"
|
|
#import "QXMineNetwork.h"
|
|
#import "QXWithDrawBindViewController.h"
|
|
#import "QXRealNameViewController.h"
|
|
#import "QXBindMobileViewController.h"
|
|
#import "QXAliBindViewController.h"
|
|
|
|
@interface QXWalletViewController ()<UITableViewDelegate,UITableViewDataSource,QXWalletHomeTopViewDelegate>
|
|
@property (nonatomic,strong)QXWalletHomeTopView *topView;
|
|
@property (nonatomic,strong)UITableView *tableView;
|
|
@property (nonatomic,assign)BOOL isBind;
|
|
@end
|
|
|
|
@implementation QXWalletViewController
|
|
|
|
- (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 getPrice];
|
|
}
|
|
-(void)setNavgationItems{
|
|
[super setNavgationItems];
|
|
self.navigationItem.title = QXText(@"钱包");
|
|
}
|
|
- (void)initSubViews{
|
|
NSArray *section1 = @[
|
|
QXText(@"金币收支"),
|
|
QXText(@"钻石收支"),
|
|
];
|
|
NSArray *section2 = @[
|
|
QXText(@"钻石换币"),
|
|
QXText(@"绑定管理"),
|
|
];
|
|
[self.dataArray addObject:section1];
|
|
[self.dataArray addObject:section2];
|
|
self.tableView.tableHeaderView = self.topView;
|
|
[self.view addSubview:self.tableView];
|
|
}
|
|
|
|
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
|
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
|
return self.dataArray.count;
|
|
}
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
|
NSArray *arr = self.dataArray[section];
|
|
return arr.count;
|
|
}
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
QXWalletHomeCell *cell = [QXWalletHomeCell cellWithTableView:tableView];
|
|
NSArray *arr = self.dataArray[indexPath.section];
|
|
cell.titleLabel.text = arr[indexPath.row];
|
|
return cell;
|
|
}
|
|
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
|
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
|
|
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 36)];
|
|
titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
|
titleLabel.textColor = RGB16(0x000000);
|
|
if (section == 0) {
|
|
titleLabel.text = QXText(@"我的账单");
|
|
}else{
|
|
titleLabel.text = QXText(@"其他功能");
|
|
}
|
|
[header addSubview:titleLabel];
|
|
return header;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
|
return 36;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
return 50;
|
|
}
|
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
if (indexPath.section == 1) {
|
|
if (indexPath.row == 0) {
|
|
QXDiamondViewController *vc = [[QXDiamondViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}else{
|
|
QXWithDrawBindViewController *vc = [[QXWithDrawBindViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
}else{
|
|
QXCornRecordViewController *vc = [[QXCornRecordViewController alloc] init];
|
|
vc.type = indexPath.row;
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
}
|
|
-(void)didClickButtonIsRecharge:(BOOL)isRecharge{
|
|
if (isRecharge) {
|
|
QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}else{
|
|
if (QXGlobal.shareGlobal.loginModel.auth == 0) {
|
|
showToast(@"请先完成实名认证");
|
|
QXRealNameViewController *vc = [[QXRealNameViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
return;
|
|
}
|
|
if (QXGlobal.shareGlobal.loginModel.mobile.length == 0) {
|
|
showToast(@"请先绑定手机号");
|
|
QXBindMobileViewController *vc = [[QXBindMobileViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
return;
|
|
}
|
|
if (!self.isBind) {
|
|
showToast(@"请先绑定提现账号");
|
|
QXAliBindViewController *vc = [[QXAliBindViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
return;
|
|
}
|
|
QXWithDrawViewController *vc = [[QXWithDrawViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
}
|
|
|
|
-(void)getPrice{
|
|
MJWeakSelf
|
|
[QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) {
|
|
weakSelf.topView.coin = coin;
|
|
weakSelf.topView.earnings = earnings;
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
|
|
[QXMineNetwork walletPayTypeWithUserId:QXGlobal.shareGlobal.loginModel.user_id successBlock:^(QXPayTypeStatusModel * _Nonnull model) {
|
|
if (model.wx.is_with_draw_open.intValue == 1 && model.wx.is_bind.intValue == 1) {
|
|
weakSelf.isBind = YES;
|
|
return;
|
|
}
|
|
if (model.ali.is_with_draw_open.intValue == 1 && model.ali.is_bind.intValue == 1) {
|
|
weakSelf.isBind = YES;
|
|
return;
|
|
}
|
|
if (model.bank.is_with_draw_open.intValue == 1 && model.bank.is_bind.intValue == 1) {
|
|
weakSelf.isBind = YES;
|
|
return;
|
|
}
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
}
|
|
|
|
-(UITableView *)tableView{
|
|
if (!_tableView) {
|
|
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)];
|
|
_tableView.dataSource = self;
|
|
_tableView.delegate = self;
|
|
_tableView.backgroundColor = [UIColor clearColor];
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
if (@available(iOS 15.0, *)) {
|
|
_tableView.sectionHeaderTopPadding = 0;
|
|
} else {
|
|
// Fallback on earlier versions
|
|
}
|
|
}
|
|
return _tableView;
|
|
}
|
|
-(QXWalletHomeTopView *)topView{
|
|
if (!_topView) {
|
|
_topView = [[QXWalletHomeTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(110))];
|
|
_topView.delegate = self;
|
|
}
|
|
return _topView;
|
|
}
|
|
|
|
@end
|