| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- //
- // HJMyIntegralExchangePayViewController.m
- // HappyJob
- //
- // Created by 张晓光 on 2019/9/9.
- // Copyright © 2019 Bob. All rights reserved.
- //
- #import "HJMyIntegralExchangePayViewController.h"
- #import "HJMyIntegralExchangePayHeaderView.h"
- #import "HJMyIntegralExchangePayTypeView.h"
- #import "WechatPay.h"
- #import "AlipayPay.h"
- @interface HJMyIntegralExchangePayViewController ()<FBScrollLayoutViewDelegate,UIGestureRecognizerDelegate>
- @property (nonatomic, strong) FBScrollLayoutView *scrollLayoutView;
- @property (nonatomic, strong) HJMyIntegralExchangePayHeaderView *headerView;
- @property (nonatomic, strong) HJMyIntegralExchangePayTypeView *walletPayView;
- @property (nonatomic, strong) HJMyIntegralExchangePayTypeView *WeChatPayView;
- @property (nonatomic, strong) HJMyIntegralExchangePayTypeView *AliPayView;
- @property (nonatomic, strong) UIButton *makeSureBtn;
- @end
- @implementation HJMyIntegralExchangePayViewController
- - (void)viewWillAppear:(BOOL)animated {
-
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- self.navigationController.interactivePopGestureRecognizer.delegate = self;
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self.view addSubview:self.scrollLayoutView];
- [self.scrollLayoutView.contentView addSubview:self.headerView];
- [self.scrollLayoutView.contentView addSubview:self.walletPayView];
- [self.scrollLayoutView.contentView addSubview:self.WeChatPayView];
- [self.scrollLayoutView.contentView addSubview:self.AliPayView];
- [self.scrollLayoutView.footerView addSubview:self.makeSureBtn];
- [self.scrollLayoutView makeConstraints];
- }
- #pragma mark - FBScrollLayoutViewDelegate
- - (void)scrollLayoutViewMakeConstraints:(FBScrollLayoutView *)scrollLayoutView {
-
- [scrollLayoutView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.view);
- }];
- }
- - (void)subviewsMakeConstraintsInScrollLayoutView:(FBScrollLayoutView *)scrollLayoutView contentView:(UIView *)contentView {
-
- [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.equalTo(contentView.mas_top).offset(0);
- make.left.right.equalTo(contentView);
- }];
-
- [self.walletPayView mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.equalTo(self.headerView.mas_bottom).offset(0);
- make.left.right.equalTo(contentView);
- }];
-
- [self.WeChatPayView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.equalTo(contentView);
- make.top.equalTo(self.walletPayView.mas_bottom).offset(0);
- }];
- [self.AliPayView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.equalTo(contentView);
- make.top.equalTo(self.WeChatPayView.mas_bottom).offset(0);
- }];
-
- [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.bottom.equalTo(self.AliPayView.mas_bottom).with.offset(0);
- }];
- }
- - (void)subviewsMakeConstraintsInScrollLayoutView:(FBScrollLayoutView *)scrollLayoutView footerView:(UIView *)footerView {
-
- [footerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(64);
- }];
- [self.makeSureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.edges.equalTo(footerView).with.insets(UIEdgeInsetsMake(10, 15, 10, 15));
- }];
- }
- #pragma mark - setter and getter
- - (void)backButtonClick:(UIButton *)btn {
-
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)walletPayViewTapClick {
-
- self.walletPayView.selectBtn.selected = YES;
- self.WeChatPayView.selectBtn.selected = NO;
- self.AliPayView.selectBtn.selected = NO;
- [self.makeSureBtn az_setGradientBackgroundWithColors:@[COLOR_GRADIENT_START,COLOR_GRADIENT_END] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- }
- - (void)weChatPayViewTapClick{
-
- self.walletPayView.selectBtn.selected = NO;
- self.WeChatPayView.selectBtn.selected = YES;
- self.AliPayView.selectBtn.selected = NO;
- [self.makeSureBtn az_setGradientBackgroundWithColors:@[COLOR_GRADIENT_START,COLOR_GRADIENT_END] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- }
- - (void)AliPayViewTapClick {
-
- self.walletPayView.selectBtn.selected = NO;
- self.WeChatPayView.selectBtn.selected = NO;
- self.AliPayView.selectBtn.selected = YES;
- [self.makeSureBtn az_setGradientBackgroundWithColors:@[COLOR_GRADIENT_START,COLOR_GRADIENT_END] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- }
- - (void)payClick:(UIButton *)btn {
-
- if (self.WeChatPayView.selectBtn.selected)
- {
- [[WechatPay shareWeChatPay] weixinPayOrderDict:@{} andPayResult:^(PayReultType reslutType) {
-
-
- }];
-
- }
- else if (self.AliPayView.selectBtn.selected)
- {
- [[AlipayPay shareAliPay] aliProductInfo:@"xjixsijjijijxsijisaija" andPayResult:^(PayReultType reslutType) {
-
- }];
- }
- }
- #pragma mark - setter and getter
- - (FBScrollLayoutView *)scrollLayoutView {
-
- if (_scrollLayoutView == nil)
- {
- _scrollLayoutView = [[FBScrollLayoutView alloc] init];
- _scrollLayoutView.delegate = self;
- // 去除顶部空白
- if (@available(iOS 11.0, *))
- {
- _scrollLayoutView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }
- else
- {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- }
- return _scrollLayoutView;
- }
- - (HJMyIntegralExchangePayHeaderView *)headerView {
-
- if (_headerView == nil)
- {
- _headerView = [[HJMyIntegralExchangePayHeaderView alloc]init];
- [_headerView.backBtn addTarget:self action:@selector(backButtonClick:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _headerView;
- }
- - (HJMyIntegralExchangePayTypeView *)walletPayView {
-
- if (_walletPayView == nil)
- {
- _walletPayView = [[HJMyIntegralExchangePayTypeView alloc]init];
- _walletPayView.titleLabel.text = @"钱包支付";
- _walletPayView.rightLabel.text = @"余额:¥88.00";
- _walletPayView.icon.image = [UIImage imageNamed:@"wallet_pay"];
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(walletPayViewTapClick)];
- [_walletPayView addGestureRecognizer:tap];
- }
- return _walletPayView;
- }
- - (HJMyIntegralExchangePayTypeView *)WeChatPayView {
-
- if (_WeChatPayView == nil)
- {
- _WeChatPayView = [[HJMyIntegralExchangePayTypeView alloc]init];
- _WeChatPayView.titleLabel.text = @"微信支付";
- _WeChatPayView.icon.image = [UIImage imageNamed:@"wechat_pay"];
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(weChatPayViewTapClick)];
- [_WeChatPayView addGestureRecognizer:tap];
- }
- return _WeChatPayView;
- }
- - (HJMyIntegralExchangePayTypeView *)AliPayView {
-
- if (_AliPayView == nil)
- {
- _AliPayView = [[HJMyIntegralExchangePayTypeView alloc]init];
- _AliPayView.titleLabel.text = @"支付宝支付";
- _AliPayView.icon.image = [UIImage imageNamed:@"Ali_pay"];
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(AliPayViewTapClick)];
- [_AliPayView addGestureRecognizer:tap];
- }
- return _AliPayView;
- }
- - (UIButton *)makeSureBtn {
-
- if (_makeSureBtn == nil)
- {
- _makeSureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_makeSureBtn setTitle:@"确认支付" forState:UIControlStateNormal];
- _makeSureBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17];
- _makeSureBtn.backgroundColor = COLOR_BACKD8;
- _makeSureBtn.layer.cornerRadius = 5;
- _makeSureBtn.layer.masksToBounds = YES;
- [_makeSureBtn addTarget:self action:@selector(payClick:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _makeSureBtn;
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|