酷店

KDPLiveEarningCell.m 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. //
  2. // KDPLiveEarningCell.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPLiveEarningCell.h"
  9. @implementation KDPLiveEarningCell
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self=[super initWithFrame:frame];
  13. if (self) {
  14. self.backImgV=[[UIImageView alloc]init];
  15. self.backImgV.image=[UIImage imageNamed:@"top_icon-backnew"];
  16. [self addSubview:self.backImgV];
  17. self.backImgV.userInteractionEnabled=YES;
  18. [self.backImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  19. make.left.top.right.mas_equalTo(0);
  20. }];
  21. UILabel *livel =[[UILabel alloc]init];
  22. livel.text=@"直播收益";
  23. livel.font=[UIFont systemFontOfSize:15];
  24. livel.textColor=[UIColor colorWithHexString:@"#666666"];
  25. [self.backImgV addSubview:livel];
  26. [livel mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.left.mas_equalTo(45);
  28. make.top.mas_equalTo(9);
  29. make.height.mas_equalTo(21);
  30. }];
  31. UIButton *accountBtn =[[UIButton alloc]init];
  32. [accountBtn setImage:[UIImage imageNamed:@"next_icon"] forState:UIControlStateNormal];
  33. [accountBtn addTarget:self action:@selector(accountclickBtn) forControlEvents:UIControlEventTouchUpInside];
  34. [self.backImgV addSubview:accountBtn];
  35. [accountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.right.mas_equalTo(-20);
  37. make.top.mas_equalTo(10);
  38. make.width.height.mas_equalTo(21);
  39. }];
  40. [self.backImgV addSubview:self.orderNumgL];
  41. [self.backImgV addSubview:self.Forecastlabel];
  42. [self.orderNumgL mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.mas_equalTo(0);
  44. make.top.mas_equalTo(39);
  45. make.height.mas_equalTo(42);
  46. make.width.mas_equalTo(SCREEN_WIDTH/2);
  47. }];
  48. [self.backImgV addSubview:self.addNumL];
  49. [self.addNumL mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.mas_equalTo(self.orderNumgL.mas_right).offset(-45);
  51. make.top.mas_equalTo(self.orderNumgL.mas_top).offset(-5);
  52. make.height.mas_equalTo(15);
  53. }];
  54. [self.Forecastlabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.mas_equalTo(self.orderNumgL.mas_right);
  56. make.top.mas_equalTo(39);
  57. make.height.mas_equalTo(42);
  58. make.width.mas_equalTo(SCREEN_WIDTH/2);
  59. }];
  60. [self orderMoneyView];
  61. [self addorderBAckView];
  62. }
  63. return self;
  64. }
  65. -(void)addorderBAckView
  66. {
  67. UIView *oderV=[[UIView alloc]init];
  68. oderV.backgroundColor=[UIColor clearColor];
  69. oderV.userInteractionEnabled=YES;
  70. [self.backImgV addSubview:oderV];
  71. [oderV mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.width.mas_equalTo(114);
  73. make.height.mas_equalTo(17);
  74. make.centerX.mas_equalTo(self.Forecastlabel.mas_centerX);
  75. }];
  76. UIView *pointorderV=[[UIView alloc]init];
  77. pointorderV.layer.cornerRadius=3;
  78. pointorderV.layer.masksToBounds=YES;
  79. pointorderV.backgroundColor=[UIColor colorWithHexString:@"#FF9E3C"];
  80. [oderV addSubview:pointorderV];
  81. [pointorderV mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.width.height.mas_equalTo(6);
  83. make.left.mas_equalTo(0);
  84. make.top.mas_equalTo(5.5);
  85. }];
  86. UILabel *ordertitleL=[[UILabel alloc]init];
  87. ordertitleL.text=@"今日预估(元)";
  88. ordertitleL.font=[UIFont systemFontOfSize:12];
  89. ordertitleL.textColor=[UIColor colorWithHexString:@"#666666"];
  90. ordertitleL.textAlignment=NSTextAlignmentCenter;
  91. [oderV addSubview:ordertitleL];
  92. [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  93. make.left.mas_equalTo(10);
  94. make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1);
  95. make.height.mas_equalTo(17);
  96. make.width.mas_equalTo(90);
  97. }];
  98. UIButton *changeBtn =[[UIButton alloc]init];
  99. [changeBtn setImage:[UIImage imageNamed:@"open_hidden_icon"] forState:UIControlStateNormal];
  100. [changeBtn setImage:[UIImage imageNamed:@"close_hidden_icon"] forState:UIControlStateSelected];
  101. changeBtn.userInteractionEnabled=YES;
  102. changeBtn.selected=[KDPublicMethod is_hiddenMoney];
  103. [changeBtn addTarget:self action:@selector(changeBtnclickBtn:) forControlEvents:UIControlEventTouchUpInside];
  104. [oderV addSubview:changeBtn];
  105. [changeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  106. make.left.mas_equalTo(ordertitleL.mas_right).offset(0);
  107. make.top.mas_equalTo(0);
  108. make.width.height.mas_equalTo(17);
  109. }];
  110. }
  111. -(void)orderMoneyView
  112. {
  113. {
  114. UIView *oderV=[[UIView alloc]init];
  115. oderV.backgroundColor=[UIColor clearColor];
  116. [self.backImgV addSubview:oderV];
  117. [oderV mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.width.mas_equalTo(75);
  119. make.height.mas_equalTo(17);
  120. make.centerX.mas_equalTo(self.orderNumgL.mas_centerX);
  121. }];
  122. UIView *pointorderV=[[UIView alloc]init];
  123. pointorderV.layer.cornerRadius=3;
  124. pointorderV.layer.masksToBounds=YES;
  125. pointorderV.backgroundColor=[UIColor colorWithHexString:@"#F44A44"];
  126. [oderV addSubview:pointorderV];
  127. [pointorderV mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.width.height.mas_equalTo(6);
  129. make.left.mas_equalTo(0);
  130. make.top.mas_equalTo(5.5);
  131. }];
  132. UILabel *ordertitleL=[[UILabel alloc]init];
  133. ordertitleL.text=@"今日订单";
  134. ordertitleL.font=[UIFont systemFontOfSize:12];
  135. ordertitleL.textColor=[UIColor colorWithHexString:@"#666666"];
  136. ordertitleL.textAlignment=NSTextAlignmentCenter;
  137. [oderV addSubview:ordertitleL];
  138. [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  139. make.left.mas_equalTo(10);
  140. make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1);
  141. make.height.mas_equalTo(17);
  142. make.width.mas_equalTo(65);
  143. }];
  144. }
  145. }
  146. #pragma mark---金额隐私切换
  147. -(void)changeBtnclickBtn:(UIButton *)bnt
  148. {
  149. KDPAccountModel *model=[KDPAccountTool account];
  150. if (model.is_hidden.integerValue == 0) {
  151. model.is_hidden = @"1";
  152. bnt.selected=YES;
  153. }else{
  154. model.is_hidden = @"0";
  155. bnt.selected=NO;
  156. }
  157. [KDPAccountTool saveAccount:model];
  158. [self ishidden_rebat];
  159. }
  160. -(void)setRebet_money:(NSString *)rebet_money
  161. {
  162. _rebet_money = rebet_money;
  163. [self ishidden_rebat];
  164. }
  165. -(void)ishidden_rebat
  166. {
  167. if ([KDPublicMethod is_hiddenMoney]) {
  168. self.Forecastlabel.text = @"****";
  169. }else{
  170. self.Forecastlabel.text=_rebet_money;
  171. }
  172. }
  173. #pragma mark---
  174. -(void)accountclickBtn
  175. {
  176. if (self.liveDataBlock) {
  177. self.liveDataBlock();
  178. }
  179. }
  180. -(UILabel *)orderNumgL
  181. {
  182. if (!_orderNumgL) {
  183. _orderNumgL=[[UILabel alloc]init];
  184. _orderNumgL.text=@"----";
  185. _orderNumgL.font=[UIFont boldSystemFontOfSize:28];
  186. _orderNumgL.textColor=[UIColor colorWithHexString:fontColor];
  187. _orderNumgL.textAlignment=NSTextAlignmentCenter;
  188. }
  189. return _orderNumgL;
  190. }
  191. -(UILabel *)addNumL
  192. {
  193. if (!_addNumL) {
  194. _addNumL=[[UILabel alloc]init];
  195. _addNumL.textColor=[UIColor colorWithHexString:ThemeColor];
  196. _addNumL.font=[UIFont systemFontOfSize:18];
  197. }
  198. return _addNumL;
  199. }
  200. -(UILabel *)Forecastlabel
  201. {
  202. if (!_Forecastlabel) {
  203. _Forecastlabel=[[UILabel alloc]init];
  204. _Forecastlabel.text=@"----";
  205. _Forecastlabel.font=[UIFont boldSystemFontOfSize:28];
  206. _Forecastlabel.textColor=[UIColor colorWithHexString:fontColor];
  207. _Forecastlabel.textAlignment=NSTextAlignmentCenter;
  208. }
  209. return _Forecastlabel;
  210. }
  211. @end