Commit e5d8c074 authored by Sandy's avatar Sandy

商品管理 bug fix

parent c8653d5d
......@@ -58,8 +58,9 @@
[self setUpViews];
[self setUpSearchBar];
[self.topView.buttonAddCommodity addTarget:self action:@selector(addCommodityAction) forControlEvents:UIControlEventTouchUpInside];
[self.topView.buttonManageCommodity addTarget:self action:@selector(manageManentAction) forControlEvents:UIControlEventTouchUpInside];
kButtonAddAction(self.topView.buttonAddCommodity, addCommodityAction)
kButtonAddAction(self.topView.buttonManageCommodity, manageManentAction)
}
- (void)viewWillAppear:(BOOL)animated {
......@@ -107,8 +108,6 @@
//设置现在默认选中的排序方式
[self.sorView defaultSelectISLeft:YES row:0];
// self.topView.isLeft = YES;
// self.topView.row = 0;
WS(weakSelf)
self.sorView.leftTableSelect = ^(NSInteger row){
......@@ -121,7 +120,6 @@
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).bottomEqualToView(self.view);
......@@ -208,6 +206,23 @@
}
- (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.arrItemDatas addObject:model];
}
[weakSelf.tableView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (NSDictionary *)getParams {
UserInfo *info = [UserInfo shareInstance];
NSDictionary *params = @{@"defintion" : @{@"probePages" : @0,
......@@ -225,22 +240,11 @@
@"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.arrItemDatas addObject:model];
}
[weakSelf.tableView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
return params;
}
#pragma mark =========== action ===========
- (void)searchAct {
......
......@@ -54,6 +54,8 @@
[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);
......@@ -150,6 +152,22 @@
- (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,
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
......@@ -165,20 +183,10 @@
@"pageSize" : kPageSize,
@"page" : @0},
@"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 ===========
......@@ -187,9 +195,9 @@
if (self.dicSelectIds.allKeys.count == self.arrCellData.count) { //全选
[self.bottomView deselectAll];
for (int i = 0; i < self.arrCellData.count; i ++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds removeObjectForKey:model.uuid];
......@@ -308,24 +316,19 @@
//解析数据
- (void)unparseData:(NSDictionary *)responseObject {
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:hud];
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.sorView defaultSelectISLeft:YES row:0];
[self resetReloadData];
}else{
hud.mode = MBProgressHUDModeText;
hud.labelText = @"未知错误!";
[MBProgressHUD Javen_showError:@"未知错误!" onView:self.view delay:0.7 complete:nil];
}
[hud show:YES];
[hud hide:YES afterDelay:0.7];
[self.bottomView deselectAll];
}
//检查是否全部选中了
......
......@@ -323,6 +323,7 @@
- (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row
{
self.selectedMark = row;
if (isLeft) {
self.isLeft = YES;
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