PayRecoderDetailViewController.m 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. //
  2. // PayRecoderDetailViewController.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/8/29.
  6. //
  7. #import "PayRecoderDetailViewController.h"
  8. @interface PayRecoderDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
  9. @property (nonatomic, strong, nullable) UITableView *tableView;
  10. @end
  11. @implementation PayRecoderDetailViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. [self drawAnyView];
  16. }
  17. - (void)drawAnyView{
  18. [self.view setBackgroundColor:HWF5F7FAColor];
  19. [self.toolBar setHidden:YES];
  20. [self.navigationBar setHidden:YES];
  21. [self.navBarBGView setHidden:NO];
  22. [self.titleLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_buy_detaile",nil)];
  23. [self.view addSubview:self.tableView];
  24. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.mas_equalTo(16);
  26. make.right.mas_equalTo(-16);
  27. make.bottom.mas_equalTo(0);
  28. make.top.equalTo(self.navBarBGView.mas_bottom).offset(4);
  29. }];
  30. [self.tableView setTableHeaderView:[self tableHeaderView]];
  31. }
  32. /*
  33. #pragma mark - Navigation
  34. // In a storyboard-based application, you will often want to do a little preparation before navigation
  35. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  36. // Get the new view controller using [segue destinationViewController].
  37. // Pass the selected object to the new view controller.
  38. }
  39. */
  40. #pragma mark - 懒加载
  41. - (UITableView *)tableView{
  42. if (!_tableView) {
  43. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStyleGrouped];
  44. _tableView.delegate = self;
  45. _tableView.dataSource = self;
  46. _tableView.showsVerticalScrollIndicator = NO;
  47. _tableView.showsHorizontalScrollIndicator = NO;
  48. // _tableView.contentInset = UIEdgeInsetsMake(-20, 0, 0, 0);
  49. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  50. [_tableView setSeparatorColor:[UIColor clearColor]];
  51. [_tableView setBackgroundColor:[UIColor clearColor]];
  52. [_tableView setTableFooterView:[UIView new]];
  53. [_tableView setBounces:YES];
  54. if (@available(iOS 15.0, *)) {
  55. _tableView.sectionHeaderTopPadding = 0;
  56. }
  57. }
  58. return _tableView;
  59. }
  60. #pragma mark - 列表委托
  61. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  62. return 1;
  63. }
  64. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  65. return 5;
  66. }
  67. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  68. NSInteger row = indexPath.row;
  69. static NSString *identifier = @"BuyRecoderDetailCell";
  70. UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  71. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  72. if (!cell){
  73. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  74. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  75. [cell setBackgroundColor:[UIColor clearColor]];
  76. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  77. [cell.textLabel setTextColor:HW666666Color];
  78. [cell.textLabel setFont:[UIFont systemFontOfSize:12]];
  79. [cell.detailTextLabel setTextColor:HW0A132BColor];
  80. [cell.detailTextLabel setFont:[UIFont systemFontOfSize:12]];
  81. [cell.detailTextLabel setTextAlignment:(NSTextAlignmentRight)];
  82. [cell.contentView setBackgroundColor:HWFFFFFFColor];
  83. }
  84. cell.contentView.layer.mask = nil;
  85. if (0 == row){
  86. [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_buy_time",nil)];
  87. [cell.detailTextLabel setText:@"2023-12-12 19:00:00"];
  88. }else if (1 == row){
  89. [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_expect_time",nil)];
  90. [cell.detailTextLabel setText:@"2023-12-15 19:00:00"];
  91. }else if (2 == row){
  92. [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_order_number",nil)];
  93. [cell.detailTextLabel setText:@"okrs0m9gyyoYS39733673768"];
  94. }else if (3 == row){
  95. [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_pay_states",nil)];
  96. [cell.detailTextLabel setText:@"支付成功"];
  97. }else if (4 == row){
  98. [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_pay_type",nil)];
  99. [cell.detailTextLabel setText:@"支付宝"];
  100. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W - 2*16.f, 35.f)
  101. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  102. cornerRadii:CGSizeMake(8, 8)];
  103. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  104. maskLayer.frame = cell.contentView.bounds;
  105. maskLayer.path = maskPath.CGPath;
  106. cell.contentView.layer.mask = maskLayer;
  107. }
  108. return cell;
  109. }
  110. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  111. return 35;
  112. }
  113. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  114. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  115. NSInteger row = indexPath.row;
  116. }
  117. - (UIView *)tableHeaderView{
  118. UIView *headView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W - 2*16.f, 52.f))];
  119. [headView setBackgroundColor:HWFFFFFFColor];
  120. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W - 2*16.f, 52.f)
  121. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  122. cornerRadii:CGSizeMake(8, 8)];
  123. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  124. maskLayer.frame = headView.bounds;
  125. maskLayer.path = maskPath.CGPath;
  126. headView.layer.mask = maskLayer;
  127. /*订单时间相关*/
  128. UILabel *vipTypeLabel = [[UILabel alloc] init];
  129. [vipTypeLabel setText:@"VIP30天"];
  130. [vipTypeLabel setFont:[UIFont boldSystemFontOfSize:16]];
  131. [vipTypeLabel setTextColor:HW0A132BColor];
  132. [headView addSubview:vipTypeLabel];
  133. [vipTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.left.mas_equalTo(14.f);
  135. make.top.mas_equalTo(16);
  136. }];
  137. /*价格标签*/
  138. NSString *leftStr3 = @"¥";
  139. NSString *rightStr3 = @"99.00";
  140. UILabel *priceLabel = [[UILabel alloc] init];
  141. [priceLabel setText:[leftStr3 stringByAppendingString:rightStr3]];
  142. [priceLabel setFont:[UIFont boldSystemFontOfSize:16]];
  143. [priceLabel setTextColor:HWDD4E4EColor];
  144. [priceLabel setTextAlignment:(NSTextAlignmentRight)];
  145. [headView addSubview:priceLabel];
  146. [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  147. make.right.mas_equalTo(-14.f);
  148. make.top.mas_equalTo(16);
  149. }];
  150. /*分割线*/
  151. UIView *line = [[UIView alloc] init];
  152. [line setBackgroundColor:HW979797Color10];
  153. [headView addSubview:line];
  154. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  155. make.left.mas_equalTo(14.f);
  156. make.right.mas_equalTo(-14.f);
  157. make.height.mas_equalTo(1.f);
  158. make.bottom.mas_equalTo(0);
  159. }];
  160. return headView;
  161. }
  162. @end