// // OrderSaleViewController.m // IBOSS // // Created by apple on 2017/5/15. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // // 功能描述:订单销售单控制器 // #import "OrderSaleViewController.h" #import "OrderSaleTotalModel.h" #import "DateFormat.h" #import "OrderSaleListModel.h" #import "OrderSalesTableViewCell.h" #import "SideSlipModel.h" #import "OrderSalesSearchModel.h" #import "OrderSalesDetailViewController.h" @interface OrderSaleViewController () @end @implementation OrderSaleViewController #pragma mark - 公共函数 /** viewDidLoad函数 */ - (void)viewDidLoad { [super viewDidLoad]; [self showTitle:@"销售单订单"]; // _mEndDate= [DateFormat getCurrentDate]; // _mStartDate = [DateFormat getDateBefore:31]; [self loadNavStyle]; [self initUI]; [self initSlideSlip]; _arrStock = [[NSMutableArray alloc]init]; _arrModels = [[NSMutableArray alloc]init]; _correctStatus = @"1"; UIView *view = [self backGroundPromptViewByFrame:_vCustomTableView.bounds promptStr:@"请筛选后查询"]; _vCustomTableView.backgroundView = view; //[self reloadData]; } /** 安全区视图发生变化 */ -(void)viewSafeAreaInsetsDidChange{ _vCustomTableView.frame = self.view.safeAreaLayoutGuide.layoutFrame; [super viewSafeAreaInsetsDidChange]; } /** 抽屉初始化 */ - (void)initSlideSlip{ // 抽屉对象 __weak typeof(self) weakself=self; self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) { for (SideSlipModel *model in dataList) { model.selectedItemList = nil; model.customDict = nil; } } commitBlock:^(NSArray *dataList) { // 查询条件 SideSlipModel *model = dataList[0]; OrderSalesSearchModel *m = [model.customDict objectForKey:SEARCH_RANGE_MODEL]; weakself.mStartDate=m.startDate; weakself.mEndDate=m.endDate; weakself.mCustomerName=m.customerName; weakself.mTelephone=m.contactTelephone; weakself.mInvoiceType=m.invoiceTypeId; weakself.correctStatus=m.correctStatus; weakself.mCustomerAddress=m.customerAddress; weakself.mOrganizationCode=m.departmentCode; weakself.staffId = m.staffId; if(_mStartDate == nil){ [self showAlertViewText:@"请选择开始日期"]; return; } if(_mEndDate == nil){ [self showAlertViewText:@"请选择结束日期"]; return; } NSUInteger result= [DateFormat compareDate:_mStartDate withDate:_mEndDate]; if(result == -1){ [self showAlertViewText:@"开始日期不能大于结束日期"]; return; } // NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init]; // [dateFormat setDateFormat:@"yyyy-MM-dd"];//设定时间格式,这里可以设置成自己需要的格式 // // NSDate *startD = [dateFormat dateFromString:_mStartDate]; // NSDate *endD = [dateFormat dateFromString:_mEndDate]; // NSInteger days= [DateFormat calculateDaysFromBegin:startD end:endD]; // // if(days > 31){ // [self showAlertViewText:@"日期间隔天数不能大于31天"]; // return; // } [weakself.filterController dismiss]; [self reloadData]; }]; _filterController.animationDuration = AnimationDuration; _filterController.hasHeadView = YES; _filterController.sideSlipLeading = UIScreenSideSlipLeading*[UIScreen mainScreen].bounds.size.width; _filterController.dataList = [self packageDataList]; } /** 数据源 @return <#return value description#> */ - (NSArray *)packageDataList { NSMutableArray *dataArray = [NSMutableArray array]; SideSlipModel *model = [[SideSlipModel alloc] init]; model.containerCellClass = @"OrderSalesSearchTableViewCell"; model.regionTitle = @"查询条件"; [dataArray addObject:model]; return [dataArray mutableCopy]; } #pragma mark - 代理函数 /** Sections @param tableView <#tableView description#> @return <#return value description#> */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } /** 头高 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 10; } /** 列表个数 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _arrModels.count; } /** 行高 @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 235; } /** cell @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"OrderSalesTableViewCell"; OrderSalesTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { cell = [[OrderSalesTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.selectionStyle=UITableViewCellSelectionStyleNone; } else //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免 { while ([cell.contentView.subviews lastObject] != nil) { [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview]; } } // 单元格ui布局 OrderSaleListModel *model=_arrModels[indexPath.row]; [cell parseOrderSalesInfo:model]; return cell; } /** 单元格点击事件 @param tableView <#tableView description#> @param indexPath <#indexPath description#> */ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ self.hidesBottomBarWhenPushed=YES; OrderSalesDetailViewController *detailvc = [[OrderSalesDetailViewController alloc] init]; OrderSaleListModel *m = _arrModels[indexPath.row]; detailvc.invoiceNo = m.invoiceNo; [self.navigationController pushViewController:detailvc animated:YES]; } #pragma mark - 私有函数 /** 初始化ui */ - (void)initUI{ self.navigationItem.title = @"订单销售单列表"; self.view.backgroundColor = [UIColor whiteColor]; _vCustomTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, Screen_Width, Screen_Height )]; _vCustomTableView.rowHeight = UITableViewAutomaticDimension; _vCustomTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight; _vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _vCustomTableView.backgroundColor = [UIColor whiteColor]; _vCustomTableView.delegate = self; _vCustomTableView.dataSource=self; [self.view addSubview:_vCustomTableView]; } -(void)initHeadView:(NSString*)invoiceType { // 合计 _headView = [[UIView alloc]initWithFrame:CGRectZero]; CGFloat lblx = 20; CGFloat lblwidth = 130; CGFloat valuey = 10; CGFloat valuewidth = 200; CGFloat valueheight = 25; CGFloat heightLine =1; UILabel *lbtotal = [UILabel new]; lbtotal.frame=CGRectMake(lblx, valuey, lblwidth, valueheight); lbtotal.font = reportTextFont; lbtotal.text = @"合计"; [_headView addSubview:lbtotal]; UIView *topSeparator = [UIView new]; topSeparator.frame = CGRectMake(0, CGRectGetMaxY(lbtotal.frame)+valuey, Screen_Width, heightLine); topSeparator.backgroundColor = LineBackgroundColor; [_headView addSubview:topSeparator]; UIImageView *goodsimgview = [UIImageView new]; UIImage *goodsImg= [UIImage imageNamed:@"goods_amount"]; goodsimgview.frame=CGRectMake(lblx,CGRectGetMaxY(topSeparator.frame)+valuey,goodsImg.size.width,goodsImg.size.height); [goodsimgview setImage:goodsImg]; [_headView addSubview:goodsimgview]; //货款总额 UILabel *lblTitleGoodsAmount = [UILabel new]; lblTitleGoodsAmount.frame=CGRectMake(CGRectGetMaxX(goodsimgview.frame)+5, CGRectGetMaxY(topSeparator.frame)+valuey-3, lblwidth, valueheight); lblTitleGoodsAmount.font = reportTextFont; lblTitleGoodsAmount.text = @"货款总额"; [_headView addSubview:lblTitleGoodsAmount]; _lblGoodsAmount = [UILabel new]; _lblGoodsAmount.frame=CGRectMake(Screen_Width - valuewidth - lblx, CGRectGetMaxY(topSeparator.frame)+valuey-3, valuewidth, valueheight); _lblGoodsAmount.font = reportTextFont; _lblGoodsAmount.textAlignment = NSTextAlignmentRight; [_headView addSubview:_lblGoodsAmount]; UIView *goodsSeparator = [UIView new]; goodsSeparator.frame = CGRectMake(CGRectGetMaxX(goodsimgview.frame)+5, CGRectGetMaxY(goodsimgview.frame)+valuey, Screen_Width, heightLine); goodsSeparator.backgroundColor = LineBackgroundColor; [_headView addSubview:goodsSeparator]; UIImageView *discountimgview = [UIImageView new]; UIImage *discountAmountImg= [UIImage imageNamed:@"discount_amount"]; discountimgview.frame=CGRectMake(lblx,CGRectGetMaxY(goodsSeparator.frame)+valuey,discountAmountImg.size.width,discountAmountImg.size.height); [discountimgview setImage:discountAmountImg]; [_headView addSubview:discountimgview]; // 舍零金额 UILabel *lblTitleDiscountAmount = [UILabel new]; lblTitleDiscountAmount.frame=CGRectMake(CGRectGetMaxX(discountimgview.frame)+5, CGRectGetMaxY(goodsSeparator.frame)+valuey, lblwidth, valueheight); lblTitleDiscountAmount.font = reportTextFont; lblTitleDiscountAmount.text = @"舍零金额"; [_headView addSubview:lblTitleDiscountAmount]; _lblDiscountAmount = [UILabel new]; _lblDiscountAmount.frame=CGRectMake(Screen_Width - valuewidth - lblx, CGRectGetMaxY(goodsSeparator.frame)+valuey, valuewidth, valueheight); _lblDiscountAmount.font = reportTextFont; _lblDiscountAmount.textAlignment = NSTextAlignmentRight; [_headView addSubview:_lblDiscountAmount]; UIView *discountSeparator = [UIView new]; discountSeparator.frame = CGRectMake(CGRectGetMaxX(discountimgview.frame)+5, CGRectGetMaxY(discountimgview.frame)+valuey, Screen_Width, heightLine); discountSeparator.backgroundColor = LineBackgroundColor; [_headView addSubview:discountSeparator]; //合计金额 UIImageView *totalimgview = [UIImageView new]; UIImage *totalImg= [UIImage imageNamed:@"total_amount"]; totalimgview.frame=CGRectMake(lblx,CGRectGetMaxY(discountSeparator.frame)+valuey,totalImg.size.width,totalImg.size.height); [totalimgview setImage:totalImg]; [_headView addSubview:totalimgview]; UILabel *lblTitleTotalAmount = [UILabel new]; lblTitleTotalAmount.frame=CGRectMake(CGRectGetMaxX(totalimgview.frame)+5, CGRectGetMaxY(discountSeparator.frame)+valuey-3, lblwidth, valueheight); lblTitleTotalAmount.font = reportTextFont; lblTitleTotalAmount.text = @"合计金额"; [_headView addSubview:lblTitleTotalAmount]; _lblTotalAmount = [UILabel new]; _lblTotalAmount.frame=CGRectMake(Screen_Width - valuewidth - lblx, CGRectGetMaxY(discountSeparator.frame)+valuey-3, valuewidth, valueheight); _lblTotalAmount.font = reportTextFont; _lblTotalAmount.textAlignment = NSTextAlignmentRight; [_headView addSubview:_lblTotalAmount]; if([invoiceType isEqualToString:@"2"]||[invoiceType isEqualToString:@"0"]){ UIView *totalSeparator = [UIView new]; totalSeparator.frame = CGRectMake(CGRectGetMaxX(totalimgview.frame)+5, CGRectGetMaxY(totalimgview.frame)+valuey, Screen_Width, heightLine); totalSeparator.backgroundColor = LineBackgroundColor; [_headView addSubview:totalSeparator]; //出库额 UIImageView *outamountimgview = [UIImageView new]; UIImage *outAmountImg= [UIImage imageNamed:@"outamount"]; outamountimgview.frame=CGRectMake(lblx,CGRectGetMaxY(totalSeparator.frame)+valuey,outAmountImg.size.width,outAmountImg.size.height); [outamountimgview setImage:outAmountImg]; [_headView addSubview:outamountimgview]; UILabel *lblTitleOutAmount = [UILabel new]; lblTitleOutAmount.frame=CGRectMake(CGRectGetMaxX(outamountimgview.frame)+5, CGRectGetMaxY(totalSeparator.frame)+valuey-3, lblwidth, valueheight); lblTitleOutAmount.font = reportTextFont; lblTitleOutAmount.text = @"出库金额"; [_headView addSubview:lblTitleOutAmount]; _lblOutAmount = [UILabel new]; _lblOutAmount.frame=CGRectMake(Screen_Width - valuewidth - lblx, CGRectGetMaxY(totalSeparator.frame)+valuey-3, valuewidth, valueheight); _lblOutAmount.font = reportTextFont; _lblOutAmount.textAlignment = NSTextAlignmentRight; [_headView addSubview:_lblOutAmount]; UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_lblOutAmount.frame)+5, SCREENWIDTH, 10)]; line.backgroundColor = LineBackgroundColor; [_headView addSubview:line]; _headView.frame=CGRectMake(0,0, Screen_Width, CGRectGetMaxY(line.frame)); } else{ UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_lblTotalAmount.frame)+5, SCREENWIDTH, 10)]; line.backgroundColor = LineBackgroundColor; [_headView addSubview:line]; _headView.frame=CGRectMake(0,0, Screen_Width, CGRectGetMaxY(line.frame)); } } /** 导航菜单 */ - (void)loadNavStyle { // 右边 UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 12)]; UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom]; [btnfilter addTarget:self action:@selector(search) forControlEvents:UIControlEventTouchUpInside]; btnfilter.frame = CGRectMake(0, 0,16, 16); [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal]; [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"] forState:UIControlStateNormal]; [v addSubview:btnfilter]; UIButton *filterLbl = [[UIButton alloc]init]; filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16); [filterLbl setTitle:@"筛选" forState:UIControlStateNormal]; [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize]; [filterLbl addTarget:self action:@selector(search) forControlEvents:UIControlEventTouchUpInside]; [v addSubview:filterLbl]; UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v]; self.navigationItem.rightBarButtonItem = menubtnAdd; //返回 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)search{ [_filterController show]; } /** 头数据 @param md md description */ - (void)initUIData:(OrderSaleTotalModel *)model{ _lblGoodsAmount.text = [NSString stringWithFormat:@"¥%@",model.goodsAmount]; _lblDiscountAmount.text = [NSString stringWithFormat:@"¥%@",model.discountAmount]; _lblTotalAmount.text = [NSString stringWithFormat:@"¥%@",model.totalAmount]; if([model.invoiceType isEqualToString:@"2"]||[model.invoiceType isEqualToString:@"0"]){ _lblOutAmount.text = [NSString stringWithFormat:@"¥%@",model.outAmount]; } // 加载数据 [self loadDetailData]; } /** 加载数据 */ - (void)loadDetailData{ [self startLoading]; NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetOrderSalesReportListIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; // 参数 if(_mStartDate == nil){ [dict setObject:@"" forKeyedSubscript:@"BeginTime"]; } else{ [dict setObject:_mStartDate forKeyedSubscript:@"BeginTime"]; } if(_mEndDate == nil){ [dict setObject:@"" forKeyedSubscript:@"EndTime"]; } else{ [dict setObject:_mEndDate forKeyedSubscript:@"EndTime"]; } if(_mCustomerAddress==nil){ [dict setObject:@"" forKeyedSubscript:@"Address"]; } else{ [dict setObject:_mCustomerAddress forKeyedSubscript:@"Address"]; } if(_mCustomerName == nil){ [dict setObject:@"" forKeyedSubscript:@"CustomerName"]; } else{ [dict setObject:_mCustomerName forKeyedSubscript:@"CustomerName"]; } if(_mOrganizationCode == nil){ [dict setObject:@"" forKeyedSubscript:@"OrganizationCode"]; } else{ [dict setObject:_mOrganizationCode forKeyedSubscript:@"OrganizationCode"]; } if(_mInvoiceType == nil){ [dict setObject:@"0" forKeyedSubscript:@"InvoiceType"]; } else{ [dict setObject:_mInvoiceType forKeyedSubscript:@"InvoiceType"]; } if(_mTelephone == nil){ [dict setObject:@"" forKeyedSubscript:@"Telephone"]; } else{ [dict setObject:_mTelephone forKeyedSubscript:@"Telephone"]; } if (_staffId == nil) { [dict setObject:@"" forKeyedSubscript:@"staffID"]; }else{ [dict setObject:_staffId forKeyedSubscript:@"staffID"]; } [dict setObject:@"1" forKeyedSubscript:@"IsTotalFlg"]; int correctStatus; if (_correctStatus) { correctStatus=1; } else{ correctStatus=0; } [dict setObject:[NSString stringWithFormat:@"%@",_correctStatus] forKeyedSubscript:@"Status"]; _downManager = [[ASIDownManager alloc] init]; _downManager.delegate = self; _downManager.onRequestSuccess = @selector(onLoadDetailFinish:); _downManager.onRequestFail = @selector(onLoadDetailFail:); [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } /** 加载合集数据 */ - (void)reloadData { [self startLoading]; NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetOrderSalesReportTotalIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; if(_mOrganizationCode == nil){ [dict setObject:@"" forKeyedSubscript:@"OrganizationCode"]; }else{ [dict setObject:_mOrganizationCode forKeyedSubscript:@"OrganizationCode"]; } if(_mStartDate == nil){ [dict setObject:@"" forKeyedSubscript:@"BeginTime"]; } else{ [dict setObject:_mStartDate forKeyedSubscript:@"BeginTime"]; } if(_mEndDate == nil){ [dict setObject:@"" forKeyedSubscript:@"EndTime"]; } else{ [dict setObject:_mEndDate forKeyedSubscript:@"EndTime"]; } if(_mTelephone == nil){ [dict setObject:@"" forKeyedSubscript:@"Telephone"]; } else{ [dict setObject:_mTelephone forKeyedSubscript:@"Telephone"]; } if(_mInvoiceType == nil){ [dict setObject:@"0" forKeyedSubscript:@"InvoiceType"]; } else{ [dict setObject:_mInvoiceType forKeyedSubscript:@"InvoiceType"]; } if(_mCustomerName == nil){ [dict setObject:@"" forKeyedSubscript:@"CustomerName"]; } else{ [dict setObject:_mCustomerName forKeyedSubscript:@"CustomerName"]; } if(_mCustomerAddress == nil){ [dict setObject:@"" forKeyedSubscript:@"Address"]; } else{ [dict setObject:_mCustomerAddress forKeyedSubscript:@"Address"]; } if (_staffId == nil) { [dict setObject:@"" forKey:@"staffID"]; }else{ [dict setObject:_staffId forKey:@"staffID"]; } [dict setObject:@"0" forKeyedSubscript:@"IsTotalFlg"]; [dict setObject:[NSString stringWithFormat:@"%@",_correctStatus] forKeyedSubscript:@"Status"]; _downManager = [[ASIDownManager alloc] init]; _downManager.delegate = self; _downManager.onRequestSuccess = @selector(onLoadFinish:); _downManager.onRequestFail = @selector(onLoadFail:); [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } #pragma mark - 代理函数 /** * 查询正常数据 * * @param sender <#sender description#> */ - (void)onLoadFinish:(ASIDownManager *)sender { // 取消进度条 [self cancel]; // 服务器返回数据 RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; // 服务器返回数据状态值 int iStatus = resultModel.status; // 服务器返回数据消息 NSString *message = resultModel.message; // 服务器返回数据状态值正确 if (iStatus == 0) { _vCustomTableView.tableHeaderView = nil; _vCustomTableView.backgroundView= nil; NSArray * approvArr = (NSArray *)resultModel.result; // 是否有数据 if(approvArr != nil && approvArr.count > 0) { [_arrStock removeAllObjects]; _vCustomTableView.tableHeaderView = nil; [_arrStock addObjectsFromArray:approvArr]; [_arrModels removeAllObjects]; [_vCustomTableView reloadData]; NSDictionary *dic; if(_arrStock.count==1){ dic =_arrStock[0]; } else if(_arrStock.count>1){ dic =_arrStock[1]; } NSInteger recount = [[dic objectForKey:@"RecCount"]integerValue]; // 是否有数据 if(recount > 0){ OrderSaleTotalModel *md = [OrderSaleTotalModel orderSaleWithDict:dic]; [self initHeadView:md.invoiceType]; _vCustomTableView.tableHeaderView=_headView; [self initUIData:md]; } else{ // 无数据的view UIView *noDataView = [self noDataViewByFrame:_vCustomTableView.bounds]; _vCustomTableView.backgroundView=noDataView; [self showAlertViewText:@"未找到匹配结果"]; return; } } } // 服务器返回数据状态值异常 else if(iStatus == ActionResultStatusAuthError ||iStatus == ActionResultStatusNoLogin ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){ [self showReLoginDialog:message]; return; } else { [_arrModels removeAllObjects]; [_vCustomTableView reloadData]; [self showAlertViewText:message]; } } /** * 异常数据 * * @param sender <#sender description#> */ - (void)onLoadFail:(ASIDownManager *)sender { [self cancel]; [self showAlertViewText:@"网络异常"]; } /** * 列表数据 * * @param sender <#sender description#> */ - (void)onLoadDetailFinish:(ASIDownManager *)sender { // 取消进度条 [self cancel]; // 服务器返回数据 RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; // 服务器返回数据状态值 int iStatus = resultModel.status; // 服务器返回数据消息 NSString *message = resultModel.message; // 服务器返回数据状态值正确 if (iStatus == 0) { // 返回结果 NSArray * approvArr = (NSArray *)resultModel.result; if(approvArr != nil) { [_arrModels removeAllObjects]; if(approvArr.count == 0){ [self showAlertViewText:@"未找到匹配结果"]; } else { NSMutableArray *arr = [NSMutableArray array]; for (NSDictionary *dic in approvArr) { OrderSaleListModel *md = [OrderSaleListModel orderSaleDetailWithDict:dic]; [arr addObject:md]; } _arrModels = arr; [_vCustomTableView reloadData]; } } } // 服务器返回数据状态值异常 else if(iStatus == ActionResultStatusAuthError ||iStatus == ActionResultStatusNoLogin ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue) { [self showReLoginDialog:message]; return; } else { [self showAlertViewText:message]; } } /** 加载失败 @param sender <#sender description#> */ - (void)onLoadDetailFail:(ASIDownManager *)sender { [self cancel]; [self showAlertViewText:@"网络异常"]; } /** * 隐藏进度条 */ - (void)cancel { [self stopLoading]; } @end