| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- //
- // RequirementReceiptCell.m
- // IBOSSHSH
- //
- // Created by ssl on 2018/1/12.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "RequirementReceiptCell.h"
- #import "DateFormat.h"
- #import "UIColor+hexColor.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- #define kTitleFont [UIFont systemFontOfSize:14]
- @implementation RequirementReceiptCell
- #pragma mark - 公共函数
- /**
- 初始化tableview cell
- @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
- @param animated
- */
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
-
- }
- #pragma mark - 私有函数
- /**
- 设置已回执cell
- @param frame <#frame description#>
- */
- - (void)setReceiptedListFrame:(RequirementReceiptFrame *)frame{
- _deliveryListModel = frame.deliveryListModel;
- UILabel *receiptNoLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptNoF]];
- receiptNoLabelView.backgroundColor = [UIColor clearColor];
- receiptNoLabelView.textColor = [UIColor blackColor];
- receiptNoLabelView.text = @"回执单号:";
- receiptNoLabelView.textAlignment = NSTextAlignmentLeft;
- receiptNoLabelView.font = kTitleFont;
- [self addSubview: receiptNoLabelView];
- NSString *receiptNoStr = [_deliveryListModel recReceiptNo];
- 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 addSubview: _receiptNo];
- _receiptNo.text = receiptNoStr;
- }
-
- UILabel *receiptState = [[UILabel alloc] initWithFrame:frame.lblReceiptStateFrame];
- receiptState.backgroundColor = [UIColor clearColor];
- receiptState.textColor = [UIColor blackColor];
- if([_deliveryListModel.recReceiptType isEqualToString:@"1"]){
- receiptState.text = @"撤销回执";
- }else{
- receiptState.text = @"回执";
- }
-
- receiptState.textAlignment = NSTextAlignmentLeft;
- receiptState.font = kTitleFont;
- [self addSubview: receiptState];
-
-
- UIView *separator = [UIView new];
- separator.frame = [frame separatorF];
- separator.backgroundColor = LineBackgroundColor;
- [self addSubview:separator];
-
- UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]];
- arrangementNoLabelView.textColor = LabelGrayTextColor;
- arrangementNoLabelView.text = @"安排单号:";
- arrangementNoLabelView.font = kTextFont;
- arrangementNoLabelView.textAlignment = NSTextAlignmentLeft;
- [self addSubview: arrangementNoLabelView];
- NSString *arrangmentNoStr = [_deliveryListModel arrangementNo];
- if(arrangmentNoStr != nil&&arrangmentNoStr.length > 0){
- _arrangementNo = [[UILabel alloc] initWithFrame:[frame arrangementNoF]];
- _arrangementNo.backgroundColor = [UIColor clearColor];
- _arrangementNo.textColor = [UIColor blackColor];
- _arrangementNo.textAlignment = NSTextAlignmentLeft;
- _arrangementNo.font = kTextFont;
- [self addSubview:_arrangementNo];
- _arrangementNo.text = arrangmentNoStr;
- }
-
- UILabel *deliveryNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDeliveryNoF]];
- deliveryNoLabelView.textColor = LabelGrayTextColor;
- deliveryNoLabelView.text = @"送安单号:";
- deliveryNoLabelView.font = kTextFont;
- deliveryNoLabelView.textAlignment = NSTextAlignmentLeft;
- [self addSubview: deliveryNoLabelView];
- NSString *deliveryNoStr = [_deliveryListModel deliveryNo];
- if(deliveryNoStr != nil&&deliveryNoStr.length>0){
- _deliveryNo= [[UILabel alloc] initWithFrame:[frame deliveryNoF]];
- _deliveryNo.backgroundColor = [UIColor clearColor];
- _deliveryNo.textColor = [UIColor blackColor];
- _deliveryNo.textAlignment = NSTextAlignmentLeft;
- _deliveryNo.font = kTextFont;
- [self addSubview:_deliveryNo];
- _deliveryNo.text = deliveryNoStr;
- }
-
- UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
- customerNameLabelView.backgroundColor = [UIColor clearColor];
- customerNameLabelView.textColor = LabelGrayTextColor;
- customerNameLabelView.text = @"客户名称:";
- customerNameLabelView.font = kTextFont;
- customerNameLabelView.textAlignment = NSTextAlignmentLeft;
- [self addSubview: customerNameLabelView];
- _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
- NSString *customerNameStr = [_deliveryListModel customerName];
- if(customerNameStr != nil && customerNameStr.length > 0){
- _customerName.backgroundColor = [UIColor clearColor];
- _customerName.textColor = [UIColor blackColor];
- _customerName.textAlignment = NSTextAlignmentLeft;
- _customerName.font = kTextFont;
- [self addSubview:_customerName];
- _customerName.text = customerNameStr;
- }
-
- UILabel *receiptDateLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptDateF]];
- receiptDateLabelView.backgroundColor = [UIColor clearColor];
- receiptDateLabelView.textColor = LabelGrayTextColor;
- receiptDateLabelView.text = @"回执日期:";
- receiptDateLabelView.font = kTextFont;
- receiptDateLabelView.textAlignment = NSTextAlignmentLeft;
- [self addSubview:receiptDateLabelView];
-
- NSString *receiptDateStr = [_deliveryListModel receiptTime];
- 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 addSubview:_receiptDate];
- _receiptDate.text = receiptDateStr;
- }
- UILabel *lblReceiptStatus = [[UILabel alloc] initWithFrame:[frame lblReceiptStatusF]];
- lblReceiptStatus.backgroundColor = [UIColor clearColor];
- lblReceiptStatus.textColor = LabelGrayTextColor;
- lblReceiptStatus.text = @"回执状态:";
- lblReceiptStatus.textAlignment = NSTextAlignmentLeft;
- lblReceiptStatus.font = kTextFont;
- [self addSubview:lblReceiptStatus];
- NSInteger receiptType = [_deliveryListModel receiptType];
- NSString *receiptTypeStr;
- if(receiptType == 1){
- receiptTypeStr = @"完成";
- }
- else if(receiptType == 2){
- receiptTypeStr = @"推迟送安";
- }
-
- if(receiptTypeStr == nil||receiptTypeStr.length>0){
- UILabel *receiptType = [[UILabel alloc] initWithFrame:[frame receiptStatusF]];
- receiptType.backgroundColor = [UIColor clearColor];
- receiptType.textColor = [UIColor blackColor];
- receiptType.text=receiptTypeStr;
- receiptType.textAlignment = NSTextAlignmentLeft;
- receiptType.font = kTextFont;
- [self addSubview:receiptType];
- }
-
-
- UIView *bottomLine = [[UIView alloc] init];
- bottomLine.backgroundColor = LineBackgroundColor;
- bottomLine.frame =[frame bottomLineF];
- [self addSubview:bottomLine];
-
- UIButton *btnReturnReceipt = [UIButton buttonWithType:UIButtonTypeCustom];
- //btnReturnReceipt.titleLabel.text = @"撤销";
- [btnReturnReceipt setTitle:@"撤销" forState: UIControlStateNormal];
- btnReturnReceipt.titleLabel.font=[UIFont systemFontOfSize:14];
- if([_deliveryListModel.recReceiptType isEqualToString:@"1"]){
-
- [btnReturnReceipt setBackgroundColor:[UIColor hexColor:@"EBEBEB"]];
-
- }else{
- [btnReturnReceipt setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
- }
- [btnReturnReceipt.layer setCornerRadius:5];
- btnReturnReceipt.frame = [frame returnReceiptF];
- [self addSubview:btnReturnReceipt];
- if(![_deliveryListModel.recReceiptType isEqualToString:@"1"]){
- [btnReturnReceipt addTarget:self action:@selector(showReturnReceipt) forControlEvents:UIControlEventTouchUpInside];
- }
- }
- /**
- 撤销回执
- */
- - (void)showReturnReceipt{
- [_delegate showReturnReceipt:_deliveryListModel];
- }
- @end
|