// // InventoryUnfreezeGoodsDetailViewController.m // IBOSS // // Created by 关宏厚 on 2020/5/22. // Copyright © 2020 elongtian. All rights reserved. // #import "InventoryUnfreezeGoodsDetailViewController.h" #import "OrderQuantity.h" @interface InventoryUnfreezeGoodsDetailViewController () @end @implementation InventoryUnfreezeGoodsDetailViewController - (void)viewDidLoad { [super viewDidLoad]; [self loadNavStyle]; [self initUI]; _unfreezeGoodsList=[[NSMutableArray alloc]init]; [self loadDetailData]; } /** 导航按钮样式 */ - (void)loadNavStyle { self.navigationItem.title =@"解冻产品明细"; //返回 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(0, 0,45,22); UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.leftBarButtonItem = menuButton; } -(void)initUI { self.view.backgroundColor = [UIColor whiteColor]; _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)]; _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight; _tableView.separatorStyle=UITableViewCellSeparatorStyleNone; _tableView.delegate = self; _tableView.dataSource=self; [self.view addSubview:_tableView]; } -(void)loadDetailData { [self startLoading]; _mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.onRequestSuccess = @selector(onGoodsDetailLoadFinish:); _mDownManager.onRequestFail = @selector(onGoodsDetailLoadFail:); NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetUnFreezeDetailDataIPhone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:_unfreezeId forKey:@"UnFreezeID"]; [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } -(void)onGoodsDetailLoadFail:(ASIDownManager *)sender { [self cancel]; [self showAlertViewText:@"网络异常"]; } -(void)onGoodsDetailLoadFinish:(ASIDownManager *)sender { [self cancel]; RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int iStatus = resultModel.status; // 服务器返回数据消息 NSString *message = resultModel.message; if(iStatus==0) { NSArray *resultArray=(NSArray*)resultModel.result; if(resultArray!=nil&&resultArray.count>0) { for(int i=0;i @param section <#section description#> @return <#return value description#> */ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [_unfreezeGoodsList count]; } /** table view 分区数 @param tableView <#tableView description#> @return <#return value description#> */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } /** cell 高度 @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return [self.heights[@(indexPath.row)] doubleValue];; } /** 高度 @return <#return value description#> */ - (NSMutableDictionary *)heights{ if (_heights == nil){ _heights = [NSMutableDictionary dictionary]; } return _heights; } /** 预防高度 @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ -(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 250; } /** 每个单元格cell @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"InventoryUnfreezeGoodsDetailListCell"; InventoryUnfreezeGoodsDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ]; cell = [[InventoryUnfreezeGoodsDetailListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; cell.selectionStyle=UITableViewCellSelectionStyleNone; InventoryUnfreezeGoodsModel *detailModel= [_unfreezeGoodsList objectAtIndex:indexPath.row]; [cell setInventoryUnfreezeGoodsDetailListCell:detailModel]; self.heights[@(indexPath.row)] = @(cell.height); return cell; } /** 安全区视图发生变化 */ -(void)viewSafeAreaInsetsDidChange{ _tableView.frame =CGRectMake(0,0, self.view.frame.size.width,self.view.safeAreaLayoutGuide.layoutFrame.size.height); [super viewSafeAreaInsetsDidChange]; } -(void)goBack { [self.navigationController popViewControllerAnimated:YES]; } /** 进度条隐藏 */ - (void)cancel { [self stopLoading]; } @end