// // AS_GoodsDetailsC.m // Asteria // // Created by 王猛 on 2023/5/6. // #import "AS_GoodsDetailsC.h" #import "GoodsDetailSrcView.h" #import "ASGoodsDetailsVM.h" #import "GoodsDetailsBottomV.h" #import "AS_GoodsReviewsListC.h" @interface AS_GoodsDetailsC () @property (nonatomic, strong) GoodsInformationM *model; @property (nonatomic, strong) ASGoodsDetailsVM *VM; @property (nonatomic, strong) GoodsDetailSrcView *scrV; @property (nonatomic, strong) GoodsDetailsBottomV *bottomV; @end @implementation AS_GoodsDetailsC - (void)viewDidLoad { [super viewDidLoad]; [self reqNet_GoodsDetails_productGetProduct]; [self ucm_subVeiwsTapBlock]; } - (void)initSubviews{ [super initSubviews]; [self.view addSubview:self.scrV]; [self.view addSubview:self.bottomV]; } - (void)ucm_subVeiwsTapBlock{ @weakify(self) self.bottomV.ViewtapClose = ^(NSInteger num, id _Nonnull data) { @strongify(self) [self action_GoodsSizeC]; }; } - (void)viewDidLayoutSubviews{ IPhoneXHeigh [self.scrV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.width.mas_equalTo(KScreenWidth); make.top.mas_equalTo(securitytop_Y); make.bottom.mas_equalTo(-65-securityBottom_H); }]; } - (void)ucm_bindvmmodel{ self.VM = [[ASGoodsDetailsVM alloc]initDelegate:self]; } -(void)reqNet_GoodsDetails_productGetProduct{ NSMutableDictionary * params = [[NSMutableDictionary alloc] init]; // [params setObject:@"55475" forKey:@"productId"]; [params setObject:self.entity_id forKey:@"productId"]; [params setObject:@"USD" forKey:@"currencyCode"]; [MBProgressHUD showHUDAddedTo:self.view animated:YES]; [self.VM ry_requestGetApi:Goods_productGetProductsById param:params]; } -(void)ry_respnsData:(nullable id)data parseAry:(nullable NSMutableArray *)arry sucess:(BOOL)sucessOrFail mark:(NSString *)mark reqNetType:(ReqNetType)reqNetType{ [MBProgressHUD hideHUDForView:self.view animated:YES]; if(sucessOrFail){ if([mark isEqualToString:Goods_productGetProductsById]){ GoodsInformationM *model = (GoodsInformationM *)[arry firstObject]; self.model = model; self.title = model.name; [self.scrV tt_configData:model]; } } } #pragma mark - **************** TT_BaseScrollViewDelegate **************** -(void)tengteng_configtapchilds:(NSInteger)num data:(id)data{ if(num == GoodsReviewsTag){ [self action_GoodsReviewsListC]; } } #pragma mark - **************** action **************** -(void)action_GoodsReviewsListC{ AS_GoodsReviewsListC *allPic = [[AS_GoodsReviewsListC alloc]init]; allPic.goodsM = self.model; [self.navigationController pushViewController:allPic animated:YES]; } -(void)action_GoodsSizeC{ UIViewController *viewController = [[CTMediator sharedInstance] Goods_GoodsSizeC:@{@"model":self.model}]; viewController.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:viewController animated:YES completion:nil]; } #pragma mark - **************** lazy **************** - (GoodsDetailSrcView *)scrV { if (!_scrV) { _scrV = [[GoodsDetailSrcView alloc] init]; _scrV.contentSize = CGSizeMake(KScreenWidth, MAXFLOAT); _scrV.TTscrolldelegate = self; } return _scrV; } - (GoodsDetailsBottomV *)bottomV { if (!_bottomV) { IPhoneXHeigh _bottomV = [[GoodsDetailsBottomV alloc] initWithFrame:CGRectMake(0, KScreenHeight - securityBottom_H-65, KScreenWidth, securityBottom_H+65)]; _bottomV.backgroundColor = Col_FFF; } return _bottomV; } @end