ProductLibraryView.m 24.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674
//
//  ProductLibraryView.m
//  Lighting
//
//  Created by mac on 16/5/11.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "ProductLibraryView.h"


@implementation ProductLibraryView
/**
 *  初始化商品数据源数组
 */
- (NSMutableArray *)datasArray
{
    if (_datasArray == nil) {
        
        _datasArray = [NSMutableArray array];
    }
    return _datasArray;
}
/**
 *  初始化筛选数据源
 */
- (NSMutableArray *)arrayData
{
    if (_arrayData == nil) {
        
        _arrayData = [NSMutableArray array];
    }
    return _arrayData;
}
/**
 *  初始化复选模型
 */
- (GoodsCondition *)condtionModel
{
    if (!_condtionModel) {
        _condtionModel = [[GoodsCondition alloc]init];
    }
    return _condtionModel;
}

- (void)viewDidLoad {
    [self initdata];
    [self initSubView];
  
    

}

-(void)initdata
{
    self.arrayData=[[NSMutableArray alloc]init];
    self.nameData=[[NSMutableArray alloc]initWithObjects:@"风格",@"类型",@"空间",@"材质",@"价格",nil];
    self.cellArray=[[NSMutableArray alloc]init];
    self.showSection=[[NSMutableArray alloc]init];
    self.typeBtnArray=[[NSMutableArray alloc]init];
    self.sectionBtnArray=[[NSMutableArray alloc]init];
    self.cellBtnArray=[[NSMutableArray alloc]init];
    self.indexPage = 1;
    self.selectedIndex=100;
    
}
- (void)uiConfigAction
{
    //下拉刷新
    MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
        
       
            //分页数据
            DataPage *Newpage = [[DataPage alloc]init];
            Newpage.page = 1;
            Newpage.rows = KROWS;
            self.condtionModel.page = Newpage;
            self.indexPage = 1;
            //搜索
            if (self.selectedCode) {
                switch (self.selectedIndex) {
                    case 100://风格
                    {
                        self.condtionModel.styleEquals = self.selectedCode;
                    }
                        break;
                    case 101://类型
                    {
                        self.condtionModel.categoryEquals = self.selectedCode;
                    }
                        break;
                    case 102://空间
                    {
                        self.condtionModel.spaceEquals = self.selectedCode;
                    }
                        break;
                    case 103://材质
                    {
                        self.condtionModel.materialEqueals = self.selectedCode;
                    }
                        break;
                    case 104://价格
                    {
                        //价格字符串切割
                        NSArray *spacrArray = [self.selectedCode componentsSeparatedByString:@"到"];
                        self.condtionModel.startprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:0] integerValue]];
                        self.condtionModel.endprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:1] integerValue]];
//                        self.condtionModel.categoryEquals = self.selectedCode;
                    }
                        break;
                        
                    default:
                        break;
                }
                
           }
            [self.collectionView.mj_footer resetNoMoreData];
            [self getScreeningdatasisRemoveArray:YES];
            [self getGoodsListDatasisRemove:YES Withobject:self.condtionModel];
        
    }];
    headerRefresh.stateLabel.hidden = YES;
    headerRefresh.lastUpdatedTimeLabel.hidden = YES;
    self.collectionView.mj_header = headerRefresh;
    [self.collectionView.mj_header beginRefreshing];
    
    //上拉加载
    self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        
        
            if (++self.indexPage  > self.totalPages) {
                [self.collectionView.mj_footer endRefreshingWithNoMoreData];
            }else
            {
                //分页数据
                DataPage *Newpage = [[DataPage alloc]init];
                Newpage.page = self.indexPage;
                Newpage.rows = KROWS;
                self.condtionModel.page = Newpage;
                //搜索
                if (self.selectedCode) {
                    self.condtionModel.categoryEquals = self.selectedCode;
                }
                [self getGoodsListDatasisRemove:NO Withobject:self.condtionModel];
            }
        
    }];

}

