| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- //
- // BusinessInfoViewController.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2017/5/3.
- // Copyright © 2017年 elongtian. All rights reserved.
- //
- #import "BusinessInfoViewController.h"
- #import "BusinessCollectionViewCell.h"
- #import "NewCustomerViewController.h"
- #import "LogListViewController.h"
- #import "CustomerListViewController.h"
- #import "CustomerNewListViewController.h"
- #import "SalesOrderListVC.h"
- #import "SalesSlipListVC.h"
- #define PhotoCollectionViewCellIdentifier @"PhotoCollectionViewCellIdentifier"
- @interface BusinessInfoViewController ()
- @end
- @implementation BusinessInfoViewController
- #pragma mark - 公共函数
- /**
- viewDidLoad函数
- */
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationItem.title=@"iBOSSMini";
- [self initUI];
- }
- /**
- 适配安全区
- */
- -(void)viewDidAppear:(BOOL)animated{
- self.tabBarController.tabBar.backgroundColor = [UIColor whiteColor];
- self.view.backgroundColor = [UIColor whiteColor];
- if (@available(iOS 11.0, *)) {
- //将CollectionView的frame设置到全部列表的下边
- _businessCollectionView.frame = CGRectMake(10,CGRectGetMaxY(_lblAllBusiness.frame)+10, SCREENWIDTH-20, self.view.safeAreaLayoutGuide.layoutFrame.size.height-(CGRectGetMaxY(_lblAllBusiness.frame)+10));
- }
- }
- #pragma mark - 属性
- - (NSMutableArray *)businessArray{
- if (_businessArray == nil) {
- _businessArray=[NSMutableArray new];
- if([kkRights isEqualToString:@""]){
- BusinessModel *businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_log"];
- [businessModel setImageTitle:@"工作日志"];
- [_businessArray addObject:businessModel];
-
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_filing"];
- [businessModel setImageTitle:@"客户报备"];
- [_businessArray addObject:businessModel];
-
-
- // businessModel=[[BusinessModel alloc]init];
- // [businessModel setImageName:@"icon_follow"];
- // [businessModel setImageTitle:@"报备跟进"];
- // [_businessArray addObject:businessModel];
-
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_order"];
- [businessModel setImageTitle:@"手机开单"];
- [_businessArray addObject:businessModel];
-
- }
-
- else{
-
- BusinessModel *businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_log"];
- [businessModel setImageTitle:@"工作日志"];
- [_businessArray addObject:businessModel];
-
- if( [kkRights rangeOfString:FUNCTION_CUSTOMER_CUSTOMERSFILING_IPHONE].location!=NSNotFound){
-
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_filing"];
- [businessModel setImageTitle:@"客户报备"];
- [_businessArray addObject:businessModel];
-
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_follow"];
- [businessModel setImageTitle:@"新增报备"];
- [_businessArray addObject:businessModel];
- }
-
- // if( [kkRights rangeOfString:FUNCTION_CUSTOMER_FILINGFOLLOW_IPHONE].location!=NSNotFound){
- // businessModel=[[BusinessModel alloc]init];
- // [businessModel setImageName:@"icon_follow"];
- // [businessModel setImageTitle:@"报备跟进"];
- // [_businessArray addObject:businessModel];
- // }
-
- if( [kkRights rangeOfString:FUNCTION_ORDER_IPHONE].location!=NSNotFound){
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"icon_order"];
- [businessModel setImageTitle:@"手机开单"];
- [_businessArray addObject:businessModel];
-
- }
-
- if([kkRights rangeOfString:FUNCTION_ADD_SALE_ORDER_FORM_IPHONE].location!=NSNotFound){
-
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"order"];
- [businessModel setImageTitle:@"销售订单"];
- [_businessArray addObject:businessModel];
- }
-
-
- if( [kkRights rangeOfString:FUNCTION_ADD_SALE_FORM_IPHONE].location!=NSNotFound){
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"salesslip"];
- [businessModel setImageTitle:@"销售单"];
- [_businessArray addObject:businessModel];
-
- }
-
- if( [kkRights rangeOfString:FUNCTION_SALES_INVENTORY_FORM_IPHONE].location!=NSNotFound){
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"salesoutstorage"];
- [businessModel setImageTitle:@"销售出库"];
- [_businessArray addObject:businessModel];
- }
-
- if( [kkRights rangeOfString:FUNCTION_OTHER_INVENTORY_FORM_IPHONE].location!=NSNotFound){
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"otheroutstorage@2x.png"];
- [businessModel setImageTitle:@"其他出库"];
- [_businessArray addObject:businessModel];
- }
-
- if( [kkRights rangeOfString:FUNCTION_OTHER_ENTER_FORM_IPHONE].location!=NSNotFound){
- businessModel=[[BusinessModel alloc]init];
- [businessModel setImageName:@"otherinstorage"];
- [businessModel setImageTitle:@"其他入库"];
- [_businessArray addObject:businessModel];
- }
-
- }
-
-
-
- }
- return _businessArray;
- }
- #pragma mark - 委托回调函数
- /**
- 个数
-
- @param collectionView <#collectionView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- return self.businessArray.count;
- }
- /**
- 单元格
-
- @param collectionView <#collectionView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
- BusinessCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:PhotoCollectionViewCellIdentifier forIndexPath:indexPath];
-
- BusinessModel *model = self.businessArray[indexPath.row];
- [cell setBusinessInfoModel:model];
-
- return cell;
- }
- /**
- 点击当个单元格
-
- @param collectionView <#collectionView description#>
- @param indexPath <#indexPath description#>
- */
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
- self.hidesBottomBarWhenPushed=YES;
- BusinessModel *businessModel= self.businessArray[indexPath.row];
- NSString *title= businessModel.imageTitle;
- if ([title isEqualToString:@"工作日志"]) {
- LogListViewController *vc=[[LogListViewController alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if([title isEqualToString:@"客户报备"]){
- // 客户报备
- CustomerNewListViewController *vc=[[CustomerNewListViewController alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- vc.flagCustomerAndFollow = YES;
- vc.checkFlagList = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if([title isEqualToString:@"新增报备"]){
- // 客户报备
- NewCustomerViewController *vc=[[NewCustomerViewController alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if([title isEqualToString:@"报备跟进"]){
- // 客户报备跟进
- CustomerListViewController *vc=[[CustomerListViewController alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- vc.flagCustomerAndFollow = NO;
- vc.checkFlagList = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if([title isEqualToString:@"手机开单"]){
- OrderHomeViewController *homeVC=[[OrderHomeViewController alloc]init];
- homeVC.parentVC=self;
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:homeVC animated:YES];
-
- }
- else if([title isEqualToString:@"销售订单"]){
- SalesOrderListVC *salesOrderVC=[[SalesOrderListVC alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:salesOrderVC animated:YES];
- }else if([title isEqualToString:@"销售单"]){
- SalesSlipListVC *salesOrderVC=[[SalesSlipListVC alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:salesOrderVC animated:YES];
- }
- else if([title isEqualToString:@"销售出库"]){
- SalesOutStorageListVC *salesOutStorageListVC=[[SalesOutStorageListVC alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:salesOutStorageListVC animated:YES];
- }
-
- else if([title isEqualToString:@"其他出库"]){
- OtherOutStorageListVC *otherOutStorageListVC=[[OtherOutStorageListVC alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:otherOutStorageListVC animated:YES];
- }
- else if([title isEqualToString:@"其他入库"]){
- OtherInStorageListVC *otherInStorageListVC=[[OtherInStorageListVC alloc]init];
- [self.navigationController setNavigationBarHidden:NO animated:YES];
- [self.navigationController pushViewController:otherInStorageListVC animated:YES];
- }
- self.hidesBottomBarWhenPushed=NO;
- }
- /**
- Sections
-
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- #pragma mark - 私有函数
- /**
- 初始化ui
- */
- -(void)initUI{
- // 背景头图片
- UIImage *pic = [UIImage imageNamed:@"banner"];
- UIImageView *bannerView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.width*pic.size.height/pic.size.width)];
- [bannerView setImage:pic];
- [self.view addSubview:bannerView];
-
- // 分割线
- _separatorView = [[UIView alloc]init];
- [_separatorView setBackgroundColor:LineBackgroundColor];
- _separatorView.frame=CGRectMake(0, CGRectGetMaxY(bannerView.frame), self.view.frame.size.width, 10);
- [self.view addSubview: _separatorView];
- UIImageView *allBusinessImagView = [[UIImageView alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(_separatorView.frame)+5,20,20)];
- [allBusinessImagView setImage:[UIImage imageNamed:@"icon_allbusiness"]];
- [self.view addSubview:allBusinessImagView];
- _lblAllBusiness = [UILabel new];
- _lblAllBusiness.text = @"全部业务";
- _lblAllBusiness.font = [UIFont systemFontOfSize:15];
- _lblAllBusiness.frame=CGRectMake(CGRectGetMaxX(allBusinessImagView.frame)+10,CGRectGetMaxY(_separatorView.frame)+5,80, 20);
- _lblAllBusiness.textColor = [UIColor blackColor];
- [self.view addSubview:_lblAllBusiness];
-
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
- [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
- _businessCollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(_lblAllBusiness.frame)+10,Screen_Width-20,Screen_Height-CGRectGetMaxY(_lblAllBusiness.frame)-rectStatusHeight-rectNavHeight-59) collectionViewLayout:flowLayout];
-
- [ _businessCollectionView registerClass:[BusinessCollectionViewCell class] forCellWithReuseIdentifier:PhotoCollectionViewCellIdentifier];
- flowLayout.itemSize=CGSizeMake(Screen_Width/4,90);
- flowLayout.minimumLineSpacing=20;
- flowLayout.minimumInteritemSpacing=20;
- _businessCollectionView.dataSource=self;
- _businessCollectionView.delegate=self;
- _businessCollectionView.backgroundColor = [UIColor whiteColor];
- _businessCollectionView.showsVerticalScrollIndicator=NO;
- _businessCollectionView.scrollEnabled=YES;
-
- [self.view addSubview:_businessCollectionView];
- [_businessCollectionView reloadData];
- }
- ///**
- // 高度
- //
- // @param photos <#photos description#>
- // @return <#return value description#>
- // */
- //- (CGFloat)getPhotoCollectionViewHeightWithPhotos:(NSMutableArray *)photos {
- // // 上下间隔已经在frame上做了
- // NSInteger row = (photos.count / 3 + (photos.count % 3 ? 1 : 0));
- // if(self.view.frame.size.width<=320){
- // return (row * 80 + (row * 20));
- // }else{
- // return (row * 100 + (row * 20));
- // }
- //
- //}
- @end
|