|
@@ -32,6 +32,9 @@
|
|
|
@property (nonatomic,assign) int sortIndex;
|
|
@property (nonatomic,assign) int sortIndex;
|
|
|
@property (nonatomic,strong) SortButton *sortButton;
|
|
@property (nonatomic,strong) SortButton *sortButton;
|
|
|
|
|
|
|
|
|
|
+@property (nonatomic,assign) NSInteger editedRow;
|
|
|
|
|
+@property (nonatomic,assign) NSInteger deletedRow;
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation PortfolioViewController
|
|
@implementation PortfolioViewController
|
|
@@ -486,7 +489,8 @@
|
|
|
self.label_net_err.layer.masksToBounds=true;
|
|
self.label_net_err.layer.masksToBounds=true;
|
|
|
|
|
|
|
|
self.sortIndex = 0;
|
|
self.sortIndex = 0;
|
|
|
-
|
|
|
|
|
|
|
+ self.editedRow = -1;
|
|
|
|
|
+ self.deletedRow = -1;
|
|
|
|
|
|
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
|
|
|
// tap.minimumPressDuration = 0.8; //定义按的时间
|
|
// tap.minimumPressDuration = 0.8; //定义按的时间
|
|
@@ -1166,7 +1170,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
cell.backgroundColor = [UIColor whiteColor];// [UIColor whiteColor];;
|
|
cell.backgroundColor = [UIColor whiteColor];// [UIColor whiteColor];;
|
|
|
|
|
+ if (indexPath.row == self.editedRow) {
|
|
|
|
|
+ cell.backgroundColor = UIColorFromRGB(0xff9933);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (indexPath.row == self.deletedRow) {
|
|
|
|
|
+ cell.backgroundColor = UIColorFromRGB(0x336699);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return cell;
|
|
return cell;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1232,13 +1244,13 @@
|
|
|
// 添加一个删除按钮
|
|
// 添加一个删除按钮
|
|
|
|
|
|
|
|
self.indexPath=indexPath;
|
|
self.indexPath=indexPath;
|
|
|
|
|
+ ModelItemCell * cell = [tableView cellForRowAtIndexPath:indexPath];
|
|
|
|
|
+
|
|
|
|
|
|
|
|
UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
|
|
UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
|
|
|
|
|
|
|
|
NSLog(@"delete click");
|
|
NSLog(@"delete click");
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
alert.tag = ALERT_DEL;
|
|
alert.tag = ALERT_DEL;
|
|
|
// alert.
|
|
// alert.
|
|
@@ -1306,6 +1318,7 @@
|
|
|
|
|
|
|
|
if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
{
|
|
|
|
|
+ self.editedRow = indexPath.row;
|
|
|
if(qty>=0)
|
|
if(qty>=0)
|
|
|
item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
else
|
|
else
|
|
@@ -1431,6 +1444,9 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
{
|
|
{
|
|
|
if(buttonIndex!=alertView.cancelButtonIndex)
|
|
if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
{
|
|
{
|
|
|
|
|
+ int count =[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
+ BOOL delete_last = self.indexPath.row == count - 1 ? YES : NO;
|
|
|
|
|
+
|
|
|
[self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
[self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
|
|
@@ -1447,6 +1463,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
|
|
if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
{
|
|
|
|
|
+ self.deletedRow = delete_last ? -1 : self.indexPath.row;
|
|
|
[self reload_data];
|
|
[self reload_data];
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|