#pragma mark -获取商品列表数据
- (void)getGoodsListDatasisRemove:(BOOL)remove Withobject:(GoodsCondition *)conditon
{

    [self getGoodsListdatas:conditon returnResponse:^(GoodsResponse *response) {
        if (response.goodsEntity.count == 0) {
            
            [self ErrorMBProgressView:@"暂无数据"];
            
        }else
        {
            if (remove) {
                [self.datasArray removeAllObjects];
            }
            for (TOGoodsEntity *model in response.goodsEntity) {
                [self.datasArray addObject:model];
            }
            [self.collectionView reloadData];
             [self.seceneTableView reloadData];
        }
    }];
}

#pragma mark -获取产品筛选数据
- (void)getScreeningdatasisRemoveArray:(BOOL)remove

{

    [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:SERVERREQUESTURL(PRODUCTSCREENING) WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {

        if ([returnValue[@"code"] isEqualToNumber:@0]) {
            if (remove) {
                [self.arrayData removeAllObjects];
            }

            GoodsFilter *goodsStyle = [[GoodsFilter alloc]initWithDictionary:returnValue[@"data"] error:nil];
            self.goodsFilter=goodsStyle;
            switch (self.selectedIndex) {
                case 100:
                    //            风格
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.styles];
                    
                    break;
                case 101:
                    //            类型
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.categories];
                    break;
                case 102:
                    //            空间
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.space];
                    break;
                case 103:
                    //            材质
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.material];
                    break;
                case 104:
                    //            价格
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.price];
                    break;
                    
                default:
                    break;
            }
            
            [self.seceneTableView reloadData];
        }
        else
            {
            [self ErrorMBProgressView:returnValue[@"message"]];
            }

    } WithErrorCodeBlock:^(id errorCodeValue) {

    } WithFailureBlock:^(id error) {

        NSLog(@"%@",error);
    }];
}



#pragma mark -获取商品列表数据
- (void)getGoodsListdatas:(GoodsCondition *)conditon returnResponse:(void(^)(GoodsResponse *))finish
{

    [self CreateMBProgressHUDLoding];
    [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(PRODUCTLIST) WithRequestType:0 WithParameter:conditon WithReturnValueBlock:^(id returnValue) {

        [self RemoveMBProgressHUDLoding];
        [self endRefreshingForTableView:self.collectionView];
        if ([returnValue[@"code"] isEqualToNumber:@0]) {

            GoodsResponse *sponse = [[GoodsResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
             self.totalPages = [returnValue[@"data"][@"totalpages"] intValue];
            //返回结果
            finish(sponse);
        }
        else
            {
            [self ErrorMBProgressView:@"暂无数据"];
            }

    } WithErrorCodeBlock:^(id errorCodeValue) {

    } WithFailureBlock:^(id error) {
         [self endRefreshingForTableView:self.collectionView];
        [self RemoveMBProgressHUDLoding];
    }];
}
-(void)initSubView
{
    for (int i=0; i<self.nameData.count; i++) {
        if (i !=5) {
            UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame=CGRectMake(ScreenWidth-250, 52+i*50, 100, 46) ;
            btn.backgroundColor=[UIColor whiteColor];
            [btn setTitle:[self.nameData objectAtIndex:i] forState:UIControlStateNormal];
             btn.contentEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0);
            [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(selectedType:) forControlEvents:UIControlEventTouchUpInside];
            if (i==0) {
                btn.backgroundColor=RGB(79, 153, 217, 1);
                [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            }else
            {
                 btn.backgroundColor=RGB(225, 225, 225, 1);
                 [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            }
            btn.tag=100 +i;
            btn.layer.masksToBounds = YES;
            btn.layer.cornerRadius = 20;
            [self.typeBtnArray addObject:btn];
            [self.view addSubview:btn];
        }
       
    }
    self.subView=[[UIView alloc]initWithFrame:CGRectMake(100, 50, ScreenWidth-300, ScreenHeight-200)];
    self.subView.backgroundColor=[UIColor whiteColor];
    [self.view  addSubview:self.subView];

    //点击手势
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView:)];
    tap.delegate = self;
    tap.cancelsTouchesInView = NO;
    [[UIApplication sharedApplication].keyWindow addGestureRecognizer:tap];
    [self initSubViews];
   
    
}


-(void)initSubViews
{
    self.headerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.subView.frame.size.width-100, 50)];
    self.headerView.backgroundColor=RGB(225, 225, 225, 1);
    [self.subView addSubview:self.headerView];
    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame=CGRectMake(10, 10, 30, 30);
    [btn setBackgroundImage:[UIImage imageNamed:@"Folder"] forState:UIControlStateNormal];
    [self.headerView addSubview:btn];
    UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(45, 10, 100, 30)];
    lable.text=@"选择产品";
    [self.headerView addSubview:lable];
    //输入框背景
    UIImageView *backView = [[UIImageView alloc]initWithFrame:CGRectMake(self.headerView.frame.size.width-300, 10,250, 30)];
    backView.userInteractionEnabled=YES;
    [backView setImage:[UIImage imageNamed:@"line"]];
    [self.headerView addSubview:backView];
    //搜索图标
    UIButton *searchBtn = [[UIButton alloc]initWithFrame:CGRectMake(10, 0, 25, 25)];
    searchBtn.backgroundColor=RGB(225, 225, 225, 1);
    [searchBtn setBackgroundImage:[UIImage imageNamed:@"search"] forState:UIControlStateNormal] ;
    [searchBtn addTarget:self action:@selector(searchProduct:) forControlEvents:UIControlEventTouchUpInside];
    [backView addSubview:searchBtn];

    
    //输入框
   self.searchTextField = [[UITextField alloc]initWithFrame:CGRectMake(50, 0, backView.frame.size.width-50, 29)];
    self.searchTextField.borderStyle = UITextBorderStyleNone;
    self.searchTextField.placeholder = @" 请输入产品关键字";
    self.searchTextField.font = [UIFont systemFontOfSize:12];
    self.searchTextField.returnKeyType = UIReturnKeySearch;
    self.searchTextField.delegate=self;
    [backView addSubview:self.searchTextField];
