BuyRecoderListCell.m 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. //
  2. // BuyRecoderListCell.m
  3. // VclustersGemini
  4. //
  5. // Created by 黄盛威 on 2020/10/19.
  6. // Copyright © 2020 APPLE. All rights reserved.
  7. //
  8. #import "BuyRecoderListCell.h"
  9. #import <Masonry.h>
  10. @interface BuyRecoderListCell(){
  11. UILabel *orderNumberLabel;
  12. UILabel *vipTypeLabel;
  13. UILabel *buyTimeLabel;
  14. UILabel *expantTimeLabel;
  15. UILabel *priceLabel;
  16. }
  17. @end
  18. @implementation BuyRecoderListCell
  19. @synthesize delegate;
  20. - (void)awakeFromNib {
  21. [super awakeFromNib];
  22. // Initialization code
  23. }
  24. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  25. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  26. if (self){
  27. [self drawView];
  28. }
  29. return self;
  30. }
  31. - (void)drawView{
  32. UIView *bgView = [[UIView alloc] init];
  33. [bgView setBackgroundColor:HWFBFCFDColor];
  34. [bgView.layer setCornerRadius:8.f];
  35. [self.contentView addSubview:bgView];
  36. [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.mas_equalTo(16.f);
  38. make.right.mas_equalTo(-16.f);
  39. make.bottom.mas_equalTo(-16.f);
  40. make.top.mas_equalTo(0);
  41. }];
  42. /*订单编号*/
  43. UILabel *orderNumberTitleLabel = [[UILabel alloc] init];
  44. [orderNumberTitleLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_oerder_title",nil)];
  45. [orderNumberTitleLabel setFont:[UIFont systemFontOfSize:12]];
  46. [orderNumberTitleLabel setTextColor:HW0A132BColor];
  47. [bgView addSubview:orderNumberTitleLabel];
  48. [orderNumberTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.mas_equalTo(16.f);
  50. make.top.mas_equalTo(16);
  51. }];
  52. orderNumberLabel = [[UILabel alloc] init];
  53. [orderNumberLabel setText:@"wefe3f3fe3wf23r32"];
  54. [orderNumberLabel setFont:[UIFont systemFontOfSize:12]];
  55. [orderNumberLabel setTextColor:HW0A132BColor];
  56. [bgView addSubview:orderNumberLabel];
  57. [orderNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.left.equalTo(orderNumberTitleLabel.mas_right);
  59. make.top.mas_equalTo(16);
  60. }];
  61. /*复制按钮*/
  62. UIButton *copyBtn = [[UIButton alloc] init];
  63. [copyBtn setImage:[UIImage imageNamed:@"buy_copy"] forState:(UIControlStateNormal)];
  64. [copyBtn addTarget:self
  65. action:@selector(copyBtnPressed)
  66. forControlEvents:(UIControlEventTouchUpInside)];
  67. [bgView addSubview:copyBtn];
  68. [copyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.left.equalTo(orderNumberLabel.mas_right);
  70. make.top.mas_equalTo(16);
  71. make.height.mas_equalTo(16);
  72. make.width.mas_equalTo(16);
  73. }];
  74. /*已付款标签*/
  75. UILabel *havePayLabel = [[UILabel alloc] init];
  76. [havePayLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_have_pay",nil)];
  77. [havePayLabel setFont:[UIFont systemFontOfSize:12]];
  78. [havePayLabel setTextColor:HW01B7EAColor];
  79. [havePayLabel setTextAlignment:(NSTextAlignmentRight)];
  80. [bgView addSubview:havePayLabel];
  81. [havePayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.right.mas_equalTo(-16.f);
  83. make.top.mas_equalTo(16);
  84. }];
  85. /*分割线*/
  86. UIView *line = [[UIView alloc] init];
  87. [line setBackgroundColor:HW979797Color10];
  88. [bgView addSubview:line];
  89. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.left.mas_equalTo(14.f);
  91. make.right.mas_equalTo(-14.f);
  92. make.height.mas_equalTo(1.f);
  93. make.top.mas_equalTo(45);
  94. }];
  95. /*订单时间相关*/
  96. vipTypeLabel = [[UILabel alloc] init];
  97. [vipTypeLabel setText:@"VIP30天"];
  98. [vipTypeLabel setFont:[UIFont boldSystemFontOfSize:16]];
  99. [vipTypeLabel setTextColor:HW0A132BColor];
  100. [bgView addSubview:vipTypeLabel];
  101. [vipTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.left.mas_equalTo(16.f);
  103. make.top.equalTo(line.mas_bottom).offset(12);
  104. }];
  105. NSString *leftStr1 = @"购买时间:";
  106. NSString *rightStr1 = @"2023-12-12 19:00:00";
  107. buyTimeLabel = [[UILabel alloc] init];
  108. [buyTimeLabel setText:[leftStr1 stringByAppendingString:rightStr1]];
  109. [buyTimeLabel setFont:[UIFont systemFontOfSize:12]];
  110. [buyTimeLabel setTextColor:HW666666Color];
  111. [bgView addSubview:buyTimeLabel];
  112. [buyTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  113. make.left.mas_equalTo(16.f);
  114. make.top.equalTo(vipTypeLabel.mas_bottom).offset(4);
  115. }];
  116. NSString *leftStr2 = @"到期时间:";
  117. NSString *rightStr2 = @"2023-12-13 19:00:00";
  118. expantTimeLabel = [[UILabel alloc] init];
  119. [expantTimeLabel setText:[leftStr2 stringByAppendingString:rightStr2]];
  120. [expantTimeLabel setFont:[UIFont systemFontOfSize:12]];
  121. [expantTimeLabel setTextColor:HW666666Color];
  122. [bgView addSubview:expantTimeLabel];
  123. [expantTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  124. make.left.mas_equalTo(16.f);
  125. make.top.equalTo(buyTimeLabel.mas_bottom);
  126. }];
  127. UIView *line1 = [[UIView alloc] init];
  128. [line1 setBackgroundColor:HW979797Color10];
  129. [bgView addSubview:line1];
  130. [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.left.mas_equalTo(14.f);
  132. make.right.mas_equalTo(-14.f);
  133. make.height.mas_equalTo(1.f);
  134. make.bottom.mas_equalTo(-58);
  135. }];
  136. /*价格标签*/
  137. NSString *leftStr3 = @"¥";
  138. NSString *rightStr3 = @"99.00";
  139. priceLabel = [[UILabel alloc] init];
  140. [priceLabel setText:[leftStr3 stringByAppendingString:rightStr3]];
  141. [priceLabel setFont:[UIFont boldSystemFontOfSize:16]];
  142. [priceLabel setTextColor:HWDD4E4EColor];
  143. [bgView addSubview:priceLabel];
  144. [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  145. make.left.mas_equalTo(16.f);
  146. make.top.equalTo(line1.mas_bottom).offset(16);
  147. }];
  148. /*订单详情*/
  149. UIButton *orderDetailBtn = [[UIButton alloc] init];
  150. orderDetailBtn.frame = CGRectMake(0, 0, 72.f, 30.f);
  151. // gradient
  152. CAGradientLayer *gl = [CAGradientLayer layer];
  153. gl.frame = CGRectMake(0,0,72.f,30.f);
  154. gl.startPoint = CGPointMake(0, 0.5);
  155. gl.endPoint = CGPointMake(1, 0.5);
  156. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  157. gl.locations = @[@(0), @(1.0f)];
  158. [orderDetailBtn.layer addSublayer:gl];
  159. [orderDetailBtn addTarget:self action:@selector(orderDetailBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  160. [orderDetailBtn setTitle:NSLocalizedString(@"buy_vip_buy_recoder_cell_see_detaile",nil) forState:(UIControlStateNormal)];
  161. [orderDetailBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  162. [orderDetailBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
  163. [orderDetailBtn.layer setCornerRadius:8.f];
  164. orderDetailBtn.clipsToBounds = YES;
  165. [bgView addSubview:orderDetailBtn];
  166. [orderDetailBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  167. make.right.mas_equalTo(-16.f);
  168. make.width.mas_equalTo(72.f);
  169. make.bottom.mas_equalTo(-16.f);
  170. make.height.mas_equalTo(30.f);
  171. }];
  172. }
  173. - (void)copyBtnPressed{
  174. ;
  175. }
  176. - (void)orderDetailBtnClick{
  177. if ([delegate respondsToSelector:@selector(buyRecoderListCellOrderDetailBtnClick)]){
  178. [delegate buyRecoderListCellOrderDetailBtnClick];
  179. }
  180. }
  181. @end