|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
|
|
//#define ALERT_FREE 1024
|
|
//#define ALERT_FREE 1024
|
|
|
#define ALERT_DEL 1025
|
|
#define ALERT_DEL 1025
|
|
|
-#define ALERT_SET_FREE 1026
|
|
|
|
|
|
|
+//#define ALERT_SET_FREE 1026
|
|
|
#define ALERT_RESTORE_FREE 1027
|
|
#define ALERT_RESTORE_FREE 1027
|
|
|
|
|
|
|
|
@interface CartViewController ()
|
|
@interface CartViewController ()
|
|
@@ -75,7 +75,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)dealloc {
|
|
- (void)dealloc {
|
|
|
|
|
+ #ifndef RA_NOTIFICATION
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-(void) logout
|
|
-(void) logout
|
|
@@ -934,8 +936,10 @@
|
|
|
self.label_net_err.layer.cornerRadius=15;
|
|
self.label_net_err.layer.cornerRadius=15;
|
|
|
self.label_net_err.layer.masksToBounds=true;
|
|
self.label_net_err.layer.masksToBounds=true;
|
|
|
|
|
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(priceTypeChanged:) name:Change_Price_Type_Notification object:nil];
|
|
|
|
|
|
|
|
|
|
|
|
+ #ifndef RA_NOTIFICATION
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(priceTypeChanged:) name:Change_Price_Type_Notification object:nil];
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
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; //定义按的时间
|
|
@@ -1183,52 +1187,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- (IBAction)onDelete:(UIButton *)sender {
|
|
|
|
|
- return ;
|
|
|
|
|
- NSMutableArray* checked = [[NSMutableArray alloc] init];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- long count = self.content_arr.count;//[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
- for(int i=0;i<count;i++)
|
|
|
|
|
- {
|
|
|
|
|
- NSMutableDictionary * item_json = [self.content_arr[i] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
|
|
|
|
|
- bool check = [[item_json valueForKey:@"check"] boolValue];
|
|
|
|
|
- if(check)
|
|
|
|
|
- {
|
|
|
|
|
- [checked addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"cart_item_id"] intValue]]];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // disable for debug
|
|
|
|
|
- if(checked.count==0)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
- // NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
|
|
|
|
|
- NSString * string = [checked componentsJoinedByString:@","];
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_remove:string];
|
|
|
|
|
-
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- [self reload_data];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//- (IBAction)onDelete:(UIButton *)sender {
|
|
|
|
|
+// return ;
|
|
|
|
|
+// NSMutableArray* checked = [[NSMutableArray alloc] init];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// long count = self.content_arr.count;//[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
+// for(int i=0;i<count;i++)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSMutableDictionary * item_json = [self.content_arr[i] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
|
|
|
|
|
+// bool check = [[item_json valueForKey:@"check"] boolValue];
|
|
|
|
|
+// if(check)
|
|
|
|
|
+// {
|
|
|
|
|
+// [checked addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"cart_item_id"] intValue]]];
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// // disable for debug
|
|
|
|
|
+// if(checked.count==0)
|
|
|
|
|
+// return;
|
|
|
|
|
+//
|
|
|
|
|
+// // NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
|
|
|
|
|
+// NSString * string = [checked componentsJoinedByString:@","];
|
|
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
+//
|
|
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_remove:string];
|
|
|
|
|
+//
|
|
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+// [self reload_data];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// });
|
|
|
|
|
+// });
|
|
|
|
|
+//}
|
|
|
|
|
|
|
|
-(void)refresh_total
|
|
-(void)refresh_total
|
|
|
{
|
|
{
|
|
@@ -2250,10 +2254,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef RA_NOTIFICATION
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
|
|
|
|
+ [ActiveViewController Notify:@"WatchListViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
#else
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
[((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
|
|
[((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
|
|
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2915,79 +2921,79 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
//
|
|
//
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
- else if(alertView.tag==ALERT_SET_FREE)
|
|
|
|
|
- {
|
|
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
- {
|
|
|
|
|
- [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
- NSMutableDictionary * item_json = nil;
|
|
|
|
|
- if (self.back_order_flag) {
|
|
|
|
|
- item_json = [[self itemJsonAtIndexPath:self.indexPath] mutableCopy];
|
|
|
|
|
- } else {
|
|
|
|
|
- item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_setFree:ids isfree:true];
|
|
|
|
|
-
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
- {
|
|
|
|
|
- [self reload_data];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Set Free Model" controller:self] ;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if(alertView.tag==ALERT_RESTORE_FREE)
|
|
|
|
|
- {
|
|
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
- {
|
|
|
|
|
- [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
- NSMutableDictionary * item_json = nil;
|
|
|
|
|
- if (self.back_order_flag) {
|
|
|
|
|
- item_json = [[self itemJsonAtIndexPath:self.indexPath] mutableCopy];
|
|
|
|
|
- } else {
|
|
|
|
|
- item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
- }
|
|
|
|
|
- NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_setFree:ids isfree:false];
|
|
|
|
|
-
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
- {
|
|
|
|
|
- [self reload_data];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Restore Model Price" controller:self] ;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// else if(alertView.tag==ALERT_SET_FREE)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+// {
|
|
|
|
|
+// [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
+// NSMutableDictionary * item_json = nil;
|
|
|
|
|
+// if (self.back_order_flag) {
|
|
|
|
|
+// item_json = [[self itemJsonAtIndexPath:self.indexPath] mutableCopy];
|
|
|
|
|
+// } else {
|
|
|
|
|
+// item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
+//
|
|
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_setFree:ids isfree:true];
|
|
|
|
|
+//
|
|
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
+// {
|
|
|
|
|
+// [self reload_data];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Set Free Model" controller:self] ;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// });
|
|
|
|
|
+// });
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if(alertView.tag==ALERT_RESTORE_FREE)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+// {
|
|
|
|
|
+// [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
+// NSMutableDictionary * item_json = nil;
|
|
|
|
|
+// if (self.back_order_flag) {
|
|
|
|
|
+// item_json = [[self itemJsonAtIndexPath:self.indexPath] mutableCopy];
|
|
|
|
|
+// } else {
|
|
|
|
|
+// item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
+// }
|
|
|
|
|
+// NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
+//
|
|
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_setFree:ids isfree:false];
|
|
|
|
|
+//
|
|
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
+// {
|
|
|
|
|
+// [self reload_data];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Restore Model Price" controller:self] ;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// });
|
|
|
|
|
+// });
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Support scanner
|
|
#pragma mark - Support scanner
|
|
@@ -3274,6 +3280,12 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
|
|
- (void)priceTypeChanged:(id)notification {
|
|
- (void)priceTypeChanged:(id)notification {
|
|
|
[self reload_data];
|
|
[self reload_data];
|
|
|
|
|
+#ifdef RA_NOTIFICATION
|
|
|
|
|
+ [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
|
|
+#else
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - button action
|
|
#pragma mark - button action
|