DeliveryListCell.m 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. //
  2. // DeliveryListCell.m
  3. // IBOSS
  4. //
  5. // Created by Dongke on 16/1/8.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:配送已回执列表单元格
  9. #import "DeliveryListCell.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation DeliveryListCell
  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. #pragma mark - 私有函数
  31. /**
  32. 设置已回执cell
  33. @param frame <#frame description#>
  34. */
  35. - (void)setReceiptedListFrame:(ReceiptedListFrame *)frame{
  36. _deliveryListModel = frame.deliveryListModel;
  37. UILabel *receiptNoLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptNoF]];
  38. receiptNoLabelView.backgroundColor = [UIColor clearColor];
  39. receiptNoLabelView.textColor = [UIColor blackColor];
  40. receiptNoLabelView.text = @"回执单号:";
  41. receiptNoLabelView.textAlignment = NSTextAlignmentLeft;
  42. receiptNoLabelView.font = kTitleFont;
  43. [self.contentView addSubview: receiptNoLabelView];
  44. NSString *receiptNoStr = [_deliveryListModel recReceiptNo];
  45. if(receiptNoStr != nil&&receiptNoStr.length > 0){
  46. _receiptNo = [[UILabel alloc] initWithFrame:[frame receiptNoF]];
  47. _receiptNo.backgroundColor = [UIColor clearColor];
  48. _receiptNo.textColor = [UIColor blackColor];
  49. _receiptNo.textAlignment = NSTextAlignmentLeft;
  50. _receiptNo.font = kTitleFont;
  51. [self.contentView addSubview: _receiptNo];
  52. _receiptNo.text = receiptNoStr;
  53. }
  54. else{
  55. _btnCancelReceipt=[UIButton buttonWithType:UIButtonTypeCustom];
  56. _btnCancelReceipt.frame=[frame btnCancelReceiptF];
  57. _btnCancelReceipt.titleLabel.font = kTitleFont;
  58. [self.contentView addSubview:_btnCancelReceipt];
  59. [_btnCancelReceipt setTitle:@"撤销" forState:UIControlStateNormal];
  60. [_btnCancelReceipt setTitleColor:[UIColor redColor]forState:UIControlStateNormal];
  61. [_btnCancelReceipt addTarget:self action:@selector(goCancelReceipt) forControlEvents:UIControlEventTouchUpInside];
  62. }
  63. UIView *separator = [UIView new];
  64. separator.frame = [frame separatorF];
  65. separator.backgroundColor = LineBackgroundColor;
  66. [self.contentView addSubview:separator];
  67. UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]];
  68. arrangementNoLabelView.textColor = LabelGrayTextColor;
  69. arrangementNoLabelView.text = @"安排单号:";
  70. arrangementNoLabelView.font = kTextFont;
  71. arrangementNoLabelView.textAlignment = NSTextAlignmentLeft;
  72. [self.contentView addSubview: arrangementNoLabelView];
  73. NSString *arrangmentNoStr = [_deliveryListModel arrangementNo];
  74. if(arrangmentNoStr != nil&&arrangmentNoStr.length > 0){
  75. _arrangementNo = [[UILabel alloc] initWithFrame:[frame arrangementNoF]];
  76. _arrangementNo.backgroundColor = [UIColor clearColor];
  77. _arrangementNo.textColor = [UIColor blackColor];
  78. _arrangementNo.textAlignment = NSTextAlignmentLeft;
  79. _arrangementNo.font = kTextFont;
  80. [self.contentView addSubview:_arrangementNo];
  81. _arrangementNo.text = arrangmentNoStr;
  82. }
  83. UILabel *deliveryNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDeliveryNoF]];
  84. deliveryNoLabelView.textColor = LabelGrayTextColor;
  85. deliveryNoLabelView.text = @"配送单号:";
  86. deliveryNoLabelView.font = kTextFont;
  87. deliveryNoLabelView.textAlignment = NSTextAlignmentLeft;
  88. [self.contentView addSubview: deliveryNoLabelView];
  89. NSString *deliveryNoStr = [_deliveryListModel deliveryNo];
  90. if(deliveryNoStr != nil&&deliveryNoStr.length>0){
  91. _deliveryNo= [[UILabel alloc] initWithFrame:[frame deliveryNoF]];
  92. _deliveryNo.backgroundColor = [UIColor clearColor];
  93. _deliveryNo.textColor = [UIColor blackColor];
  94. _deliveryNo.textAlignment = NSTextAlignmentLeft;
  95. _deliveryNo.font = kTextFont;
  96. [self.contentView addSubview:_deliveryNo];
  97. _deliveryNo.text = deliveryNoStr;
  98. }
  99. UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  100. customerNameLabelView.backgroundColor = [UIColor clearColor];
  101. customerNameLabelView.textColor = LabelGrayTextColor;
  102. customerNameLabelView.text = @"客户名称:";
  103. customerNameLabelView.font = kTextFont;
  104. customerNameLabelView.textAlignment = NSTextAlignmentLeft;
  105. [self.contentView addSubview: customerNameLabelView];
  106. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  107. NSString *customerNameStr = [_deliveryListModel customerName];
  108. if(customerNameStr != nil && customerNameStr.length > 0){
  109. _customerName.backgroundColor = [UIColor clearColor];
  110. _customerName.textColor = [UIColor blackColor];
  111. _customerName.textAlignment = NSTextAlignmentLeft;
  112. _customerName.font = kTextFont;
  113. [self.contentView addSubview:_customerName];
  114. _customerName.text = customerNameStr;
  115. }
  116. UILabel *customerAddressLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]];
  117. customerAddressLabelView.backgroundColor = [UIColor clearColor];
  118. customerAddressLabelView.textColor = LabelGrayTextColor;
  119. customerAddressLabelView.text = @"客户地址:";
  120. customerAddressLabelView.font = kTextFont;
  121. customerAddressLabelView.textAlignment = NSTextAlignmentLeft;
  122. [self.contentView addSubview: customerAddressLabelView];
  123. _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]];
  124. NSString *customerAddressStr = [_deliveryListModel deliveryAddress];
  125. if(customerAddressStr != nil && customerAddressStr.length > 0){
  126. _customerAddress.backgroundColor = [UIColor clearColor];
  127. _customerAddress.textColor = [UIColor blackColor];
  128. _customerAddress.textAlignment = NSTextAlignmentLeft;
  129. _customerAddress.font = kTextFont;
  130. [self.contentView addSubview:_customerAddress];
  131. _customerAddress.text = customerAddressStr;
  132. }
  133. UILabel *customerTelephoneLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]];
  134. customerTelephoneLabelView.backgroundColor = [UIColor clearColor];
  135. customerTelephoneLabelView.textColor = LabelGrayTextColor;
  136. customerTelephoneLabelView.text = @"客户电话:";
  137. customerTelephoneLabelView.font = kTextFont;
  138. customerTelephoneLabelView.textAlignment = NSTextAlignmentLeft;
  139. [self.contentView addSubview: customerTelephoneLabelView];
  140. _customerTelephone = [[UILabel alloc] initWithFrame:[frame customerTelephoneF]];
  141. NSString *customerTelephoneStr = [_deliveryListModel customerTelephone];
  142. if(customerTelephoneStr != nil && customerTelephoneStr.length > 0){
  143. _customerTelephone.backgroundColor = [UIColor clearColor];
  144. _customerTelephone.textColor = [UIColor blackColor];
  145. _customerTelephone.textAlignment = NSTextAlignmentLeft;
  146. _customerTelephone.font = kTextFont;
  147. [self.contentView addSubview:_customerTelephone];
  148. _customerTelephone.text = customerTelephoneStr;
  149. }
  150. UILabel *receiptDateLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptDateF]];
  151. receiptDateLabelView.backgroundColor = [UIColor clearColor];
  152. receiptDateLabelView.textColor = LabelGrayTextColor;
  153. receiptDateLabelView.text = @"回执日期:";
  154. receiptDateLabelView.font = kTextFont;
  155. receiptDateLabelView.textAlignment = NSTextAlignmentLeft;
  156. [self.contentView addSubview:receiptDateLabelView];
  157. NSString *receiptDateStr = [_deliveryListModel receiptTime];
  158. receiptDateStr = [DateFormat dateFormatSplit:receiptDateStr];
  159. if(receiptDateStr != nil&&receiptDateStr.length > 0){
  160. _receiptDate = [[UILabel alloc] initWithFrame:[frame receiptDateF]];
  161. _receiptDate.backgroundColor = [UIColor clearColor];
  162. _receiptDate.textColor = [UIColor blackColor];
  163. _receiptDate.textAlignment = NSTextAlignmentLeft;
  164. _receiptDate.font = kTextFont;
  165. [self.contentView addSubview:_receiptDate];
  166. _receiptDate.text = receiptDateStr;
  167. }
  168. UILabel *lblReceiptStatus = [[UILabel alloc] initWithFrame:[frame lblReceiptStatusF]];
  169. lblReceiptStatus.backgroundColor = [UIColor clearColor];
  170. lblReceiptStatus.textColor = LabelGrayTextColor;
  171. lblReceiptStatus.text = @"回执状态:";
  172. lblReceiptStatus.textAlignment = NSTextAlignmentLeft;
  173. lblReceiptStatus.font = kTextFont;
  174. [self.contentView addSubview:lblReceiptStatus];
  175. NSInteger receiptType = [_deliveryListModel receiptType];
  176. NSString *receiptTypeStr;
  177. if(receiptType == 1){
  178. receiptTypeStr = @"完成";
  179. }
  180. else if(receiptType == 2){
  181. receiptTypeStr = @"推迟送货";
  182. }else{
  183. receiptTypeStr = @"全部";
  184. }
  185. if(receiptTypeStr == nil||receiptTypeStr.length>0){
  186. UILabel *receiptType = [[UILabel alloc] initWithFrame:[frame receiptStatusF]];
  187. receiptType.backgroundColor = [UIColor clearColor];
  188. receiptType.textColor = [UIColor blackColor];
  189. receiptType.text=receiptTypeStr;
  190. receiptType.textAlignment = NSTextAlignmentLeft;
  191. receiptType.font = kTextFont;
  192. [self.contentView addSubview:receiptType];
  193. }
  194. }
  195. -(void)goCancelReceipt{
  196. if([self.cancelDelegate respondsToSelector:@selector(cancelReceipt:)])
  197. {
  198. [self.cancelDelegate cancelReceipt:_index];
  199. }
  200. }
  201. @end