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

修改Cart使之在Customer登陆时也能修改价格。
修改提货价名称,从登陆信息获取。

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

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


+ 26 - 4
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -1746,7 +1746,7 @@
 - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
 - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
 
 
 {
 {
-    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     // 添加一个删除按钮
     // 添加一个删除按钮
     
     
     self.indexPath=indexPath;
     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) {
     UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         
         
         NSLog(@"edit click");
         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;
         UIViewController* parentvc=self;
@@ -2086,7 +2106,7 @@
 
 
     
     
     
     
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
     if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
     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]]
         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 arr;
         //    return @[deleteRowAction,addWatchAction, editRowAction,freeRowAction];
         //    return @[deleteRowAction,addWatchAction, editRowAction,freeRowAction];
+    } else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
+        return @[deleteRowAction,addWatchAction,editRowAction];
     }
     }
     else
     else
         return @[deleteRowAction,addWatchAction];
         return @[deleteRowAction,addWatchAction];

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

@@ -147,7 +147,7 @@
                     break;
                     break;
             }
             }
             
             
-            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"Current price is %@, please change to %@ and try again.",pricename,ab_lager] preferredStyle:UIAlertControllerStyleAlert];
+            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"Current price is %@, please change to %@ and try again.",pricename,[Singleton sharedInstance].deliveryString] preferredStyle:UIAlertControllerStyleAlert];
             
             
             UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
             UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                 
                 

+ 2 - 0
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -3626,6 +3626,8 @@ repeat:
         [Singleton sharedInstance].permissions_submit_order = [[objheader valueForKey:@"can_submit_order"] boolValue];
         [Singleton sharedInstance].permissions_submit_order = [[objheader valueForKey:@"can_submit_order"] boolValue];
 
 
         [Singleton sharedInstance].permissions_merge_order = [[objheader valueForKey:@"can_merge_order"] boolValue];
         [Singleton sharedInstance].permissions_merge_order = [[objheader valueForKey:@"can_merge_order"] boolValue];
+        
+        [Singleton sharedInstance].deliveryString = [objheader valueForKey:@"delivery_price"];
 
 
         
         
         //        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);
         //        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);

+ 2 - 1
RedAnt ERP Mobile/iSales-NPD/CategoryPriceCell.m

@@ -9,6 +9,7 @@
 #import "CategoryPriceCell.h"
 #import "CategoryPriceCell.h"
 #import "SetCategoryPriceController.h"
 #import "SetCategoryPriceController.h"
 #import "config.h"
 #import "config.h"
+
 @interface CategoryPriceCell ()
 @interface CategoryPriceCell ()
 
 
 @property (strong, nonatomic) IBOutlet UILabel *categoryLabel;
 @property (strong, nonatomic) IBOutlet UILabel *categoryLabel;
@@ -38,7 +39,7 @@
     NSString *price = @"";
     NSString *price = @"";
     switch (basePrice.integerValue) {
     switch (basePrice.integerValue) {
         case 0:{
         case 0:{
-            basePrice = ab_lager;
+            basePrice = [Singleton sharedInstance].deliveryString;
         }
         }
             break;
             break;
         case 1:{
         case 1:{

+ 1 - 1
RedAnt ERP Mobile/iSales-NPD/PriceSettingViewController.h

@@ -10,7 +10,7 @@
 
 
 @interface PriceSettingViewController : UIViewController
 @interface PriceSettingViewController : UIViewController
 
 
-@property (nonatomic,assign) NSInteger priceType;
+@property (nonatomic,assign) NSInteger priceType;///< 0提货价、1统一卖价、 2计算价
 @property (nonatomic,assign) BOOL showPrice;
 @property (nonatomic,assign) BOOL showPrice;
 
 
 @end
 @end

+ 3 - 3
RedAnt ERP Mobile/iSales-NPD/PriceSettingViewController.m

@@ -71,10 +71,10 @@
 
 
 - (void)changePriceType:(NSInteger)type {
 - (void)changePriceType:(NSInteger)type {
     
     
-    NSString *title = ab_lager;
+    NSString *title = [Singleton sharedInstance].deliveryString;
     switch (type) {
     switch (type) {
         case 0: {
         case 0: {
-            title = ab_lager;
+            title = [Singleton sharedInstance].deliveryString;
         }
         }
             break;
             break;
         case 1: {
         case 1: {
@@ -166,7 +166,7 @@
     
     
     enumvc.cadedate = @{
     enumvc.cadedate = @{
                         @"count" : @"3",
                         @"count" : @"3",
-                        @"val_0" : @{@"value" : ab_lager,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
+                        @"val_0" : @{@"value" : [Singleton sharedInstance].deliveryString,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
                         @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]},
                         @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]},
                         @"val_2" : @{@"value" : given_price,@"value_code" : @"2",@"check" : [self checkPriceType:2]}
                         @"val_2" : @{@"value" : given_price,@"value_code" : @"2",@"check" : [self checkPriceType:2]}
                         }.mutableCopy;
                         }.mutableCopy;

+ 3 - 3
RedAnt ERP Mobile/iSales-NPD/SetCategoryPriceController.m

@@ -77,10 +77,10 @@
 
 
 - (void)changePriceType:(NSInteger)type {
 - (void)changePriceType:(NSInteger)type {
     
     
-    NSString *title = ab_lager;
+    NSString *title = [Singleton sharedInstance].deliveryString;
     switch (type) {
     switch (type) {
         case 0: {
         case 0: {
-            title = ab_lager;
+            title = [Singleton sharedInstance].deliveryString;
         }
         }
             break;
             break;
         case 1: {
         case 1: {
@@ -130,7 +130,7 @@
     
     
     enumvc.cadedate = @{
     enumvc.cadedate = @{
                         @"count" : @"2",
                         @"count" : @"2",
-                        @"val_0" : @{@"value" : ab_lager,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
+                        @"val_0" : @{@"value" : [Singleton sharedInstance].deliveryString,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
                         @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]}
                         @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]}
                         }.mutableCopy;
                         }.mutableCopy;
     enumvc.title = @"";
     enumvc.title = @"";

+ 3 - 1
RedAnt ERP Mobile/iSales-NPD/Singleton.h

@@ -13,7 +13,9 @@
 
 
 @property (nonatomic,assign) sqlite3 *currentDB;///<当前打开的数据库
 @property (nonatomic,assign) sqlite3 *currentDB;///<当前打开的数据库
 
 
-@property (nonatomic,assign) NSInteger npd_shop_price_type;///<Shop 设置的价格类型
+@property (nonatomic,assign) NSInteger npd_shop_price_type;///<Shop设置的价格类型,0提货价、1统一卖价、 2计算价
+
+@property (nonatomic,copy) NSString *deliveryString;///<登陆成功后接收的提货价名称
 
 
 #pragma mark - Shop 用户权限
 #pragma mark - Shop 用户权限
 
 

+ 4 - 1
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -13,10 +13,13 @@
 #define test_server
 #define test_server
 #define exception_switch 1
 #define exception_switch 1
 
 
-#define ab_lager @"Delivery price"
+//#define ab_lager @"Delivery price"
 #define flat_price @"MSRP"
 #define flat_price @"MSRP"
 #define given_price @"Calculated price"
 #define given_price @"Calculated price"
 
 
+#import "Singleton.h"
+
+
 #define PDF_DEBUG true
 #define PDF_DEBUG true
 
 
 //#define ENCRYPT_OFF
 //#define ENCRYPT_OFF