RequirementReceiptFrame.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // RequirementReceiptFrame.m
  3. // IBOSSHSH
  4. //
  5. // Created by ssl on 2018/1/12.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "RequirementReceiptFrame.h"
  9. #import "NSString+Tools.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation RequirementReceiptFrame
  14. #pragma mark - 私有函数
  15. - (void)setReceiptedListFrame:(RequirementReceiptModel *)deliveryListModel{
  16. _deliveryListModel = deliveryListModel;
  17. NSDictionary *receiptDict = @{NSFontAttributeName:kTitleFont};
  18. CGFloat xpadding = 10;
  19. NSString *receiptNoTitle = @"回执单号:";
  20. CGRect lblReceiptNoFrame = [receiptNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  21. lblReceiptNoFrame.origin.x = xpadding;
  22. lblReceiptNoFrame.origin.y = 15;
  23. _lblReceiptNoF = lblReceiptNoFrame;
  24. NSString *receiptNo = [deliveryListModel recReceiptNo];
  25. if(receiptNo != nil && receiptNo.length > 0){
  26. CGRect receiptNoFrame = [receiptNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:receiptDict];
  27. receiptNoFrame.origin.x = CGRectGetMaxX(_lblReceiptNoF);
  28. receiptNoFrame.origin.y = 15;
  29. _receiptNoF=receiptNoFrame;
  30. }
  31. NSString *receiptState;
  32. if([deliveryListModel.recReceiptType isEqualToString:@"1"]){
  33. receiptState = @"撤销回执";
  34. }else{
  35. receiptState = @"回执";
  36. }
  37. CGRect lblReceiptStateFrame = [receiptState textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  38. lblReceiptStateFrame.origin.x = SCREENWIDTH-40-CGRectGetWidth(lblReceiptStateFrame);
  39. lblReceiptStateFrame.origin.y = 15;
  40. _lblReceiptStateFrame = lblReceiptStateFrame;
  41. _separatorF=CGRectMake(0,CGRectGetMaxY(_lblReceiptNoF)+15, Screen_Width, 1);
  42. NSString *arrangementNoTitle = @"安排单号:";
  43. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  44. lblArrangementNoFrame.origin.x = xpadding;
  45. lblArrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  46. _lblArrangementNoF = lblArrangementNoFrame;
  47. NSString *arrangementNo = [_deliveryListModel arrangementNo];
  48. if(arrangementNo != nil&&arrangementNo.length > 0){
  49. CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:receiptDict];
  50. arrangementNoFrame.origin.x = CGRectGetMaxX(_lblArrangementNoF) ;
  51. arrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  52. _arrangementNoF = arrangementNoFrame;
  53. }
  54. NSString *deliveryNoTitle = @"配送单号:";
  55. CGRect lblDeliveryNoFrame = [deliveryNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  56. lblDeliveryNoFrame.origin.x = xpadding;
  57. lblDeliveryNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
  58. _lblDeliveryNoF = lblDeliveryNoFrame;
  59. NSString *deliveryNo = [deliveryListModel deliveryNo];
  60. if(deliveryNo != nil&&deliveryNo.length > 0){
  61. CGRect deliveryNoFrame = [deliveryNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:receiptDict];
  62. deliveryNoFrame.origin.x = CGRectGetMaxX(_lblDeliveryNoF) ;
  63. deliveryNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
  64. _deliveryNoF = deliveryNoFrame;
  65. }
  66. NSString *customerNameTitle = @"客户名称:";
  67. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  68. lblCustomerNameFrame.origin.x = xpadding;
  69. lblCustomerNameFrame.origin.y = CGRectGetMaxY(_lblDeliveryNoF) + 15;
  70. _lblCustomerNameF = lblCustomerNameFrame;
  71. NSString *customerName = [_deliveryListModel customerName];
  72. if(customerName != nil && customerName.length > 0){
  73. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:receiptDict];
  74. customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF)+2;
  75. customerNameFrame.origin.y = CGRectGetMaxY(_lblDeliveryNoF)+15;
  76. _customerNameF = customerNameFrame;
  77. }
  78. NSString *receiptDateTitle = @"回执日期:";
  79. CGRect lblReceiptDateFrame = [receiptDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  80. lblReceiptDateFrame.origin.x = xpadding;
  81. lblReceiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  82. _lblReceiptDateF = lblReceiptDateFrame;
  83. NSString *receiptDate = [_deliveryListModel receiptTime];
  84. receiptDate = [DateFormat dateFormatSplit:receiptDate];
  85. if(receiptDate != nil &&receiptDate.length > 0){
  86. CGRect receiptDateFrame = [receiptDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:receiptDict];
  87. receiptDateFrame.origin.x = CGRectGetMaxX(_lblReceiptDateF) ;
  88. receiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  89. _receiptDateF = receiptDateFrame;
  90. }
  91. NSString *receiptStatusTitle = @"回执状态:";
  92. CGRect lblReceiptStatusFrame = [receiptStatusTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:receiptDict];
  93. lblReceiptStatusFrame.origin.x = Screen_Width / 2;
  94. lblReceiptStatusFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  95. _lblReceiptStatusF = lblReceiptStatusFrame;
  96. NSInteger receiptType = [_deliveryListModel receiptType];
  97. NSString *receiptTypeStr;
  98. if(receiptType == 1){
  99. receiptTypeStr = @"完成";
  100. }
  101. else if(receiptType == 2){
  102. receiptTypeStr = @"推迟送安";
  103. }
  104. // else{
  105. // receiptTypeStr = @"全部";
  106. //
  107. // }
  108. if(receiptTypeStr != nil && receiptTypeStr.length > 0){
  109. CGRect receiptTypeFrame = [receiptTypeStr textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:receiptDict];
  110. receiptTypeFrame.origin.x = CGRectGetMaxX(_lblReceiptStatusF) ;
  111. receiptTypeFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  112. _receiptStatusF= receiptTypeFrame;
  113. }
  114. _bottomLineF = CGRectMake(0, CGRectGetMaxY(lblReceiptDateFrame)+15, SCREENWIDTH, 1);
  115. _returnReceiptF = CGRectMake(SCREENWIDTH -110, CGRectGetMaxY(_bottomLineF)+15, 70, 30);
  116. _cellHeight = CGRectGetMaxY(_returnReceiptF)+15;
  117. }
  118. @end