//
    
    self.seceneTableView=[[UITableView alloc]initWithFrame:CGRectMake( self.headerView.frame.size.width, 0, 100, self.subView.frame.size.height)];
    self.seceneTableView.delegate=self;
    self.seceneTableView.dataSource=self;
    self.seceneTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.seceneTableView.tableHeaderView=nil;
    [self.subView addSubview:self.seceneTableView];
    
 
    //确定是水平滚动,还是垂直滚动
    UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayout alloc] init];
    [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
    
    self.collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake( 0, 50, self.headerView.frame.size.width, self.subView.frame.size.height-50) collectionViewLayout:flowLayout];
    self.collectionView.dataSource=self;
    self.collectionView.delegate=self;
    [self.collectionView setBackgroundColor:RGB(241, 241, 241, 1)];
    //注册Cell,必须要有
    [self.collectionView registerClass:[ProductCollectionPictureCell class] forCellWithReuseIdentifier:@"UICollectionViewCell"];
    
    [self.subView addSubview:self.collectionView];
    [self uiConfigAction];
}
-(void)selectedType:(UIButton *)sender
{
   
    for (UIButton *btn in self.typeBtnArray) {
        btn.backgroundColor=RGB(225, 225, 225, 1);
       [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    sender.backgroundColor=RGB(79, 153, 217, 1);
    [sender setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    btn.backgroundColor=RGB(79, 153, 217, 1);
//    btn.backgroundColor=RGB(225, 225, 225, 1);
    self.selectedIndex=sender.tag;
            switch (sender.tag) {
                case 100:
                    //            风格
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.styles];
                    
                    break;
                case 101:
                    //            类型
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.categories];
                    break;
                case 102:
                    //            空间
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.space];
                    break;
                case 103:
                    //            材质
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.material];
                    break;
                case 104:
                    //            价格
                    self.arrayData=[NSMutableArray arrayWithArray:self.goodsFilter.price];
                    break;
              
                default:
                    break;
            }
    [self.seceneTableView reloadData];
