Commit e5d8c074 authored by Sandy's avatar Sandy

商品管理 bug fix

parent c8653d5d
...@@ -58,8 +58,9 @@ ...@@ -58,8 +58,9 @@
[self setUpViews]; [self setUpViews];
[self setUpSearchBar]; [self setUpSearchBar];
[self.topView.buttonAddCommodity addTarget:self action:@selector(addCommodityAction) forControlEvents:UIControlEventTouchUpInside]; kButtonAddAction(self.topView.buttonAddCommodity, addCommodityAction)
[self.topView.buttonManageCommodity addTarget:self action:@selector(manageManentAction) forControlEvents:UIControlEventTouchUpInside]; kButtonAddAction(self.topView.buttonManageCommodity, manageManentAction)
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
...@@ -107,9 +108,7 @@ ...@@ -107,9 +108,7 @@
//设置现在默认选中的排序方式 //设置现在默认选中的排序方式
[self.sorView defaultSelectISLeft:YES row:0]; [self.sorView defaultSelectISLeft:YES row:0];
// self.topView.isLeft = YES;
// self.topView.row = 0;
WS(weakSelf) WS(weakSelf)
self.sorView.leftTableSelect = ^(NSInteger row){ self.sorView.leftTableSelect = ^(NSInteger row){
[weakSelf leftSelectCodtition:row]; [weakSelf leftSelectCodtition:row];
...@@ -121,7 +120,6 @@ ...@@ -121,7 +120,6 @@
CLog(@"r"); CLog(@"r");
}; };
//
_tableView = [UITableView plainTableViewWithTarget:self cellNibName:@"CommodityTableViewCell" cellId:kCellId]; _tableView = [UITableView plainTableViewWithTarget:self cellNibName:@"CommodityTableViewCell" cellId:kCellId];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
_tableView.sd_layout.topSpaceToView(self.sorView,0).leftEqualToView(self.view).rightEqualToView(self.view).bottomEqualToView(self.view); _tableView.sd_layout.topSpaceToView(self.sorView,0).leftEqualToView(self.view).rightEqualToView(self.view).bottomEqualToView(self.view);
...@@ -208,26 +206,9 @@ ...@@ -208,26 +206,9 @@
} }
- (void)setUpData { - (void)setUpData {
UserInfo *info = [UserInfo shareInstance];
NSDictionary *params = @{@"defintion" : @{@"probePages" : @0,
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"conditions" : @[@{@"parameters" : @[info.domain],
@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"}},
@{@"parameters" : @[@[[UserInfo shareInstance].shop.uuid]],
@"operation" : @"shop uuid equals",
@"parameter" : @{@"operation" : @"sring"}},
@{@"parameters" : @[self.searchText],
@"operation" : self.condition,
@"parameter" : @{@"operation" : @"sring"}}],
@"pageSize" : kPageSize,
@"page" : @0},
@"fetchParts" : @[@"string"]};
WS(weakSelf) WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { [[HTTPCilent shareCilent] POST:@"goods/query2" parameters:[self getParams] success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) { for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic]; CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
...@@ -241,6 +222,29 @@ ...@@ -241,6 +222,29 @@
} }
- (NSDictionary *)getParams {
UserInfo *info = [UserInfo shareInstance];
NSDictionary *params = @{@"defintion" : @{@"probePages" : @0,
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"conditions" : @[@{@"parameters" : @[info.domain],
@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"}},
@{@"parameters" : @[@[[UserInfo shareInstance].shop.uuid]],
@"operation" : @"shop uuid equals",
@"parameter" : @{@"operation" : @"sring"}},
@{@"parameters" : @[self.searchText],
@"operation" : self.condition,
@"parameter" : @{@"operation" : @"sring"}}],
@"pageSize" : kPageSize,
@"page" : @0},
@"fetchParts" : @[@"string"]};
return params;
}
#pragma mark =========== action =========== #pragma mark =========== action ===========
- (void)searchAct { - (void)searchAct {
......
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
[weakSelf rightSelectCondition:row]; [weakSelf rightSelectCondition:row];
CLog(@"r"); CLog(@"r");
}; };
_tableView = [UITableView plainTableViewWithTarget:self cellNibName:@"CommodityTableViewCell" cellId:kCellId]; _tableView = [UITableView plainTableViewWithTarget:self cellNibName:@"CommodityTableViewCell" cellId:kCellId];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
_tableView.sd_layout.topSpaceToView(self.sorView,0).leftEqualToView(self.view).rightEqualToView(self.view).bottomSpaceToView(self.view, 70); _tableView.sd_layout.topSpaceToView(self.sorView,0).leftEqualToView(self.view).rightEqualToView(self.view).bottomSpaceToView(self.view, 70);
...@@ -149,7 +151,23 @@ ...@@ -149,7 +151,23 @@
- (void)setUpData { - (void)setUpData {
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:[self getParams] 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) {
}];
}
- (NSDictionary *)getParams
{
NSDictionary *params = @{@"defintion" : @{@"probePages" : @0, NSDictionary *params = @{@"defintion" : @{@"probePages" : @0,
@"orders" : @[@{@"field" : self.field, @"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}], @"direction" : self.direction}],
...@@ -165,21 +183,11 @@ ...@@ -165,21 +183,11 @@
@"pageSize" : kPageSize, @"pageSize" : kPageSize,
@"page" : @0}, @"page" : @0},
@"fetchParts" : @[@"string"]}; @"fetchParts" : @[@"string"]};
return params;
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 =========== #pragma mark =========== action ===========
- (void)selectAll:(UIButton *)btn { - (void)selectAll:(UIButton *)btn {
...@@ -187,9 +195,9 @@ ...@@ -187,9 +195,9 @@
if (self.dicSelectIds.allKeys.count == self.arrCellData.count) { //全选 if (self.dicSelectIds.allKeys.count == self.arrCellData.count) { //全选
[self.bottomView deselectAll]; [self.bottomView deselectAll];
for (int i = 0; i < self.arrCellData.count; i ++) { for (int i = 0; i < self.arrCellData.count; i ++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES]; [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
CommotityListModel *model = self.arrCellData[indexPath.row]; CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds removeObjectForKey:model.uuid]; [self.dicSelectIds removeObjectForKey:model.uuid];
...@@ -308,24 +316,19 @@ ...@@ -308,24 +316,19 @@
//解析数据 //解析数据
- (void)unparseData:(NSDictionary *)responseObject { - (void)unparseData:(NSDictionary *)responseObject {
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:hud];
if ([responseObject[@"code"] isEqualToNumber:@0]) { if ([responseObject[@"code"] isEqualToNumber:@0]) {
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = kSysWhite;
hud.customView = imageView;
hud.mode = MBProgressHUDModeCustomView;
hud.labelText = @"操作成功!";
[MBProgressHUD Javen_showSuccess:@"操作成功!" onView:self.view delay:0.7 complete:nil];
[self.dicSelectIds removeAllObjects]; [self.dicSelectIds removeAllObjects];
[self.sorView defaultSelectISLeft:YES row:0];
[self resetReloadData]; [self resetReloadData];
}else{ }else{
hud.mode = MBProgressHUDModeText; [MBProgressHUD Javen_showError:@"未知错误!" onView:self.view delay:0.7 complete:nil];
hud.labelText = @"未知错误!";
} }
[hud show:YES];
[hud hide:YES afterDelay:0.7]; [self.bottomView deselectAll];
} }
//检查是否全部选中了 //检查是否全部选中了
......
...@@ -323,6 +323,7 @@ ...@@ -323,6 +323,7 @@
- (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row - (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row
{ {
self.selectedMark = row;
if (isLeft) { if (isLeft) {
self.isLeft = YES; self.isLeft = YES;
self.arrTitles = self.arrLeft; self.arrTitles = self.arrLeft;
......
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