diff --git a/YHB_Prj/YHB_Prj/FourthViewController/FourthViewController.m b/YHB_Prj/YHB_Prj/FourthViewController/FourthViewController.m index 3c70279..33b9e91 100644 --- a/YHB_Prj/YHB_Prj/FourthViewController/FourthViewController.m +++ b/YHB_Prj/YHB_Prj/FourthViewController/FourthViewController.m @@ -19,9 +19,13 @@ #import "NetManager.h" #import "ProblemGoodsViewController.h" #import "ScanVC.h" +#import "CLTableViewCell.h" +#import "LoginMode.h" #define userFace @"userFace" +static const CGFloat storeTVWidth = 100; + typedef enum : NSUInteger { cellTypeTenant = 0,//商户 cellTypeGate,//门店 @@ -45,6 +49,11 @@ @interface FourthViewController ()120?120:cellHeight*_storeArr.count; + _storeTV = [[UITableView alloc] initWithFrame:CGRectMake(kMainScreenWidth/2.0-storeTVWidth/2.0, _maskingView.height/2.0-storeTVHeight/2.0, storeTVWidth, storeTVHeight)]; + _storeTV.delegate =self; + _storeTV.dataSource = self; + _storeTV.separatorStyle = UITableViewCellSeparatorStyleNone; + _storeTV.tableFooterView = [UIView new]; + [self.view addSubview:_storeTV]; +} + +- (void)touchMask +{ + [self.view bringSubviewToFront:_mineTableView]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return _cellTitleArray.count; + if (tableView==_mineTableView) + { + return _cellTitleArray.count; + } + else + { + return _storeArr.count; + } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.row==5) + if (tableView==_mineTableView) + { + if (indexPath.row==5) + { + return 10; + } + return [FourthTableViewCell heightForFourthCell]; + } + else { - return 10; + return 30; } - return [FourthTableViewCell heightForFourthCell]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.row != 5) + if (tableView==_mineTableView) { - static NSString *cellId = @"FourthCell"; - FourthTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId]; - if (!cell) + if (indexPath.row != 5) { - [tableView registerNib:[UINib nibWithNibName:@"FourthTableViewCell" bundle:nil] forCellReuseIdentifier:cellId]; - cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + static NSString *cellId = @"FourthCell"; + FourthTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + if (!cell) + { + [tableView registerNib:[UINib nibWithNibName:@"FourthTableViewCell" bundle:nil] forCellReuseIdentifier:cellId]; + cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + } + + return cell; + } + else + { + UITableViewCell *cell = [[UITableViewCell alloc] init]; + UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, kMainScreenWidth-50, 0.5)]; + lineView.backgroundColor = RGBCOLOR(220, 220, 220); + [cell addSubview:lineView]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; } - - return cell; } else { - UITableViewCell *cell = [[UITableViewCell alloc] init]; - UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, kMainScreenWidth-50, 0.5)]; - lineView.backgroundColor = RGBCOLOR(220, 220, 220); - [cell addSubview:lineView]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; + static NSString *clcellId = @"clCell"; + CLTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:clcellId]; + if (!cell) + { + cell = [[CLTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:clcellId andWidth:storeTVWidth]; + cell.titleLabel.font = kFont12; + } + StoreMode *mode = _storeArr[indexPath.row]; + cell.titleLabel.text = mode.strStoreName; return cell; } } - (void)tableView:(UITableView *)tableView willDisplayCell:(FourthTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { - if(indexPath.row!=5) + if (tableView==_mineTableView) { - cell.cellImgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"mine_menu_%d", (int)indexPath.row]]; - cell.cellTitleLabel.text = _cellTitleArray[indexPath.row]; + if(indexPath.row!=5) + { + cell.cellImgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"mine_menu_%d", (int)indexPath.row]]; + cell.cellTitleLabel.text = _cellTitleArray[indexPath.row]; + } } } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:NO]; - switch (indexPath.row) { - case cellTypeTenant: - { - TenantViewController *vc = [[TenantViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeGate: - { - GateViewController *vc = [[GateViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeClerk: - { - ClerkViewController *vc = [[ClerkViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeSupplier: - { - SupplierViewController *vc = [[SupplierViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeOption: - { - SettingViewController *vc = [[SettingViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeScan: - { - ScanVC *vc = [[ScanVC alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; - } - case cellTypeMatter: - { - ProblemGoodsViewController *vc = [[ProblemGoodsViewController alloc] init]; - vc.hidesBottomBarWhenPushed = YES; - [self.navigationController pushViewController:vc animated:YES]; - break; + if (tableView==_mineTableView) + { + [tableView deselectRowAtIndexPath:indexPath animated:NO]; + switch (indexPath.row) { + case cellTypeTenant: + { + TenantViewController *vc = [[TenantViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case cellTypeGate: + { + GateViewController *vc = [[GateViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case cellTypeClerk: + { + ClerkViewController *vc = [[ClerkViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case cellTypeSupplier: + { + SupplierViewController *vc = [[SupplierViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case cellTypeOption: + { + SettingViewController *vc = [[SettingViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case cellTypeScan: + { + [self.view bringSubviewToFront:_maskingView]; + [self.view bringSubviewToFront:_storeTV]; + break; + } + case cellTypeMatter: + { + ProblemGoodsViewController *vc = [[ProblemGoodsViewController alloc] init]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + default: + break; } - default: - break; + } + else + { + [tableView deselectRowAtIndexPath:indexPath animated:NO]; + StoreMode *mode = _storeArr[indexPath.row]; + [self.view bringSubviewToFront:_mineTableView]; + ScanVC *vc = [[ScanVC alloc] initWithMode:mode]; + vc.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:vc animated:YES]; } } diff --git a/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.h b/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.h index 14608b1..a8ca95f 100644 --- a/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.h +++ b/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.h @@ -7,7 +7,8 @@ // #import "BaseViewController.h" - +@class StoreMode; @interface ScanVC : BaseViewController +- (instancetype)initWithMode:(StoreMode *)aMode; @end diff --git a/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.m b/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.m index 66948f0..90d455d 100644 --- a/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.m +++ b/YHB_Prj/YHB_Prj/FourthViewController/ScanVC/ScanVC.m @@ -8,17 +8,27 @@ #import "ScanVC.h" #import "DJScanViewController.h" +#import "LoginMode.h" @interface ScanVC () - +@property(nonatomic,strong) StoreMode *mode; @property(nonatomic,strong) UIButton *scanBtn; @end @implementation ScanVC +- (instancetype)initWithMode:(StoreMode *)aMode +{ + if (self = [super init]) + { + _mode = aMode; + } + return self; +} + - (void)viewDidLoad { [super viewDidLoad]; - self.title = @"快速扫描"; + self.title = _mode.strStoreName; self.view.backgroundColor = [UIColor whiteColor]; CGFloat btnWidth = 250;