123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- //
- // YOUPAILZGameAccompanyListCell.m
- // VQU
- //
- // Created by CY on 2021/4/27.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZGameAccompanyListCell.h"
- #import "YOUPAILZGameAccompanyModel.h"
- @interface YOUPAILZGameAccompanyListCell ()
- @property (nonatomic, weak) UILabel *youpaipdayL; //日期
- @property (nonatomic, weak) UILabel *youpaiporderIDL; //订单号
- @property (nonatomic, weak) UILabel *youpaipstateL; //状态
- @property (nonatomic, weak) UIImageView *youpaipgameLogoImgV; //游戏logo
- @property (nonatomic, weak) UILabel *youpaipnicknameL; //昵称
- @property (nonatomic, weak) UILabel *youpaipgameNameL; //游戏名称
- @property (nonatomic, weak) UILabel *youpaiplevelL; //段位
- @property (nonatomic, weak) UILabel *youpaipregionL; //大区
- @property (nonatomic, weak) UILabel *youpaippriceL; //价格
- @property (nonatomic, weak) UIButton *youpaipbtn; // 按钮
- @property (nonatomic, strong)YOUPAILZGameAccompanyModel *youpaipmodel;
- @end
- @implementation YOUPAILZGameAccompanyListCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- [self youpaifsetupUI];
- }
- return self;
- }
- - (void)youpaifsetupUI{
- UILabel *dayL = [[UILabel alloc] init];
- dayL.font = LCFont14;
- dayL.textColor = HexColorFromRGB(0x666666);
- [self.contentView addSubview:dayL];
- self.youpaipdayL = dayL;
- [dayL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(16.0f);
- make.top.offset(10.0f);
- make.height.offset(20.0f);
- }];
-
- UILabel *orderIDL = [[UILabel alloc] init];
- orderIDL.font = LCFont14;
- orderIDL.textColor = HexColorFromRGB(0x666666);
- [self.contentView addSubview:orderIDL];
- self.youpaiporderIDL = orderIDL;
- [orderIDL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(16.0f);
- make.top.equalTo(dayL.mas_bottom).offset(0.0f);
- make.height.offset(20.0f);
- }];
-
- UILabel *stateL = [[UILabel alloc] init];
- stateL.font = LCFont14;
- stateL.textColor = HexColorFromRGB(0x666666);
- [self.contentView addSubview:stateL];
- self.youpaipstateL = stateL;
- [stateL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-16.0f);
- make.top.offset(10.0f);
- make.height.offset(20.0f);
- }];
-
- UIImageView *gameLogoImgV = [[UIImageView alloc] init];
- [self.contentView addSubview:gameLogoImgV];
- self.youpaipgameLogoImgV = gameLogoImgV;
- [gameLogoImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(orderIDL.mas_bottom).offset(10.0f);
- make.left.offset(16.0f);
- make.size.mas_offset(CGSizeMake(80.0f, 80.0f));
- }];
-
- UILabel *nicknameL = [[UILabel alloc] init];
- nicknameL.font = LCBoldFont(15.0f);
- nicknameL.textColor = HexColorFromRGB(0x333333);
- [self.contentView addSubview:nicknameL];
- self.youpaipnicknameL = nicknameL;
- [nicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(gameLogoImgV.mas_right).offset(9.0f);
- make.top.equalTo(orderIDL.mas_bottom).offset(10.0f);
- make.height.offset(21.0f);
- }];
-
- UILabel *gameNameL = [[UILabel alloc] init];
- gameNameL.font = LCFont12;
- gameNameL.textColor = HexColorFromRGB(0x999999);
- [self.contentView addSubview:gameNameL];
- self.youpaipgameNameL = gameNameL;
- [gameNameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(gameLogoImgV.mas_right).offset(9.0f);
- make.top.equalTo(nicknameL.mas_bottom).offset(1.0f);
- make.height.offset(16.5f);
- }];
-
- UILabel *levelL = [[UILabel alloc] init];
- levelL.font = LCFont12;
- levelL.textColor = HexColorFromRGB(0x999999);
- [self.contentView addSubview:levelL];
- self.youpaiplevelL = levelL;
- [levelL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(gameLogoImgV.mas_right).offset(9.0f);
- make.top.equalTo(gameNameL.mas_bottom).offset(1.0f);
- make.height.offset(16.5f);
- }];
-
- UILabel *regionL = [[UILabel alloc] init];
- regionL.font = LCFont12;
- regionL.textColor = HexColorFromRGB(0x999999);
- [self.contentView addSubview:regionL];
- self.youpaipregionL = regionL;
- [regionL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(gameLogoImgV.mas_right).offset(9.0f);
- make.top.equalTo(levelL.mas_bottom).offset(1.0f);
- make.height.offset(16.5f);
- }];
-
- UILabel *priceL = [[UILabel alloc] init];
- priceL.font = LCFont13;
- priceL.textColor = HexColorFromRGB(0x999999);
- [self.contentView addSubview:priceL];
- self.youpaippriceL = priceL;
- [priceL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-16.0f);
- make.bottom.offset(-16.5f);
- }];
-
-
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.titleLabel.font = LCFont14;
- [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- UIImage *bgImg = [LCTools ColorImage:CGSizeMake(86.0f, 25.0f) FromColors:@[LCGradientOneColor,LCGradientTwoColor] ByGradientType:GradientLeftToRight];
- [btn setBackgroundImage:bgImg forState:UIControlStateNormal];
- [btn setBackgroundImage:bgImg forState:UIControlStateHighlighted];
- btn.layer.cornerRadius = 5.0f;
- btn.clipsToBounds = YES;
- [btn addTarget:self action:@selector(youpaifbtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:btn];
- self.youpaipbtn = btn;
- [btn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-16.0f);
- make.bottom.equalTo(priceL.mas_top).offset(-2.0f);
- make.size.mas_offset(CGSizeMake(86.0f, 25.0f));
- }];
-
- }
- - (void)youpaifbtnClick{
- //状态 0 待接单,1 已接单,2 买家申请退款中,3 拒绝退款,4 已退款,5 服务已完成,6 已结算
- NSInteger status = [self.youpaipmodel.youpaipstatus integerValue];
- NSInteger is_anchor = [LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor;
- if (is_anchor == 1) {
- if (status == 0) {
- if ([self.delegate respondsToSelector:@selector(youpaifagreeTakeOrderWithCell:model:)]) {
- [self.delegate youpaifagreeTakeOrderWithCell:self model:self.youpaipmodel];
- }
- }else if (status == 1){
- if ([self.delegate respondsToSelector:@selector(youpaiffinishOrderWithCell:model:)]) {
- [self.delegate youpaiffinishOrderWithCell:self model:self.youpaipmodel];
- }
- }else if (status == 2){
- if ([self.delegate respondsToSelector:@selector(youpaifhandleRefundWithCell:model:)]) {
- [self.delegate youpaifhandleRefundWithCell:self model:self.youpaipmodel];
- }
- }
- }else{
- if (status == 1 || status == 5) {
- if ([self.delegate respondsToSelector:@selector(youpaifapplyRefundWithCell:model:)]) {
- [self.delegate youpaifapplyRefundWithCell:self model:self.youpaipmodel];
- }
- }else if (status == 3){
- if ([self.delegate respondsToSelector:@selector(youpaifcomplaintWithCell:model:)]) {
- [self.delegate youpaifcomplaintWithCell:self model:self.youpaipmodel];
- }
- }
- }
- }
- - (void)youpaifreloadWithModel:(YOUPAILZGameAccompanyModel *)model{
- self.youpaipmodel = model;
- self.youpaipdayL.text = model.youpaipcreate_time_text;
- self.youpaiporderIDL.text = [NSString stringWithFormat:@"订单号:%@",model.youpaiporder_no];
- self.youpaipnicknameL.text = model.youpaipnickname;
- self.youpaipgameNameL.text = model.youpaipgame_name;
- [self.youpaipgameLogoImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipgame_icon]];
- self.youpaiplevelL.text = [NSString stringWithFormat:@"段位:%@",model.youpaipdan_text];
- self.youpaipregionL.text = [NSString stringWithFormat:@"大区:%@",model.youpaipregion_text];
- //状态 0 待接单,1 已接单,2 买家申请退款中,3 拒绝退款,4 已退款,5 服务已完成,6 已结算
- NSInteger status = [model.youpaipstatus integerValue];
- if (status == 0 || status == 1 || status == 2) {
- self.youpaipstateL.textColor = [UIColor redColor];
- }else{
- self.youpaipstateL.textColor = HexColorFromRGB(0x666666);
- }
- NSInteger is_anchor = [LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor;
- if (status == 6) {
- self.youpaippriceL.hidden = NO;
- if (is_anchor == 1) {
- self.youpaippriceL.text = [NSString stringWithFormat:@"收入%@钻",model.youpaipearnings];
- }else{
- self.youpaippriceL.text = [NSString stringWithFormat:@"支出%@钻",model.youpaipamount];
- }
- }else{
- self.youpaippriceL.hidden = YES;
- }
- self.youpaipstateL.text = model.youpaipstatus_text;
- self.youpaipbtn.hidden = YES;
- if (is_anchor == 1) {
- if (status == 0) {
- self.youpaipbtn.hidden = NO;
- [self.youpaipbtn setTitle:@"同意接单" forState:UIControlStateNormal];
- }else if (status == 1){
- self.youpaipbtn.hidden = NO;
- [self.youpaipbtn setTitle:@"服务完成" forState:UIControlStateNormal];
- }else if (status == 2){
- self.youpaipbtn.hidden = NO;
- [self.youpaipbtn setTitle:@"处理退款" forState:UIControlStateNormal];
- }
- }else{
- if (status == 1 || status == 5) {
- self.youpaipbtn.hidden = NO;
- [self.youpaipbtn setTitle:@"申请退款" forState:UIControlStateNormal];
- }else if (status == 3){
- self.youpaipbtn.hidden = NO;
- [self.youpaipbtn setTitle:@"申诉" forState:UIControlStateNormal];
- }
- }
-
-
- }
- @end
|