Commit da881b65 by lee

ucategory filter

parent 803ed47b
......@@ -17,5 +17,7 @@
@property (nonatomic) NSInteger page;
@property (nonatomic) NSMutableArray *products;
@property (nonatomic) BUYCollectionSort sort;
@property (nonatomic) NSMutableArray<KWMFilter *> *filters;
@property (nonatomic) NSString *brand;
@end
......@@ -35,11 +35,11 @@
@property (nonatomic) NSArray *allBrands;
@property(nonatomic) BUYCollectionSort sort;
//@property(nonatomic) BUYCollectionSort sort;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectFilters;
//@property(nonatomic) NSMutableArray<KWMFilter *> *selectFilters;
@property(nonatomic) NSString *selectBrands;
//@property(nonatomic) NSString *selectBrands;
@property(nonatomic) NSArray<KWMCategoryModel *>* categories;
......@@ -108,8 +108,8 @@
[self initTbvLeft];
[self initCvRight];
self.sort = BUYCollectionSortCollectionDefault;
self.selectBrands = @"";
// self.sort = BUYCollectionSortCollectionDefault;
// self.selectBrands = @"";
}
-(void)initTbvLeft{
......@@ -195,14 +195,14 @@
KWMBrandFilterVC *brandFilterVC = (KWMBrandFilterVC *)[KWMBaseVC findControllerBy:[KWMBrandFilterVC kwmTag] fromStoryboard:@"Category"];
brandFilterVC.brandArray = self.allBrands;
brandFilterVC.delegate = self;
brandFilterVC.selectBrand = self.selectBrands;
brandFilterVC.selectBrand = self.selectedCategory.brand;
tragetVC = brandFilterVC;
}else{
KWMProductFilterVC *productFilterVC = (KWMProductFilterVC *)[KWMBaseVC findControllerBy:[KWMProductFilterVC kwmTag] fromStoryboard:@"Category"];
productFilterVC.filterMode = filterMode;
productFilterVC.delegate = self;
productFilterVC.selectedSort = self.sort;
productFilterVC.selectedTags = self.selectFilters;
productFilterVC.selectedSort = self.selectedCategory.sort;
productFilterVC.selectedTags = self.selectedCategory.filters;
tragetVC = productFilterVC;
}
CGSize size = [UIScreen mainScreen].bounds.size;
......@@ -211,8 +211,8 @@
#pragma mark -
-(void)kwm_onCompleProductFilter:(KWMFilterView *)filterView{
self.selectFilters = filterView.selectedTags;
self.sort = filterView.selectedSort;
// self.selectFilters = filterView.selectedTags;
self.selectedCategory.filters = filterView.selectedTags;
self.selectedCategory.sort = filterView.selectedSort;
[self.filterTab close];
[self.refreshUtil reLoadData];
......@@ -226,7 +226,8 @@
#pragma mark -
-(void)kwm_onCompleteBrandFilter:(NSString *)selectBrand{
self.selectBrands = selectBrand;
// self.selectBrands = selectBrand;
self.selectedCategory.brand = selectBrand;
[self.filterTab close];
[self.refreshUtil reLoadData];
[self.cvRightProduct.mj_header beginRefreshing];
......@@ -257,12 +258,12 @@
__weak KWMCategoryVC *weakSelf = self;
self.filterTab.userInteractionEnabled = false;
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:self.selectFilters];
if(![KWMStringUtil isEmpty:self.selectBrands]){
[tags addObject:self.selectBrands];
}
KWMCategoryModel *cmodel = self.selectedCategory;
[self.client getProductsPage:cpage inCollection:cmodel.collection_id withTags:tags sortOrder:self.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:cmodel.filters];
if(!cmodel.brand){
[tags addObject:cmodel.brand];
}
[self.client getProductsPage:cpage inCollection:cmodel.collection_id withTags:tags sortOrder:cmodel.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
if (cmodel == self.selectedCategory) {
[weakSelf.refreshUtil hideLoading];
}
......@@ -292,7 +293,6 @@
- (void)setSelectedCategory:(KWMCategoryModel *)selectedCategory {
_selectedCategory = selectedCategory;
self.refreshUtil.page = _selectedCategory.page;
self.sort = _selectedCategory.sort;
self.refreshUtil.hasNextPage = YES;
self.refreshUtil.dataList = _selectedCategory.products;
[self.cvRightProduct reloadData];
......
......@@ -44,7 +44,7 @@
case BUYCollectionSortPriceAscending:
return 3;
default:
return 0;
return -1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment