UpHotOrderView.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //
  2. // UpHotOrderView.m
  3. // YBVideo
  4. //
  5. // Created by ybRRR on 2023/7/12.
  6. // Copyright © 2023 cat. All rights reserved.
  7. //
  8. #import "UpHotOrderView.h"
  9. @interface UpHotOrderView ()
  10. {
  11. UIView *backView;
  12. }
  13. @end
  14. @implementation UpHotOrderView
  15. -(instancetype)initWithFrame:(CGRect)frame andInfoDic:(NSDictionary *)infoDic
  16. {
  17. self = [super initWithFrame:frame];
  18. if(self){
  19. self.backgroundColor = RGBA(1, 1, 1, 0.4);
  20. backView = [[UIView alloc]init];
  21. backView.frame = CGRectMake(0, 0, _window_width *0.6, _window_width *0.6*0.7);
  22. backView.backgroundColor = UIColor.whiteColor;
  23. backView.center = self.center;
  24. backView.layer.cornerRadius = 10;
  25. backView.layer.masksToBounds = YES;
  26. [self addSubview:backView];
  27. UILabel *titleLb = [[UILabel alloc]init];
  28. titleLb.font = [UIFont systemFontOfSize:16];
  29. titleLb.textColor = UIColor.blackColor;
  30. titleLb.text = YZMsg(@"您还有一个上热门未使用");
  31. [backView addSubview:titleLb];
  32. [titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.centerX.equalTo(backView.mas_centerX);
  34. make.top.equalTo(backView.mas_top).offset(10);
  35. }];
  36. UILabel *coinLbT = [[UILabel alloc]init];
  37. coinLbT.font = [UIFont systemFontOfSize:14];
  38. coinLbT.textColor = UIColor.grayColor;
  39. coinLbT.text = YZMsg(@"投放金额");
  40. [backView addSubview:coinLbT];
  41. [coinLbT mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.equalTo(backView.mas_left).offset(40);
  43. make.top.equalTo(titleLb.mas_bottom).offset(10);
  44. }];
  45. UILabel *pushT = [[UILabel alloc]init];
  46. pushT.font = [UIFont systemFontOfSize:14];
  47. pushT.textColor = UIColor.grayColor;
  48. pushT.text = YZMsg(@"曝光量");
  49. [backView addSubview:pushT];
  50. [pushT mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.equalTo(coinLbT.mas_left);
  52. make.top.equalTo(coinLbT.mas_bottom).offset(10);
  53. }];
  54. UILabel *numT = [[UILabel alloc]init];
  55. numT.font = [UIFont systemFontOfSize:14];
  56. numT.textColor = UIColor.grayColor;
  57. numT.text = YZMsg(@"预计进场人数");
  58. [backView addSubview:numT];
  59. [numT mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.equalTo(pushT.mas_left);
  61. make.top.equalTo(pushT.mas_bottom).offset(10);
  62. }];
  63. UILabel *coinLb = [[UILabel alloc]init];
  64. coinLb.font = [UIFont systemFontOfSize:14];
  65. coinLb.textColor = UIColor.grayColor;
  66. coinLb.text = minstr([infoDic valueForKey:@"coin"]);
  67. [backView addSubview:coinLb];
  68. [coinLb mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.left.equalTo(numT.mas_right).offset(10);
  70. make.centerY.equalTo(coinLbT.mas_centerY);
  71. }];
  72. UILabel *pushLb = [[UILabel alloc]init];
  73. pushLb.font = [UIFont systemFontOfSize:14];
  74. pushLb.textColor = UIColor.grayColor;
  75. pushLb.text = minstr([infoDic valueForKey:@"exposure"]);
  76. [backView addSubview:pushLb];
  77. [pushLb mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.left.equalTo(numT.mas_right).offset(10);
  79. make.centerY.equalTo(pushT.mas_centerY);
  80. }];
  81. UILabel *numLb = [[UILabel alloc]init];
  82. numLb.font = [UIFont systemFontOfSize:14];
  83. numLb.textColor = UIColor.grayColor;
  84. numLb.text =[NSString stringWithFormat:@"%@-%@",minstr([infoDic valueForKey:@"user_min_num"]),minstr([infoDic valueForKey:@"user_max_num"])];
  85. [backView addSubview:numLb];
  86. [numLb mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.equalTo(numT.mas_right).offset(10);
  88. make.centerY.equalTo(numT.mas_centerY);
  89. }];
  90. [self layoutIfNeeded];
  91. [PublicObj lineViewWithFrame:CGRectMake(0, backView.height-46, backView.width, 1) andColor:RGBA(240, 240, 240, 1) andView:backView];
  92. [PublicObj lineViewWithFrame:CGRectMake(backView.width/2, backView.height-46, 1, 46) andColor:RGBA(240, 240, 240, 1) andView:backView];
  93. UIButton *cancelBtn = [UIButton buttonWithType:0];
  94. cancelBtn.frame = CGRectMake(0, backView.height-45, backView.width/2, 45);
  95. [cancelBtn setTitle:YZMsg(@"取消") forState:0];
  96. [cancelBtn setTitleColor:UIColor.grayColor forState:0];
  97. cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  98. [cancelBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  99. [backView addSubview:cancelBtn];
  100. UIButton *sureBtn = [UIButton buttonWithType:0];
  101. sureBtn.frame = CGRectMake(backView.width/2, backView.height-45, backView.width/2, 45);
  102. [sureBtn setTitle:YZMsg(@"使用") forState:0];
  103. [sureBtn setTitleColor:Pink_Cor forState:0];
  104. sureBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  105. [sureBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  106. [backView addSubview:sureBtn];
  107. }
  108. return self;
  109. }
  110. -(void)btnClick:(UIButton *)sender{
  111. if(self.btnEvent){
  112. self.btnEvent(sender.titleLabel.text);
  113. }
  114. }
  115. @end