//
//  socallCell.m
//  Open
//
//  Created by 看看智能 on 2017/3/16.
//  Copyright © 2017年 黄江涛 . All rights reserved.

//采集认证的详细信息显示

#import "socallCell.h"

@implementation socallCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

   
    
}



-(float)messageHeight{
    CGSize size = [self.address sizeThatFits:CGSizeMake(self.address.bounds.size.width,CGFLOAT_MAX)];
    //        NSLog(@"%lf-------%lf",size.height,size.height,cell.address.bounds.size.height);
  
    CGSize sizeTWO = [self.suggestts sizeThatFits:CGSizeMake(self.suggestts.bounds.size.width, CGFLOAT_MAX)];

    return size.height +sizeTWO.height;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setSocModel:(socialResultModel *)socModel
{
    _socModel =socModel;

    
    switch (self.record) {
        case 1:
            [self record_1_s:socModel];
            break;
            
        default:
                 [self records:socModel];
            break;
    }
    
  
}

//

-(void)records:(socialResultModel *)socModel{

    if ([socModel.match_state isEqualToString:@"0"]) {
        self.titleBools.text =@"认证成功";
        self.titleBools.textColor =kRGBColor(24, 133, 37);
    }else if([socModel.match_state isEqualToString:@"2"])
    {
        self.titleBools.text =@"认证失败";
        self.titleBools.textColor =[UIColor redColor];
    }else if([socModel.match_state isEqualToString:@"1"])
    {
        self.titleBools.text =@"认证未完成";
        self.titleBools.textColor =kRGBColor(30, 196, 237);
    }else
    {
        self.titleBools.text =@"人工审核中";
        self.titleBools.textColor =kRGBColor(30, 196, 237);
    }
    
    NSString *str1 =[EnercryTool desA:socModel.personName];
//    NSString *str2 =[EnercryTool desA:socModel.identityNumber];
    NSString *str2 = [[EnercryTool desA:socModel.identityNumber] stringByReplacingCharactersInRange:NSMakeRange(3, 13) withString:@"*************"];
    
    self.nameTs.text =str1;
  

    self.addressts.text =str2;
    self.addressLabels.text =@"地    址:";
    self.timeL.text =socModel.createTime;
    
    
    if (!socModel.suggest) {
        self.suggestts.text =socModel.suggest;
    }else
    {
        NSString *str3 =[@"提     示:  " stringByAppendingString:socModel.suggest];
        self.suggestts.text =str3;
    }
    if (!socModel.nowAddress) {
        self.address.text = @"";

        self.addressLabels.text =@"";
    }else
    {
        NSString *str3 =socModel.nowAddress;
        self.address.text =str3;
        if ([str3 isEqualToString:@""]) {
            self.addressJ_2.constant =0;
            self.address.text =@"";
            self.addressLabels.text =@"";
        }else{
              self.addressJ_2.constant =10;
            self.address.text =str3;
            self.addressLabels.text =@"地    址:";
        }
     
    }

}
//当为社保采集的时候
-(void)record_1_s:(socialResultModel *)socModel{

    self.addressJ_2.constant =0;
    self.address.text =@"";
    self.addressLabels.text =@"";
    if ([socModel.data_state isEqualToString:@"0"]) {
        self.titleBools.text =@"采集成功";
        self.titleBools.textColor =kRGBColor(24, 133, 37);
    }else if([socModel.data_state isEqualToString:@"2"])
    {
        self.titleBools.text =@"审核失败";
        self.titleBools.textColor =[UIColor redColor];
    }else if([socModel.data_state isEqualToString:@"1"])
    {
        self.titleBools.text =@"审核中";
        self.titleBools.textColor =kRGBColor(30, 196, 237);
    }else if([socModel.data_state isEqualToString:@"3"])
    {
        self.titleBools.text =@"采集失败";
        self.titleBools.textColor =kRGBColor(30, 196, 237);
    }else if([socModel.data_state isEqualToString:@"4"]){
        self.titleBools.text =@"停止发放";
        self.titleBools.textColor =[UIColor redColor];
    }else{
        self.titleBools.text =@"死亡";
        self.titleBools.textColor =[UIColor redColor];
    }
    
    NSString *str1 =[EnercryTool desA:socModel.names];
//    NSString *str2 =[EnercryTool desA:socModel.identityNumber];
     NSString *str2 = [[EnercryTool desA:socModel.identityNumber] stringByReplacingCharactersInRange:NSMakeRange(3, 13) withString:@"*************"];
    
    self.nameTs.text =str1;
    self.addressts.text =str2;

    self.timeL.text =socModel.createTime;
    
    
    if (!socModel.descriptions) {
        self.suggestts.text =socModel.descriptions;
    }else
    {
        NSString *str3 =[@"提    示:  " stringByAppendingString:socModel.descriptions];
        self.suggestts.text =str3;
    }
    
    
}
-(void)layoutSubviews{
    [super layoutSubviews];
}
@end
