| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- //
- // InventoryFrozenOrderListViewController.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/5/13.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "InventoryFrozenOrderListViewController.h"
- @interface InventoryFrozenOrderListViewController ()
- @end
- @implementation InventoryFrozenOrderListViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initUI];
- [self loadNavStyle];
- _orderList=[[NSMutableArray alloc]init];
- [self loadData];
-
-
- }
- /**
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
- _tableView.frame =CGRectMake(0, 0, self.view.frame.size.width,self.view.safeAreaLayoutGuide.layoutFrame.size.height);
-
- [super viewSafeAreaInsetsDidChange];
- }
- /**
- 导航按钮样式
- */
- - (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)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- -(void)initUI
- {
- _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)loadData
- {
- [self startLoading];
- _downManager = [[ASIDownManager alloc] init];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onDataLoadFinish:);
- _downManager.onRequestFail = @selector(onDataLoadFail:);
-
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetFreezeDataSearchIPhone" 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:(_contacts==nil?@"":_contacts) forKey:@"Contacts"];
- [dict setObject:(_telephone==nil?@"":_telephone) forKey:@"Telephone"];
- [dict setObject:(_customerCode==nil?@"":_customerCode) forKey:@"CustomerCode"];
- [dict setObject:(_staffName==nil?@"":_staffName) forKey:@"SalesmanName"];
- [dict setObject:(_freezeReasonName==nil?@"":_freezeReasonName) forKey:@"FreezeReason"];
-
- [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- -(void)onDataLoadFinish:(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<resultArray.count;i++)
- {
- NSDictionary *resultDic=[resultArray objectAtIndex:i];
- InventoryFreezeOrderListModel *orderListModel=[InventoryFreezeOrderListModel dk_modelWithDictionary:resultDic];
- [_orderList addObject:orderListModel];
- }
-
- [_tableView reloadData];
- }
- }
-
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
-
- }
- -(void)onDataLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self showAlertViewText:@"网络异常"];
- }
- /**
- 单元格cell个数
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_orderList 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];;
-
- }
- /**
- 点击单元格事件
- @param tableView tableView description
- @param indexPath indexPath description
- */
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- InventoryFreezeOrderListModel *orderListModel= [_orderList objectAtIndex:indexPath.row];
-
- if([self.inventoryDelegate respondsToSelector:@selector(getInventoryFrozenGoodsDetail:unfreezeId:)])
- {
- [self.inventoryDelegate getInventoryFrozenGoodsDetail:orderListModel.freezeId unfreezeId:orderListModel.unfreezeId];
- [self.navigationController popViewControllerAnimated:YES];
- }
-
-
-
- }
- /**
- 高度
-
- @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 = @"InventoryFrozenOrderListCell";
- InventoryFrozenOrderListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
- cell = [[InventoryFrozenOrderListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
-
- InventoryFreezeOrderListModel *orderModel= [_orderList objectAtIndex:indexPath.row];
-
- [cell setInventoryFrozenOrderListCell:orderModel];
- cell.position = (int)indexPath.row;
- self.heights[@(indexPath.row)] = @(cell.height);
- return cell;
- }
- /**
- 隐藏进度条
- */
- - (void)cancel {
- [self stopLoading];
- }
- @end
|