|
|
@@ -1746,7 +1746,7 @@
|
|
|
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
|
|
{
|
|
|
-
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
// 添加一个删除按钮
|
|
|
|
|
|
self.indexPath=indexPath;
|
|
|
@@ -1838,11 +1838,31 @@
|
|
|
|
|
|
|
|
|
// 添加一个编辑按钮
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
|
|
|
|
|
|
NSLog(@"edit click");
|
|
|
-
|
|
|
+ if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
|
|
|
+
|
|
|
+ if ([Singleton sharedInstance].npd_shop_price_type == 0) {
|
|
|
+
|
|
|
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Warning" message:@"Current Price Type is Delivery Price,You Can't Change it" preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+
|
|
|
+ UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ [alert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ }];
|
|
|
+
|
|
|
+ [alert addAction:action];
|
|
|
+
|
|
|
+ if (weakself) {
|
|
|
+ __strong typeof(weakself) strongself = weakself;
|
|
|
+ [strongself presentViewController:alert animated:YES completion:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
UIViewController* parentvc=self;
|
|
|
@@ -2086,7 +2106,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
|
|
|
{
|
|
|
NSMutableDictionary * item_json = [self.content_arr[indexPath.row ] mutableCopy];// [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]]
|
|
|
@@ -2114,6 +2134,8 @@
|
|
|
|
|
|
return arr;
|
|
|
// return @[deleteRowAction,addWatchAction, editRowAction,freeRowAction];
|
|
|
+ } else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
|
|
|
+ return @[deleteRowAction,addWatchAction,editRowAction];
|
|
|
}
|
|
|
else
|
|
|
return @[deleteRowAction,addWatchAction];
|