AS_GoodsDetailsC.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // AS_GoodsDetailsC.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/5/6.
  6. //
  7. #import "AS_GoodsDetailsC.h"
  8. #import "GoodsDetailSrcView.h"
  9. #import "ASGoodsDetailsVM.h"
  10. #import "GoodsDetailsBottomV.h"
  11. #import "AS_GoodsReviewsListC.h"
  12. @interface AS_GoodsDetailsC ()<TT_BaseScrollViewDelegate,RY_baseVMprotocol>
  13. @property (nonatomic, strong) GoodsInformationM *model;
  14. @property (nonatomic, strong) ASGoodsDetailsVM *VM;
  15. @property (nonatomic, strong) GoodsDetailSrcView *scrV;
  16. @property (nonatomic, strong) GoodsDetailsBottomV *bottomV;
  17. @end
  18. @implementation AS_GoodsDetailsC
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. [self reqNet_GoodsDetails_productGetProduct];
  22. [self ucm_subVeiwsTapBlock];
  23. }
  24. - (void)initSubviews{
  25. [super initSubviews];
  26. [self.view addSubview:self.scrV];
  27. [self.view addSubview:self.bottomV];
  28. }
  29. - (void)ucm_subVeiwsTapBlock{
  30. @weakify(self)
  31. self.bottomV.ViewtapClose = ^(NSInteger num, id _Nonnull data) {
  32. @strongify(self)
  33. [self action_GoodsSizeC];
  34. };
  35. }
  36. - (void)viewDidLayoutSubviews{
  37. IPhoneXHeigh
  38. [self.scrV mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.left.mas_equalTo(0);
  40. make.width.mas_equalTo(KScreenWidth);
  41. make.top.mas_equalTo(securitytop_Y);
  42. make.bottom.mas_equalTo(-65-securityBottom_H);
  43. }];
  44. }
  45. - (void)ucm_bindvmmodel{
  46. self.VM = [[ASGoodsDetailsVM alloc]initDelegate:self];
  47. }
  48. -(void)reqNet_GoodsDetails_productGetProduct{
  49. NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
  50. // [params setObject:@"55475" forKey:@"productId"];
  51. [params setObject:self.entity_id forKey:@"productId"];
  52. [params setObject:@"USD" forKey:@"currencyCode"];
  53. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  54. [self.VM ry_requestGetApi:Goods_productGetProductsById param:params];
  55. }
  56. -(void)ry_respnsData:(nullable id)data
  57. parseAry:(nullable NSMutableArray *)arry
  58. sucess:(BOOL)sucessOrFail
  59. mark:(NSString *)mark
  60. reqNetType:(ReqNetType)reqNetType{
  61. [MBProgressHUD hideHUDForView:self.view animated:YES];
  62. if(sucessOrFail){
  63. if([mark isEqualToString:Goods_productGetProductsById]){
  64. GoodsInformationM *model = (GoodsInformationM *)[arry firstObject];
  65. self.model = model;
  66. self.title = model.name;
  67. [self.scrV tt_configData:model];
  68. }
  69. }
  70. }
  71. #pragma mark - **************** TT_BaseScrollViewDelegate ****************
  72. -(void)tengteng_configtapchilds:(NSInteger)num data:(id)data{
  73. if(num == GoodsReviewsTag){
  74. [self action_GoodsReviewsListC];
  75. }
  76. }
  77. #pragma mark - **************** action ****************
  78. -(void)action_GoodsReviewsListC{
  79. AS_GoodsReviewsListC *allPic = [[AS_GoodsReviewsListC alloc]init];
  80. allPic.goodsM = self.model;
  81. [self.navigationController pushViewController:allPic animated:YES];
  82. }
  83. -(void)action_GoodsSizeC{
  84. UIViewController *viewController = [[CTMediator sharedInstance] Goods_GoodsSizeC:@{@"model":self.model}];
  85. viewController.modalPresentationStyle = UIModalPresentationFullScreen;
  86. [self presentViewController:viewController animated:YES completion:nil];
  87. }
  88. #pragma mark - **************** lazy ****************
  89. - (GoodsDetailSrcView *)scrV {
  90. if (!_scrV) {
  91. _scrV = [[GoodsDetailSrcView alloc] init];
  92. _scrV.contentSize = CGSizeMake(KScreenWidth, MAXFLOAT);
  93. _scrV.TTscrolldelegate = self;
  94. }
  95. return _scrV;
  96. }
  97. - (GoodsDetailsBottomV *)bottomV {
  98. if (!_bottomV) {
  99. IPhoneXHeigh
  100. _bottomV = [[GoodsDetailsBottomV alloc] initWithFrame:CGRectMake(0, KScreenHeight - securityBottom_H-65, KScreenWidth, securityBottom_H+65)];
  101. _bottomV.backgroundColor = Col_FFF;
  102. }
  103. return _bottomV;
  104. }
  105. @end