//    [self.collectionView.mj_header beginRefreshing];
}
-(void)didSelectSection:(UIButton *)sender
{
    [self.sectionBtnArray removeAllObjects];
    [self.sectionBtnArray addObject:sender.titleLabel.text];
    sender.backgroundColor=RGB(221, 221, 221, 1);
   
    switch (self.selectedIndex) {
        case 100://风格
        {
            self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] typecode] ;
            [self.collectionView.mj_header beginRefreshing];
        }
            break;
        case 101://类型
        {
            if ([[NSString stringWithFormat:@"%d",sender.tag-100 ]isEqualToString:[NSString stringWithFormat:@"%@",[self.showSection firstObject]]]) {
                [self.cellArray removeAllObjects ];
                [self.showSection removeAllObjects];
                [self.seceneTableView reloadData];
            }else
            {
                [self.cellArray removeAllObjects ];
                [self.showSection removeAllObjects];
                self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] fid] ;
                [self.collectionView.mj_header beginRefreshing];
                self.cellArray=[NSMutableArray arrayWithArray:[[self.arrayData objectAtIndex_opple:sender.tag-100] children]];
                [self.showSection addObject:[NSString stringWithFormat:@"%d",sender.tag-100]];
                [self.seceneTableView reloadData];
            }
          
        }
            break;
        case 102://空间
        {
         self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] typecode] ;
        [self.collectionView.mj_header beginRefreshing];
        }
            break;
        case 103://材质
        {
            self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] typecode] ;
            [self.collectionView.mj_header beginRefreshing];

        }
            break;
        case 104://价格
        {
            self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] typename] ;
            [self.collectionView.mj_header beginRefreshing];
        }
            break;
            
       
        default:
            self.condtionModel.nameLike = self.selectedCode;
            break;
            break;
    }

}
#pragma mark -- UICollectionViewDataSource
//定义展示的UICollectionViewCell的个数
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
      return self.datasArray.count;

}


//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * CellIdentifier = @"UICollectionViewCell";
    ProductCollectionPictureCell * cell = (ProductCollectionPictureCell*)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
    NSArray *imageArray = [[[self.datasArray objectAtIndex_opple:indexPath.item] pictures] componentsSeparatedByString:@","];
    [cell.productImageView sd_setImageWithURL:[NSURL URLWithString:[imageArray firstObject]] placeholderImage:REPLACEIMAGE];
    cell.productDesce.text=[[self.datasArray objectAtIndex_opple:indexPath.item] name];

   TOGoodsEntity *model = [self.datasArray objectAtIndex_opple:indexPath.item];
    cell.productPrice.text = [NSString stringWithFormat:@"¥%@",[[[self.datasArray objectAtIndex_opple:indexPath.item] tagPrice] stringValue]];
    cell.productParameter.text=[NSString stringWithFormat:@"%@ %@ ",model.code,model.size];
    cell.productModel=[self.datasArray objectAtIndex_opple:indexPath.item];

    return cell;
}
#pragma mark --UICollectionViewDelegateFlowLayout
//定义每个Item 的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(190, 150);
}

//定义每个UICollectionView 的边距
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(10, 10, 20, 20);
}
//定义每个UICollectionView 的纵向间距
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
    return 2;
}

#pragma mark --UICollectionViewDelegate

//UICollectionView被选中时调用的方法
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    ProductCollectionPictureCell * cell = (ProductCollectionPictureCell *)[collectionView cellForItemAtIndexPath:indexPath];
    if ([self.delegate respondsToSelector:@selector(addProductImage:productModel:)]) {
        
        [self.delegate addProductImage:cell.productImageView.image productModel:cell.productModel];
    }

}

//返回这个UICollectionView是否可以被选择
-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

