“wangdongchao” 1 anno fa
parent
commit
4cfd474929

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

@@ -7,12 +7,15 @@
 
 #import "ASGoodsDetailsTableView.h"
 
+//#import "GoodsReviewsListM.h"
+
 #import "ASGoodsBannerCell.h"
 #import "ASGoodsDetailsSizeCell.h"
 #import "ASGoodsCouponCell.h"
 #import "ASGoodsTitlePriceCell.h"
 #import "ASGoodsGuaranteeInfoCell.h"
 #import "ASGoodsReviewHeadCell.h"
+#import "GoodsReviewsCell.h"
 
 @interface ASGoodsDetailsTableView()
 
@@ -24,11 +27,20 @@
 @implementation ASGoodsDetailsTableView
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-    NSDictionary *dicData = self.infodata[indexPath.row];
     
-    NSObject *objectM = [dicData objectForKey:@"data"];
-    NSString *typeStr = [dicData objectForKey:@"type"];
     
+    NSObject *dataM = self.infodata[indexPath.row];
+    
+    NSObject *objectM = nil;
+    NSString *typeStr = @"";
+    if ([dataM isKindOfClass:[NSDictionary class]]) {
+        NSDictionary *dataDic = (NSDictionary *)dataM;
+        objectM = [dataDic objectForKey:@"data"];
+        typeStr = [dataDic objectForKey:@"type"];
+    } else if ([dataM isKindOfClass:[GoodsReviewsListM class]]) {
+        objectM = dataM;
+    }
+
     if ([typeStr isEqualToString:@"banner"]) {
         ASGoodsBannerCell *cell = [ASGoodsBannerCell cellWithTableView:tableView CellClass:[ASGoodsBannerCell class]];
         
@@ -96,6 +108,16 @@
         };
         
         return  cell;
+    } else if ([objectM isKindOfClass:[GoodsReviewsListM class]]) {
+//        GoodsReviewsListM *objectM =  self.infodata[indexPath.row];
+        GoodsReviewsCell *cell = [GoodsReviewsCell cellWithTableView:tableView CellClass:[GoodsReviewsCell class]];
+        [cell configData:objectM];
+        @weakify(self)
+        cell.currencyparameterClose = ^(NSInteger type, id Data) {
+            @strongify(self) //图片选择器展示
+            
+        };
+        return cell;
     }
     
     return  nil;

+ 32 - 12
Asteria/Fuction/Goods/VC/ASGoodsDetailsViewController.m

@@ -16,9 +16,9 @@
 #import "GoodsDetailsBottomV.h"
 
 #import "GoodsInformationM.h"
+#import "GoodsReviewsListM.h"
 
 
-#import "WKM_goodsBanner.h"
 
 @interface ASGoodsDetailsViewController ()<RY_baseVMprotocol>
 
@@ -28,16 +28,18 @@
 
 @property (nonatomic, strong) GoodsInformationM *model;
 
-@property (nonatomic, strong) WKM_goodsBanner *goodsBanner;
+//评论数据
+@property (nonatomic, strong) NSArray *reviewDataArray;;
 
 @property (nonatomic, strong)  UIView *footView;
 
 @property (nonatomic, strong) GoodsDetailsBottomV *bottomV;
 //尺寸数据
 @property (nonatomic, strong) NSDictionary *sizeParam;
+
+
 //底部按钮点击类型
 @property (nonatomic, assign) NSInteger bottomClickType;
-
 //底部按钮点击类型
 @property (nonatomic, assign) BOOL isReview;
 
@@ -49,6 +51,8 @@
     [super viewDidLoad];
     
     [self reqNet_GoodsDetails_productGetProduct];
+    [self reqNet_Goods_productGetProductsReview];
+    
 }
 
 - (void)initSubviews {
@@ -96,7 +100,7 @@
     [MBProgressHUD showHUDAddedTo:self.view animated:YES];
     [self.VM ry_formDataRequestPostApi:Size_rewriteCartAddProducts param:params];
 }
-
+//商品详情信息
 -(void)reqNet_GoodsDetails_productGetProduct{
     NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
 //    [params setObject:@"55475" forKey:@"productId"];
@@ -105,6 +109,16 @@
     [MBProgressHUD showHUDAddedTo:self.view animated:YES];
     [self.VM ry_requestGetApi:Goods_productGetProductsById param:params];
 }
+//商品评论
+-(void)reqNet_Goods_productGetProductsReview{
+    NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
+    [params setObject:self.entity_id forKey:@"pid"];
+//    [params setObject:@0 forKey:@"img"];
+    [params setObject:@"Newest" forKey:@"sortreview"];
+    [params setObject:@(self.TableV.Page) forKey:@"p"];
+    [params setObject:@3 forKey:@"limit"];
+    [self.VM ry_requestGetApi:Goods_productGetProductsReview param:params];
+}
 -(void)ry_respnsData:(nullable id)data
             parseAry:(nullable NSMutableArray *)arry
               sucess:(BOOL)sucessOrFail
@@ -117,6 +131,7 @@
             self.model = model;
             self.title = model.name;
             
+            [self loadWebString];
             [self updateGoodsDetailsData];
         } else if([mark isEqualToString:Size_rewriteCartAddProducts]) {            
             
@@ -126,6 +141,15 @@
                     [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
                 }
             }];
+        } else if ([mark isEqualToString:Goods_productGetProductsReview]) {
+            
+//            [self.TableV configDataNew:arry has_more:arry.count==10 ? YES : NO];
+            
+            self.reviewDataArray = arry;
+            
+            if (self.model) {
+                [self updateGoodsDetailsData];
+            }
         }
     }
 }
@@ -154,25 +178,21 @@
         NSDictionary *reviewHead = @{@"type":@"reviewHead", @"data":self.model};
         [self.TableV.infodata addObject:reviewHead];
         
+        //评论数据
+        [self.TableV.infodata addObjectsFromArray:self.reviewDataArray];
         
         self.TableV.tableFooterView = nil;
         
     } else {
-        [self loadWebString];
+        self.TableV.tableFooterView = _footView;
     }
     
-    
-    
-    
-    
     [self.TableV reloadData];
 }
 
 - (void)loadWebString {
     _footView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 0.001)];
-    
-    self.TableV.tableFooterView = _footView;
-    
+        
     ASGoodsIntrouduceWebView *webInfoView = [[ASGoodsIntrouduceWebView alloc] initWithFrame:CGRectZero];
     [_footView addSubview:webInfoView];
     [webInfoView mas_makeConstraints:^(MASConstraintMaker *make) {