DispatchNoReceiptCell.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. //
  2. // RequirementNoReceiptCell.m
  3. // IBOSSHSH
  4. //
  5. // Created by ssl on 2018/1/12.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "DispatchNoReceiptCell.h"
  9. #import "UIColor+hexColor.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @interface DispatchNoReceiptCell(){
  14. }
  15. @end
  16. @implementation DispatchNoReceiptCell
  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:(DispatchNoReceiptFrame *)frame{
  46. _noReceiptFrame=frame;
  47. UILabel *customerNameLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  48. customerNameLabelView.backgroundColor = [UIColor clearColor];
  49. customerNameLabelView.textColor = [UIColor blackColor];
  50. customerNameLabelView.text = @"客户名称:";
  51. customerNameLabelView.font =[UIFont systemFontOfSize:15];
  52. customerNameLabelView.textAlignment = NSTextAlignmentLeft;
  53. [self addSubview: customerNameLabelView];
  54. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  55. NSString *customerNameStr = [frame.unReceiptListModel customerName];
  56. if(customerNameStr != nil&&customerNameStr.length>0){
  57. _customerName.backgroundColor = [UIColor clearColor];
  58. _customerName.textColor = [UIColor blackColor];
  59. _customerName.textAlignment = NSTextAlignmentLeft;
  60. _customerName.font =[UIFont systemFontOfSize:15];
  61. [self.contentView addSubview:_customerName];
  62. _customerName.text=customerNameStr;
  63. }
  64. if([frame.unReceiptListModel.receivables doubleValue]>0)
  65. {
  66. _customerName.text=[NSString stringWithFormat:@"%@%@",customerNameStr,@"[有费用]"];
  67. }
  68. _btnDialTelephone=[UIButton buttonWithType:UIButtonTypeCustom];
  69. _btnDialTelephone.frame=[frame btnDialTelephoneF];
  70. [self.contentView addSubview:_btnDialTelephone];
  71. [_btnDialTelephone addTarget:self action:@selector(dialTelephone) forControlEvents:UIControlEventTouchUpInside];
  72. UIImageView *telephoneImg = [[UIImageView alloc]init];
  73. telephoneImg.frame=CGRectMake(0,0,32,32);
  74. [telephoneImg setImage:[UIImage imageNamed:@"dial_telephone"]];
  75. telephoneImg.userInteractionEnabled=NO;
  76. [_btnDialTelephone addSubview:telephoneImg];
  77. UIView *separator = [UIView new];
  78. separator.frame = [frame separatorF];
  79. separator.backgroundColor = LineBackgroundColor;
  80. [self.contentView addSubview:separator];
  81. UILabel *lblCustomerAddress= [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]];
  82. lblCustomerAddress.backgroundColor = [UIColor clearColor];
  83. lblCustomerAddress.textColor = LabelGrayTextColor;
  84. lblCustomerAddress.text = @"送货地址:";
  85. lblCustomerAddress.font =[UIFont systemFontOfSize:15];
  86. lblCustomerAddress.textAlignment = NSTextAlignmentLeft;
  87. [self.contentView addSubview: lblCustomerAddress];
  88. NSString *customerAddressStr = [frame.unReceiptListModel deliveryAddress];
  89. _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]];
  90. _customerAddress.backgroundColor = [UIColor clearColor];
  91. _customerAddress.textColor = [UIColor blackColor];
  92. _customerAddress.textAlignment = NSTextAlignmentLeft;
  93. _customerAddress.numberOfLines=0;
  94. _customerAddress.font =[UIFont systemFontOfSize:15];
  95. [self.contentView addSubview:_customerAddress];
  96. _customerAddress.text=customerAddressStr;
  97. UILabel *telephoneLabelView = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]];
  98. telephoneLabelView.backgroundColor = [UIColor clearColor];
  99. telephoneLabelView.textColor =LabelGrayTextColor;
  100. telephoneLabelView.text = @"联系电话:";
  101. telephoneLabelView.font =kTextFont;
  102. telephoneLabelView.textAlignment = NSTextAlignmentLeft;
  103. [self.contentView addSubview:telephoneLabelView];
  104. NSString *telephoneStr= [frame.unReceiptListModel telephone];
  105. if(telephoneStr != nil&&telephoneStr.length>0){
  106. _telephoneNumber=telephoneStr;
  107. _telephone= [[UILabel alloc] initWithFrame:[frame customerTelephoneF]];
  108. _telephone.backgroundColor = [UIColor clearColor];
  109. _telephone.textColor = [UIColor blackColor];
  110. _telephone.textAlignment = NSTextAlignmentLeft;
  111. _telephone.font =kTextFont;
  112. [self.contentView addSubview:_telephone];
  113. _telephone.text=telephoneStr;
  114. }
  115. UILabel *dispatchNoLabelView = [[UILabel alloc] initWithFrame:[frame lblDispatchNoF]];
  116. dispatchNoLabelView.backgroundColor = [UIColor clearColor];
  117. dispatchNoLabelView.textColor =LabelGrayTextColor;
  118. dispatchNoLabelView.text = @"派工单号:";
  119. dispatchNoLabelView.textAlignment = NSTextAlignmentLeft;
  120. dispatchNoLabelView.font = kTitleFont;
  121. [self addSubview: dispatchNoLabelView];
  122. NSString *dispatchNoStr = [frame.unReceiptListModel arrangementNo];
  123. if(dispatchNoStr != nil&&dispatchNoStr.length>0){
  124. _deliveryNo = [[UILabel alloc] initWithFrame:[frame dispatchNoF]];
  125. _deliveryNo.backgroundColor = [UIColor clearColor];
  126. _deliveryNo.textColor = [UIColor blackColor];
  127. _deliveryNo.textAlignment = NSTextAlignmentLeft;
  128. _deliveryNo.font = kTitleFont;
  129. [self.contentView addSubview: _deliveryNo];
  130. _deliveryNo.text=dispatchNoStr;
  131. }
  132. UILabel *lblDeliveryDate = [[UILabel alloc] initWithFrame:[frame lblDeliveryDateF]];
  133. lblDeliveryDate.backgroundColor = [UIColor clearColor];
  134. lblDeliveryDate.textColor = LabelGrayTextColor;
  135. lblDeliveryDate.text = @"送货日期:";
  136. lblDeliveryDate.textAlignment = NSTextAlignmentLeft;
  137. lblDeliveryDate.font =kTextFont;
  138. [self.contentView addSubview:lblDeliveryDate];
  139. NSString *deliveryDateStr = [frame.unReceiptListModel deliveryDate];
  140. if(deliveryDateStr!= nil&&deliveryDateStr.length>0){
  141. UILabel *deliveryDate= [[UILabel alloc] initWithFrame:[frame deliveryDateF]];
  142. deliveryDate.backgroundColor = [UIColor clearColor];
  143. deliveryDate.textColor = [UIColor blackColor];
  144. deliveryDate.text=deliveryDateStr;
  145. deliveryDate.textAlignment = NSTextAlignmentLeft;
  146. deliveryDate.font =kTextFont;
  147. [self.contentView addSubview:deliveryDate];
  148. }
  149. UILabel *lblTruckName= [[UILabel alloc] initWithFrame:[frame lblTruckNameF]];
  150. lblTruckName.backgroundColor = [UIColor clearColor];
  151. lblTruckName.textColor = LabelGrayTextColor;
  152. lblTruckName.text = @"车 牌 号:";
  153. lblTruckName.font =kTextFont;
  154. lblTruckName.textAlignment = NSTextAlignmentLeft;
  155. [self.contentView addSubview: lblTruckName];
  156. NSString *truckNameStr = [frame.unReceiptListModel truckName];
  157. _truckName = [[UITextField alloc] initWithFrame:[frame truckNameF]];
  158. _truckName.placeholder=@"请输入车牌号";
  159. _truckName.delegate=self;
  160. _truckName.backgroundColor = [UIColor clearColor];
  161. _truckName.textColor = [UIColor blackColor];
  162. _truckName.textAlignment = NSTextAlignmentLeft;
  163. _truckName.font =kTextFont;
  164. [self.contentView addSubview:_truckName];
  165. _truckName.text=truckNameStr;
  166. UILabel *lblInstallDate = [[UILabel alloc] initWithFrame:[frame installDateTitleF]];
  167. lblInstallDate.backgroundColor = [UIColor clearColor];
  168. lblInstallDate.textColor = LabelGrayTextColor;
  169. lblInstallDate.text = @"安装日期:";
  170. lblInstallDate.textAlignment = NSTextAlignmentLeft;
  171. lblInstallDate.font =kTextFont;
  172. [self.contentView addSubview:lblInstallDate];
  173. NSString *installDateStr = [frame.unReceiptListModel installDate];
  174. if(installDateStr!= nil&&installDateStr.length>0){
  175. _installDate= [[UILabel alloc] initWithFrame:[frame installDateF]];
  176. _installDate.backgroundColor = [UIColor clearColor];
  177. _installDate.textColor = [UIColor blackColor];
  178. _installDate.textAlignment = NSTextAlignmentLeft;
  179. _installDate.font =kTextFont;
  180. [self.contentView addSubview:_installDate];
  181. _installDate.text=installDateStr;
  182. }
  183. UILabel *lblServiceStaff = [[UILabel alloc] initWithFrame:[frame serviceStaffTitleF]];
  184. lblServiceStaff.backgroundColor = [UIColor clearColor];
  185. lblServiceStaff.textColor = LabelGrayTextColor;
  186. lblServiceStaff.text = @"服务人员:";
  187. lblServiceStaff.textAlignment = NSTextAlignmentLeft;
  188. lblServiceStaff.font =kTextFont;
  189. [self.contentView addSubview:lblServiceStaff];
  190. NSString *serviceStaffStr = [frame.unReceiptListModel serviceStaffName];
  191. if(serviceStaffStr!= nil&&serviceStaffStr.length>0){
  192. _serviceStaff= [[UILabel alloc] initWithFrame:[frame serviceStaffF]];
  193. _serviceStaff.backgroundColor = [UIColor clearColor];
  194. _serviceStaff.textColor = [UIColor blackColor];
  195. _serviceStaff.text=serviceStaffStr;
  196. _serviceStaff.textAlignment = NSTextAlignmentLeft;
  197. _serviceStaff.font =kTextFont;
  198. [self.contentView addSubview:_serviceStaff];
  199. }
  200. UILabel *lblDeliveryFlagTitle= [[UILabel alloc] initWithFrame:[frame deliveryFlagTitleF]];
  201. lblDeliveryFlagTitle.backgroundColor = [UIColor clearColor];
  202. lblDeliveryFlagTitle.textColor = LabelGrayTextColor;
  203. lblDeliveryFlagTitle.text = @"送货回执标识:";
  204. lblDeliveryFlagTitle.font =kTextFont;
  205. lblDeliveryFlagTitle.textAlignment = NSTextAlignmentLeft;
  206. [self.contentView addSubview: lblDeliveryFlagTitle];
  207. NSString *deliveryFlag = [frame.unReceiptListModel deliveryReceiptFlag];
  208. NSString *deliveryFlagStr;
  209. if([deliveryFlag intValue]==0)
  210. {
  211. deliveryFlagStr=@"否";
  212. }
  213. else{
  214. deliveryFlagStr=@"是";
  215. }
  216. UILabel *lblDeliveryFlag= [[UILabel alloc] initWithFrame:[frame deliveryFlagF]];
  217. lblDeliveryFlag.backgroundColor = [UIColor clearColor];
  218. lblDeliveryFlag.textColor = [UIColor blackColor]; ;
  219. lblDeliveryFlag.text =deliveryFlagStr;
  220. lblDeliveryFlag.font =kTextFont;
  221. lblDeliveryFlag.textAlignment = NSTextAlignmentLeft;
  222. [self.contentView addSubview: lblDeliveryFlag];
  223. UILabel *lblInstallFlagTitle= [[UILabel alloc] initWithFrame:[frame installFlagTitleF]];
  224. lblInstallFlagTitle.backgroundColor = [UIColor clearColor];
  225. lblInstallFlagTitle.textColor = LabelGrayTextColor;
  226. lblInstallFlagTitle.text = @"安装回执标识:";
  227. lblInstallFlagTitle.font =kTextFont;
  228. lblInstallFlagTitle.textAlignment = NSTextAlignmentLeft;
  229. [self.contentView addSubview: lblInstallFlagTitle];
  230. NSString *installFlag = [frame.unReceiptListModel installReceiptFlag];
  231. NSString *installFlagStr;
  232. if([installFlag intValue]==0)
  233. {
  234. installFlagStr=@"否";
  235. }
  236. else{
  237. installFlagStr=@"是";
  238. }
  239. UILabel *lblInstallFlag= [[UILabel alloc] initWithFrame:[frame installFlagF]];
  240. lblInstallFlag.backgroundColor = [UIColor clearColor];
  241. lblInstallFlag.textColor = [UIColor blackColor]; ;
  242. lblInstallFlag.text =installFlagStr;
  243. lblInstallFlag.font =kTextFont;
  244. lblInstallFlag.textAlignment = NSTextAlignmentLeft;
  245. [self.contentView addSubview: lblInstallFlag];
  246. UILabel *lblDispatchStatusTitle= [[UILabel alloc] initWithFrame:[frame dispatchStatusTitleF]];
  247. lblDispatchStatusTitle.backgroundColor = [UIColor clearColor];
  248. lblDispatchStatusTitle.textColor = LabelGrayTextColor;
  249. lblDispatchStatusTitle.text = @"派工类型:";
  250. lblDispatchStatusTitle.textAlignment = NSTextAlignmentLeft;
  251. lblDispatchStatusTitle.font =kTextFont;
  252. [self.contentView addSubview:lblDispatchStatusTitle];
  253. _buttons= [NSMutableArray arrayWithCapacity:3];
  254. _btnDeliveryType=[[RadioBtn alloc] initWithFrame:frame.deliveryTypeF];
  255. [_buttons addObject:_btnDeliveryType];
  256. [_btnDeliveryType addTarget:self action:@selector(onRadioButtonValueChanged:) forControlEvents:UIControlEventValueChanged];
  257. [_btnDeliveryType setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
  258. _btnDeliveryType.tag=1;
  259. _btnDeliveryType.titleLabel.font = [UIFont boldSystemFontOfSize:17];
  260. [_btnDeliveryType setImage:[UIImage imageNamed:@"unselect.png"] forState:UIControlStateNormal];
  261. [_btnDeliveryType setImage:[UIImage imageNamed:@"select.png"] forState:UIControlStateSelected];
  262. _btnDeliveryType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  263. [self.contentView addSubview:_btnDeliveryType];
  264. _btnInstallType=[[RadioBtn alloc] initWithFrame:frame.installTypeF];
  265. [_buttons addObject:_btnInstallType];
  266. [_btnInstallType addTarget:self action:@selector(onRadioButtonValueChanged:) forControlEvents:UIControlEventValueChanged];
  267. _btnInstallType.tag=2;
  268. [_btnInstallType setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
  269. _btnInstallType.titleLabel.font = [UIFont boldSystemFontOfSize:17];
  270. [_btnInstallType setImage:[UIImage imageNamed:@"unselect.png"] forState:UIControlStateNormal];
  271. [_btnInstallType setImage:[UIImage imageNamed:@"select.png"] forState:UIControlStateSelected];
  272. _btnInstallType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  273. [self.contentView addSubview:_btnInstallType];
  274. _btnDeliveryInstallType=[[RadioBtn alloc] initWithFrame:frame.deliveryInstallTypeF];
  275. [_buttons addObject:_btnDeliveryInstallType];
  276. [_btnDeliveryInstallType addTarget:self action:@selector(onRadioButtonValueChanged:) forControlEvents:UIControlEventValueChanged];
  277. _btnDeliveryInstallType.tag=3;
  278. [_btnDeliveryInstallType setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
  279. _btnDeliveryInstallType.titleLabel.font = [UIFont boldSystemFontOfSize:17];
  280. [_btnDeliveryInstallType setImage:[UIImage imageNamed:@"unselect.png"] forState:UIControlStateNormal];
  281. [_btnDeliveryInstallType setImage:[UIImage imageNamed:@"select.png"] forState:UIControlStateSelected];
  282. _btnDeliveryInstallType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  283. [self.contentView addSubview:_btnDeliveryInstallType];
  284. [_buttons[0] setGroupButtons:_buttons];
  285. UILabel *deliveryLabel =[[UILabel alloc] initWithFrame:[frame deliveryTypeTitleF ]];
  286. deliveryLabel.tag=1;
  287. deliveryLabel.backgroundColor = [UIColor clearColor];
  288. deliveryLabel.text = @"配送";
  289. deliveryLabel.font = kTextFont;
  290. [self.contentView addSubview:deliveryLabel];
  291. UITapGestureRecognizer *tapRecognizerDelivery= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDeliveryRadioValueChanged:)];
  292. deliveryLabel.userInteractionEnabled=YES;
  293. [deliveryLabel addGestureRecognizer:tapRecognizerDelivery];
  294. UILabel *installLabel =[[UILabel alloc] initWithFrame:[frame installTypeTitleF ]];
  295. installLabel.backgroundColor = [UIColor clearColor];
  296. installLabel.text = @"安装";
  297. installLabel.tag=2;
  298. installLabel.font = kTextFont;
  299. [self.contentView addSubview:installLabel];
  300. UITapGestureRecognizer *tapRecognizerInstall= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onInstallRadioValueChanged:)];
  301. [installLabel addGestureRecognizer:tapRecognizerInstall];
  302. UILabel *deliveryInstallLabel =[[UILabel alloc] initWithFrame:[frame deliveryInstallTypeTitleF ]];
  303. deliveryInstallLabel.backgroundColor = [UIColor clearColor];
  304. deliveryInstallLabel.text = @"送安一体";
  305. deliveryInstallLabel.tag=3;
  306. deliveryInstallLabel.font = kTextFont;
  307. [self.contentView addSubview:deliveryInstallLabel];
  308. UITapGestureRecognizer *tapRecognizerDeliveryInstall= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDeliveryInstallRadioValueChanged:)];
  309. [deliveryInstallLabel addGestureRecognizer:tapRecognizerDeliveryInstall];
  310. if([frame.unReceiptListModel.requirementType intValue]==1)
  311. {
  312. if([[frame.unReceiptListModel receiptFlag ]intValue]==1)
  313. _btnDeliveryType.enabled=YES;
  314. _btnInstallType.enabled=NO;
  315. _btnDeliveryInstallType.enabled=NO;
  316. deliveryLabel.userInteractionEnabled=YES;
  317. installLabel.userInteractionEnabled=NO;
  318. deliveryInstallLabel.userInteractionEnabled=NO;
  319. [_buttons[0] setSelected:YES];
  320. }
  321. if([frame.unReceiptListModel.requirementType intValue]==2)
  322. {
  323. if([[frame.unReceiptListModel receiptFlag ]intValue]==2)
  324. {
  325. _btnDeliveryType.userInteractionEnabled=NO;
  326. _btnInstallType.userInteractionEnabled=YES;
  327. [_buttons[1] setSelected:YES];
  328. _btnDeliveryInstallType.userInteractionEnabled=NO;
  329. deliveryLabel.userInteractionEnabled=NO;
  330. installLabel.userInteractionEnabled=YES;
  331. deliveryInstallLabel.userInteractionEnabled=NO;
  332. }
  333. }
  334. if([frame.unReceiptListModel.requirementType intValue]==3)
  335. {
  336. if([frame.unReceiptListModel.deliveryReceiptFlag intValue]==0&&[frame.unReceiptListModel.installReceiptFlag intValue]==0)
  337. {
  338. if([[frame.unReceiptListModel receiptFlag ]intValue]==1)
  339. {
  340. _btnDeliveryType.userInteractionEnabled=YES;
  341. [_buttons[0] setSelected:YES];
  342. _btnInstallType.userInteractionEnabled=NO;
  343. _btnDeliveryInstallType.userInteractionEnabled=YES;
  344. deliveryLabel.userInteractionEnabled=YES;
  345. installLabel.userInteractionEnabled=NO;
  346. deliveryInstallLabel.userInteractionEnabled=YES;
  347. }
  348. if([[frame.unReceiptListModel receiptFlag ]intValue]==3)
  349. {
  350. _btnDeliveryType.userInteractionEnabled=YES;
  351. [_buttons[2] setSelected:YES];
  352. _btnInstallType.userInteractionEnabled=NO;
  353. _btnDeliveryInstallType.userInteractionEnabled=YES;
  354. deliveryLabel.userInteractionEnabled=YES;
  355. installLabel.userInteractionEnabled=NO;
  356. deliveryInstallLabel.userInteractionEnabled=YES;
  357. }
  358. }
  359. if([frame.unReceiptListModel.deliveryReceiptFlag intValue]==1&&[frame.unReceiptListModel.installReceiptFlag intValue]==0)
  360. {
  361. if([[frame.unReceiptListModel receiptFlag ]intValue]==2)
  362. {
  363. [_buttons[1] setSelected:YES];
  364. _btnInstallType.userInteractionEnabled=YES;
  365. _btnDeliveryType.userInteractionEnabled=NO;
  366. _btnDeliveryInstallType.userInteractionEnabled=NO;
  367. deliveryLabel.userInteractionEnabled=NO;
  368. installLabel.userInteractionEnabled=YES;
  369. deliveryInstallLabel.userInteractionEnabled=NO;
  370. }
  371. }
  372. }
  373. UIView *middleSeparator=[UIView new];
  374. middleSeparator.frame=[frame middleSeparatorF];
  375. [self.contentView addSubview:middleSeparator];
  376. [middleSeparator setBackgroundColor:LineBackgroundColor];
  377. UIButton *btnNavigate = [UIButton buttonWithType:UIButtonTypeCustom];
  378. [btnNavigate setTitle:@"导航" forState:UIControlStateNormal];
  379. [btnNavigate setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  380. [btnNavigate addTarget:self action:@selector(goNavigate) forControlEvents:UIControlEventTouchUpInside];
  381. btnNavigate.layer.cornerRadius = 4;
  382. btnNavigate.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  383. btnNavigate.frame =[frame navigationBtnF];
  384. [self.contentView addSubview:btnNavigate];
  385. UIButton *btnSave = [UIButton buttonWithType:UIButtonTypeCustom];
  386. [btnSave setTitle:@"保存" forState:UIControlStateNormal];
  387. [btnSave setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  388. [btnSave addTarget:self action:@selector(goSave) forControlEvents:UIControlEventTouchUpInside];
  389. btnSave.layer.cornerRadius = 4;
  390. btnSave.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  391. btnSave.frame =[frame saveBtnF];
  392. [self.contentView addSubview:btnSave];
  393. }
  394. /**
  395. textfield结束编辑回调函数
  396. @param field <#field description#>
  397. */
  398. - (void) textFieldDidEndEditing:(UITextField *) field
  399. {
  400. [self endEditing:YES];
  401. NSString *truckNumber=field.text;
  402. if([self.receiptFlagDelegate respondsToSelector:@selector(updateTruckNumber: truckNumber:)])
  403. {
  404. [self.receiptFlagDelegate updateTruckNumber:_position truckNumber:truckNumber];
  405. }
  406. }
  407. -(void)goSave
  408. {
  409. if([self.receiptFlagDelegate respondsToSelector:@selector(saveData:)])
  410. {
  411. [self.receiptFlagDelegate saveData:_position];
  412. }
  413. }
  414. -(void)goNavigate
  415. {
  416. if([self.receiptFlagDelegate respondsToSelector:@selector(goNavigation:)])
  417. {
  418. [self.receiptFlagDelegate goNavigation:_position];
  419. }
  420. }
  421. - (void)onDeliveryRadioValueChanged:(UITapGestureRecognizer *)gesture
  422. {
  423. _receiptFlag=@"1";
  424. [_buttons[0] setSelected:YES];
  425. if([self.receiptFlagDelegate respondsToSelector:@selector(updateReceiptFlag:receiptFlag:)])
  426. {
  427. [self.receiptFlagDelegate updateReceiptFlag:_position receiptFlag:_receiptFlag];
  428. }
  429. }
  430. - (void)onInstallRadioValueChanged:(UITapGestureRecognizer *)gesture
  431. {
  432. _receiptFlag=@"2";
  433. [_buttons[1] setSelected:YES];
  434. if([self.receiptFlagDelegate respondsToSelector:@selector(updateReceiptFlag:receiptFlag:)])
  435. {
  436. [self.receiptFlagDelegate updateReceiptFlag:_position receiptFlag:_receiptFlag];
  437. }
  438. }
  439. - (void)onDeliveryInstallRadioValueChanged:(UITapGestureRecognizer *)gesture
  440. {
  441. _receiptFlag=@"3";
  442. [_buttons[2] setSelected:YES];
  443. if([self.receiptFlagDelegate respondsToSelector:@selector(updateReceiptFlag:receiptFlag:)])
  444. {
  445. [self.receiptFlagDelegate updateReceiptFlag:_position receiptFlag:_receiptFlag];
  446. }
  447. }
  448. -(void) onRadioButtonValueChanged:(RadioBtn*)sender
  449. {
  450. // Lets handle ValueChanged event only for selected button, and ignore for deselected
  451. if(sender.selected) {
  452. if(sender.tag==1)
  453. {
  454. _receiptFlag=@"1";
  455. }
  456. if(sender.tag==2)
  457. {
  458. _receiptFlag=@"2";
  459. }
  460. if(sender.tag==3)
  461. {
  462. _receiptFlag=@"3";
  463. }
  464. if([self.receiptFlagDelegate respondsToSelector:@selector(updateReceiptFlag:receiptFlag:)])
  465. {
  466. [self.receiptFlagDelegate updateReceiptFlag:_position receiptFlag:_receiptFlag];
  467. }
  468. }
  469. }
  470. -(void)dialTelephone{
  471. if(_telephoneNumber!=nil&&_telephoneNumber.length>0)
  472. if([self.telephoneDelegate respondsToSelector:@selector(dialTelephone:)])
  473. {
  474. [self.telephoneDelegate dialTelephone:_telephoneNumber];
  475. }
  476. }
  477. @end