#pragma mark - 协议方法
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 50;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return self.arrayData.count;;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 50)];
    view.backgroundColor = [UIColor whiteColor];
    NSString *str=[[NSString alloc]init];
    if (self.selectedIndex==101) {
        str=[NSString stringWithFormat:@"%@",[[self.arrayData objectAtIndex_opple:section] name]];
    }else
    {
       str=[NSString stringWithFormat:@"%@",[[self.arrayData objectAtIndex_opple:section] typename]];
    }
    
    UIButton *btn=[[ UIButton alloc]initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height-1)];
    [btn setTitle:str forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    if ([str isEqualToString:[self.sectionBtnArray firstObject]]) {
        btn.backgroundColor=RGB(221, 221, 221, 1);
        [btn setTitleColor:RGB(79, 153, 217, 1) forState:UIControlStateNormal];
    }else
    {
        btn.backgroundColor=[UIColor whiteColor];
        [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    btn.tag=section+100;
    btn.titleLabel.font=[UIFont systemFontOfSize:15];
    [btn addTarget:self action:@selector(didSelectSection:) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:btn];
    UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(0, view.frame.size.height-1, view.frame.size.width, 1)];
    lable.backgroundColor=[UIColor grayColor];
    [view addSubview:lable];
    return view;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (self.selectedIndex==101) {//类型
        if ([self.showSection containsObject:[NSString stringWithFormat:@"%ld",(long)section]]) {
            return self.cellArray.count;
        }else
        {
            return 0;
        }
    }else
    {
        return 0;
    }
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([tableView isEqual:self.seceneTableView])
    {
        return 50;
    }else
    {
        return 150;
    }
    
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
           static NSString *cellID = @"ChooseTansferCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
//            cell.selectionStyle = UITableViewCellSelectionStyleNone;

        }
    cell.backgroundColor=[UIColor whiteColor];
    cell.textLabel.textColor=[UIColor blackColor];
    
    if ([[self.cellArray objectAtIndex_opple:indexPath.row]isKindOfClass:[GoodsCategory class]]) {
        cell.textLabel.text=[[self.cellArray objectAtIndex_opple:indexPath.row] name];
        if ([cell.textLabel.text isEqualToString:[self.cellBtnArray firstObject]]) {
            cell.backgroundColor=RGB(221, 221, 221, 1);
            cell.textLabel.textColor=RGB(79, 153, 217, 1);
        }
        cell.textLabel.textAlignment=NSTextAlignmentCenter;
    }//        05产品库-详情_03
           return cell;
        
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.cellBtnArray removeAllObjects];
    self.selectedCode = [[self.cellArray objectAtIndex_opple:indexPath.row] fid] ;
    [self.cellBtnArray addObject:[[self.cellArray objectAtIndex_opple:indexPath.row] name]];

    [self.collectionView.mj_header beginRefreshing];
    
}
//产品搜索
-(void)searchProduct:(UIButton *)sender
{
    if (self.searchTextField.text==nil||[self.searchTextField.text isEqualToString:@""]) {
        [self  SHOWPrompttext:@"请先输入搜索关键字"];
    }else
    {
    self.condtionModel.nameLike=self.searchTextField.text;
    [self.collectionView.mj_header beginRefreshing];
 
    }
    
}
#pragma mark -Return键检测
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
     [textField resignFirstResponder];
    if (self.searchTextField.text==nil||[self.searchTextField.text isEqualToString:@""]) {
        [self  SHOWPrompttext:@"请先输入搜索关键字"];
    }else
    {
        self.condtionModel.nameLike=self.searchTextField.text;
        [self.collectionView.mj_header beginRefreshing];
        
    }
    return YES;
}

-(void)DismissScreenView:(UITapGestureRecognizer*)sender{
    CGPoint point = [sender locationInView:self.view];
    if (point.x<100 || point.x >ScreenWidth-150||point.y<50||point.y>ScreenHeight-150) {
        
        if (self) {
            if ([self.delegate respondsToSelector:@selector(restProductBtnImage)]) {
                [self.delegate restProductBtnImage];
            }
           
        }
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end