浏览代码

fix:商品详情加车问题处理

“wangdongchao” 1 年之前
父节点
当前提交
13fa992293

+ 3 - 0
Asteria/Fuction/Cart/Cart_CheckoutC.m

@@ -71,6 +71,9 @@
     [self requestGetShipMethodByAddress];
     //获取购物车信息(地址信息)
     [self requestCartInfo];
+    if (!self.totalsM) {
+        [self reqNet_Cart_cartsMineTotals];
+    }
 }
 
 - (void)initSubviews {

+ 6 - 6
Asteria/Fuction/Cart/PayManager/ASCheckoutPayManager.m

@@ -146,7 +146,7 @@ static ASCheckoutPayManager *_instance = nil;
         K_STRONG_SELF;
         [MBProgressHUD hideHUDForView:topVC.view animated:YES];
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":@"支付失败"});
+            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
         }
     }];
 }
@@ -187,7 +187,7 @@ static ASCheckoutPayManager *_instance = nil;
         K_STRONG_SELF;
         [MBProgressHUD hideHUDForView:topVC.view animated:YES];
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":@"支付失败"});
+            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
         }
     }];
 }
@@ -218,7 +218,7 @@ static ASCheckoutPayManager *_instance = nil;
         [MBProgressHUD hideHUDForView:topVC.view animated:YES];
         
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":@"支付失败"});
+            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
         }
     }];
 }
@@ -229,8 +229,8 @@ static ASCheckoutPayManager *_instance = nil;
 
     self.client_token = authToken;
     
-    NSDictionary *additional_data = @{
-                                      @"authorization_token":authToken};
+    
+    NSDictionary *additional_data = @{@"authorization_token":authToken};
     
     NSDictionary *payType = @{@"method":@"klarna_pay_over_time",
                               @"additional_data":additional_data};
@@ -254,7 +254,7 @@ static ASCheckoutPayManager *_instance = nil;
         [MBProgressHUD hideHUDForView:topVC.view animated:YES];
         
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":@"支付失败"});
+            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
         }
     }];
 }

+ 3 - 2
Asteria/Fuction/Goods/V/ASGoodsDetailsTableView.m

@@ -79,14 +79,15 @@
     } else if ([typeStr isEqualToString:@"size"]) {
         ASGoodsDetailsSizeCell *cell = [ASGoodsDetailsSizeCell cellWithTableView:tableView CellClass:[ASGoodsDetailsSizeCell class]];
         
-        [cell configData:(GoodsInformationM *)objectM];
-        
         @weakify(self)
         cell.currencyparameterClose = ^(NSInteger type, id Data) {
             @strongify(self)
             [self generaltriggermethodType:type data:Data];
         };
         
+        
+        [cell configData:(GoodsInformationM *)objectM];
+        
         return  cell;
     } else if ([typeStr isEqualToString:@"guarantee"]) {
         ASGoodsGuaranteeInfoCell *cell = [ASGoodsGuaranteeInfoCell cellWithTableView:tableView CellClass:[ASGoodsGuaranteeInfoCell class]];

+ 13 - 0
Asteria/Fuction/Goods/VC/ASGoodsDetailsViewController.m

@@ -108,6 +108,19 @@
 }
 
 -(void)reqNet_Size_rewriteCartAddProducts {
+        
+    if (!AS_Dict_valid(self.sizeParam)) {
+        NSMutableDictionary *optionDic = [NSMutableDictionary dictionary];
+        for (OptionsModel *optionM in self.model.options) {
+            OptionsValuesM *valuesM = optionM.values[optionM.optionSelectTag];
+            NSString *tempStr =[NSString stringWithFormat:@"options[%@]",optionM.option_id];
+            optionDic[tempStr] =valuesM.option_type_id;
+        }
+        NSMutableDictionary *sizeDic = [NSMutableDictionary dictionaryWithDictionary:optionDic];
+        sizeDic[@"qty"] = [NSString stringWithFormat:@"%@", @"1"];
+        self.sizeParam = sizeDic;
+    }
+    
     NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:self.sizeParam];
     params[@"product"] =  self.model.Id;
     NSLog(@"=====%@", params);