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

DRMineOrderView.m 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. //
  2. // DRMineOrderView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/17.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRMineOrderView.h"
  9. @interface DRMineOrderView ()
  10. @property (nonatomic, strong) UILabel *waitCount;
  11. @property (nonatomic, strong) UILabel *didCount;
  12. @end
  13. @implementation DRMineOrderView
  14. - (instancetype)initWithFrame:(CGRect)frame {
  15. self = [super initWithFrame:frame];
  16. if (self) {
  17. self.backgroundColor = [UIColor whiteColor];
  18. self.layer.cornerRadius = 6;
  19. self.layer.masksToBounds = YES;
  20. [self initSubViews];
  21. }
  22. return self;
  23. }
  24. - (void)initSubViews {
  25. // UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 60, 20)];
  26. // title.text = @"订单明细";
  27. // title.font = [UIFont systemFontOfSize:14];
  28. // [self addSubview:title];
  29. //
  30. // UIButton *moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-70-10, 10, 70, 20)];
  31. // moreBtn.centerY = title.centerY;
  32. // [moreBtn setTitleColor:[UIColor YHColorWithHex:0x999999] forState:UIControlStateNormal];
  33. // [moreBtn setTitle:@"查看更多" forState:UIControlStateNormal];
  34. // [moreBtn setImage:[UIImage imageNamed:@"accIcon_mine"] forState:UIControlStateNormal];
  35. // moreBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  36. // [moreBtn setButtonImageTitleStyle:ButtonImageTitleStyleRight padding:-5];
  37. // [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
  38. // [self addSubview:moreBtn];
  39. //
  40. // UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, title.bottom+10, self.width-30, 1)];
  41. // line.backgroundColor = [UIColor YHColorWithHex:0xE5E5E5];
  42. // [self addSubview:line];
  43. NSArray *imgBg = @[@"commission_one",@"commission_two",@"commission_three",@"commission_four"];
  44. NSArray *bg_titles = @[@"本月预估收入",@"上月预估收入",@"本月结算收入",@"上月结算收入"];
  45. CGFloat width = (self.width-45)/2;
  46. CGFloat height = 88;
  47. for (int i = 0; i < imgBg.count; i++) {
  48. UIImageView *leftImgView = [[UIImageView alloc] initWithFrame:CGRectMake(15+(15+width)*(i%2), (height+10)*(i/2), width, height)];
  49. // leftImgView.image = [UIImage imageNamed:imgBg[i]];
  50. leftImgView.contentMode = UIViewContentModeScaleAspectFill;
  51. leftImgView.userInteractionEnabled = YES;
  52. [self addSubview:leftImgView];
  53. leftImgView.tag = 500+i;
  54. UITapGestureRecognizer *tapImg = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageAcion:)];
  55. [leftImgView addGestureRecognizer:tapImg];
  56. UILabel *waitTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, leftImgView.width, 15)];
  57. waitTitle.textColor = [UIColor YHColorWithHex:0x9B9B9B];
  58. waitTitle.font = [UIFont systemFontOfSize:13];
  59. waitTitle.textAlignment = NSTextAlignmentCenter;
  60. waitTitle.centerX = leftImgView.width/2;
  61. waitTitle.text = bg_titles[i];
  62. [leftImgView addSubview:waitTitle];
  63. UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, waitTitle.bottom+15, leftImgView.width, 22)];
  64. countLabel.textColor = [UIColor homeRedColor];
  65. countLabel.font = [UIFont systemFontOfSize:20];
  66. countLabel.textAlignment = NSTextAlignmentCenter;
  67. countLabel.centerX = leftImgView.width/2;
  68. countLabel.text = @"--";
  69. countLabel.tag = 10000+i;
  70. [leftImgView addSubview:countLabel];
  71. // if (i > 1) {
  72. // UILabel *stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, countLabel.bottom+2, leftImgView.width, 15)];
  73. // stateLabel.textAlignment = NSTextAlignmentCenter;
  74. // stateLabel.textColor = [UIColor whiteColor];
  75. // stateLabel.font = [UIFont systemFontOfSize:12];
  76. // stateLabel.tag = 2000+i;
  77. // [leftImgView addSubview:stateLabel];
  78. // }
  79. if (i == 0) {
  80. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(self.width/2, 15, 0.5, 63)];
  81. line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
  82. [self addSubview:line];
  83. }
  84. if (i == 2) {
  85. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(self.width/2, 108, 0.5, 63)];
  86. line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
  87. [self addSubview:line];
  88. }
  89. }
  90. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, self.height/2, self.width-30, 0.5)];
  91. line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
  92. [self addSubview:line];
  93. }
  94. #pragma mark ---- public -----
  95. - (void)setAccountInfoWithUserInfo:(DRUserInfo *)userInfo {
  96. NSArray *countNum = @[userInfo.this_month_forecast_income,
  97. userInfo.last_month_forecast_income,
  98. userInfo.this_month_settlement_income,
  99. userInfo.last_month_settlement_income
  100. ];
  101. for (int i = 0; i < countNum.count; i++) {
  102. UILabel *countLabel = [self viewWithTag:10000+i];
  103. NSString *countStr = [NSString stringWithFormat:@"¥%@",[countNum objectAtIndex:i]];
  104. countLabel.text = countStr;
  105. }
  106. UILabel *leftBottomState = [self viewWithTag:2000+2];
  107. leftBottomState.text = [userInfo.this_month_settlement_income_is_account boolValue] ? @"已到账" : @"未到账";
  108. UILabel *rightBottomState = [self viewWithTag:2000+3];
  109. rightBottomState.text = [userInfo.last_month_settlement_income_is_account boolValue] ? @"已到账" : @"未到账";
  110. }
  111. - (void)setUnloginInfo {
  112. for (int i = 0; i < 4; i++) {
  113. UILabel *countLabel = [self viewWithTag:10000+i];
  114. NSString *countStr = [NSString stringWithFormat:@"--"];
  115. countLabel.text = countStr;
  116. }
  117. UILabel *leftBottomState = [self viewWithTag:2000+2];
  118. leftBottomState.text = @"未到账";
  119. UILabel *rightBottomState = [self viewWithTag:2000+3];
  120. rightBottomState.text = @"未到账";
  121. }
  122. - (void)moreBtnClick {
  123. if (self.moreButtonClick) {
  124. self.moreButtonClick();
  125. }
  126. }
  127. - (void)tapImageAcion:(UITapGestureRecognizer *)tap {
  128. NSInteger index = tap.view.tag - 500;
  129. BOOL isThisMonth=NO;
  130. NSInteger type=0;
  131. switch (index) {
  132. case 0:
  133. isThisMonth = YES;
  134. break;
  135. case 2:
  136. type=1;
  137. isThisMonth = YES;
  138. break;
  139. case 1:
  140. isThisMonth = NO;
  141. break;
  142. case 3:
  143. type=1;
  144. isThisMonth = NO;
  145. break;
  146. default:
  147. break;
  148. }
  149. if (self.commissionClick) {
  150. self.commissionClick(isThisMonth,type);
  151. }
  152. }
  153. @end