Просмотр исходного кода

修复价格类型修改后Cart价格未变

Pen Li 9 лет назад
Родитель
Сommit
24306721f9

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 12 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -24,6 +24,7 @@
 #import "DefaultTableHeaderView.h"
 #import "SortItemViewController.h"
 #import "SortButton.h"
+#import "NotificationNameCenter.h"
 
 #define ALERT_FREE 1024
 #define ALERT_DEL 1025
@@ -40,6 +41,10 @@
 
 @implementation CartViewController
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 -(void) logout
 {
     
@@ -611,7 +616,7 @@
     self.label_net_err.layer.cornerRadius=15;
     self.label_net_err.layer.masksToBounds=true;
     
-    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(priceTypeChanged:) name:Change_Price_Type_Notification object:nil];
     
     
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
@@ -2519,5 +2524,11 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     self.sortItemController.view.frame = self.view.bounds;
 }
 
+#pragma mark - notification action
+
+- (void)priceTypeChanged:(id)notification {
+    [self reload_data];
+}
+
 
 @end

+ 5 - 0
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -142,6 +142,11 @@
         
         // 检查价格类型
         // 提货价才能提交订单
+        /**  价格类型
+         *   0 提货价
+         *   1 统一价
+         *   2 计算价
+         */
         NSInteger priceType = [Singleton sharedInstance].npd_shop_price_type;
         if (priceType != 0) {
             

+ 12 - 1
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -17,6 +17,7 @@
 #import "DefaultAppearance.h"
 #import "DefaultTableHeaderView.h"
 #import "SelectUploadOrderViewController.h"
+#import "NotificationNameCenter.h"
 
 @interface OrderListViewController ()
 
@@ -29,6 +30,10 @@
 
 @implementation OrderListViewController
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 - (NSMutableArray *)mergeList {
     if (!_mergeList) {
         _mergeList = [NSMutableArray array];
@@ -91,7 +96,7 @@
     self.label_net_err.layer.cornerRadius=15;
     self.label_net_err.layer.masksToBounds=true;
     
-    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePriceType:) name:Change_Price_Type_Notification object:nil];
     
     
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
@@ -1507,5 +1512,11 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     
 }
 
+#pragma mark - notification action
+
+- (void)changePriceType:(id)notification {
+    [self ReloadData];
+}
+
 
 @end

+ 2 - 1
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.h

@@ -10,7 +10,8 @@
 
 @interface NotificationNameCenter : NSObject
 
-UIKIT_EXTERN  NSString  *LoginOK_HandleUrgencyFile_Notification;
+UIKIT_EXTERN  NSString  *LoginOK_HandleUrgencyFile_Notification;///<登陆成功通知
 
+UIKIT_EXTERN  NSString  *Change_Price_Type_Notification;///<切换价格通知
 
 @end

+ 2 - 0
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.m

@@ -12,4 +12,6 @@
 
 const NSString  *LoginOK_HandleUrgencyFile_Notification = @"LoginOK_HandleUrgencyFile_Notification";
 
+const NSString  *Change_Price_Type_Notification = @"Change_Price_Type_Notification";
+
 @end

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD/PriceSettingViewController.m

@@ -14,6 +14,7 @@
 #import "Singleton.h"
 #import <objc/runtime.h>
 #import "MainViewController.h"
+#import "NotificationNameCenter.h"
 
 
 
@@ -197,6 +198,9 @@
         
         [Singleton sharedInstance].npd_shop_price_type = self.priceType;
     
+        // 刷新 Cart、Order List
+        [[NSNotificationCenter defaultCenter] postNotificationName:Change_Price_Type_Notification object:nil];
+        
     } else { // 失败
         
         DebugLog(@"set price type failure");

+ 7 - 2
RedAnt ERP Mobile/iSales-NPD/Singleton.h

@@ -12,9 +12,14 @@
 
 @property (nonatomic,assign) NSInteger npd_shop_price_type;///<Shop 设置的价格类型
 
-@property (nonatomic,copy) NSString *pdf_item_ids; ///<临时数据,用于create PDF
+#pragma mark - 用户权限
+
+@property (nonatomic,assign) BOOL permissions_price_setting;///<价格设置权限
+@property (nonatomic,assign) BOOL permissions_edit_order;///<编辑订单权限,Place Order
+@property (nonatomic,assign) BOOL permissions_submit_order;///<提交订单权限
+@property (nonatomic,assign) BOOL permissions_merge_order;///<合并订单权限
+
 
-@property (nonatomic,copy) NSString *pdf_product_ids; ///<临时数据,用于create PDF
 
 + (instancetype)sharedInstance;
 

+ 1 - 0
RedAnt ERP Mobile/iSales-NPD/Singleton.m

@@ -19,4 +19,5 @@
     return singleton;
 }
 
+
 @end