酷店

KDPLiveEarningCell.m 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1); 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.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1); 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. //存储第一次打开APP,是否显示客服页面,
  150. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  151. NSString *oneStep =[defaults objectForKey:@"hidden"];
  152. if (oneStep.integerValue == 0) {
  153. [defaults setValue:@"1" forKey:@"hidden"];
  154. bnt.selected=YES;
  155. }else{
  156. [defaults setValue:@"0" forKey:@"hidden"];
  157. bnt.selected=NO;
  158. }
  159. [defaults synchronize];
  160. [self ishidden_rebat];
  161. }
  162. -(void)setRebet_money:(NSString *)rebet_money
  163. {
  164. _rebet_money = rebet_money;
  165. [self ishidden_rebat];
  166. }
  167. -(void)ishidden_rebat
  168. {
  169. if ([KDPublicMethod is_hiddenMoney]) {
  170. self.Forecastlabel.text = @"****";
  171. }else{
  172. self.Forecastlabel.text=_rebet_money;
  173. }
  174. }
  175. #pragma mark---
  176. -(void)accountclickBtn
  177. {
  178. if (self.liveDataBlock) {
  179. self.liveDataBlock();
  180. }
  181. }
  182. -(UILabel *)orderNumgL
  183. {
  184. if (!_orderNumgL) {
  185. _orderNumgL=[[UILabel alloc]init];
  186. _orderNumgL.text=@"----";
  187. _orderNumgL.font=[UIFont boldSystemFontOfSize:28];
  188. _orderNumgL.textColor=[UIColor colorWithHexString:fontColor];
  189. _orderNumgL.textAlignment=NSTextAlignmentCenter;
  190. }
  191. return _orderNumgL;
  192. }
  193. -(UILabel *)addNumL
  194. {
  195. if (!_addNumL) {
  196. _addNumL=[[UILabel alloc]init];
  197. _addNumL.textColor=[UIColor colorWithHexString:ThemeColor];
  198. _addNumL.font=[UIFont systemFontOfSize:18];
  199. }
  200. return _addNumL;
  201. }
  202. -(UILabel *)Forecastlabel
  203. {
  204. if (!_Forecastlabel) {
  205. _Forecastlabel=[[UILabel alloc]init];
  206. _Forecastlabel.text=@"----";
  207. _Forecastlabel.font=[UIFont boldSystemFontOfSize:28];
  208. _Forecastlabel.textColor=[UIColor colorWithHexString:fontColor];
  209. _Forecastlabel.textAlignment=NSTextAlignmentCenter;
  210. }
  211. return _Forecastlabel;
  212. }
  213. @end