Commit 8a12ec72 authored by Sandy's avatar Sandy

封装筛选控件功能 商品管理下级界面数据展示

parent cc1a1c40
......@@ -92,7 +92,6 @@
1979754A1CAA4DB900407E3F /* CommodityMutipleSelectBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 197975491CAA4DB900407E3F /* CommodityMutipleSelectBottomView.xib */; };
1979754D1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1979754C1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m */; };
197975511CAB6F5D00407E3F /* OrderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 197975501CAB6F5D00407E3F /* OrderViewController.m */; };
1983EF451CBE2726004510B3 /* ManagementSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */; };
199B4D681CABBCF600451E0E /* OrderDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 199B4D671CABBCF600451E0E /* OrderDetailViewController.m */; };
199B4D6A1CABBEF400451E0E /* OrderDetailTopView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 199B4D691CABBEF400451E0E /* OrderDetailTopView.xib */; };
199B4D6D1CABBF0800451E0E /* OrderDetailTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 199B4D6C1CABBF0800451E0E /* OrderDetailTopView.m */; };
......@@ -383,8 +382,6 @@
1979754C1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenMultipleViewWithHeader.m; sourceTree = "<group>"; };
1979754F1CAB6F5D00407E3F /* OrderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderViewController.h; sourceTree = "<group>"; };
197975501CAB6F5D00407E3F /* OrderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderViewController.m; sourceTree = "<group>"; };
1983EF431CBE2726004510B3 /* ManagementSearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagementSearchViewController.h; sourceTree = "<group>"; };
1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManagementSearchViewController.m; sourceTree = "<group>"; };
199B4D661CABBCF600451E0E /* OrderDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderDetailViewController.h; sourceTree = "<group>"; };
199B4D671CABBCF600451E0E /* OrderDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderDetailViewController.m; sourceTree = "<group>"; };
199B4D691CABBEF400451E0E /* OrderDetailTopView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OrderDetailTopView.xib; sourceTree = "<group>"; };
......@@ -914,8 +911,6 @@
1979752D1CA90D6C00407E3F /* CommodityManagementViewController.m */,
197975431CAA2FAB00407E3F /* ManagementViewController.h */,
197975441CAA2FAB00407E3F /* ManagementViewController.m */,
1983EF431CBE2726004510B3 /* ManagementSearchViewController.h */,
1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */,
);
name = CommodityManagement;
sourceTree = "<group>";
......@@ -1910,7 +1905,6 @@
1946DC9A1CB7542D00AC6557 /* CatgoryModel.m in Sources */,
197975511CAB6F5D00407E3F /* OrderViewController.m in Sources */,
19DCCBDF1C9AA0450072C3BF /* ICRPlaceholderTextView.m in Sources */,
1983EF451CBE2726004510B3 /* ManagementSearchViewController.m in Sources */,
1900A33C1CB602D500B2B7C4 /* StoreNameViewController.m in Sources */,
19DCCBCD1C9AA0450072C3BF /* UIFont+Custom.m in Sources */,
19DCCBE41C9AA0450072C3BF /* ICRFunctionEntity.m in Sources */,
......
......@@ -18,4 +18,5 @@ typedef void (^selectedRow)(NSInteger);
- (instancetype)sortView;
- (void)hide;;
- (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row;
@end
......@@ -22,6 +22,10 @@
@property (nonatomic, assign) NSInteger selectedMark;
@property (nonatomic, strong) CoverShadowView *viewTopCover;
@property (nonatomic, assign) BOOL isTableOpen;
@property (nonatomic, assign) BOOL isLeft;
@property (nonatomic, assign) BOOL isLeftOpen;
@end
@implementation CommodityManagementSortView
- (instancetype)sortView {
......@@ -161,6 +165,7 @@
[self.leftBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
self.leftTableSelect(indexPath.row);
self.isLeft = YES;
}else{
space = @"right";
[self rightBtnAction];
......@@ -168,6 +173,7 @@
[self.leftBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
self.rightTableSelect(indexPath.row);
self.isLeft = NO;
}
......@@ -179,13 +185,20 @@
// Configure the cell...
cell.tintColor = kCustomGreenColor;
if (self.selectedMark == indexPath.row) {
cell.textLabel.textColor = kCustomGreenColor;
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
if (self.isLeft == self.isLeftOpen) {
if (self.selectedMark == indexPath.row) {
cell.textLabel.textColor = kCustomGreenColor;
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
}else{
cell.textLabel.textColor = [UIColor blackColor];
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
}else{
cell.textLabel.textColor = [UIColor blackColor];
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
return cell;
}
......@@ -206,10 +219,12 @@
_arrTitles = _arrLeft;
if (self.clickCount != M_PI) {
[self showTableView];
self.isLeftOpen = YES;
}else{
[self hideTableView];
self.isLeftOpen = NO;
}
[self iconAnimate];
}
......@@ -218,10 +233,11 @@
_arrTitles = _arrRight;
if (self.rightClickCount != M_PI) {
[self showTableView];
self.isLeftOpen = NO;
}else{
[self hideTableView];
self.isLeftOpen = NO;
}
[self rightIconAnimate];
}
......@@ -276,6 +292,27 @@
}
- (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row
{
if (isLeft) {
self.isLeft = YES;
self.arrTitles = self.arrLeft;
[self setLeftBtnTitle:self.arrTitles[row]];
[self.leftBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
self.isLeft = YES;
}else{
self.isLeft = NO;
self.arrTitles = self.arrRight;
[self.rightBtn setTitle:[NSString stringWithFormat:@"%@ ",self.arrTitles[row]] forState:UIControlStateNormal];
[self.leftBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
self.isLeft = NO;
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
......@@ -10,4 +10,6 @@
@interface CommodityManagementTopView : UIView
@property (nonatomic, strong) NSMutableArray *arrDatas;
@property (nonatomic, assign) BOOL isLeft;//判断排序判断选中了左边还是右边
@property (nonatomic, assign) NSInteger row;//判断排序判断选中了哪一行 传到下一个页面
@end
......@@ -30,6 +30,9 @@
[self hideSortView];
manageVC.isShowNavigationBar = YES;
manageVC.arrCellData = [self.arrDatas mutableCopy];
manageVC.isLeft = self.isLeft;
manageVC.row = self.row;
[[self viewController] PushViewController:manageVC animated:YES];
CLog(@"m");
......@@ -38,6 +41,8 @@
[self hideSortView];
AddCommodityViewController *addVC = [[AddCommodityViewController alloc] init];
addVC.hidesBottomBarWhenPushed = YES;
[[self viewController].navigationController pushViewController:addVC animated:YES];
CLog(@"a");
......
......@@ -32,6 +32,9 @@
@property (nonatomic, strong) UIView *titleView;
@property (nonatomic, strong) UIView *searchTitleView;
@end
@implementation CommodityManagementViewController
......@@ -108,6 +111,9 @@
- (void)leftSelectCodtition:(NSInteger)row {
self.topView.isLeft = YES;
self.topView.row = row;
switch (row) {
case 0:
{
......@@ -136,6 +142,10 @@
}
- (void)rightSelectCondition:(NSInteger)row {
self.topView.isLeft = NO;
self.topView.row = row;
switch (row) {
case 0:
{
......
//
// ManagementSearchViewController.h
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface ManagementSearchViewController : IBTUIViewController
@end
//
// ManagementSearchViewController.m
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "ManagementSearchViewController.h"
@interface ManagementSearchViewController ()<UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
@end
@implementation ManagementSearchViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpSearchBar];
// Do any additional setup after loading the view.
}
- (void)setUpSearchBar {
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 35)];//allocate titleView
UIColor *color = self.navigationController.navigationBar.barTintColor;
[titleView setBackgroundColor:color];
UISearchBar *searchBar = [[UISearchBar alloc] init];
searchBar.delegate = self;
searchBar.frame = CGRectMake(0, 0, 260, 35);
searchBar.centerX = titleView.centerX;
searchBar.backgroundImage = [UIImage imageWithColor:color];
[searchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[titleView addSubview:searchBar];
self.navigationItem.titleView = titleView;
[searchBar becomeFirstResponder];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -12,4 +12,6 @@
@interface ManagementViewController : IBTUIViewController
@property (nonatomic, strong) CommodityManagementSortView *sorView;
@property (nonatomic, strong) NSMutableArray *arrCellData;
@property (nonatomic, assign) BOOL isLeft;//判断排序判断选中了左边还是右边
@property (nonatomic, assign) NSInteger row;//判断排序判断选中了哪一行
@end
......@@ -10,29 +10,40 @@
#import "CommodityTableViewCell.h"
#import "UITableView+Category.h"
#import "CommodityMutipleSelectBottomView.h"
#define kPageSize @999
#define kCellId @"CommodityTableViewCell.h"
@interface ManagementViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) CommodityMutipleSelectBottomView *bottomView;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, copy) NSString *field; //排序的字段
@property (nonatomic, copy) NSString *direction; //排序的顺序 升序或降序
@property (nonatomic, copy) NSString *condition;
@end
@implementation ManagementViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.condition = @"shop online only";
self.field = @"";
self.direction = @"desc";
self.navigationItem.title = @"批量管理";
[self.view addSubview:self.sorView];
[self.sorView defaultSelectISLeft:self.isLeft row:self.row];
WS(weakSelf)
self.sorView.leftTableSelect = ^(NSInteger row){
[weakSelf leftSelectCodtition:row];
CLog(@"l");
};
self.sorView.rightTableSelect = ^(NSInteger row){
[weakSelf rightSelectCondition:row];
CLog(@"r");
};
_tableView = [UITableView plainTableViewWithTarget:self cellNibName:@"CommodityTableViewCell" cellId:kCellId];
[self.view addSubview:_tableView];
_tableView.sd_layout.topSpaceToView(self.sorView,0).leftEqualToView(self.view).rightEqualToView(self.view).bottomSpaceToView(self.view, 70);
......@@ -50,6 +61,107 @@
// Do any additional setup after loading the view.
}
- (void)leftSelectCodtition:(NSInteger)row {
switch (row) {
case 0:
{
self.condition = @"shop online only";
}
break;
case 1:
{
self.condition = @"shop offline only";
}
break;
default:
break;
}
[self resetReloadData];
}
- (void)rightSelectCondition:(NSInteger)row {
switch (row) {
case 0:
{
self.field = @"shop goods create time";
self.direction = @"desc";
}
break;
case 1:
{
self.field = @"salesvolume";
self.direction = @"desc";
}
break;
case 2:
{
self.field = @"brokerageRate";
self.direction = @"desc";
}
break;
case 3:
{
self.field = @" spec price";
self.direction = @"desc";
}
break;
default:
break;
}
[self resetReloadData];
}
//改变排序条件之后重新请求数据
- (void)resetReloadData {
[self.arrCellData removeAllObjects];
[self setUpData];
}
- (void)setUpData {
NSDictionary *params = @{@"defintion" : @{@"probePages" : @0,
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"conditions" : @[@{@"parameters" : @[[UserInfo shareInstance].domain],
@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"}},
@{@"parameters" : @[@[[UserInfo shareInstance].shop.uuid]],
@"operation" : @"shop uuid equals",
@"parameter" : @{@"operation" : @"sring"}},
@{@"parameters" : @[@""],
@"operation" : self.condition,
@"parameter" : @{@"operation" : @"sring"}}],
@"pageSize" : kPageSize,
@"page" : @0},
@"fetchParts" : @[@"string"]};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
[weakSelf.arrCellData addObject:model];
}
[weakSelf.tableView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
#pragma mark =========== action ===========
- (void)selectAll:(UIButton *)btn {//tag 等于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