MerchantBaseEnrollContentView.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. if (self.delegate && [self.delegate respondsToSelector:@selector(onMerchantEnrollGotoNextButtonClick)]) {
  55. [self.delegate onMerchantEnrollGotoNextButtonClick];
  56. }
  57. }
  58. - (UIView *)listView {
  59. return self;
  60. }
  61. - (void)setCurrentStep:(MerchantEnrollStep)currentStep {
  62. _currentStep = currentStep;
  63. switch (currentStep) {
  64. case MerchantEnrollStepGuide:
  65. self.titleLabel.text = ASLocalizedString(@"商家入驻");
  66. [self.nextButton setTitle:ASLocalizedString(@"立即入驻") forState:UIControlStateNormal];
  67. break;
  68. case MerchantEnrollStepCheckList:
  69. self.titleLabel.text = ASLocalizedString(@"提交材料清单");
  70. [self.nextButton setTitle:ASLocalizedString(@"已准备好以上资料,立即入驻") forState:UIControlStateNormal];
  71. break;
  72. case MerchantEnrollStepStoreInfo:
  73. _titleLabel.text = ASLocalizedString(@"店铺信息");
  74. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  75. break;
  76. case MerchantEnrollStepBusinessLicense:
  77. _titleLabel.text = ASLocalizedString(@"营业执照");
  78. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  79. break;
  80. case MerchantEnrollStepLegalInfo:
  81. _titleLabel.text = ASLocalizedString(@"法人信息");
  82. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  83. break;
  84. case MerchantEnrollStepBank:
  85. _titleLabel.text = ASLocalizedString(@"银行卡账户信息");
  86. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  87. break;
  88. case MerchantEnrollStepSetAdmin:
  89. _titleLabel.text = ASLocalizedString(@"设置管理员");
  90. [_nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  91. break;
  92. case MerchantEnrollStepPay:
  93. _titleLabel.text = ASLocalizedString(@"支付保证金");
  94. [_nextButton setTitle:ASLocalizedString(@"已完成支付,下一步") forState:UIControlStateNormal];
  95. break;
  96. }
  97. }
  98. - (UILabel *)titleLabel {
  99. if (!_titleLabel) {
  100. _titleLabel = [[UILabel alloc] init];
  101. _titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
  102. _titleLabel.textColor = UIColor.blackColor;
  103. _titleLabel.text = ASLocalizedString(@"店铺信息");
  104. }
  105. return _titleLabel;
  106. }
  107. - (UIScrollView *)scrollView {
  108. if (!_scrollView) {
  109. UIScrollView *scrollView = [[UIScrollView alloc] init];
  110. scrollView.showsVerticalScrollIndicator = NO;
  111. scrollView.showsHorizontalScrollIndicator = NO;
  112. scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  113. scrollView.backgroundColor = UIColor.clearColor;
  114. _scrollView = scrollView;
  115. }
  116. return _scrollView;
  117. }
  118. - (UIView *)contentView {
  119. if (!_contentView) {
  120. UIView *contentView = [[UIView alloc] init];
  121. contentView.backgroundColor = [UIColor clearColor];
  122. _contentView = contentView;
  123. }
  124. return _contentView;
  125. }
  126. - (UIButton *)nextButton {
  127. if (!_nextButton) {
  128. UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
  129. nextButton.size = CGSizeMake(kRealValue(351), kRealValue(50));
  130. [nextButton setTitle:ASLocalizedString(@"下一步") forState:UIControlStateNormal];
  131. [nextButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  132. nextButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
  133. nextButton.backgroundColor = [UIColor colorWithHexString:@"#1A65FF"];
  134. [nextButton addTarget:self action:@selector(nextButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
  135. _nextButton = nextButton;
  136. [nextButton configShadow:kRealValue(25)
  137. shadowColor:[UIColor colorWithHexString:@"#1A65FF"]
  138. size:nextButton.size];
  139. }
  140. return _nextButton;
  141. }
  142. @end