// // InstallReceiptListCell.m // IBOSS // // Created by apple on 16/1/8. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // // 功能描述:安装已回执单元格类 #import "InstallReceiptListCell.h" #import "DateFormat.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] #define kTitleFont [UIFont systemFontOfSize:14] @implementation InstallReceiptListCell #pragma mark - 公有函数 /** 初始化单元格 @param style <#style description#> @param reuseIdentifier <#reuseIdentifier description#> @return <#return value description#> */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self){ self.layer.cornerRadius=CornerRadius; self.layer.backgroundColor = [UIColor clearColor].CGColor; self.layer.masksToBounds=YES; } return self; } /** 设置单元格可点击 @param selected <#selected description#> @param animated <#animated description#> */ - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } #pragma mark - 私有函数 /** 设置安装已回执frame @param frame <#frame description#> */ - (void)parseInfoFrame:(InstallReceiptedListFrame*)frame{ _installationReceiptListModel=frame.installationReceiptListModel; UILabel *receiptNoLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptNoF]]; receiptNoLabelView.backgroundColor = [UIColor clearColor]; receiptNoLabelView.textColor = [UIColor blackColor]; receiptNoLabelView.text = @"回执单号:"; receiptNoLabelView.textAlignment = NSTextAlignmentLeft; receiptNoLabelView.font =kTitleFont; [self.contentView addSubview: receiptNoLabelView]; NSString *receiptNoStr = [_installationReceiptListModel receiptNo]; if(receiptNoStr != nil&&receiptNoStr.length>0){ _receiptNo = [[UILabel alloc] initWithFrame:[frame receiptNoF]]; _receiptNo.backgroundColor = [UIColor clearColor]; _receiptNo.textColor = [UIColor blackColor]; _receiptNo.textAlignment = NSTextAlignmentLeft; _receiptNo.font =kTitleFont; [self.contentView addSubview: _receiptNo]; _receiptNo.text=receiptNoStr; } else{ _btnCancelReceipt=[UIButton buttonWithType:UIButtonTypeCustom]; _btnCancelReceipt.frame=[frame btnCancelReceiptF]; _btnCancelReceipt.titleLabel.font = kTitleFont; [_btnCancelReceipt setTitle:@"撤销" forState:UIControlStateNormal]; [_btnCancelReceipt setTitleColor:[UIColor redColor]forState:UIControlStateNormal]; [_btnCancelReceipt addTarget:self action:@selector(goCancelReceipt) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:_btnCancelReceipt]; } UIView *separator = [UIView new]; separator.frame = [frame separatorF]; separator.backgroundColor=LineBackgroundColor; [self.contentView addSubview:separator]; UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]]; arrangementNoLabelView.backgroundColor = [UIColor clearColor]; arrangementNoLabelView.textColor = LabelGrayTextColor; arrangementNoLabelView.text = @"安排单号:"; arrangementNoLabelView.textAlignment = NSTextAlignmentLeft; arrangementNoLabelView.font =kTextFont; [self.contentView addSubview: arrangementNoLabelView]; NSString *arrangementNoStr = [_installationReceiptListModel arrangementNo]; if(arrangementNoStr != nil&&arrangementNoStr.length>0){ _arragementNo = [[UILabel alloc] initWithFrame:[frame arrangementNoF]]; _arragementNo.backgroundColor = [UIColor clearColor]; _arragementNo.textColor = [UIColor blackColor]; _arragementNo.textAlignment = NSTextAlignmentLeft; _arragementNo.font =kTextFont; [self.contentView addSubview: _arragementNo]; _arragementNo.text=arrangementNoStr; } UILabel *installationNoLabelView = [[UILabel alloc] initWithFrame:[frame lblInstallationNoF]]; installationNoLabelView.backgroundColor = [UIColor clearColor]; installationNoLabelView.textColor = LabelGrayTextColor; installationNoLabelView.text = @"安装单号:"; installationNoLabelView.textAlignment = NSTextAlignmentLeft; installationNoLabelView.font =kTextFont; [self.contentView addSubview: installationNoLabelView]; NSString *installationNoStr = [_installationReceiptListModel installationNo]; if(installationNoStr != nil&&installationNoStr.length>0){ _installNo = [[UILabel alloc] initWithFrame:[frame installationNoF]]; _installNo.backgroundColor = [UIColor clearColor]; _installNo.textColor = [UIColor blackColor]; _installNo.textAlignment = NSTextAlignmentLeft; _installNo.font =kTextFont; [self.contentView addSubview: _installNo]; _installNo.text=installationNoStr; } UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]]; customerNameLabelView.backgroundColor = [UIColor clearColor]; customerNameLabelView.textColor = LabelGrayTextColor; customerNameLabelView.text = @"客户名称:"; customerNameLabelView.textAlignment = NSTextAlignmentLeft; customerNameLabelView.font =kTextFont; [self.contentView addSubview: customerNameLabelView]; NSString *customerNameStr = [_installationReceiptListModel customerName]; if(customerNameStr != nil&&customerNameStr.length>0){ _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]]; _customerName.backgroundColor = [UIColor clearColor]; _customerName.textColor = [UIColor blackColor]; _customerName.textAlignment = NSTextAlignmentLeft; _customerName.font =kTextFont; [self.contentView addSubview: _customerName]; _customerName.text=customerNameStr; } UILabel *customerAddressLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]]; customerAddressLabelView.backgroundColor = [UIColor clearColor]; customerAddressLabelView.textColor = LabelGrayTextColor; customerAddressLabelView.text = @"客户地址:"; customerAddressLabelView.font = kTextFont; customerAddressLabelView.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview: customerAddressLabelView]; _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]]; NSString *customerAddressStr = [_installationReceiptListModel customerAddress]; if(customerAddressStr != nil && customerAddressStr.length > 0){ _customerAddress.backgroundColor = [UIColor clearColor]; _customerAddress.textColor = [UIColor blackColor]; _customerAddress.textAlignment = NSTextAlignmentLeft; _customerAddress.font = kTextFont; [self.contentView addSubview:_customerAddress]; _customerAddress.text = customerAddressStr; } UILabel *customerTelephoneLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]]; customerTelephoneLabelView.backgroundColor = [UIColor clearColor]; customerTelephoneLabelView.textColor = LabelGrayTextColor; customerTelephoneLabelView.text = @"客户电话:"; customerTelephoneLabelView.font = kTextFont; customerTelephoneLabelView.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview: customerTelephoneLabelView]; _customerTelephone = [[UILabel alloc] initWithFrame:[frame customerTelephoneF]]; NSString *customerTelephoneStr = [_installationReceiptListModel customerTelephone]; if(customerTelephoneStr != nil && customerTelephoneStr.length > 0){ _customerTelephone.backgroundColor = [UIColor clearColor]; _customerTelephone.textColor = [UIColor blackColor]; _customerTelephone.textAlignment = NSTextAlignmentLeft; _customerTelephone.font = kTextFont; [self.contentView addSubview:_customerTelephone]; _customerTelephone.text = customerTelephoneStr; } UILabel *receiptDateLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptDateF]]; receiptDateLabelView.backgroundColor = [UIColor clearColor]; receiptDateLabelView.textColor =LabelGrayTextColor; receiptDateLabelView.text = @"回执日期:"; receiptDateLabelView.textAlignment = NSTextAlignmentLeft; receiptDateLabelView.font =kTextFont; [self.contentView addSubview: receiptDateLabelView]; NSString *receiptDateStr = [_installationReceiptListModel receiptDate]; receiptDateStr= [DateFormat dateFormatSplit:receiptDateStr]; if(receiptDateStr != nil&&receiptDateStr.length>0){ _receiptDate = [[UILabel alloc] initWithFrame:[frame receiptDateF]]; _receiptDate.backgroundColor = [UIColor clearColor]; _receiptDate.textColor = [UIColor blackColor]; _receiptDate.textAlignment = NSTextAlignmentLeft; _receiptDate.font =kTextFont; [self.contentView addSubview: _receiptDate]; _receiptDate.text=receiptDateStr; } UILabel *receiptStatusLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptStatusF]]; receiptStatusLabelView.backgroundColor = [UIColor clearColor]; receiptStatusLabelView.textColor = LabelGrayTextColor; receiptStatusLabelView.text = @"回执状态:"; receiptStatusLabelView.textAlignment = NSTextAlignmentLeft; receiptStatusLabelView.font =kTextFont; [self.contentView addSubview: receiptStatusLabelView]; NSString *receiptTypeStr = [_installationReceiptListModel receiptType]; if(receiptTypeStr != nil&&receiptTypeStr.length>0){ _receiptType = [[UILabel alloc] initWithFrame:[frame receiptStatusF]]; _receiptType.backgroundColor = [UIColor clearColor]; _receiptType.textColor = [UIColor blackColor]; _receiptType.textAlignment = NSTextAlignmentLeft; _receiptType.font =kTextFont; [self.contentView addSubview: _receiptType]; if ([receiptTypeStr isEqualToString:@"1"]) { self.receiptType.text = @"完成"; } if ([receiptTypeStr isEqualToString:@"3"]) { self.receiptType.text = @"推迟安装"; } } } -(void)goCancelReceipt{ if([self.cancelDelegate respondsToSelector:@selector(cancelReceipt:)]) { [self.cancelDelegate cancelReceipt:_index]; } } @end