DispatchReceiptCell.m 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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 "DispatchReceiptCell.h"
  9. #import "DateFormat.h"
  10. #import "UIColor+hexColor.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation DispatchReceiptCell
  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:(DispatchReceiptFrame *)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.contentView 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.contentView addSubview: _receiptNo];
  59. _receiptNo.text = receiptNoStr;
  60. }
  61. _btnDialTelephone=[UIButton buttonWithType:UIButtonTypeCustom];
  62. _btnDialTelephone.frame=[frame btnDialTelephoneF];
  63. [self.contentView addSubview:_btnDialTelephone];
  64. [_btnDialTelephone addTarget:self action:@selector(dialTelephone) forControlEvents:UIControlEventTouchUpInside];
  65. UIImageView *telephoneImg = [[UIImageView alloc]init];
  66. telephoneImg.frame=CGRectMake(0,0,32,32);
  67. [telephoneImg setImage:[UIImage imageNamed:@"dial_telephone"]];
  68. telephoneImg.userInteractionEnabled=NO;
  69. [_btnDialTelephone addSubview:telephoneImg];
  70. UIView *separator = [UIView new];
  71. separator.frame = [frame separatorF];
  72. separator.backgroundColor = LineBackgroundColor;
  73. [self.contentView addSubview:separator];
  74. UILabel *dispatchNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDispatchNoF]];
  75. dispatchNoLabelView.textColor = LabelGrayTextColor;
  76. dispatchNoLabelView.text = @"派工单号:";
  77. dispatchNoLabelView.font = kTextFont;
  78. dispatchNoLabelView.textAlignment = NSTextAlignmentLeft;
  79. [self.contentView addSubview: dispatchNoLabelView];
  80. NSString *dispatchNoStr = [_deliveryListModel arrangementNo];
  81. if(dispatchNoStr != nil&&dispatchNoStr.length>0){
  82. _lblDispatchNo= [[UILabel alloc] initWithFrame:[frame dispatchNoF]];
  83. _lblDispatchNo.backgroundColor = [UIColor clearColor];
  84. _lblDispatchNo.textColor = [UIColor blackColor];
  85. _lblDispatchNo.textAlignment = NSTextAlignmentLeft;
  86. _lblDispatchNo.font = kTextFont;
  87. [self.contentView addSubview:_lblDispatchNo];
  88. _lblDispatchNo.text = dispatchNoStr;
  89. }
  90. UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  91. customerNameLabelView.backgroundColor = [UIColor clearColor];
  92. customerNameLabelView.textColor = LabelGrayTextColor;
  93. customerNameLabelView.text = @"客户名称:";
  94. customerNameLabelView.font = kTextFont;
  95. customerNameLabelView.textAlignment = NSTextAlignmentLeft;
  96. [self.contentView addSubview: customerNameLabelView];
  97. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  98. NSString *customerNameStr = [_deliveryListModel customerName];
  99. if(customerNameStr != nil && customerNameStr.length > 0){
  100. _customerName.backgroundColor = [UIColor clearColor];
  101. _customerName.textColor = [UIColor blackColor];
  102. _customerName.textAlignment = NSTextAlignmentLeft;
  103. _customerName.font = kTextFont;
  104. [self.contentView addSubview:_customerName];
  105. _customerName.text = customerNameStr;
  106. }
  107. UILabel *telephoneLabelView = [[UILabel alloc] initWithFrame:[frame lblTelephoneF]];
  108. telephoneLabelView.backgroundColor = [UIColor clearColor];
  109. telephoneLabelView.textColor = LabelGrayTextColor;
  110. telephoneLabelView.text = @"联系电话:";
  111. telephoneLabelView.font = kTextFont;
  112. telephoneLabelView.textAlignment = NSTextAlignmentLeft;
  113. [self.contentView addSubview: telephoneLabelView];
  114. _telephone = [[UILabel alloc] initWithFrame:[frame telephoneF]];
  115. _telephoneStr = [_deliveryListModel telephone];
  116. if(_telephoneStr != nil && _telephoneStr.length > 0){
  117. _telephone.backgroundColor = [UIColor clearColor];
  118. _telephone.textColor = [UIColor blackColor];
  119. _telephone.textAlignment = NSTextAlignmentLeft;
  120. _telephone.font = kTextFont;
  121. [self.contentView addSubview:_telephone];
  122. _telephone.text = _telephoneStr;
  123. }
  124. UILabel *serviceStaffNameLabelView = [[UILabel alloc] initWithFrame:[frame lblServiceStaffNameF]];
  125. serviceStaffNameLabelView.backgroundColor = [UIColor clearColor];
  126. serviceStaffNameLabelView.textColor = LabelGrayTextColor;
  127. serviceStaffNameLabelView.text = @"服务人员:";
  128. serviceStaffNameLabelView.font = kTextFont;
  129. serviceStaffNameLabelView.textAlignment = NSTextAlignmentLeft;
  130. [self.contentView addSubview: serviceStaffNameLabelView];
  131. _serviceStaffName = [[UILabel alloc] initWithFrame:[frame serviceStaffNameF]];
  132. NSString *serviceStaffNameStr = [_deliveryListModel serviceStaffName];
  133. if(serviceStaffNameStr != nil && serviceStaffNameStr.length > 0){
  134. _serviceStaffName.backgroundColor = [UIColor clearColor];
  135. _serviceStaffName.textColor = [UIColor blackColor];
  136. _serviceStaffName.textAlignment = NSTextAlignmentLeft;
  137. _serviceStaffName.font = kTextFont;
  138. [self.contentView addSubview:_serviceStaffName];
  139. _serviceStaffName.text = serviceStaffNameStr;
  140. }
  141. UILabel *receiptDateLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptDateF]];
  142. receiptDateLabelView.backgroundColor = [UIColor clearColor];
  143. receiptDateLabelView.textColor = LabelGrayTextColor;
  144. receiptDateLabelView.text = @"回执日期:";
  145. receiptDateLabelView.font = kTextFont;
  146. receiptDateLabelView.textAlignment = NSTextAlignmentLeft;
  147. [self.contentView addSubview:receiptDateLabelView];
  148. NSString *receiptDateStr = [_deliveryListModel receiptTime];
  149. receiptDateStr = [DateFormat dateFormatSplit:receiptDateStr];
  150. if(receiptDateStr != nil&&receiptDateStr.length > 0){
  151. _receiptDate = [[UILabel alloc] initWithFrame:[frame receiptDateF]];
  152. _receiptDate.backgroundColor = [UIColor clearColor];
  153. _receiptDate.textColor = [UIColor blackColor];
  154. _receiptDate.textAlignment = NSTextAlignmentLeft;
  155. _receiptDate.font = kTextFont;
  156. [self.contentView addSubview:_receiptDate];
  157. _receiptDate.text = receiptDateStr;
  158. }
  159. UILabel *receiptTypeLabelView = [[UILabel alloc] initWithFrame:[frame lblReceiptTypeTitleF]];
  160. receiptTypeLabelView.backgroundColor = [UIColor clearColor];
  161. receiptTypeLabelView.textColor = LabelGrayTextColor;
  162. receiptTypeLabelView.text = @"回执类型:";
  163. receiptTypeLabelView.font = kTextFont;
  164. receiptTypeLabelView.textAlignment = NSTextAlignmentLeft;
  165. [self.contentView addSubview:receiptTypeLabelView];
  166. NSString *receiptTypeStr;
  167. if(_deliveryListModel.receiptType==1){
  168. receiptTypeStr = @"撤销回执";
  169. }else{
  170. receiptTypeStr = @"回执";
  171. }
  172. if(receiptTypeStr != nil&&receiptTypeStr.length > 0){
  173. _lblReceiptType = [[UILabel alloc] initWithFrame:[frame receiptTypeF]];
  174. _lblReceiptType.backgroundColor = [UIColor clearColor];
  175. _lblReceiptType.textColor = [UIColor blackColor];
  176. _lblReceiptType.textAlignment = NSTextAlignmentLeft;
  177. _lblReceiptType.font = kTextFont;
  178. [self.contentView addSubview:_lblReceiptType];
  179. _lblReceiptType.text = receiptTypeStr;
  180. }
  181. UILabel *lblDeliveryFlagTitle= [[UILabel alloc] initWithFrame:[frame deliveryFlagTitleF]];
  182. lblDeliveryFlagTitle.backgroundColor = [UIColor clearColor];
  183. lblDeliveryFlagTitle.textColor = LabelGrayTextColor;
  184. lblDeliveryFlagTitle.text = @"送货回执标识:";
  185. lblDeliveryFlagTitle.font =kTextFont;
  186. lblDeliveryFlagTitle.textAlignment = NSTextAlignmentLeft;
  187. [self.contentView addSubview: lblDeliveryFlagTitle];
  188. NSString *deliveryFlag = [_deliveryListModel deliveryReceiptFlag];
  189. NSString *deliveryFlagStr;
  190. if([deliveryFlag intValue]==0)
  191. {
  192. deliveryFlagStr=@"否";
  193. }
  194. else{
  195. deliveryFlagStr=@"是";
  196. }
  197. UILabel *lblDeliveryFlag= [[UILabel alloc] initWithFrame:[frame deliveryFlagF]];
  198. lblDeliveryFlag.backgroundColor = [UIColor clearColor];
  199. lblDeliveryFlag.textColor = [UIColor blackColor]; ;
  200. lblDeliveryFlag.text =deliveryFlagStr;
  201. lblDeliveryFlag.font =kTextFont;
  202. lblDeliveryFlag.textAlignment = NSTextAlignmentLeft;
  203. [self.contentView addSubview: lblDeliveryFlag];
  204. UILabel *lblInstallFlagTitle= [[UILabel alloc] initWithFrame:[frame installFlagTitleF]];
  205. lblInstallFlagTitle.backgroundColor = [UIColor clearColor];
  206. lblInstallFlagTitle.textColor = LabelGrayTextColor;
  207. lblInstallFlagTitle.text = @"安装回执标识:";
  208. lblInstallFlagTitle.font =kTextFont;
  209. lblInstallFlagTitle.textAlignment = NSTextAlignmentLeft;
  210. [self.contentView addSubview: lblInstallFlagTitle];
  211. NSString *installFlag = [_deliveryListModel installReceiptFlag];
  212. NSString *installFlagStr;
  213. if([installFlag intValue]==0)
  214. {
  215. installFlagStr=@"否";
  216. }
  217. else{
  218. installFlagStr=@"是";
  219. }
  220. UILabel *lblInstallFlag= [[UILabel alloc] initWithFrame:[frame installFlagF]];
  221. lblInstallFlag.backgroundColor = [UIColor clearColor];
  222. lblInstallFlag.textColor = [UIColor blackColor]; ;
  223. lblInstallFlag.text =installFlagStr;
  224. lblInstallFlag.font =kTextFont;
  225. lblInstallFlag.textAlignment = NSTextAlignmentLeft;
  226. [self.contentView addSubview: lblInstallFlag];
  227. // UIView *bottomLine = [[UIView alloc] init];
  228. // bottomLine.backgroundColor = LineBackgroundColor;
  229. // bottomLine.frame =[frame bottomLineF];
  230. // [self.contentView addSubview:bottomLine];
  231. //
  232. // UIButton *btnReturnReceipt = [UIButton buttonWithType:UIButtonTypeCustom];
  233. // //btnReturnReceipt.titleLabel.text = @"撤销";
  234. // [btnReturnReceipt setTitle:@"撤销" forState: UIControlStateNormal];
  235. // btnReturnReceipt.titleLabel.font=[UIFont systemFontOfSize:14];
  236. // if(_deliveryListModel.receiptType==1){
  237. //
  238. // [btnReturnReceipt setBackgroundColor:[UIColor hexColor:@"EBEBEB"]];
  239. //
  240. // }else{
  241. // [btnReturnReceipt setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  242. // }
  243. // [btnReturnReceipt.layer setCornerRadius:5];
  244. // btnReturnReceipt.frame = [frame returnReceiptF];
  245. // [self.contentView addSubview:btnReturnReceipt];
  246. // if(_deliveryListModel.receiptType!=1){
  247. // [btnReturnReceipt addTarget:self action:@selector(showReturnReceipt) forControlEvents:UIControlEventTouchUpInside];
  248. // }
  249. }
  250. -(void)dialTelephone{
  251. if(_telephoneStr!=nil&&_telephoneStr.length>0)
  252. if([self.telephoneDelegate respondsToSelector:@selector(dialTelephone:)])
  253. {
  254. [self.telephoneDelegate dialTelephone:_telephoneStr];
  255. }
  256. }
  257. /**
  258. 撤销回执
  259. */
  260. - (void)showReturnReceipt{
  261. [_delegate showReturnReceipt:_deliveryListModel];
  262. }
  263. @end