// // KDPLiveEarningCell.m // KuDianProject // // Created by 学丽 on 2019/7/4. // Copyright © 2019 KDP. All rights reserved. // #import "KDPLiveEarningCell.h" @implementation KDPLiveEarningCell -(instancetype)initWithFrame:(CGRect)frame { self=[super initWithFrame:frame]; if (self) { self.backImgV=[[UIImageView alloc]init]; self.backImgV.image=[UIImage imageNamed:@"top_icon-backnew"]; [self addSubview:self.backImgV]; self.backImgV.userInteractionEnabled=YES; [self.backImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.mas_equalTo(0); }]; UILabel *livel =[[UILabel alloc]init]; livel.text=@"直播收益"; livel.font=[UIFont systemFontOfSize:15]; livel.textColor=[UIColor colorWithHexString:@"#666666"]; [self.backImgV addSubview:livel]; [livel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(45); make.top.mas_equalTo(9); make.height.mas_equalTo(21); }]; UIButton *accountBtn =[[UIButton alloc]init]; [accountBtn setImage:[UIImage imageNamed:@"next_icon"] forState:UIControlStateNormal]; [accountBtn addTarget:self action:@selector(accountclickBtn) forControlEvents:UIControlEventTouchUpInside]; [self.backImgV addSubview:accountBtn]; [accountBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-20); make.top.mas_equalTo(10); make.width.height.mas_equalTo(21); }]; [self.backImgV addSubview:self.orderNumgL]; [self.backImgV addSubview:self.Forecastlabel]; [self.orderNumgL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.top.mas_equalTo(39); make.height.mas_equalTo(42); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; [self.backImgV addSubview:self.addNumL]; [self.addNumL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.orderNumgL.mas_right).offset(-45); make.top.mas_equalTo(self.orderNumgL.mas_top).offset(-5); make.height.mas_equalTo(15); }]; [self.Forecastlabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.orderNumgL.mas_right); make.top.mas_equalTo(39); make.height.mas_equalTo(42); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; [self orderMoneyView]; [self addorderBAckView]; } return self; } -(void)addorderBAckView { UIView *oderV=[[UIView alloc]init]; oderV.backgroundColor=[UIColor clearColor]; oderV.userInteractionEnabled=YES; [self.backImgV addSubview:oderV]; [oderV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(114); make.height.mas_equalTo(17); make.centerX.mas_equalTo(self.Forecastlabel.mas_centerX); }]; UIView *pointorderV=[[UIView alloc]init]; pointorderV.layer.cornerRadius=3; pointorderV.layer.masksToBounds=YES; pointorderV.backgroundColor=[UIColor colorWithHexString:@"#FF9E3C"]; [oderV addSubview:pointorderV]; [pointorderV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(6); make.left.mas_equalTo(0); make.top.mas_equalTo(5.5); }]; UILabel *ordertitleL=[[UILabel alloc]init]; ordertitleL.text=@"今日预估(元)"; ordertitleL.font=[UIFont systemFontOfSize:12]; ordertitleL.textColor=[UIColor colorWithHexString:@"#666666"]; ordertitleL.textAlignment=NSTextAlignmentCenter; [oderV addSubview:ordertitleL]; [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1); make.height.mas_equalTo(17); make.width.mas_equalTo(90); }]; UIButton *changeBtn =[[UIButton alloc]init]; [changeBtn setImage:[UIImage imageNamed:@"open_hidden_icon"] forState:UIControlStateNormal]; [changeBtn setImage:[UIImage imageNamed:@"close_hidden_icon"] forState:UIControlStateSelected]; changeBtn.userInteractionEnabled=YES; changeBtn.selected=[KDPublicMethod is_hiddenMoney]; [changeBtn addTarget:self action:@selector(changeBtnclickBtn:) forControlEvents:UIControlEventTouchUpInside]; [oderV addSubview:changeBtn]; [changeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(ordertitleL.mas_right).offset(0); make.top.mas_equalTo(0); make.width.height.mas_equalTo(17); }]; } -(void)orderMoneyView { { UIView *oderV=[[UIView alloc]init]; oderV.backgroundColor=[UIColor clearColor]; [self.backImgV addSubview:oderV]; [oderV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(75); make.height.mas_equalTo(17); make.centerX.mas_equalTo(self.orderNumgL.mas_centerX); }]; UIView *pointorderV=[[UIView alloc]init]; pointorderV.layer.cornerRadius=3; pointorderV.layer.masksToBounds=YES; pointorderV.backgroundColor=[UIColor colorWithHexString:@"#F44A44"]; [oderV addSubview:pointorderV]; [pointorderV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(6); make.left.mas_equalTo(0); make.top.mas_equalTo(5.5); }]; UILabel *ordertitleL=[[UILabel alloc]init]; ordertitleL.text=@"今日订单"; ordertitleL.font=[UIFont systemFontOfSize:12]; ordertitleL.textColor=[UIColor colorWithHexString:@"#666666"]; ordertitleL.textAlignment=NSTextAlignmentCenter; [oderV addSubview:ordertitleL]; [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(1); make.height.mas_equalTo(17); make.width.mas_equalTo(65); }]; } } #pragma mark---金额隐私切换 -(void)changeBtnclickBtn:(UIButton *)bnt { KDPAccountModel *model=[KDPAccountTool account]; if (model.is_hidden.integerValue == 0) { model.is_hidden = @"1"; bnt.selected=YES; }else{ model.is_hidden = @"0"; bnt.selected=NO; } [KDPAccountTool saveAccount:model]; [self ishidden_rebat]; } -(void)setRebet_money:(NSString *)rebet_money { _rebet_money = rebet_money; [self ishidden_rebat]; } -(void)ishidden_rebat { if ([KDPublicMethod is_hiddenMoney]) { self.Forecastlabel.text = @"****"; }else{ self.Forecastlabel.text=_rebet_money; } } #pragma mark--- -(void)accountclickBtn { if (self.liveDataBlock) { self.liveDataBlock(); } } -(UILabel *)orderNumgL { if (!_orderNumgL) { _orderNumgL=[[UILabel alloc]init]; _orderNumgL.text=@"----"; _orderNumgL.font=[UIFont boldSystemFontOfSize:28]; _orderNumgL.textColor=[UIColor colorWithHexString:fontColor]; _orderNumgL.textAlignment=NSTextAlignmentCenter; } return _orderNumgL; } -(UILabel *)addNumL { if (!_addNumL) { _addNumL=[[UILabel alloc]init]; _addNumL.textColor=[UIColor colorWithHexString:ThemeColor]; _addNumL.font=[UIFont systemFontOfSize:18]; } return _addNumL; } -(UILabel *)Forecastlabel { if (!_Forecastlabel) { _Forecastlabel=[[UILabel alloc]init]; _Forecastlabel.text=@"----"; _Forecastlabel.font=[UIFont boldSystemFontOfSize:28]; _Forecastlabel.textColor=[UIColor colorWithHexString:fontColor]; _Forecastlabel.textAlignment=NSTextAlignmentCenter; } return _Forecastlabel; } @end