处理支付

This commit is contained in:
2026-02-04 15:57:22 +08:00
parent c1b50b407d
commit 85fb407717
5 changed files with 112 additions and 136 deletions

View File

@@ -45,6 +45,12 @@ static const CGFloat JXheightForHeaderInSection = 39;
@property (nonatomic, strong) UIButton *closeButton; //
@property (nonatomic, strong) UIButton *restoreButton;
///
@property (nonatomic, strong) UIView *bottomContainer;
@property (nonatomic, strong) UIButton *payButton;
@property (nonatomic, strong) UILabel *agreementLabel;
@property (nonatomic, strong) UIButton *agreementButton;
@end
@implementation KBPayMainVC
@@ -138,7 +144,34 @@ static const CGFloat JXheightForHeaderInSection = 39;
self.pagerView.mainTableView.backgroundColor = [UIColor colorWithHex:0xF6F7FB];
//
[self.view addSubview:self.bottomContainer];
[self.bottomContainer addSubview:self.payButton];
[self.bottomContainer addSubview:self.agreementLabel];
[self.bottomContainer addSubview:self.agreementButton];
[self.bottomContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
}];
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bottomContainer);
make.bottom.equalTo(self.bottomContainer).offset(-KB_SAFE_BOTTOM - 15);
}];
[self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bottomContainer);
make.bottom.equalTo(self.agreementButton.mas_top).offset(0);
}];
[self.payButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bottomContainer).offset(24);
make.right.equalTo(self.bottomContainer).offset(-24);
make.bottom.equalTo(self.agreementLabel.mas_top).offset(-14);
make.top.equalTo(self.bottomContainer).offset(16);
make.height.mas_equalTo(58);
}];
}
- (void)viewDidAppear:(BOOL)animated {
@@ -159,8 +192,10 @@ static const CGFloat JXheightForHeaderInSection = 39;
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.pagerView.frame = self.view.bounds;
// pagerView
CGFloat bottomHeight = self.bottomContainer.bounds.size.height;
self.pagerView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - bottomHeight);
}
#pragma mark - JXPagerViewDelegate
@@ -231,6 +266,28 @@ static const CGFloat JXheightForHeaderInSection = 39;
[self.navigationController popViewControllerAnimated:true];
}
- (void)onTapPayButton {
// VC
NSInteger index = self.myCategoryView.selectedIndex;
if (index == 0) {
// VIP
KBVipPay *vipVC = (KBVipPay *)[self.pagerView.listContainerView.validListDict objectForKey:@(index)];
if ([vipVC respondsToSelector:@selector(onTapPayButton)]) {
[vipVC onTapPayButton];
}
} else {
// SVIP
KBPaySvipVC *svipVC = (KBPaySvipVC *)[self.pagerView.listContainerView.validListDict objectForKey:@(index)];
if ([svipVC respondsToSelector:@selector(onTapPayButton)]) {
[svipVC onTapPayButton];
}
}
}
- (void)onTapAgreementButton {
[KBHUD showInfo:KBLocalized(@"Open agreement")];
}
- (void)onTapRestoreButton {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn"
pageId:@"vip_pay"
@@ -277,4 +334,47 @@ static const CGFloat JXheightForHeaderInSection = 39;
}
return _restoreButton;
}
- (UIView *)bottomContainer {
if (!_bottomContainer) {
_bottomContainer = [UIView new];
_bottomContainer.backgroundColor = [UIColor colorWithHex:0xF6F7FB];
}
return _bottomContainer;
}
- (UIButton *)payButton {
if (!_payButton) {
_payButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_payButton setTitle:KBLocalized(@"Recharge Now") forState:UIControlStateNormal];
_payButton.titleLabel.font = [KBFont medium:15];
_payButton.layer.cornerRadius = 29;
_payButton.clipsToBounds = YES;
_payButton.backgroundColor = [UIColor colorWithHex:0x222222];
[_payButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_payButton addTarget:self action:@selector(onTapPayButton) forControlEvents:UIControlEventTouchUpInside];
}
return _payButton;
}
- (UILabel *)agreementLabel {
if (!_agreementLabel) {
_agreementLabel = [UILabel new];
_agreementLabel.text = KBLocalized(@"By Clicking \"pay\", You Indicate Your Agreement To The");
_agreementLabel.font = [KBFont regular:12];
_agreementLabel.textColor = [UIColor colorWithHex:KBBlackValue];
}
return _agreementLabel;
}
- (UIButton *)agreementButton {
if (!_agreementButton) {
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_agreementButton setTitle:KBLocalized(@"《Embership Agreement》") forState:UIControlStateNormal];
[_agreementButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
_agreementButton.titleLabel.font = [KBFont regular:12];
[_agreementButton addTarget:self action:@selector(onTapAgreementButton) forControlEvents:UIControlEventTouchUpInside];
}
return _agreementButton;
}
@end