UnReceiptListCell.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. //
  2. // UnReceiptListCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 16/4/14.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:配送未回执列表单元格
  9. #import "UnReceiptListCell.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @interface UnReceiptListCell(){
  14. }
  15. @end
  16. @implementation UnReceiptListCell
  17. #pragma mark - 公共函数
  18. /**
  19. 初始化单元格
  20. @param style <#style description#>
  21. @param reuseIdentifier <#reuseIdentifier description#>
  22. @return <#return value description#>
  23. */
  24. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  25. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  26. if (self) {
  27. self.layer.cornerRadius=CornerRadius;
  28. self.layer.backgroundColor = [UIColor clearColor].CGColor;
  29. self.layer.masksToBounds=YES;
  30. }
  31. return self;
  32. }
  33. /**
  34. 单元格选中事件
  35. @param selected <#selected description#>
  36. @param animated <#animated description#>
  37. */
  38. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  39. [super setSelected:selected animated:animated];
  40. }
  41. /**
  42. 设置未回执frame
  43. @param frame <#frame description#>
  44. */
  45. - (void)setUnReceiptListFrame:(UnReceiptListFrame *)frame{
  46. UILabel *deliveryNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDeliveryNoF]];
  47. deliveryNoLabelView.backgroundColor = [UIColor clearColor];
  48. deliveryNoLabelView.textColor = [UIColor blackColor];
  49. deliveryNoLabelView.text = @"送货单号:";
  50. deliveryNoLabelView.textAlignment = NSTextAlignmentLeft;
  51. deliveryNoLabelView.font = kTitleFont;
  52. [self.contentView addSubview: deliveryNoLabelView];
  53. NSString *deliveryNoStr = [frame.unReceiptListModel deliveryNo];
  54. if(deliveryNoStr != nil&&deliveryNoStr.length>0){
  55. _deliveryNo = [[UILabel alloc] initWithFrame:[frame deliveryNoF]];
  56. _deliveryNo.backgroundColor = [UIColor clearColor];
  57. _deliveryNo.textColor = [UIColor blackColor];
  58. _deliveryNo.textAlignment = NSTextAlignmentLeft;
  59. _deliveryNo.font = kTitleFont;
  60. [self.contentView addSubview: _deliveryNo];
  61. _deliveryNo.text=deliveryNoStr;
  62. }
  63. _btnDialTelephone=[UIButton buttonWithType:UIButtonTypeCustom];
  64. _btnDialTelephone.frame=[frame btnDialTelephoneF];
  65. [self.contentView addSubview:_btnDialTelephone];
  66. [_btnDialTelephone addTarget:self action:@selector(dialTelephone) forControlEvents:UIControlEventTouchUpInside];
  67. UIImageView *telephoneImg = [[UIImageView alloc]init];
  68. telephoneImg.frame=CGRectMake(0,0,32,32);
  69. [telephoneImg setImage:[UIImage imageNamed:@"dial_telephone"]];
  70. telephoneImg.userInteractionEnabled=NO;
  71. [_btnDialTelephone addSubview:telephoneImg];
  72. UIView *separator = [UIView new];
  73. separator.frame = [frame separatorF];
  74. separator.backgroundColor = LineBackgroundColor;
  75. [self.contentView 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.contentView addSubview: arrangementNoLabelView];
  82. NSString *arrangmentNoStr = [frame.unReceiptListModel 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.contentView addSubview:_arrangementNo];
  90. _arrangementNo.text=arrangmentNoStr;
  91. }
  92. UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  93. customerNameLabelView.backgroundColor = [UIColor clearColor];
  94. customerNameLabelView.textColor = LabelGrayTextColor;
  95. customerNameLabelView.text = @"客户名称:";
  96. customerNameLabelView.font =kTextFont;
  97. customerNameLabelView.textAlignment = NSTextAlignmentLeft;
  98. [self.contentView addSubview: customerNameLabelView];
  99. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  100. NSString *customerNameStr = [frame.unReceiptListModel customerName];
  101. if(customerNameStr != nil&&customerNameStr.length>0){
  102. _customerName.backgroundColor = [UIColor clearColor];
  103. _customerName.textColor = [UIColor blackColor];
  104. _customerName.textAlignment = NSTextAlignmentLeft;
  105. _customerName.font =kTextFont;
  106. [self.contentView addSubview:_customerName];
  107. _customerName.text=customerNameStr;
  108. }
  109. UILabel *telephoneLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]];
  110. telephoneLabelView.backgroundColor = [UIColor clearColor];
  111. telephoneLabelView.textColor =LabelGrayTextColor;
  112. telephoneLabelView.text = @"客户电话:";
  113. telephoneLabelView.font =kTextFont;
  114. telephoneLabelView.textAlignment = NSTextAlignmentLeft;
  115. [self.contentView addSubview:telephoneLabelView];
  116. NSString *telephoneStr= [frame.unReceiptListModel telephone];
  117. _telephoneNumber=telephoneStr;
  118. if(telephoneStr != nil&&telephoneStr.length>0){
  119. _telephone= [[UILabel alloc] initWithFrame:[frame customerTelephoneF]];
  120. _telephone.backgroundColor = [UIColor clearColor];
  121. _telephone.textColor = [UIColor blackColor];
  122. _telephone.textAlignment = NSTextAlignmentLeft;
  123. _telephone.font =kTextFont;
  124. [self.contentView addSubview:_telephone];
  125. _telephone.text=telephoneStr;
  126. }
  127. UILabel *lblDeliveryDate = [[UILabel alloc] initWithFrame:[frame lblDeliveryDateF]];
  128. lblDeliveryDate.backgroundColor = [UIColor clearColor];
  129. lblDeliveryDate.textColor = LabelGrayTextColor;
  130. lblDeliveryDate.text = @"送货日期:";
  131. lblDeliveryDate.textAlignment = NSTextAlignmentLeft;
  132. lblDeliveryDate.font =kTextFont;
  133. [self.contentView addSubview:lblDeliveryDate];
  134. NSString *deliveryDateStr = [frame.unReceiptListModel deliveryDate];
  135. deliveryDateStr= [DateFormat dateFormatSplit:deliveryDateStr];
  136. if(deliveryDateStr == nil||deliveryDateStr.length>0){
  137. UILabel *deliveryDate= [[UILabel alloc] initWithFrame:[frame deliveryDateF]];
  138. deliveryDate.backgroundColor = [UIColor clearColor];
  139. deliveryDate.textColor = [UIColor blackColor];
  140. deliveryDate.text=deliveryDateStr;
  141. deliveryDate.textAlignment = NSTextAlignmentLeft;
  142. deliveryDate.font =kTextFont;
  143. [self.contentView addSubview:deliveryDate];
  144. }
  145. UILabel *lblTruckName= [[UILabel alloc] initWithFrame:[frame lblTruckNameF]];
  146. lblTruckName.backgroundColor = [UIColor clearColor];
  147. lblTruckName.textColor = LabelGrayTextColor;
  148. lblTruckName.text = @"车牌号码:";
  149. lblTruckName.font =kTextFont;
  150. lblTruckName.textAlignment = NSTextAlignmentLeft;
  151. [self.contentView addSubview: lblTruckName];
  152. NSString *truckNameStr = [frame.unReceiptListModel truckName];
  153. if(truckNameStr != nil&&truckNameStr.length>0){
  154. _truckName = [[UILabel alloc] initWithFrame:[frame truckNameF]];
  155. _truckName.backgroundColor = [UIColor clearColor];
  156. _truckName.textColor = [UIColor blackColor];
  157. _truckName.textAlignment = NSTextAlignmentLeft;
  158. _truckName.font =kTextFont;
  159. [self.contentView addSubview:_truckName];
  160. _truckName.text=truckNameStr;
  161. }
  162. UILabel *lblCustomerAddress= [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]];
  163. lblCustomerAddress.backgroundColor = [UIColor clearColor];
  164. lblCustomerAddress.textColor = LabelGrayTextColor;
  165. lblCustomerAddress.text = @"客户地址:";
  166. lblCustomerAddress.font =kTextFont;
  167. lblCustomerAddress.textAlignment = NSTextAlignmentLeft;
  168. [self.contentView addSubview: lblCustomerAddress];
  169. NSString *customerAddressStr = [frame.unReceiptListModel deliveryAddress];
  170. _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]];
  171. _customerAddress.backgroundColor = [UIColor clearColor];
  172. _customerAddress.textColor = [UIColor blackColor];
  173. _customerAddress.textAlignment = NSTextAlignmentLeft;
  174. _customerAddress.numberOfLines=0;
  175. _customerAddress.font =kTextFont;
  176. [self.contentView addSubview:_customerAddress];
  177. _customerAddress.text=customerAddressStr;
  178. NSString *organizationName=[frame.unReceiptListModel organizationName];
  179. NSString *staffName=[frame.unReceiptListModel staffName];
  180. UILabel *lblTitleOrganization= [[UILabel alloc] initWithFrame:[frame lblOrganizationNameF]];
  181. lblTitleOrganization.backgroundColor = [UIColor clearColor];
  182. lblTitleOrganization.textColor = LabelGrayTextColor;
  183. lblTitleOrganization.text = @"业务部门:";
  184. lblTitleOrganization.font =kTextFont;
  185. lblTitleOrganization.textAlignment = NSTextAlignmentLeft;
  186. [self.contentView addSubview: lblTitleOrganization];
  187. if(organizationName!=nil&&organizationName.length>0){
  188. _lblDepartment = [[UILabel alloc] initWithFrame:[frame organizationNameF]];
  189. _lblDepartment.backgroundColor = [UIColor clearColor];
  190. _lblDepartment.textColor = [UIColor blackColor];
  191. _lblDepartment.textAlignment = NSTextAlignmentLeft;
  192. _lblDepartment.numberOfLines=0;
  193. _lblDepartment.font =kTextFont;
  194. [self.contentView addSubview:_lblDepartment];
  195. _lblDepartment.text=organizationName;
  196. }
  197. UILabel *lblTitleStaff= [[UILabel alloc] initWithFrame:[frame lblStaffNameF]];
  198. lblTitleStaff.backgroundColor = [UIColor clearColor];
  199. lblTitleStaff.textColor = LabelGrayTextColor;
  200. lblTitleStaff.text = @"业 务 员:";
  201. lblTitleStaff.font =kTextFont;
  202. lblTitleStaff.textAlignment = NSTextAlignmentLeft;
  203. [self.contentView addSubview: lblTitleStaff];
  204. if(staffName!=nil&&staffName.length>0){
  205. _lblStaff = [[UILabel alloc] initWithFrame:[frame staffNameF]];
  206. _lblStaff.backgroundColor = [UIColor clearColor];
  207. _lblStaff.textColor = [UIColor blackColor];
  208. _lblStaff.textAlignment = NSTextAlignmentLeft;
  209. _lblStaff.numberOfLines=0;
  210. _lblStaff.font =kTextFont;
  211. [self.contentView addSubview:_lblStaff];
  212. _lblStaff.text=staffName;
  213. }
  214. }
  215. -(void)dialTelephone{
  216. if(_telephoneNumber!=nil&&_telephoneNumber.length>0)
  217. if([self.telephoneDelegate respondsToSelector:@selector(dialTelephone:)])
  218. {
  219. [self.telephoneDelegate dialTelephone:_telephoneNumber];
  220. }
  221. }
  222. @end