MerchantBaseEnrollContentView.m 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. //
  2. // MerchantBaseEnrollContentView.m
  3. // merchant
  4. //
  5. // Created by qitewei on 2025/8/18.
  6. //
  7. #import "MerchantBaseEnrollContentView.h"
  8. #import "UIView+Extention.h"
  9. @implementation MerchantBaseEnrollContentView
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. self.backgroundColor = UIColor.clearColor;
  15. [self addGradientLayerWithColors:@[
  16. [UIColor colorWithHexString:@"#ECF4FF"],
  17. [UIColor colorWithHexString:@"#ffffff"],
  18. ] direction:GradientLayerDirection_V
  19. frame:CGRectMake(12, 0, frame.size.width-24, frame.size.height)
  20. roundingCorners:UIRectCornerAllCorners
  21. cornerRadii:16];
  22. // 添加标题
  23. [self addSubview:self.titleLabel];
  24. // 添加scrollView
  25. [self addSubview:self.scrollView];
  26. [self addSubview:self.nextButton];
  27. [self.scrollView addSubview:self.contentView];
  28. // 标题
  29. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.mas_offset(kRealValue(30));
  31. make.centerX.mas_offset(0);
  32. }];
  33. // ScrollView
  34. [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.centerX.equalTo(self);
  36. make.width.mas_equalTo(self.width-24);
  37. make.bottom.equalTo(self.nextButton.mas_top).mas_offset(-kRealValue(20));
  38. make.top.equalTo(self.titleLabel.mas_bottom).offset(kRealValue(10));
  39. }];
  40. [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.edges.equalTo(self.scrollView);
  42. make.width.equalTo(self.scrollView);
  43. }];
  44. // 提交按钮
  45. [self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.centerX.mas_offset(0);
  47. make.size.mas_equalTo(self.nextButton.size);
  48. make.bottom.mas_offset(kRealValue(-20));
  49. }];
  50. }
  51. return self;
  52. }
  53. - (void)nextButtonTapped:(UIButton *)sender {
  54. [self goNext];
  55. }
  56. - (void)goNext {
  57. if (self.delegate && [self.delegate respondsToSelector:@selector(onMerchantEnrollGotoNextButtonClick)]) {
  58. [self.delegate onMerchantEnrollGotoNextButtonClick];
  59. }
  60. }
  61. - (UIView *)listView {
  62. return self;
  63. }
  64. - (void)setCurrentStep:(MerchantEnrollStep)currentStep {
  65. _currentStep = currentStep;
  66. switch (currentStep) {
  67. case MerchantEnrollStepGuide:
  68. self.titleLabel.text = ASLocalizedString(@"商家入驻");
  69. [self.nextButton setTitle:ASLocalizedString(@"立即入驻") forState:UIControlStateNormal];
  70. break;
  71. case MerchantEnrollStepCheckList:
  72. self.titleLabel.text = ASLocalizedString(@"提交材料清单");
  73. [self.nextButton setTitle:ASLocalizedString(@"已准备好以上资料,立即入驻") forState:UIControlStateNormal];
  74. break;
  75. case MerchantEnrollStepStoreInfo:
  76. _titleLabel.text = ASLocalizedString(@"店铺信息");
  77. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  78. break;
  79. case MerchantEnrollStepBusinessLicense:
  80. _titleLabel.text = ASLocalizedString(@"营业执照");
  81. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  82. break;
  83. case MerchantEnrollStepLegalInfo:
  84. _titleLabel.text = ASLocalizedString(@"法人信息");
  85. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  86. break;
  87. case MerchantEnrollStepBank:
  88. _titleLabel.text = ASLocalizedString(@"银行卡账户信息");
  89. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  90. break;
  91. case MerchantEnrollStepSetAdmin:
  92. _titleLabel.text = ASLocalizedString(@"设置管理员");
  93. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  94. break;
  95. case MerchantEnrollStepPay:
  96. _titleLabel.text = ASLocalizedString(@"支付保证金");
  97. [_nextButton setTitle:ASLocalizedString(@"已完成支付,下一步") forState:UIControlStateNormal];
  98. break;
  99. case MerchantEnrollStepWatingForReview:
  100. break;
  101. case MerchantEnrollStepReviewFail:
  102. break;
  103. case MerchantEnrollStepComplete:
  104. break;
  105. }
  106. }
  107. - (UILabel *)titleLabel {
  108. if (!_titleLabel) {
  109. _titleLabel = [[UILabel alloc] init];
  110. _titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
  111. _titleLabel.textColor = UIColor.blackColor;
  112. _titleLabel.text = ASLocalizedString(@"店铺信息");
  113. }
  114. return _titleLabel;
  115. }
  116. - (UIScrollView *)scrollView {
  117. if (!_scrollView) {
  118. UIScrollView *scrollView = [[UIScrollView alloc] init];
  119. scrollView.showsVerticalScrollIndicator = NO;
  120. scrollView.showsHorizontalScrollIndicator = NO;
  121. scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  122. scrollView.backgroundColor = UIColor.clearColor;
  123. _scrollView = scrollView;
  124. }
  125. return _scrollView;
  126. }
  127. - (UIView *)contentView {
  128. if (!_contentView) {
  129. UIView *contentView = [[UIView alloc] init];
  130. contentView.backgroundColor = [UIColor clearColor];
  131. _contentView = contentView;
  132. }
  133. return _contentView;
  134. }
  135. - (UIButton *)nextButton {
  136. if (!_nextButton) {
  137. UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
  138. nextButton.size = CGSizeMake(kRealValue(351), kRealValue(50));
  139. [nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  140. [nextButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  141. nextButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
  142. nextButton.backgroundColor = [UIColor colorWithHexString:@"#1A65FF"];
  143. [nextButton addTarget:self action:@selector(nextButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
  144. _nextButton = nextButton;
  145. [nextButton configShadow:kRealValue(25)
  146. shadowColor:[UIColor colorWithHexString:@"#1A65FF"]
  147. size:nextButton.size];
  148. }
  149. return _nextButton;
  150. }
  151. - (NetHttpsManager *)netManager {
  152. if (!_netManager) {
  153. _netManager = [NetHttpsManager manager];
  154. }
  155. return _netManager;
  156. }
  157. - (UIViewController *)viewController {
  158. return (UIViewController *)self.delegate;
  159. }
  160. - (NSDictionary *)getMerchantEnrollParameters {
  161. return @{};
  162. }
  163. @end