RequirementReceiptCell.m 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. //
  2. // RequirementReceiptCell.m
  3. // IBOSSHSH
  4. //
  5. // Created by ssl on 2018/1/12.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "RequirementReceiptCell.h"
  9. #import "DateFormat.h"
  10. #import "UIColor+hexColor.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation RequirementReceiptCell
  14. #pragma mark - 公共函数
  15. /**
  16. 初始化tableview cell
  17. @param style <#style description#>
  18. @param reuseIdentifier <#reuseIdentifier description#>
  19. @return <#return value description#>
  20. */
  21. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  22. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  23. if (self) {
  24. self.layer.cornerRadius = CornerRadius;
  25. self.layer.backgroundColor = [UIColor clearColor].CGColor;
  26. self.layer.masksToBounds = YES;
  27. }
  28. return self;
  29. }
  30. /**
  31. 点击效果
  32. @param selected
  33. @param animated
  34. */
  35. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  36. }
  37. #pragma mark - 私有函数
  38. /**
  39. 设置已回执cell
  40. @param frame <#frame description#>
  41. */
  42. - (void)setReceiptedListFrame:(RequirementReceiptFrame *)frame{
  43. _deliveryListModel = frame.deliveryListModel;
  44. UILabel *receiptNoLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptNoF]];
  45. receiptNoLabelView.backgroundColor = [UIColor clearColor];
  46. receiptNoLabelView.textColor = [UIColor blackColor];
  47. receiptNoLabelView.text = @"回执单号:";
  48. receiptNoLabelView.textAlignment = NSTextAlignmentLeft;
  49. receiptNoLabelView.font = kTitleFont;
  50. [self addSubview: receiptNoLabelView];
  51. NSString *receiptNoStr = [_deliveryListModel recReceiptNo];
  52. if(receiptNoStr != nil&&receiptNoStr.length > 0){
  53. _receiptNo = [[UILabel alloc] initWithFrame:[frame receiptNoF]];
  54. _receiptNo.backgroundColor = [UIColor clearColor];
  55. _receiptNo.textColor = [UIColor blackColor];
  56. _receiptNo.textAlignment = NSTextAlignmentLeft;
  57. _receiptNo.font = kTitleFont;
  58. [self addSubview: _receiptNo];
  59. _receiptNo.text = receiptNoStr;
  60. }
  61. UILabel *receiptState = [[UILabel alloc] initWithFrame:frame.lblReceiptStateFrame];
  62. receiptState.backgroundColor = [UIColor clearColor];
  63. receiptState.textColor = [UIColor blackColor];
  64. if([_deliveryListModel.recReceiptType isEqualToString:@"1"]){
  65. receiptState.text = @"撤销回执";
  66. }else{
  67. receiptState.text = @"回执";
  68. }
  69. receiptState.textAlignment = NSTextAlignmentLeft;
  70. receiptState.font = kTitleFont;
  71. [self addSubview: receiptState];
  72. UIView *separator = [UIView new];
  73. separator.frame = [frame separatorF];
  74. separator.backgroundColor = LineBackgroundColor;
  75. [self addSubview:separator];
  76. UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]];
  77. arrangementNoLabelView.textColor = LabelGrayTextColor;
  78. arrangementNoLabelView.text = @"安排单号:";
  79. arrangementNoLabelView.font = kTextFont;
  80. arrangementNoLabelView.textAlignment = NSTextAlignmentLeft;
  81. [self addSubview: arrangementNoLabelView];
  82. NSString *arrangmentNoStr = [_deliveryListModel arrangementNo];
  83. if(arrangmentNoStr != nil&&arrangmentNoStr.length > 0){
  84. _arrangementNo = [[UILabel alloc] initWithFrame:[frame arrangementNoF]];
  85. _arrangementNo.backgroundColor = [UIColor clearColor];
  86. _arrangementNo.textColor = [UIColor blackColor];
  87. _arrangementNo.textAlignment = NSTextAlignmentLeft;
  88. _arrangementNo.font = kTextFont;
  89. [self addSubview:_arrangementNo];
  90. _arrangementNo.text = arrangmentNoStr;
  91. }
  92. UILabel *deliveryNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDeliveryNoF]];
  93. deliveryNoLabelView.textColor = LabelGrayTextColor;
  94. deliveryNoLabelView.text = @"送安单号:";
  95. deliveryNoLabelView.font = kTextFont;
  96. deliveryNoLabelView.textAlignment = NSTextAlignmentLeft;
  97. [self addSubview: deliveryNoLabelView];
  98. NSString *deliveryNoStr = [_deliveryListModel deliveryNo];
  99. if(deliveryNoStr != nil&&deliveryNoStr.length>0){
  100. _deliveryNo= [[UILabel alloc] initWithFrame:[frame deliveryNoF]];
  101. _deliveryNo.backgroundColor = [UIColor clearColor];
  102. _deliveryNo.textColor = [UIColor blackColor];
  103. _deliveryNo.textAlignment = NSTextAlignmentLeft;
  104. _deliveryNo.font = kTextFont;
  105. [self addSubview:_deliveryNo];
  106. _deliveryNo.text = deliveryNoStr;
  107. }
  108. UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  109. customerNameLabelView.backgroundColor = [UIColor clearColor];
  110. customerNameLabelView.textColor = LabelGrayTextColor;
  111. customerNameLabelView.text = @"客户名称:";
  112. customerNameLabelView.font = kTextFont;
  113. customerNameLabelView.textAlignment = NSTextAlignmentLeft;
  114. [self addSubview: customerNameLabelView];
  115. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  116. NSString *customerNameStr = [_deliveryListModel customerName];
  117. if(customerNameStr != nil && customerNameStr.length > 0){
  118. _customerName.backgroundColor = [UIColor clearColor];
  119. _customerName.textColor = [UIColor blackColor];
  120. _customerName.textAlignment = NSTextAlignmentLeft;
  121. _customerName.font = kTextFont;
  122. [self addSubview:_customerName];
  123. _customerName.text = customerNameStr;
  124. }
  125. UILabel *receiptDateLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptDateF]];
  126. receiptDateLabelView.backgroundColor = [UIColor clearColor];
  127. receiptDateLabelView.textColor = LabelGrayTextColor;
  128. receiptDateLabelView.text = @"回执日期:";
  129. receiptDateLabelView.font = kTextFont;
  130. receiptDateLabelView.textAlignment = NSTextAlignmentLeft;
  131. [self addSubview:receiptDateLabelView];
  132. NSString *receiptDateStr = [_deliveryListModel receiptTime];
  133. receiptDateStr = [DateFormat dateFormatSplit:receiptDateStr];
  134. if(receiptDateStr != nil&&receiptDateStr.length > 0){
  135. _receiptDate = [[UILabel alloc] initWithFrame:[frame receiptDateF]];
  136. _receiptDate.backgroundColor = [UIColor clearColor];
  137. _receiptDate.textColor = [UIColor blackColor];
  138. _receiptDate.textAlignment = NSTextAlignmentLeft;
  139. _receiptDate.font = kTextFont;
  140. [self addSubview:_receiptDate];
  141. _receiptDate.text = receiptDateStr;
  142. }
  143. UILabel *lblReceiptStatus = [[UILabel alloc] initWithFrame:[frame lblReceiptStatusF]];
  144. lblReceiptStatus.backgroundColor = [UIColor clearColor];
  145. lblReceiptStatus.textColor = LabelGrayTextColor;
  146. lblReceiptStatus.text = @"回执状态:";
  147. lblReceiptStatus.textAlignment = NSTextAlignmentLeft;
  148. lblReceiptStatus.font = kTextFont;
  149. [self addSubview:lblReceiptStatus];
  150. NSInteger receiptType = [_deliveryListModel receiptType];
  151. NSString *receiptTypeStr;
  152. if(receiptType == 1){
  153. receiptTypeStr = @"完成";
  154. }
  155. else if(receiptType == 2){
  156. receiptTypeStr = @"推迟送安";
  157. }
  158. if(receiptTypeStr == nil||receiptTypeStr.length>0){
  159. UILabel *receiptType = [[UILabel alloc] initWithFrame:[frame receiptStatusF]];
  160. receiptType.backgroundColor = [UIColor clearColor];
  161. receiptType.textColor = [UIColor blackColor];
  162. receiptType.text=receiptTypeStr;
  163. receiptType.textAlignment = NSTextAlignmentLeft;
  164. receiptType.font = kTextFont;
  165. [self addSubview:receiptType];
  166. }
  167. UIView *bottomLine = [[UIView alloc] init];
  168. bottomLine.backgroundColor = LineBackgroundColor;
  169. bottomLine.frame =[frame bottomLineF];
  170. [self addSubview:bottomLine];
  171. UIButton *btnReturnReceipt = [UIButton buttonWithType:UIButtonTypeCustom];
  172. //btnReturnReceipt.titleLabel.text = @"撤销";
  173. [btnReturnReceipt setTitle:@"撤销" forState: UIControlStateNormal];
  174. btnReturnReceipt.titleLabel.font=[UIFont systemFontOfSize:14];
  175. if([_deliveryListModel.recReceiptType isEqualToString:@"1"]){
  176. [btnReturnReceipt setBackgroundColor:[UIColor hexColor:@"EBEBEB"]];
  177. }else{
  178. [btnReturnReceipt setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  179. }
  180. [btnReturnReceipt.layer setCornerRadius:5];
  181. btnReturnReceipt.frame = [frame returnReceiptF];
  182. [self addSubview:btnReturnReceipt];
  183. if(![_deliveryListModel.recReceiptType isEqualToString:@"1"]){
  184. [btnReturnReceipt addTarget:self action:@selector(showReturnReceipt) forControlEvents:UIControlEventTouchUpInside];
  185. }
  186. }
  187. /**
  188. 撤销回执
  189. */
  190. - (void)showReturnReceipt{
  191. [_delegate showReturnReceipt:_deliveryListModel];
  192. }
  193. @end