123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- //
- // YOUPAILCVideoChargeCell.m
- // LiveChat
- //
- // Created by 张灿 on 2018/10/11.
- // Copyright © 2018年 caicai. All rights reserved.
- //
- #import "YOUPAILCVideoChargeCell.h"
- @interface YOUPAILCVideoChargeCell()
- /* youpaipbgV */
- @property (weak, nonatomic) UIView *youpaipbgV;
- @property (nonatomic,weak)UILabel *youpaiptimerL;
- @property (nonatomic,weak)UILabel *youpaipgiftL;
- @property (nonatomic,weak)UILabel *youpaipgiftL1;
- @property (nonatomic,weak)UILabel *youpaipdiscountL;
- @property (nonatomic,weak)UILabel *youpaipguardL;
- @property (nonatomic,weak)UILabel *youpaiptimerMoneyL;
- /* 视频优惠 */
- @property (weak, nonatomic) UILabel *youpaipyouhuiquanLabel;
- //贵族优惠
- @property (weak, nonatomic) UILabel *youpaipyouNobleLabel;
- @property (weak, nonatomic) UILabel *payLabel;
- @property(nonatomic,strong)UILabel *youpaiIncomeL;
- @property(nonatomic,strong)UILabel *youpaipguardRight;
- @property(nonatomic,strong)UILabel *youpaipgiftLeft;
- @property(nonatomic,strong)UILabel *youpaipgiftRight;
- @property(nonatomic,strong)UIView *youpaipTwoBgView;
- @property(nonatomic,strong)UIView *threeBgView;
- @end
- @implementation YOUPAILCVideoChargeCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
-
- UIView *youpaipbgV = [[UIView alloc] init];
- self.youpaipbgV = youpaipbgV;
- youpaipbgV.backgroundColor = HexColorFromRGBA(0x000000, 0.1);
- youpaipbgV.layer.cornerRadius = 8.0f;
- youpaipbgV.clipsToBounds = YES;
- [self.contentView addSubview:youpaipbgV];
- [youpaipbgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.right.offset(-14.0f);
- make.top.offset(0);
- make.height.offset(282);
- }];
- UILabel *payLabel = [UILabel new];
- self.payLabel = payLabel;
- [youpaipbgV addSubview:payLabel];
- [payLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.top.mas_equalTo(12);
- }];
- payLabel.textColor = HexColorFromRGB(0xFED64B);
- payLabel.font = [UIFont systemFontOfSize:13];
-
- //第二层View
- UIView *youpaipTwoBgView = [[UIView alloc] init];
- self.youpaipTwoBgView = youpaipTwoBgView;
- youpaipTwoBgView.backgroundColor = HexColorFromRGBA(0x000000, 0.08);
- youpaipTwoBgView.layer.cornerRadius = 8.0f;
- youpaipTwoBgView.clipsToBounds = YES;
- [youpaipbgV addSubview:youpaipTwoBgView];
- [youpaipTwoBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(12.0f);
- make.right.offset(-13.0f);
- make.top.offset(40);
- make.height.offset(148.0f);
- }];
- //通话时长
- UILabel *youpaiptimerL = [[UILabel alloc] init];
- youpaiptimerL.font = LCFont14;
- youpaiptimerL.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaiptimerL];
- self.youpaiptimerL = youpaiptimerL;
- [youpaiptimerL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(10.0f);
- make.top.offset(10);
- make.height.offset(17.0f);
- }];
- //通话时长价值
- UILabel *youpaiptimerMoneyL = [[UILabel alloc] init];
- youpaiptimerMoneyL.font = LCFont12;
- youpaiptimerMoneyL.textColor = HexColorFromRGB(0xffffff);
- [youpaipTwoBgView addSubview:youpaiptimerMoneyL];
- self.youpaiptimerMoneyL = youpaiptimerMoneyL;
- [youpaiptimerMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10.0f);
- make.top.equalTo(youpaiptimerL);
- }];
-
- //女神减免时长
- UILabel *youpaipdiscountL = [[UILabel alloc] init];
- youpaipdiscountL.font = [UIFont systemFontOfSize:12];
- youpaipdiscountL.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipdiscountL];
- self.youpaipdiscountL = youpaipdiscountL;
- [youpaipdiscountL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaiptimerL).offset(70);
- make.top.mas_equalTo(youpaiptimerL.mas_bottom).offset(4.0f);
- make.height.mas_equalTo(14.0f);
- }];
-
- //贵族优惠|优惠券
- UILabel *youpaipyouhuiquanLabel = [UILabel new];
- self.youpaipyouhuiquanLabel = youpaipyouhuiquanLabel;
- youpaipyouhuiquanLabel.font = LCFont12;
- youpaipyouhuiquanLabel.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipyouhuiquanLabel];
- [youpaipyouhuiquanLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaipdiscountL);
- make.top.mas_equalTo(youpaipdiscountL.mas_bottom).offset(2.0f);
- make.height.offset(14.0f);
- }];
- //贵族优惠
- UILabel *youpaipyouNobleLabel = [UILabel new];
- self.youpaipyouNobleLabel = youpaipyouNobleLabel;
- youpaipyouNobleLabel.font = LCFont12;
- youpaipyouNobleLabel.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipyouNobleLabel];
- [youpaipyouNobleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaipyouhuiquanLabel);
- make.top.mas_equalTo(youpaipyouhuiquanLabel.mas_bottom).offset(2.0f);
- make.height.mas_equalTo(14.0f);
- }];
-
- //送出礼物|得到礼物
- UILabel *youpaipgiftL = [[UILabel alloc] init];
- youpaipgiftL.font = LCFont14;
- youpaipgiftL.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipgiftL];
- self.youpaipgiftL = youpaipgiftL;
- [youpaipgiftL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10.0f);
- make.top.mas_equalTo(96);
- make.height.offset(17.0f);
- }];
-
- UILabel *youpaipgiftL1 = [[UILabel alloc] init];
- youpaipgiftL1.font = LCFont14;
- youpaipgiftL1.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipgiftL1];
- self.youpaipgiftL1 = youpaipgiftL1;
- [youpaipgiftL1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-10.0f);
- make.top.equalTo(youpaipgiftL);
- make.height.offset(17.0f);
- }];
-
- //赠送|收到守护
- UILabel *youpaipguardL = [[UILabel alloc] init];
- youpaipguardL.font = LCFont14;
- youpaipguardL.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipguardL];
- self.youpaipguardL = youpaipguardL;
- [youpaipguardL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10.0f);
- make.top.equalTo(youpaipgiftL.mas_bottom).offset(8.0f);
- make.height.offset(17.0f);
- }];
-
- //赠送|收到守护价格
- UILabel *youpaipguardRight = [[UILabel alloc] init];
- youpaipguardRight.font = LCFont14;
- youpaipguardRight.textColor = [UIColor whiteColor];
- [youpaipTwoBgView addSubview:youpaipguardRight];
- self.youpaipguardRight = youpaipguardRight;
- [youpaipguardRight mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10.0f);
- make.top.equalTo(youpaipguardL);
- make.height.offset(17.0f);
- }];
-
- //本次收入|支出多少
- UILabel *youpaiIncomeL = [[UILabel alloc] init];
- youpaiIncomeL.font = LCFont14;
- youpaiIncomeL.textColor = HexColorFromRGB(0xFED64B);
- [youpaipbgV addSubview:youpaiIncomeL];
- self.youpaiIncomeL = youpaiIncomeL;
- [youpaiIncomeL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.top.mas_equalTo(youpaipTwoBgView.mas_bottom).offset(16.0f);
- make.height.offset(17.0f);
- }];
-
- //收到礼物|送出礼物
- UIView *threeBgView = [UIView new];
- self.threeBgView = threeBgView;
- [youpaipbgV addSubview:threeBgView];
- [threeBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(youpaiIncomeL.mas_bottom).offset(10);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.height.mas_equalTo(38);
- }];
- threeBgView.layer.cornerRadius = 8;
- threeBgView.clipsToBounds = YES;
- threeBgView.backgroundColor = HexColorFromRGBA(0xffffff, 0.08);
-
- UILabel *youpaipgiftLeft = [[UILabel alloc] init];
- self.youpaipgiftLeft = youpaipgiftLeft;
- youpaipgiftLeft.font = LCFont14;
- youpaipgiftLeft.textColor = HexColorFromRGB(0xffffff);
- [threeBgView addSubview:youpaipgiftLeft];
- [youpaipgiftLeft mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10.0f);
- make.centerY.equalTo(0);
- }];
-
-
- UILabel *youpaipgiftRight = [[UILabel alloc] init];
- self.youpaipgiftRight = youpaipgiftRight;
- youpaipgiftRight.font = LCFont14;
- youpaipgiftRight.textColor = HexColorFromRGB(0xffffff);
- [threeBgView addSubview:youpaipgiftRight];
- [youpaipgiftRight mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10.0f);
- make.centerY.equalTo(0);
- }];
-
-
- }
- - (void)setYoupaipfinishModel:(YOUPAILCVideoFinishModel *)youpaipfinishModel{
- _youpaipfinishModel = youpaipfinishModel;
-
- self.youpaipdiscountL.hidden = YES;
- self.youpaipyouhuiquanLabel.hidden = YES;
- self.youpaipyouNobleLabel.hidden = YES;
- NSMutableArray *arr = [NSMutableArray new];
- if (youpaipfinishModel) {
- if (youpaipfinishModel.youpaipDes3.length>0) {
- [arr addObject:youpaipfinishModel.youpaipDes3];
- }
- if (youpaipfinishModel.youpaipDes2.length>0) {
- [arr addObject:youpaipfinishModel.youpaipDes2];
- }
- if (youpaipfinishModel.youpaipDes1.length>0) {
- [arr addObject:youpaipfinishModel.youpaipDes1];
- }
-
- }
-
- CGFloat height = 148-60+arr.count*20;
- [self.youpaipTwoBgView updateConstraints:^(MASConstraintMaker *make) {
- make.height.offset(height);
- }];
- [self.youpaipgiftL updateConstraints:^(MASConstraintMaker *make) {
-
- make.top.mas_equalTo(arr.count*20+36);
-
- }];
- UIView *frontV = nil;
-
-
- if (youpaipfinishModel.youpaipDes3.length !=0) {
- self.youpaipdiscountL.hidden = NO;
- self.youpaipdiscountL.text = youpaipfinishModel.youpaipDes3;
- [self.youpaipdiscountL mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.top.mas_equalTo(self.youpaiptimerL.mas_bottom).offset(4.0f);
- }else{
- make.top.equalTo(frontV.mas_bottom).offset(4.0f);
- }
-
- make.left.mas_equalTo(self.youpaiptimerL).offset(70);
- make.height.mas_equalTo(14.0f);
- }];
- frontV = self.youpaipdiscountL;
- }
- if (youpaipfinishModel.youpaipDes1.length !=0) {
- self.youpaipyouhuiquanLabel.hidden = NO;
- self.youpaipyouhuiquanLabel.text =youpaipfinishModel.youpaipDes1;
- [self.youpaipyouhuiquanLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.top.mas_equalTo(self.youpaiptimerL.mas_bottom).offset(4.0f);
- }else{
- make.top.equalTo(frontV.mas_bottom).offset(2.0f);
- }
-
- make.left.mas_equalTo(self.youpaiptimerL).offset(70);
- make.height.mas_equalTo(14.0f);
- }];
- frontV = self.youpaipyouhuiquanLabel;
- }
- if (youpaipfinishModel.youpaipDes2.length !=0) {
- self.youpaipyouNobleLabel.hidden = NO;
- self.youpaipyouNobleLabel.text = youpaipfinishModel.youpaipDes2;
- [self.youpaipyouNobleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.top.mas_equalTo(self.youpaiptimerL.mas_bottom).offset(4.0f);
- }else{
- make.top.equalTo(frontV.mas_bottom).offset(2.0f);
- }
-
- make.left.mas_equalTo(self.youpaiptimerL).offset(70);
- make.height.mas_equalTo(14.0f);
- }];
- frontV = self.youpaipyouNobleLabel;
- }
-
-
- if ([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id isEqualToString:youpaipfinishModel.youpaipfrom_uid]) {
-
- self.payLabel.text = [NSString stringWithFormat:@"本次支出:%@",youpaipfinishModel.youpaiptotal_paynew?youpaipfinishModel.youpaiptotal_paynew:@""];
- self.youpaiptimerMoneyL.text = [NSString stringWithFormat:@"%@",youpaipfinishModel.youpaippay_moneynew];
- self.youpaipgiftL.text = [NSString stringWithFormat:@"送出礼物:"];
- self.youpaipgiftL1.text =[NSString stringWithFormat:@"%@",youpaipfinishModel.youpaipgift_moneynew?youpaipfinishModel.youpaipgift_moneynew:@""];
- self.youpaipgiftLeft.text = @"收到礼物";
- self.youpaipgiftRight.text = youpaipfinishModel.youpaipgift_anchor_pricenew?youpaipfinishModel.youpaipgift_anchor_pricenew:@"";
- self.youpaipguardL.text = [NSString stringWithFormat:@"送出守护符:%@个",@(youpaipfinishModel.youpaipguard_numnew)];
- self.youpaipguardRight.text = [NSString stringWithFormat:@"%@",youpaipfinishModel.youpaipguard_pricenew?youpaipfinishModel.youpaipguard_pricenew:@""];
-
- self.youpaiIncomeL.text = [NSString stringWithFormat:@"本次收入:%@",youpaipfinishModel.youpaipgift_anchor_pricenew ?youpaipfinishModel.youpaipgift_anchor_pricenew:@""];
-
-
-
- // if ([youpaipfinishModel.youpaippreference_type isEqualToString:@"coupon"]) {//是否有优惠券
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"视频优惠: %@钻石/分钟",youpaipfinishModel.youpaipdes];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"+%@钻石",youpaipfinishModel.youpaipdiscount_amount];
- //
- // }else if([youpaipfinishModel.youpaippreference_type isEqualToString:@"noble"]){//贵族优惠
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"贵族优惠: %@钻石/分钟",youpaipfinishModel.youpaipdes];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"+%@钻石",youpaipfinishModel.youpaipdiscount_amount];
- //
- // }else if([youpaipfinishModel.youpaippreference_type isEqualToString:@"none"]){//没有优惠
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(147.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"贵族优惠 (%@)",@"未开通"];
- // }else{
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"贵族优惠 (%@)",@"未开通"];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"-0钻石"];
- //
- // }
-
- }else{
- // 总收入
- self.payLabel.text = [NSString stringWithFormat:@"本次收入:%@",youpaipfinishModel.youpaipincome_moneynew?youpaipfinishModel.youpaipincome_moneynew:@""];
- self.youpaiptimerMoneyL.text = [NSString stringWithFormat:@"%@",youpaipfinishModel.youpaipcall_income];
- self.youpaipgiftL.text = [NSString stringWithFormat:@"收到礼物:"];
- self.youpaipgiftL1.text = [NSString stringWithFormat:@"%@",youpaipfinishModel.youpaipgift_moneynew?youpaipfinishModel.youpaipgift_moneynew:@""];
- self.youpaipguardL.text = [NSString stringWithFormat:@"收到守护符:%@个",@(youpaipfinishModel.youpaipguard_numnew)];
- self.youpaipguardRight.text = [NSString stringWithFormat:@"%@",youpaipfinishModel.youpaipguard_pricenew];
- self.youpaiIncomeL.text = [NSString stringWithFormat:@"本次支出:%@",youpaipfinishModel.youpaipgift_anchor_pricenew?youpaipfinishModel.youpaipgift_anchor_pricenew:@""];
- self.youpaipgiftLeft.text = @"送出礼物";
- self.youpaipgiftRight.text = youpaipfinishModel.youpaipgift_anchor_pricenew;
- // if ([youpaipfinishModel.youpaippreference_type isEqualToString:@"coupon"]) {//是否有优惠券
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"视频优惠: %@钻石/分钟",youpaipfinishModel.youpaipdes];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"-%@钻石",youpaipfinishModel.youpaipdiscount_amount];
- //
- // }else if([youpaipfinishModel.youpaippreference_type isEqualToString:@"noble"]){//贵族优惠
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"贵族优惠: %@钻石/分钟",youpaipfinishModel.youpaipdes];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"-%@钻石",youpaipfinishModel.youpaipdiscount_amount];
- //
- // }else if([youpaipfinishModel.youpaippreference_type isEqualToString:@"none"]){//没有优惠
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(147.0f+23);
- //// }];
- //
- // }else{
- //// [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- //// make.height.offset(170.0f+23);
- //// }];
- // self.youpaipyouhuiquanLabel.text = [NSString stringWithFormat:@"贵族优惠 (%@)",@"未开通"];
- // self.youpaipyouhuiquanMoneyL.text = [NSString stringWithFormat:@"-0钻石"];
- //
- // }
- }
- // self.youpaiptitleL.attributedText = [LCTools setRichTextWithTitle:titleText subTitle:[NSString stringWithFormat:@"(%@钻石/分钟)",youpaipfinishModel.youpaipskill.youpaipprice] titleColor:HexColorFromRGB(0xffffff) subTitleColor:HexColorFromRGB(0x9F9DA5) titleFontSize:16.0f subTitleFontSize:14.0f];
- NSInteger minute = youpaipfinishModel.youpaipcall_time / 60;
- NSInteger second = youpaipfinishModel.youpaipcall_time % 60;
- self.youpaiptimerL.text = [NSString stringWithFormat:@"通话时长:%@分%@秒",@(minute),@(second)];
- // self.youpaipdiscountL.text = youpaipfinishModel.youpaipDes3;
- // self.youpaipyouhuiquanLabel.text =youpaipfinishModel.youpaipDes1;
- // self.youpaipyouNobleLabel.text = youpaipfinishModel.youpaipDes2;
- // self.youpaipdiscountL.text = [NSString stringWithFormat:@"女神减免:%@分钟",@(youpaipfinishModel.youpaipreduce_time)];
-
- }
- @end
|