// // DRWithdrawDetailController.m // YouHuiProject // // Created by 小花 on 2018/7/31. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRWithdrawDetailController.h" @interface DRWithdrawDetailController () @property (nonatomic, strong) UIScrollView *scrollView; @end @implementation DRWithdrawDetailController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self configUI]; [self request]; } - (void)configNavigationBar { [self.navigationBar setNavTitle:@"提现详情"]; self.navigationBar.backgroundColor = [UIColor changeColor]; self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor]; UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal]; [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; [self.navigationBar setCustomLeftButtons:@[leftBtn]]; } - (void)backAction { [self.navigationController popViewControllerAnimated:YES]; } - (void)configUI { [self.view addSubview:self.scrollView]; NSArray *titles = @[@"提现金额",@"提现方式",@"提现账号",@"提现时间",@"交易单号"]; for (int i = 0; i < titles.count; i++) { UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(48)+Fitsize(48)*i, SCREEN_WIDTH-Fitsize(30), FITSIZE(1))]; line.backgroundColor = [UIColor YHColorWithHex:0xE5E5E5]; [self.scrollView addSubview:line]; UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(48)*i, Fitsize(75), Fitsize(47))]; title.font = [UIFont systemFontOfSize:Fitsize(16)]; title.textColor = [UIColor YHColorWithHex:0x999999]; title.text = titles[i]; [self.scrollView addSubview:title]; UILabel *detail = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(114), Fitsize(48)*i, SCREEN_WIDTH-FITSIZE(105), Fitsize(47))]; detail.centerY = title.centerY; detail.right = SCREEN_WIDTH-Fitsize(15); detail.textAlignment = NSTextAlignmentRight; detail.textColor = [UIColor YHColorWithHex:0x999999]; detail.font = [UIFont systemFontOfSize:Fitsize(16)]; detail.tag = 1000+i; [self.scrollView addSubview:detail]; } } - (void)request { NSString *url = [NSString stringWithFormat:@"%@/api/v2/users/withdrawaList",BaseURL]; NSDictionary *para = @{@"id":self.detailId}; [DRHttp post:url params:para success:^(id json) { if (![json isKindOfClass:[NSNull class]]) { [self setDataWithJson:json[@"data"]]; } } failure:^(NSError *error) { }]; } - (void)setDataWithJson:(NSDictionary *)dict { if ([dict isKindOfClass:[NSNull class]]) { return; } NSString *account = dict[@"alipay_account"]; NSString *newAccountStr; if (account.length == 11 && ![account containsString:@"@"]) { newAccountStr = [account stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"]; }else { newAccountStr = account; } NSArray *detail = @[[NSString stringWithFormat:@"¥%.2f",[dict[@"money"] floatValue]], dict[@"platform"], newAccountStr, dict[@"create_time"], dict[@"alipay_id"]]; for (int i = 0; i < detail.count; i++) { UILabel *detailLb = (UILabel *)[self.scrollView viewWithTag:1000+i]; detailLb.text = detail[i]; } } - (UIScrollView *)scrollView { if (!_scrollView) { _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)]; _scrollView.backgroundColor = [UIColor whiteColor]; _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight+1); _scrollView.showsVerticalScrollIndicator = NO; _scrollView.bounces = YES; } return _scrollView; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #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