线上所有马甲包模板,与《猎豆》同UI。域名zhuadd

HSQAccountHeader.m 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // HSQAccountHeader.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/6/8.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "HSQAccountHeader.h"
  9. @interface HSQAccountHeader(){
  10. UILabel *_blanceLabel;
  11. NSString *_blance;
  12. BOOL isLinkAliPay;
  13. }
  14. @end
  15. @implementation HSQAccountHeader
  16. - (instancetype)initWithFrame:(CGRect)frame {
  17. self = [super initWithFrame:frame];
  18. if (self) {
  19. self.backgroundColor = [UIColor changeColor];
  20. [self initSubViews];
  21. [self request];
  22. }
  23. return self;
  24. }
  25. - (void)initSubViews {
  26. // UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(25, 10, 200, 20)];
  27. // title.text = @"账户余额:";
  28. // title.font = [UIFont systemFontOfSize:14];
  29. // title.textColor = [UIColor whiteColor];
  30. // [self addSubview:title];
  31. _blanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(25, FITSIZE(10), SCREEN_WIDTH-50, FITSIZE(40))];
  32. _blanceLabel.textColor = [UIColor whiteColor];
  33. _blanceLabel.textAlignment=NSTextAlignmentCenter;
  34. _blanceLabel.font = [UIFont boldSystemFontOfSize:48];
  35. _blanceLabel.text = @"--.--";
  36. [self addSubview:_blanceLabel];
  37. UIButton *money = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2-42, FITSIZE(65), 84, FITSIZE(22))];
  38. [money setTitle:@"提现" forState:UIControlStateNormal];
  39. money.layer.cornerRadius=2;
  40. money.layer.masksToBounds=YES;
  41. money.layer.borderColor=[UIColor whiteColor].CGColor;
  42. money.layer.masksToBounds=YES;
  43. money.layer.borderWidth=0.5;
  44. [money setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  45. money.titleLabel.font = [UIFont systemFontOfSize:10];
  46. [self addSubview:money];
  47. [money addTarget:self action:@selector(moneyAction) forControlEvents:UIControlEventTouchUpInside];
  48. }
  49. - (void)moneyAction {
  50. if (self.moneyBackBlcok) {
  51. self.moneyBackBlcok(_blance,isLinkAliPay);
  52. }
  53. }
  54. - (void)reloadData {
  55. [self request];
  56. }
  57. - (void)request{
  58. NSString *url=[NSString stringWithFormat:@"%@/api/v2/adzoneCreate/accountPrice",BaseURL];
  59. [HSQHttp post:url params:nil success:^(id json) {
  60. if (json[@"data"]) {
  61. _blance = [NSString stringWithFormat:@"%@",json[@"data"][@"notEnd"]];
  62. NSString *discount_price = [NSString stringWithFormat:@"¥%.2f",_blance.floatValue];
  63. NSMutableAttributedString *disAttr = [[NSMutableAttributedString alloc] initWithString:discount_price];
  64. [disAttr yy_setFont:[UIFont systemFontOfSize:18] range:NSMakeRange(0, 1)];
  65. [disAttr yy_setFont:[UIFont systemFontOfSize:48] range:NSMakeRange(1, discount_price.length-1)];
  66. _blanceLabel.attributedText =disAttr;
  67. if ([json[@"data"][@"accountFlag"] isEqual:@2]) {
  68. isLinkAliPay = YES;
  69. }else {
  70. isLinkAliPay = NO;
  71. }
  72. }
  73. } failure:^(NSError *error) {
  74. }];
  75. }
  76. @end