| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- //
- // DeliveryListCell.m
- // IBOSS
- //
- // Created by Dongke on 16/1/8.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- // 功能描述:配送已回执列表单元格
- #import "DeliveryListCell.h"
- #import "DateFormat.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- #define kTitleFont [UIFont systemFontOfSize:14]
- @implementation DeliveryListCell
- #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;
- }
- #pragma mark - 私有函数
- /**
- 设置已回执cell
- @param frame <#frame description#>
- */
- - (void)setReceiptedListFrame:(ReceiptedListFrame *)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.contentView 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.contentView addSubview: _receiptNo];
- _receiptNo.text = receiptNoStr;
-
- }
- else{
- _btnCancelReceipt=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnCancelReceipt.frame=[frame btnCancelReceiptF];
- _btnCancelReceipt.titleLabel.font = kTitleFont;
- [self.contentView addSubview:_btnCancelReceipt];
- [_btnCancelReceipt setTitle:@"撤销" forState:UIControlStateNormal];
- [_btnCancelReceipt setTitleColor:[UIColor redColor]forState:UIControlStateNormal];
- [_btnCancelReceipt addTarget:self action:@selector(goCancelReceipt) forControlEvents:UIControlEventTouchUpInside];
-
- }
- UIView *separator = [UIView new];
- separator.frame = [frame separatorF];
- separator.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:separator];
-
- UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]];
- arrangementNoLabelView.textColor = LabelGrayTextColor;
- arrangementNoLabelView.text = @"安排单号:";
- arrangementNoLabelView.font = kTextFont;
- arrangementNoLabelView.textAlignment = NSTextAlignmentLeft;
- [self.contentView 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.contentView addSubview:_arrangementNo];
- _arrangementNo.text = arrangmentNoStr;
- }
-
- UILabel *deliveryNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDeliveryNoF]];
- deliveryNoLabelView.textColor = LabelGrayTextColor;
- deliveryNoLabelView.text = @"配送单号:";
- deliveryNoLabelView.font = kTextFont;
- deliveryNoLabelView.textAlignment = NSTextAlignmentLeft;
- [self.contentView 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.contentView 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.contentView 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.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 = [_deliveryListModel deliveryAddress];
- 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 = [_deliveryListModel 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.font = kTextFont;
- receiptDateLabelView.textAlignment = NSTextAlignmentLeft;
- [self.contentView 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.contentView 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.contentView addSubview:lblReceiptStatus];
- NSInteger receiptType = [_deliveryListModel receiptType];
- NSString *receiptTypeStr;
- if(receiptType == 1){
- receiptTypeStr = @"完成";
- }
- else if(receiptType == 2){
- receiptTypeStr = @"推迟送货";
- }else{
- 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.contentView addSubview:receiptType];
- }
-
- }
- -(void)goCancelReceipt{
- if([self.cancelDelegate respondsToSelector:@selector(cancelReceipt:)])
- {
- [self.cancelDelegate cancelReceipt:_index];
- }
- }
- @end
|