InstallReceiptListCell.m 10 KB

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