AS_GoodsDetailsC.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 sub_veiwTapBlock];
  23. }
  24. - (void)initSubviews{
  25. [super initSubviews];
  26. [self.view addSubview:self.scrV];
  27. [self.view addSubview:self.bottomV];
  28. }
  29. - (void)viewDidLayoutSubviews{
  30. IPhoneXHeigh
  31. [self.scrV mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.mas_equalTo(0);
  33. make.width.mas_equalTo(KScreenWidth);
  34. make.top.mas_equalTo(securitytop_Y);
  35. make.bottom.mas_equalTo(-65-securityBottom_H);
  36. }];
  37. }
  38. - (void)ucm_bindvmmodel{
  39. self.VM = [[ASGoodsDetailsVM alloc]initDelegate:self];
  40. }
  41. -(void)reqNet_GoodsDetails_productGetProduct{
  42. NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
  43. // [params setObject:@"55475" forKey:@"productId"];
  44. [params setObject:@"31556" forKey:@"productId"];
  45. [params setObject:@"USD" forKey:@"currencyCode"];
  46. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  47. [self.VM ry_requestGetApi:Goods_productGetProductsById param:params];
  48. }
  49. -(void)ry_respnsData:(id)data
  50. parseAry:(NSMutableArray *)arry
  51. sucess:(BOOL)sucessOrFail
  52. mark:(NSString *)mark{
  53. [MBProgressHUD hideHUDForView:self.view animated:YES];
  54. if(sucessOrFail){
  55. if([mark isEqualToString:Goods_productGetProductsById]){
  56. GoodsInformationM *model = (GoodsInformationM *)[arry firstObject];
  57. self.model = model;
  58. self.title = model.name;
  59. [self.scrV tt_configData:model];
  60. }
  61. }
  62. }
  63. #pragma mark - **************** TT_BaseScrollViewDelegate ****************
  64. -(void)tengteng_configtapchilds:(NSInteger)num data:(id)data{
  65. if(num == GoodsReviewsTag){
  66. [self action_GoodsReviewsListC];
  67. }
  68. }
  69. #pragma mark - **************** action ****************
  70. -(void)action_GoodsReviewsListC{
  71. AS_GoodsReviewsListC *allPic = [[AS_GoodsReviewsListC alloc]init];
  72. allPic.goodsM = self.model;
  73. [self.navigationController pushViewController:allPic animated:YES];
  74. }
  75. #pragma mark - **************** lazy ****************
  76. - (GoodsDetailSrcView *)scrV {
  77. if (!_scrV) {
  78. _scrV = [[GoodsDetailSrcView alloc] init];
  79. _scrV.contentSize = CGSizeMake(KScreenWidth, MAXFLOAT);
  80. _scrV.TTscrolldelegate = self;
  81. }
  82. return _scrV;
  83. }
  84. - (GoodsDetailsBottomV *)bottomV {
  85. if (!_bottomV) {
  86. IPhoneXHeigh
  87. _bottomV = [[GoodsDetailsBottomV alloc] initWithFrame:CGRectMake(0, KScreenHeight - securityBottom_H-65, KScreenWidth, securityBottom_H+65)];
  88. _bottomV.backgroundColor = Col_FFF;
  89. }
  90. return _bottomV;
  91. }
  92. @end