ReceiptDetailViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. // ReceiptDetailViewController
  2. // IOBSS 2.0
  3. //
  4. // Created by 刘瀚璘 on 2017.7.18
  5. // Copyright 2017 沈阳东科云信软件有限公司. All rights reserved.
  6. //
  7. // 系统名称:
  8. // 功能描述:定制品回执详细
  9. #import "ReceiptDetailViewController.h"
  10. #import "ReceiptDetailModel.h"
  11. #import "CustomerReceiptDetailCell.h"
  12. #import "AlbumPhotoCollectionViewCell.h"
  13. #import "XHImageViewer.h"
  14. @interface ReceiptDetailViewController ()<UITableViewDelegate,UITableViewDataSource, UICollectionViewDataSource,UICollectionViewDelegate>{
  15. /**
  16. 安排单号
  17. */
  18. UILabel *_lblArrangementNo;
  19. /**
  20. 回执类型
  21. */
  22. UILabel *_lblRecReceiptType;
  23. /**
  24. 客户名称
  25. */
  26. UILabel *_lblCustomerName;
  27. /**
  28. 联系人
  29. */
  30. UILabel *_lblContacts;
  31. /**
  32. 送货单号
  33. */
  34. UILabel *_lblDeliveryNo;
  35. /**
  36. 送货地址
  37. */
  38. UILabel *_lblDeliveryAddress;
  39. /**
  40. 应收金额
  41. */
  42. UILabel *_lblReceivables;
  43. /**
  44. 已回执金额
  45. */
  46. UILabel *_lblCompleteReceivables;
  47. /**
  48. 回执金额
  49. */
  50. UILabel *_lblReceiptAmount;
  51. /**
  52. 应收方式
  53. */
  54. UILabel *_lblReceivablesType;
  55. /**
  56. 单据回收标示
  57. */
  58. UILabel *_lblRecoverFlag;
  59. /**
  60. 回执状态
  61. */
  62. UILabel *_lblReceiptStatus;
  63. /**
  64. 记录cell的高度的数组
  65. */
  66. NSMutableDictionary *_dicCellHeight;
  67. /**
  68. 圆角布局
  69. */
  70. UIView *_content;
  71. /**
  72. scrollView
  73. */
  74. UIScrollView *_scrollView;
  75. /**
  76. 位置
  77. */
  78. UIView *_positionImage;
  79. /**
  80. 位置
  81. */
  82. UILabel *_lblPosition;
  83. /**
  84. 位置
  85. */
  86. NSString *_strPosition;
  87. }
  88. @end
  89. @implementation ReceiptDetailViewController
  90. #pragma mark - 公共函数
  91. /**
  92. 公共函数
  93. */
  94. - (void)viewDidLoad {
  95. [super viewDidLoad];
  96. [self initUI];
  97. [self reloadData];
  98. }
  99. /**
  100. 安全区视图发生变化
  101. */
  102. -(void)viewSafeAreaInsetsDidChange{
  103. _scrollView.frame = self.view.safeAreaLayoutGuide.layoutFrame;
  104. [super viewSafeAreaInsetsDidChange];
  105. }
  106. #pragma mark - 请求数据
  107. /**
  108. 请求数据
  109. */
  110. - (void)reloadData {
  111. _dicCellHeight = [NSMutableDictionary dictionary];
  112. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  113. [dict setObject:@"GetFixedReceiptDetailIphone" forKey:@"Action"];
  114. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  115. [dict setObject:kkUserCode forKey:@"UserCode"];
  116. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  117. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  118. [dict setObject:_deliveryID forKey:@"FixedID"];
  119. [dict setObject:_arrangementID forKey:@"ArrangementID"];
  120. [dict setObject:_receiptNo forKey:@"ReceiptNo"];
  121. _downManager = [[ASIDownManager alloc] init];
  122. _downManager.delegate = self;
  123. _downManager.onRequestSuccess = @selector(onLoadFinish:);
  124. _downManager.onRequestFail = @selector(onLoadFail:);
  125. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  126. }
  127. #pragma mark - 数据回调
  128. /**
  129. 数据回调成功
  130. @param sender
  131. */
  132. - (void)onLoadFinish:(ASIDownManager *)sender {
  133. // 服务器返回数据
  134. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  135. // 服务器返回数据状态值
  136. int iStatus = resultModel.status;
  137. // 服务器返回数据消息
  138. NSString *message = resultModel.message;
  139. // 服务器返回数据状态值正确
  140. if (iStatus == 0){
  141. NSDictionary *dic = (NSDictionary *)resultModel.result;
  142. if(dic != nil){
  143. NSArray *array = [dic objectForKey:@"Table"];
  144. for (int i = 0; i < array.count; i++) {
  145. NSDictionary *dic = array[i];
  146. if([dic objectForKey:@"ArrangementNo"]){
  147. _lblArrangementNo.text = [NSString stringWithFormat:@"安排单号:%@",[dic objectForKey:@"ArrangementNo"]];
  148. }
  149. if([dic objectForKey:@"recReceiptType"]){
  150. if([[dic objectForKey:@"recReceiptType"]boolValue]){
  151. _lblRecReceiptType.text = [NSString stringWithFormat:@"回执类型:%@",@"撤销回执"];
  152. }else {
  153. _lblRecReceiptType.text = [NSString stringWithFormat:@"回执类型:%@",@"回执"];
  154. }
  155. }
  156. if([dic objectForKey:@"CustomerName"]){
  157. _lblCustomerName.text = [NSString stringWithFormat:@"客户名称:%@",[dic objectForKey:@"CustomerName"]];;
  158. }
  159. if([dic objectForKey:@"Contacts"]){
  160. _lblContacts.text = [NSString stringWithFormat:@"联 系 人:%@",[dic objectForKey:@"Contacts"]];;
  161. }
  162. if([dic objectForKey:@"FixedNo"]){
  163. _lblDeliveryNo.text = [NSString stringWithFormat:@"售前单号:%@",[dic objectForKey:@"FixedNo"]];;
  164. }
  165. if([dic objectForKey:@"Receivables"]){
  166. NSString *str = [NSString stringWithFormat:@"%0.2f",[[dic objectForKey:@"Receivables"] doubleValue]];
  167. _lblReceivables.text = [NSString stringWithFormat:@"应收金额:%@",str];;
  168. }
  169. if([dic objectForKey:@"CompleteReceivables"]){
  170. NSString *str = [NSString stringWithFormat:@"%0.2f",[[dic objectForKey:@"CompleteReceivables"] doubleValue]];
  171. _lblCompleteReceivables.text = [NSString stringWithFormat:@"已回执金额:%@",str];
  172. }
  173. if([dic objectForKey:@"ReceiptAmount"]){
  174. NSString *str = [NSString stringWithFormat:@"%0.2f",[[dic objectForKey:@"ReceiptAmount"] doubleValue]];
  175. _lblReceiptAmount.text = [NSString stringWithFormat:@"回执金额:%@",str];
  176. }
  177. if([dic objectForKey:@"ReceivablesType"]){
  178. _lblReceivablesType.text = [NSString stringWithFormat:@"应收方式:%@",[dic objectForKey:@"ReceivablesType"]];
  179. }
  180. if([[dic objectForKey:@"ReceiptStatus"] boolValue]){
  181. _lblReceiptStatus.text = [NSString stringWithFormat:@"回执状态:%@",@"完成"];
  182. }else{
  183. _lblReceiptStatus.text = [NSString stringWithFormat:@"回执状态:%@",@"再次安排"];
  184. }
  185. }
  186. NSArray *arrImage = [dic objectForKey:@"ImagePath"];
  187. if(arrImage){
  188. _arrImagePaths = [[NSMutableArray alloc] init];
  189. [_arrImagePaths addObjectsFromArray:arrImage];
  190. }
  191. NSArray *arrPosition = [dic objectForKey:@"Position"];
  192. if(arrPosition.count != 0)
  193. {
  194. //共一条数据
  195. NSDictionary * dicPositon = arrPosition[0];
  196. _strPosition = [dicPositon objectForKey:@"Position"];
  197. }
  198. _arrData = [[NSMutableArray alloc] init];
  199. NSArray *arrTable1 = [dic objectForKey:@"Table1"];
  200. for (int i = 0; i < arrTable1.count; i++) {
  201. NSDictionary *dic = arrTable1[i];
  202. ReceiptDetailModel *model = [ReceiptDetailModel dk_modelWithDictionary:dic];
  203. [_arrData insertObject:model atIndex:0];
  204. if([model.receiptRemarks isEqualToString:@""]){
  205. //不加空格计算不出备注的高度
  206. model.receiptRemarks = @" ";
  207. }
  208. _dicCellHeight[@(arrTable1.count - 1 - i)] = @([model.receiptRemarks sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:CGSizeMake(SCREENWIDTH-110, MAXFLOAT)].height + 389);
  209. }
  210. CGFloat tableViewHeight;
  211. for (int i = 0; i < _dicCellHeight.count; i++) {
  212. tableViewHeight = tableViewHeight + [_dicCellHeight[@(i)] floatValue];
  213. }
  214. _tableView.frame = CGRectMake(0,CGRectGetMaxY(_content.frame)+10, SCREENWIDTH, tableViewHeight+10);
  215. [_tableView reloadData];
  216. [_collectionView reloadData];
  217. }
  218. }
  219. else if(iStatus == ActionResultStatusAuthError
  220. ||iStatus == ActionResultStatusNoLogin
  221. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  222. [self showReLoginDialog:message];
  223. }
  224. else{
  225. // [self.tableView reloadData];
  226. [self showAlertViewText:message];
  227. }
  228. }
  229. /**
  230. 数据回调失败
  231. @param sender
  232. */
  233. - (void)onLoadFail:(ASIDownManager *)sender {
  234. //[self.tableView reloadData];
  235. [self showAlertViewText:@"网络异常"];
  236. }
  237. #pragma mark - 自定义方法
  238. /**
  239. 刷新ScrollView高度
  240. */
  241. - (void)refreshHeight {
  242. _scrollView.contentSize = CGSizeMake(SCREENWIDTH, CGRectGetMaxY(_tableView.frame)+10);
  243. _collectionView.frame = CGRectMake(0, CGRectGetMaxY(_tableView.frame)
  244. , SCREENWIDTH,[Util getPhotoCollectionViewHeightWithPhotos :_arrImagePaths]);
  245. _scrollView.contentSize = CGSizeMake(SCREENWIDTH, CGRectGetMaxY(_collectionView.frame)+10);
  246. [_collectionView reloadData];
  247. if(_strPosition == nil){
  248. _positionImage.hidden = YES;
  249. }else{
  250. _positionImage.hidden = NO;
  251. _positionImage.frame = CGRectMake(0, CGRectGetMaxY(_collectionView.frame)+8, Screen_Width,30);
  252. _lblPosition.text = _strPosition;
  253. _scrollView.contentSize = CGSizeMake(SCREENWIDTH, CGRectGetMaxY(_positionImage.frame)+10);
  254. }
  255. }
  256. #pragma mark - tableView实现的方法
  257. /**
  258. 组数
  259. @param tableView
  260. @return
  261. */
  262. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  263. return 1;
  264. }
  265. /**
  266. 返回cell
  267. @param tableView
  268. @param indexPath
  269. @return
  270. */
  271. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  272. static NSString *str = @"CustomerReceiptDetailCell";
  273. CustomerReceiptDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
  274. if(cell == nil){
  275. NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"CustomerReceiptDetailCell" owner:nil options:nil];
  276. cell = [nibs lastObject];
  277. }
  278. ReceiptDetailModel *model = [_arrData objectAtIndex:indexPath.row];
  279. cell.model = model;
  280. [cell loadCell];
  281. return cell;
  282. }
  283. /**
  284. 每组多少行
  285. @param tableView
  286. @param section
  287. @return
  288. */
  289. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  290. return _arrData.count;
  291. }
  292. /**
  293. 预估高度
  294. @param tableView tableView
  295. @param indexPath 组数,行数的封装
  296. @return 预估高度值
  297. */
  298. - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
  299. return 170;
  300. }
  301. /**
  302. tableview将要加载完
  303. @param tableView
  304. @param cell
  305. @param indexPath
  306. */
  307. - (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
  308. {
  309. if([indexPath row] == ((NSIndexPath*)[[tableView indexPathsForVisibleRows] lastObject]).row){
  310. [self refreshHeight];
  311. }
  312. }
  313. #pragma mark - collectionviewdelegate collectionviewdatasource
  314. /**
  315. 个数
  316. @param collectionView
  317. @param section
  318. @return
  319. */
  320. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
  321. return _arrImagePaths.count;
  322. }
  323. /**
  324. 返回cell
  325. @param collectionView
  326. @param indexPath
  327. @return
  328. */
  329. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
  330. static NSString *PhotoCollectionViewCellIdentifier = @"PhotoCollectionViewCellIdentifier";
  331. AlbumPhotoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:PhotoCollectionViewCellIdentifier forIndexPath:indexPath];
  332. NSArray *followInfoarray = _arrImagePaths;
  333. cell.indexPath = indexPath;
  334. //Image *image1 = [followInfoarray objectAtIndex:indexPath.row];
  335. NSString *imagepath = [[followInfoarray objectAtIndex:indexPath.row]objectForKey:@"ImagePath"];
  336. if(imagepath != nil&&[imagepath length]>0){
  337. NSString *imageUrl= [NSString stringWithFormat:@"http://%@:%@/WebService/%@",kkServerUrl,kkServerPort,imagepath];
  338. NSURL *url = [NSURL URLWithString:imageUrl];
  339. [cell.photoImageView setImageWithURL:url placeholderImage:nil];
  340. }
  341. return cell;
  342. }
  343. /**
  344. 点击图片
  345. @param collectionView
  346. @param indexPath
  347. */
  348. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  349. AlbumPhotoCollectionViewCell *cell = (AlbumPhotoCollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
  350. NSMutableArray *imageViews = [NSMutableArray array];
  351. NSArray *visibleCell = [self.collectionView visibleCells];
  352. NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"indexPath" ascending:YES];
  353. visibleCell = [visibleCell sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]];
  354. [visibleCell enumerateObjectsUsingBlock:^(AlbumPhotoCollectionViewCell *cell, NSUInteger idx, BOOL *stop) {
  355. [imageViews addObject:[[cell.contentView subviews] lastObject]];
  356. }];
  357. XHImageViewer *imageViewer = [[XHImageViewer alloc] init];
  358. [imageViewer showWithImageViews:imageViews selectedView:[[cell.contentView subviews] lastObject]];
  359. }
  360. - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  361. return YES;
  362. }
  363. #pragma mark - 初始化布局
  364. /**
  365. 初始化布局
  366. */
  367. - (void)initUI {
  368. self.navigationItem.title = @"定制品售前回执明细";
  369. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  370. [button setImage:[UIImage imageNamed:@"icon_back.png"] forState:UIControlStateNormal];
  371. [button addTarget:self action:@selector(goBack)
  372. forControlEvents:UIControlEventTouchUpInside];
  373. button.frame = CGRectMake(0, 0,45,22);
  374. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  375. self.navigationItem.leftBarButtonItem = menuButton;
  376. self.view.frame = CGRectMake(0, 0, self.view.frame.size.width, Screen_Height-rectStatusHeight-rectNavHeight);
  377. _scrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];
  378. _scrollView.backgroundColor = [UIColor colorWithRed:234.0/255 green:235.0/255 blue:236.0/255 alpha:1];
  379. [self.view addSubview:_scrollView];
  380. //圆角布局
  381. _content = [[UIView alloc] init];
  382. _content.frame = CGRectMake(10, 10, SCREENWIDTH-20, 500);
  383. _content.backgroundColor = [UIColor whiteColor];
  384. _content.layer.masksToBounds = YES;
  385. _content.layer.cornerRadius = CornerRadius;
  386. _content.layer.borderWidth = 0.0;
  387. [_scrollView addSubview:_content];
  388. //回执单号
  389. UILabel *lblReceiptNo = [[UILabel alloc] initWithFrame:CGRectMake(10,10, SCREENWIDTH-30, 14)];
  390. lblReceiptNo.text = [NSString stringWithFormat:@"回执单号:%@",_receiptNo];
  391. lblReceiptNo.font = [UIFont systemFontOfSize:14];
  392. [_content addSubview:lblReceiptNo];
  393. UIImageView *line = [[UIImageView alloc]initWithFrame:CGRectMake(0, 34, SCREENWIDTH-20, 1)];
  394. [line setImage:[UIImage imageNamed:@"titlebotton"]];
  395. [_content addSubview:line];
  396. //回执类型
  397. _lblRecReceiptType = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(line.frame)+10, SCREENWIDTH-30, 13)];
  398. _lblRecReceiptType.text = [NSString stringWithFormat:@"回执类型:%@",@""];
  399. _lblRecReceiptType.font = [UIFont systemFontOfSize:13];
  400. [_content addSubview:_lblRecReceiptType];
  401. //安排单号
  402. _lblArrangementNo = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblRecReceiptType.frame)+10, SCREENWIDTH-30, 13)];
  403. _lblArrangementNo.text = [NSString stringWithFormat:@"安排单号:%@",@""];
  404. _lblArrangementNo.font = [UIFont systemFontOfSize:13];
  405. [_content addSubview:_lblArrangementNo];
  406. //售前单号
  407. _lblDeliveryNo = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblArrangementNo.frame)+10, SCREENWIDTH-30, 13)];
  408. _lblDeliveryNo.text = [NSString stringWithFormat:@"售前单号:%@",@""];
  409. _lblDeliveryNo.font = [UIFont systemFontOfSize:13];
  410. [_content addSubview:_lblDeliveryNo];
  411. _lblCustomerName = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblDeliveryNo.frame)+10, SCREENWIDTH-30, 13)];
  412. _lblCustomerName.text = [NSString stringWithFormat:@"客户名称:%@",@""];
  413. _lblCustomerName.font = [UIFont systemFontOfSize:13];
  414. [_content addSubview:_lblCustomerName];
  415. _lblContacts = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblCustomerName.frame)+10, SCREENWIDTH-30, 13)];
  416. _lblContacts.text = [NSString stringWithFormat:@"联 系 人:%@",@""];
  417. _lblContacts.font = [UIFont systemFontOfSize:13];
  418. [_content addSubview:_lblContacts];
  419. _lblReceiptStatus = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblContacts.frame)+10, SCREENWIDTH-30, 13)];
  420. _lblReceiptStatus.text = [NSString stringWithFormat:@"回执状态:%@",@""];
  421. _lblReceiptStatus.font = [UIFont systemFontOfSize:13];
  422. [_content addSubview:_lblReceiptStatus];
  423. _lblReceivables = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblReceiptStatus.frame)+10, SCREENWIDTH-30, 13)];
  424. _lblReceivables.text = [NSString stringWithFormat:@"应收金额:%@",@""];
  425. _lblReceivables.font = [UIFont systemFontOfSize:13];
  426. [_content addSubview:_lblReceivables];
  427. _lblReceivablesType = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblReceivables.frame)+10, SCREENWIDTH-30, 13)];
  428. _lblReceivablesType.text = [NSString stringWithFormat:@"应收方式:%@",@""];
  429. _lblReceivablesType.font = [UIFont systemFontOfSize:13];
  430. [_content addSubview:_lblReceivablesType];
  431. _lblCompleteReceivables = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblReceivablesType.frame)+10, SCREENWIDTH-30, 13)];
  432. _lblCompleteReceivables.text = [NSString stringWithFormat:@"已回执金额:%@",@""];
  433. _lblCompleteReceivables.font = [UIFont systemFontOfSize:13];
  434. [_content addSubview:_lblCompleteReceivables];
  435. _lblReceiptAmount = [[UILabel alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_lblCompleteReceivables.frame)+10, SCREENWIDTH-30, 13)];
  436. _lblReceiptAmount.text = [NSString stringWithFormat:@"回执金额:%@",@""];
  437. _lblReceiptAmount.font = [UIFont systemFontOfSize:13];
  438. [_content addSubview:_lblReceiptAmount];
  439. _content.frame = CGRectMake(10, 10, SCREENWIDTH-20, CGRectGetMaxY(_lblReceiptAmount.frame)+10);
  440. _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(_content.frame)+10, SCREENWIDTH, 200) style:UITableViewStylePlain];
  441. _tableView.scrollEnabled=NO;
  442. _tableView.delegate = self;
  443. [self.tableView registerNib:[UINib nibWithNibName:@"CustomerReceiptDetailCell"bundle:[NSBundle mainBundle]]forCellReuseIdentifier:@"CustomerReceiptDetailCell"];
  444. _tableView.rowHeight = UITableViewAutomaticDimension;
  445. _tableView.backgroundColor = _scrollView.backgroundColor;
  446. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  447. _tableView.dataSource = self;
  448. [_scrollView addSubview:_tableView];
  449. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  450. flowLayout.itemSize = CGSizeMake(85, 85);
  451. flowLayout.minimumInteritemSpacing = 5;
  452. flowLayout.minimumLineSpacing = 10;
  453. flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
  454. flowLayout.sectionInset = UIEdgeInsetsMake(7, 20, 0, 20);
  455. _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_tableView.frame)+10
  456. , SCREENWIDTH,0) collectionViewLayout:flowLayout];
  457. [self.collectionView registerClass:[AlbumPhotoCollectionViewCell class] forCellWithReuseIdentifier:@"PhotoCollectionViewCellIdentifier"];
  458. _collectionView.dataSource = self;
  459. _collectionView.delegate = self;
  460. self.collectionView.backgroundColor = [UIColor colorWithRed:234.0/255 green:235.0/255 blue:236.0/255 alpha:1];
  461. [_scrollView addSubview:_collectionView];
  462. //位置view
  463. _positionImage = [[UIView alloc] init];
  464. _positionImage.frame=CGRectMake(0, CGRectGetMaxY(_collectionView.frame)+8, Screen_Width, 0);
  465. _positionImage.hidden = YES;
  466. [_scrollView addSubview:_positionImage];
  467. //星号
  468. UIImageView *ivposition = [UIImageView new];
  469. ivposition.frame=CGRectMake(12,4,9,12);
  470. ivposition.image = [UIImage imageNamed:@"icon_position"];
  471. [_positionImage addSubview:ivposition];
  472. _lblPosition = [[UILabel alloc] init];
  473. _lblPosition.font= [UIFont systemFontOfSize:14];
  474. _lblPosition.frame=CGRectMake(28, 0, Screen_Width-32, 20);
  475. [_positionImage addSubview:_lblPosition];
  476. }
  477. @end