|
|
@@ -27,7 +27,7 @@
|
|
|
|
|
|
@property (nonatomic,strong) NSMutableArray *mergeList;
|
|
|
|
|
|
-@property (strong, nonatomic) IBOutlet UIButton *mergeListButton;
|
|
|
+@property (strong, nonatomic) IBOutlet UIBarButtonItem *mergeListButton;
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -120,8 +120,6 @@
|
|
|
self.content_data = [[NSMutableArray alloc]init];
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
UIRefreshControl *ref = [[UIRefreshControl alloc]init];
|
|
|
ref.tag = 201 ;
|
|
|
ref.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
|
|
|
@@ -275,14 +273,33 @@
|
|
|
|
|
|
// 检查权限
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
+ NSMutableArray *items = [self.toolbarView.items mutableCopy];
|
|
|
+
|
|
|
if(appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
|
|
|
|
|
|
+
|
|
|
// 合并订单的权限
|
|
|
- self.mergeListButton.hidden = ![Singleton sharedInstance].permissions_merge_order;
|
|
|
+ if ([Singleton sharedInstance].permissions_merge_order) { // 能够合并
|
|
|
+
|
|
|
+ if (![items containsObject:self.mergeListButton]) { // 没显示button
|
|
|
+ [items insertObject:self.mergeListButton atIndex:4];
|
|
|
+ self.toolbarView.items = items;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else { // 不能合并
|
|
|
+ if ([items containsObject:self.mergeListButton]) { // 显示button
|
|
|
+ [items removeObject:self.mergeListButton];
|
|
|
+ self.toolbarView.items = items;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- self.mergeListButton.hidden = YES;
|
|
|
+// self.mergeListButton.hidden = YES;
|
|
|
+ if ([items containsObject:self.mergeListButton]) { // 显示button
|
|
|
+ [items removeObject:self.mergeListButton];
|
|
|
+ self.toolbarView.items = items;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -300,7 +317,7 @@
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Attention", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
+ UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Warning", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
[alert show];
|
|
|
|
|
|
|
|
|
@@ -1278,7 +1295,7 @@
|
|
|
|
|
|
} else if (appDelegate.user_type==USER_ROLE_CUSTOMER) {
|
|
|
|
|
|
- UITableViewRowAction *add2MergeListAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Add To MergeList" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
|
|
|
+ UITableViewRowAction *add2MergeListAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Add To Combine Order List" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
|
|
|
|
|
|
NSString *orderCode = [NSString stringWithFormat:@"%@",[self.content_data[indexPath.row] valueForKey:@"order_code"]];
|
|
|
|
|
|
@@ -1532,12 +1549,12 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
#pragma mark - button action
|
|
|
|
|
|
-- (IBAction)mergeListButtonClick:(UIButton *)sender {
|
|
|
+- (IBAction)mergeListButtonClick:(UIBarButtonItem *)sender {
|
|
|
|
|
|
|
|
|
if (!self.mergeList.count) {
|
|
|
|
|
|
- [RAUtils message_alert:@"Merge List is Empty" title:nil controller:self];
|
|
|
+ [RAUtils message_alert:@"Combine Order List is Empty" title:nil controller:self];
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -1547,13 +1564,12 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
mergeVC.mergeList = self.mergeList;
|
|
|
|
|
|
- mergeVC.title = @"Merge List";
|
|
|
+ mergeVC.title = @"Combine Order List";
|
|
|
|
|
|
__weak typeof(self) weakself = self;
|
|
|
|
|
|
mergeVC.mergeBlock = ^(NSDictionary *ret) {
|
|
|
|
|
|
- DebugLog(@"merge order return: %@",ret);
|
|
|
|
|
|
if (weakself) {
|
|
|
|