// // BuyRecoderListCell.m // VclustersGemini // // Created by 黄盛威 on 2020/10/19. // Copyright © 2020 APPLE. All rights reserved. // #import "BuyRecoderListCell.h" #import @interface BuyRecoderListCell(){ UILabel *orderNumberLabel; UILabel *vipTypeLabel; UILabel *buyTimeLabel; UILabel *expantTimeLabel; UILabel *priceLabel; } @end @implementation BuyRecoderListCell @synthesize delegate; - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self){ [self drawView]; } return self; } - (void)drawView{ UIView *bgView = [[UIView alloc] init]; [bgView setBackgroundColor:HWFBFCFDColor]; [bgView.layer setCornerRadius:8.f]; [self.contentView addSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.right.mas_equalTo(-16.f); make.bottom.mas_equalTo(-16.f); make.top.mas_equalTo(0); }]; /*订单编号*/ UILabel *orderNumberTitleLabel = [[UILabel alloc] init]; [orderNumberTitleLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_oerder_title",nil)]; [orderNumberTitleLabel setFont:[UIFont systemFontOfSize:12]]; [orderNumberTitleLabel setTextColor:HW0A132BColor]; [bgView addSubview:orderNumberTitleLabel]; [orderNumberTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.top.mas_equalTo(16); }]; orderNumberLabel = [[UILabel alloc] init]; [orderNumberLabel setText:@"wefe3f3fe3wf23r32"]; [orderNumberLabel setFont:[UIFont systemFontOfSize:12]]; [orderNumberLabel setTextColor:HW0A132BColor]; [bgView addSubview:orderNumberLabel]; [orderNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(orderNumberTitleLabel.mas_right); make.top.mas_equalTo(16); }]; /*复制按钮*/ UIButton *copyBtn = [[UIButton alloc] init]; [copyBtn setImage:[UIImage imageNamed:@"buy_copy"] forState:(UIControlStateNormal)]; [copyBtn addTarget:self action:@selector(copyBtnPressed) forControlEvents:(UIControlEventTouchUpInside)]; [bgView addSubview:copyBtn]; [copyBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(orderNumberLabel.mas_right); make.top.mas_equalTo(16); make.height.mas_equalTo(16); make.width.mas_equalTo(16); }]; /*已付款标签*/ UILabel *havePayLabel = [[UILabel alloc] init]; [havePayLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_have_pay",nil)]; [havePayLabel setFont:[UIFont systemFontOfSize:12]]; [havePayLabel setTextColor:HW01B7EAColor]; [havePayLabel setTextAlignment:(NSTextAlignmentRight)]; [bgView addSubview:havePayLabel]; [havePayLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-16.f); make.top.mas_equalTo(16); }]; /*分割线*/ UIView *line = [[UIView alloc] init]; [line setBackgroundColor:HW979797Color10]; [bgView addSubview:line]; [line mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14.f); make.right.mas_equalTo(-14.f); make.height.mas_equalTo(1.f); make.top.mas_equalTo(45); }]; /*订单时间相关*/ vipTypeLabel = [[UILabel alloc] init]; [vipTypeLabel setText:@"VIP30天"]; [vipTypeLabel setFont:[UIFont boldSystemFontOfSize:16]]; [vipTypeLabel setTextColor:HW0A132BColor]; [bgView addSubview:vipTypeLabel]; [vipTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.top.equalTo(line.mas_bottom).offset(12); }]; NSString *leftStr1 = @"购买时间:"; NSString *rightStr1 = @"2023-12-12 19:00:00"; buyTimeLabel = [[UILabel alloc] init]; [buyTimeLabel setText:[leftStr1 stringByAppendingString:rightStr1]]; [buyTimeLabel setFont:[UIFont systemFontOfSize:12]]; [buyTimeLabel setTextColor:HW666666Color]; [bgView addSubview:buyTimeLabel]; [buyTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.top.equalTo(vipTypeLabel.mas_bottom).offset(4); }]; NSString *leftStr2 = @"到期时间:"; NSString *rightStr2 = @"2023-12-13 19:00:00"; expantTimeLabel = [[UILabel alloc] init]; [expantTimeLabel setText:[leftStr2 stringByAppendingString:rightStr2]]; [expantTimeLabel setFont:[UIFont systemFontOfSize:12]]; [expantTimeLabel setTextColor:HW666666Color]; [bgView addSubview:expantTimeLabel]; [expantTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.top.equalTo(buyTimeLabel.mas_bottom); }]; UIView *line1 = [[UIView alloc] init]; [line1 setBackgroundColor:HW979797Color10]; [bgView addSubview:line1]; [line1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14.f); make.right.mas_equalTo(-14.f); make.height.mas_equalTo(1.f); make.bottom.mas_equalTo(-58); }]; /*价格标签*/ NSString *leftStr3 = @"¥"; NSString *rightStr3 = @"99.00"; priceLabel = [[UILabel alloc] init]; [priceLabel setText:[leftStr3 stringByAppendingString:rightStr3]]; [priceLabel setFont:[UIFont boldSystemFontOfSize:16]]; [priceLabel setTextColor:HWDD4E4EColor]; [bgView addSubview:priceLabel]; [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16.f); make.top.equalTo(line1.mas_bottom).offset(16); }]; /*订单详情*/ UIButton *orderDetailBtn = [[UIButton alloc] init]; orderDetailBtn.frame = CGRectMake(0, 0, 72.f, 30.f); // gradient CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = CGRectMake(0,0,72.f,30.f); gl.startPoint = CGPointMake(0, 0.5); gl.endPoint = CGPointMake(1, 0.5); gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor]; gl.locations = @[@(0), @(1.0f)]; [orderDetailBtn.layer addSublayer:gl]; [orderDetailBtn addTarget:self action:@selector(orderDetailBtnClick) forControlEvents:(UIControlEventTouchUpInside)]; [orderDetailBtn setTitle:NSLocalizedString(@"buy_vip_buy_recoder_cell_see_detaile",nil) forState:(UIControlStateNormal)]; [orderDetailBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [orderDetailBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]]; [orderDetailBtn.layer setCornerRadius:8.f]; orderDetailBtn.clipsToBounds = YES; [bgView addSubview:orderDetailBtn]; [orderDetailBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-16.f); make.width.mas_equalTo(72.f); make.bottom.mas_equalTo(-16.f); make.height.mas_equalTo(30.f); }]; } - (void)copyBtnPressed{ ; } - (void)orderDetailBtnClick{ if ([delegate respondsToSelector:@selector(buyRecoderListCellOrderDetailBtnClick)]){ [delegate buyRecoderListCellOrderDetailBtnClick]; } } @end