dkahgld

ZBOrderTitleView.m 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //
  2. // ZBOrderTitleView.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/3/27.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "ZBOrderTitleView.h"
  9. @implementation ZBOrderTitleView
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self=[super initWithFrame:frame];
  13. if (self) {
  14. self.backgroundColor=[UIColor whiteColor];
  15. self.layer.cornerRadius=6;
  16. self.userInteractionEnabled=YES;
  17. self.layer.masksToBounds=YES;
  18. UITapGestureRecognizer *gets =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickLiveData)];
  19. [self addGestureRecognizer:gets];
  20. UILabel *orderpersonL =[[UILabel alloc]init];
  21. orderpersonL.text=@"今日订单数";
  22. orderpersonL.font=[UIFont systemFontOfSize:14];
  23. orderpersonL.textColor=[UIColor YHColorWithHex:0x333333];
  24. orderpersonL.textAlignment=NSTextAlignmentCenter;
  25. [self addSubview:orderpersonL];
  26. [orderpersonL mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.top.mas_equalTo(13);
  28. make.height.mas_equalTo(20);
  29. make.centerX.mas_equalTo(self.mas_centerX).offset(-self.width/4);
  30. }];
  31. UILabel *orderMonl =[[UILabel alloc]init];
  32. orderMonl.text=@"今日预估(元)";
  33. orderMonl.font=[UIFont systemFontOfSize:14];
  34. orderMonl.textColor=[UIColor YHColorWithHex:0x333333];
  35. orderMonl.textAlignment=NSTextAlignmentCenter;
  36. [self addSubview:orderMonl];
  37. [orderMonl mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.top.mas_equalTo(13);
  39. make.height.mas_equalTo(20);
  40. make.centerX.mas_equalTo(self.mas_centerX).offset(self.width/4);
  41. }];
  42. UIView *Linev=[[UIView alloc]initWithFrame:CGRectMake(self.width/2-1, 22, 2, 74)];
  43. Linev.backgroundColor=[UIColor YHColorWithHex:0xF4F4F4];
  44. [self addSubview:Linev];
  45. [self addSubview:self.orderNum];
  46. [self addSubview:self.orderMoney];
  47. [self.orderNum mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.centerX.mas_equalTo(orderpersonL.mas_centerX).offset(-5);
  49. make.height.mas_equalTo(40);
  50. make.top.mas_equalTo(orderpersonL.mas_bottom).offset(21);
  51. }];
  52. [self.orderMoney mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.centerX.mas_equalTo(orderMonl.mas_centerX).offset(-5);
  54. make.height.mas_equalTo(40);
  55. make.top.mas_equalTo(orderpersonL.mas_bottom).offset(21);
  56. }];
  57. // UIImageView *personImgV =[[UIImageView alloc]init];
  58. // personImgV.image=[UIImage imageNamed:@"top_shangsheng"];
  59. // personImgV.tag=1111;
  60. // [self addSubview:personImgV];
  61. //
  62. // UIImageView *moneyImgV =[[UIImageView alloc]init];
  63. // moneyImgV.image=[UIImage imageNamed:@"top_shangsheng"];
  64. // moneyImgV.tag=2111;
  65. // [self addSubview:moneyImgV];
  66. //
  67. // [personImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  68. // make.top.mas_equalTo(orderpersonL.mas_bottom).offset(36);
  69. // make.height.mas_equalTo(12);
  70. // make.left.mas_equalTo(self.orderNum.mas_right).offset(10);
  71. // make.width.mas_equalTo(3);
  72. // }];
  73. // [moneyImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  74. // make.top.mas_equalTo(orderpersonL.mas_bottom).offset(36);
  75. // make.height.mas_equalTo(12);
  76. // make.left.mas_equalTo(self.orderMoney.mas_right).offset(10);
  77. // make.width.mas_equalTo(3);
  78. // }];
  79. // NSTimer *splashTimer = nil;
  80. // splashTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(anmimationView) userInfo:nil repeats:YES];
  81. [self addSubview:self.addNumLabel];
  82. [self.addNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.left.mas_equalTo(orderpersonL.mas_right).offset(5);
  84. make.top.mas_equalTo(orderpersonL.mas_bottom);
  85. make.height.mas_equalTo(26);
  86. }];
  87. [self addSubview:self.changeAccordBtn];
  88. [self.changeAccordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.width.mas_equalTo(30);
  90. make.height.mas_equalTo(20);
  91. make.top.mas_equalTo(13);
  92. make.left.mas_equalTo(orderMonl.mas_right);
  93. }];
  94. }
  95. return self;
  96. }
  97. -(void)anmimationView
  98. {
  99. UIImageView *personImgV=[self viewWithTag:1111];
  100. UIImageView *moneyImgV=[self viewWithTag:2111];
  101. [UIView animateWithDuration:0.6 animations:^{
  102. moneyImgV.transform=CGAffineTransformMakeTranslation(0, -5); personImgV.transform=CGAffineTransformMakeTranslation(0, -5);
  103. } completion:^(BOOL finished) {
  104. [UIView animateWithDuration:0.6 animations:^{
  105. moneyImgV.transform=CGAffineTransformIdentity; personImgV.transform=CGAffineTransformIdentity;
  106. }];
  107. }];
  108. }
  109. -(UILabel *)orderNum
  110. {
  111. if (!_orderNum) {
  112. _orderNum =[[UILabel alloc]init];
  113. _orderNum.text=@"---";
  114. _orderNum.font=[UIFont systemFontOfSize:28];
  115. _orderNum.textColor=[UIColor YHColorWithHex:0x333333];
  116. _orderNum.textAlignment=NSTextAlignmentCenter;
  117. }
  118. return _orderNum;
  119. }
  120. -(UILabel *)orderMoney
  121. {
  122. if (!_orderMoney) {
  123. _orderMoney =[[UILabel alloc]init];
  124. _orderMoney.text=@"----";
  125. _orderMoney.font=[UIFont systemFontOfSize:28];
  126. _orderMoney.textColor=[UIColor YHColorWithHex:0x333333];
  127. _orderMoney.textAlignment=NSTextAlignmentCenter;
  128. }
  129. return _orderMoney;
  130. }
  131. -(UILabel *)addNumLabel
  132. {
  133. if (!_addNumLabel) {
  134. _addNumLabel =[[UILabel alloc]init];
  135. _addNumLabel.textColor=[UIColor YHColorWithHex:0xFF7D00];
  136. _addNumLabel.font=[UIFont systemFontOfSize:19];
  137. _addNumLabel.text=@"+0";
  138. }
  139. return _addNumLabel;
  140. }
  141. -(UIButton *)changeAccordBtn
  142. {
  143. if (!_changeAccordBtn) {
  144. _changeAccordBtn=[[UIButton alloc]init];
  145. NSString * isHidden =[PublicFunction GetMoneyStatus];
  146. if (isHidden.integerValue == 0) {
  147. [_changeAccordBtn setImage:[UIImage imageNamed:@"xianshi_money"] forState:UIControlStateNormal];
  148. }else{
  149. [_changeAccordBtn setImage:[UIImage imageNamed:@"hidden_money"] forState:UIControlStateNormal];
  150. }
  151. [_changeAccordBtn addTarget:self action:@selector(changeClickAccordBtn) forControlEvents:UIControlEventTouchUpInside];
  152. _changeAccordBtn.adjustsImageWhenHighlighted=NO;
  153. }
  154. return _changeAccordBtn;
  155. }
  156. #pragma mark---修改,金额是否可见
  157. -(void)changeClickAccordBtn
  158. {
  159. if (self.changeBlock) {
  160. self.changeBlock();
  161. }
  162. }
  163. -(void)clickLiveData
  164. {
  165. if (self.LiveBlock) {
  166. self.LiveBlock();
  167. }
  168. }
  169. @end