|
@@ -20,6 +20,8 @@
|
|
#import "GoodsReviewsListM.h"
|
|
#import "GoodsReviewsListM.h"
|
|
#import "KWMineMoreProductModel.h"
|
|
#import "KWMineMoreProductModel.h"
|
|
|
|
|
|
|
|
+#import "ASProductBaseModel.h"
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
@interface ASGoodsDetailsViewController ()<RY_baseVMprotocol>
|
|
@interface ASGoodsDetailsViewController ()<RY_baseVMprotocol>
|
|
@@ -32,6 +34,8 @@
|
|
|
|
|
|
//评论数据
|
|
//评论数据
|
|
@property (nonatomic, strong) NSArray *reviewDataArray;;
|
|
@property (nonatomic, strong) NSArray *reviewDataArray;;
|
|
|
|
+//推荐商品数据
|
|
|
|
+@property (nonatomic, strong) NSArray *recommendGoodsArr;;
|
|
|
|
|
|
@property (nonatomic, strong) UIView *footView;
|
|
@property (nonatomic, strong) UIView *footView;
|
|
|
|
|
|
@@ -51,11 +55,13 @@
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
-
|
|
|
|
|
|
+
|
|
[self reqNet_Goods_productGetProductsReview];
|
|
[self reqNet_Goods_productGetProductsReview];
|
|
|
|
|
|
[self reqNet_GoodsDetails_productGetProduct];
|
|
[self reqNet_GoodsDetails_productGetProduct];
|
|
|
|
|
|
|
|
+ [self request_RecommendGoodsData];
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- (void)_shareClick {
|
|
- (void)_shareClick {
|
|
@@ -110,6 +116,10 @@
|
|
[self.TableV reloadData];
|
|
[self.TableV reloadData];
|
|
// [self updateGoodsDetailsData];
|
|
// [self updateGoodsDetailsData];
|
|
} else if (num == 4) {//写商品评论
|
|
} else if (num == 4) {//写商品评论
|
|
|
|
+ if (![ASUserInfoManager shared].isLogin) {
|
|
|
|
+ [Fuction_Tool pop_toLoginVC];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
GoodsReviewsWriteC *vc = [[GoodsReviewsWriteC alloc]init];
|
|
GoodsReviewsWriteC *vc = [[GoodsReviewsWriteC alloc]init];
|
|
vc.goodsM = self.model;
|
|
vc.goodsM = self.model;
|
|
// vc.topBgV = self.topBgV;
|
|
// vc.topBgV = self.topBgV;
|
|
@@ -117,14 +127,52 @@
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
} else if (num == 100) {
|
|
} else if (num == 100) {
|
|
self.sizeParam = (NSDictionary *)data;
|
|
self.sizeParam = (NSDictionary *)data;
|
|
|
|
+ } else if (num == 101) {//推荐商品跳转
|
|
|
|
+ ASProductBaseModel *model = (ASProductBaseModel *)data;
|
|
|
|
+ UIViewController *viewController = [[CTMediator sharedInstance] Goods_GoodsDetailsC:@{@"entity_id":model.Id}];
|
|
|
|
+ [self.navigationController pushViewController:viewController animated:YES];
|
|
|
|
+ } else if (num == 102) {//推荐商品加车
|
|
|
|
+ ASProductBaseModel *model = (ASProductBaseModel *)data;
|
|
|
|
+ [self action_GoodsSizeC:model.Id];
|
|
} else if (num == 1000) {
|
|
} else if (num == 1000) {
|
|
[self.TableV reloadData];
|
|
[self.TableV reloadData];
|
|
}
|
|
}
|
|
|
|
+
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//请求尺寸
|
|
|
|
+-(void)action_GoodsSizeC:(NSString *)entity_id {
|
|
|
|
+ if (!ASUserInfoManager.shared.isLogin) {
|
|
|
|
+ [Fuction_Tool pop_toLoginVC];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
|
+ [params setObject:entity_id forKey:@"productId"];
|
|
|
|
+ [params setObject:ASCurrencyManager.shared.currentCur forKey:@"currencyCode"];
|
|
|
|
+ [MBProgressHUD showHUDAddedTo:self.view animated:true];
|
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
|
+ [ASNetTools.shared getWithPath:getProdectDetail param:params success:^(id _Nonnull json) {
|
|
|
|
+ [MBProgressHUD hideHUDForView:weakSelf.view animated:true];
|
|
|
|
+ GoodsInformationM *model = [GoodsInformationM mj_objectWithKeyValues:json];
|
|
|
|
+ if (model == nil || model.Id == nil || model.Id.isEmpty) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ UIViewController *viewController = [[CTMediator sharedInstance] Goods_GoodsSizeC:@{@"model":model}];
|
|
|
|
+ viewController.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
|
|
+ [weakSelf presentViewController:viewController animated:YES completion:nil];
|
|
|
|
+ } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
|
|
|
|
+ [self.view makeToast:msg];
|
|
|
|
+ [MBProgressHUD hideHUDForView:weakSelf.view animated:true];
|
|
|
|
+ }];
|
|
}
|
|
}
|
|
|
|
|
|
-(void)reqNet_Size_rewriteCartAddProducts {
|
|
-(void)reqNet_Size_rewriteCartAddProducts {
|
|
|
|
+
|
|
|
|
+ if (![ASUserInfoManager shared].isLogin) {
|
|
|
|
+ [Fuction_Tool pop_toLoginVC];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
if (!AS_Dict_valid(self.sizeParam)) {
|
|
if (!AS_Dict_valid(self.sizeParam)) {
|
|
NSMutableDictionary *optionDic = [NSMutableDictionary dictionary];
|
|
NSMutableDictionary *optionDic = [NSMutableDictionary dictionary];
|
|
@@ -149,7 +197,7 @@
|
|
NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
|
|
NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
|
|
// [params setObject:@"55475" forKey:@"productId"];
|
|
// [params setObject:@"55475" forKey:@"productId"];
|
|
[params setObject:self.entity_id forKey:@"productId"];
|
|
[params setObject:self.entity_id forKey:@"productId"];
|
|
- [params setObject:@"USD" forKey:@"currencyCode"];
|
|
|
|
|
|
+ [params setObject:ASCurrencyManager.shared.currentCur forKey:@"currencyCode"];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[self.VM ry_requestGetApi:Goods_productGetProductsById param:params];
|
|
[self.VM ry_requestGetApi:Goods_productGetProductsById param:params];
|
|
}
|
|
}
|
|
@@ -163,14 +211,22 @@
|
|
[params setObject:@3 forKey:@"limit"];
|
|
[params setObject:@3 forKey:@"limit"];
|
|
[self.VM ry_requestGetApi:Goods_productGetProductsReview param:params];
|
|
[self.VM ry_requestGetApi:Goods_productGetProductsReview param:params];
|
|
}
|
|
}
|
|
|
|
+//推荐商品
|
|
|
|
+- (void)request_RecommendGoodsData {
|
|
|
|
+ [self.VM ry_requestGetApi:Goods_RecommendGoods param:@{}];
|
|
|
|
+}
|
|
|
|
+
|
|
-(void)ry_respnsData:(nullable id)data
|
|
-(void)ry_respnsData:(nullable id)data
|
|
parseAry:(nullable NSMutableArray *)arry
|
|
parseAry:(nullable NSMutableArray *)arry
|
|
sucess:(BOOL)sucessOrFail
|
|
sucess:(BOOL)sucessOrFail
|
|
mark:(NSString *)mark
|
|
mark:(NSString *)mark
|
|
reqNetType:(ReqNetType)reqNetType{
|
|
reqNetType:(ReqNetType)reqNetType{
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
|
+
|
|
if(sucessOrFail){
|
|
if(sucessOrFail){
|
|
if([mark isEqualToString:Goods_productGetProductsById]){
|
|
if([mark isEqualToString:Goods_productGetProductsById]){
|
|
|
|
+
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
+
|
|
GoodsInformationM *model = (GoodsInformationM *)[arry firstObject];
|
|
GoodsInformationM *model = (GoodsInformationM *)[arry firstObject];
|
|
self.model = model;
|
|
self.model = model;
|
|
self.title = model.name;
|
|
self.title = model.name;
|
|
@@ -181,6 +237,8 @@
|
|
|
|
|
|
} else if([mark isEqualToString:Size_rewriteCartAddProducts]) {
|
|
} else if([mark isEqualToString:Size_rewriteCartAddProducts]) {
|
|
|
|
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
+
|
|
[self.view makeToast:@"Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
|
|
[self.view makeToast:@"Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
|
|
if (self.bottomClickType == 1) {
|
|
if (self.bottomClickType == 1) {
|
|
Cart_CheckoutC *vc = [[Cart_CheckoutC alloc] init];
|
|
Cart_CheckoutC *vc = [[Cart_CheckoutC alloc] init];
|
|
@@ -189,14 +247,19 @@
|
|
}];
|
|
}];
|
|
} else if ([mark isEqualToString:Goods_productGetProductsReview]) {
|
|
} else if ([mark isEqualToString:Goods_productGetProductsReview]) {
|
|
|
|
|
|
-// [self.TableV configDataNew:arry has_more:arry.count==10 ? YES : NO];
|
|
|
|
-
|
|
|
|
self.reviewDataArray = arry;
|
|
self.reviewDataArray = arry;
|
|
|
|
+ if (self.model) {
|
|
|
|
+ [self updateGoodsDetailsData];
|
|
|
|
+ }
|
|
|
|
+ } else if ([mark isEqualToString:Goods_RecommendGoods]) {
|
|
|
|
|
|
|
|
+ self.recommendGoodsArr = arry;
|
|
if (self.model) {
|
|
if (self.model) {
|
|
[self updateGoodsDetailsData];
|
|
[self updateGoodsDetailsData];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -221,15 +284,21 @@
|
|
//评论头
|
|
//评论头
|
|
NSDictionary *reviewHead = @{@"type":@"reviewHead", @"data":self.model};
|
|
NSDictionary *reviewHead = @{@"type":@"reviewHead", @"data":self.model};
|
|
[self.TableV.infodata addObject:reviewHead];
|
|
[self.TableV.infodata addObject:reviewHead];
|
|
- //评论数据
|
|
|
|
- [self.TableV.infodata addObjectsFromArray:self.reviewDataArray];
|
|
|
|
- //评论底部
|
|
|
|
- NSDictionary *reviewFoot = @{@"type":@"reviewFoot", @"data":self.model};
|
|
|
|
- [self.TableV.infodata addObject:reviewFoot];
|
|
|
|
|
|
+
|
|
|
|
+ if (AS_Array_valid(self.reviewDataArray)) {
|
|
|
|
+ //评论数据
|
|
|
|
+ [self.TableV.infodata addObjectsFromArray:self.reviewDataArray];
|
|
|
|
+ //评论底部
|
|
|
|
+ NSDictionary *reviewFoot = @{@"type":@"reviewFoot", @"data":self.model};
|
|
|
|
+ [self.TableV.infodata addObject:reviewFoot];
|
|
|
|
+ }
|
|
|
|
+
|
|
//推荐商品
|
|
//推荐商品
|
|
- KWMineMoreProductModel *model = [KWMineMoreProductModel demoData];
|
|
|
|
- NSDictionary *customer = @{@"type":@"customer", @"data":model};
|
|
|
|
- [self.TableV.infodata addObject:customer];
|
|
|
|
|
|
+ if (AS_Array_valid(self.recommendGoodsArr)) {
|
|
|
|
+ NSDictionary *customer = @{@"type":@"customer", @"data":self.recommendGoodsArr};
|
|
|
|
+ [self.TableV.infodata addObject:customer];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
// if (self.isReview) {
|
|
// if (self.isReview) {
|
|
//
|
|
//
|