《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRWithdrawDetailController.m 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // DRWithdrawDetailController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/31.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRWithdrawDetailController.h"
  9. @interface DRWithdrawDetailController ()
  10. @property (nonatomic, strong) UIScrollView *scrollView;
  11. @end
  12. @implementation DRWithdrawDetailController
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. [self configNavigationBar];
  16. [self configUI];
  17. [self request];
  18. }
  19. - (void)configNavigationBar {
  20. [self.navigationBar setNavTitle:@"提现详情"];
  21. self.navigationBar.backgroundColor = [UIColor changeColor];
  22. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  23. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  24. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  25. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  26. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  27. }
  28. - (void)backAction {
  29. [self.navigationController popViewControllerAnimated:YES];
  30. }
  31. - (void)configUI {
  32. [self.view addSubview:self.scrollView];
  33. NSArray *titles = @[@"提现金额",@"提现方式",@"提现账号",@"提现时间",@"交易单号"];
  34. for (int i = 0; i < titles.count; i++) {
  35. UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(48)+Fitsize(48)*i, SCREEN_WIDTH-Fitsize(30), FITSIZE(1))];
  36. line.backgroundColor = [UIColor YHColorWithHex:0xE5E5E5];
  37. [self.scrollView addSubview:line];
  38. UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(48)*i, Fitsize(75), Fitsize(47))];
  39. title.font = [UIFont systemFontOfSize:Fitsize(16)];
  40. title.textColor = [UIColor YHColorWithHex:0x999999];
  41. title.text = titles[i];
  42. [self.scrollView addSubview:title];
  43. UILabel *detail = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(114), Fitsize(48)*i, SCREEN_WIDTH-FITSIZE(105), Fitsize(47))];
  44. detail.centerY = title.centerY;
  45. detail.right = SCREEN_WIDTH-Fitsize(15);
  46. detail.textAlignment = NSTextAlignmentRight;
  47. detail.textColor = [UIColor YHColorWithHex:0x999999];
  48. detail.font = [UIFont systemFontOfSize:Fitsize(16)];
  49. detail.tag = 1000+i;
  50. [self.scrollView addSubview:detail];
  51. }
  52. }
  53. - (void)request {
  54. NSString *url = [NSString stringWithFormat:@"%@/api/v2/users/withdrawaList",BaseURL];
  55. NSDictionary *para = @{@"id":self.detailId};
  56. [DRHttp post:url params:para success:^(id json) {
  57. if (![json isKindOfClass:[NSNull class]]) {
  58. [self setDataWithJson:json[@"data"]];
  59. }
  60. } failure:^(NSError *error) {
  61. }];
  62. }
  63. - (void)setDataWithJson:(NSDictionary *)dict {
  64. if ([dict isKindOfClass:[NSNull class]]) {
  65. return;
  66. }
  67. NSString *account = dict[@"alipay_account"];
  68. NSString *newAccountStr;
  69. if (account.length == 11 && ![account containsString:@"@"]) {
  70. newAccountStr = [account stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
  71. }else {
  72. newAccountStr = account;
  73. }
  74. NSArray *detail = @[[NSString stringWithFormat:@"¥%.2f",[dict[@"money"] floatValue]],
  75. dict[@"platform"],
  76. newAccountStr,
  77. dict[@"create_time"],
  78. dict[@"alipay_id"]];
  79. for (int i = 0; i < detail.count; i++) {
  80. UILabel *detailLb = (UILabel *)[self.scrollView viewWithTag:1000+i];
  81. detailLb.text = detail[i];
  82. }
  83. }
  84. - (UIScrollView *)scrollView {
  85. if (!_scrollView) {
  86. _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)];
  87. _scrollView.backgroundColor = [UIColor whiteColor];
  88. _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight+1);
  89. _scrollView.showsVerticalScrollIndicator = NO;
  90. _scrollView.bounces = YES;
  91. }
  92. return _scrollView;
  93. }
  94. - (void)didReceiveMemoryWarning {
  95. [super didReceiveMemoryWarning];
  96. // Dispose of any resources that can be recreated.
  97. }
  98. /*
  99. #pragma mark - Navigation
  100. // In a storyboard-based application, you will often want to do a little preparation before navigation
  101. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  102. // Get the new view controller using [segue destinationViewController].
  103. // Pass the selected object to the new view controller.
  104. }
  105. */
  106. @end