|
|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
#import "ZXPayView.h"
|
|
|
#import "ZXPayWayViewModel.h"
|
|
|
-#import <AlipaySDK/AlipaySDK.h>
|
|
|
+//#import <AlipaySDK/AlipaySDK.h>
|
|
|
#import "WLDecimalKeyboard.h"
|
|
|
#import "WXApi.h"
|
|
|
#define amountArr @[@"1元",@"10元",@"50元",@"100元"]
|
|
|
@@ -40,16 +40,16 @@
|
|
|
int callBackCount;
|
|
|
}
|
|
|
-(instancetype)initWithFrame:(CGRect)frame{
|
|
|
-
|
|
|
+
|
|
|
if (self == [super initWithFrame:frame]) {
|
|
|
-
|
|
|
+
|
|
|
self.backgroundColor = Color(0, 0, 0 , 0.5);
|
|
|
[self initUI];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
return self;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)initUI{
|
|
|
@@ -59,20 +59,20 @@
|
|
|
_HUD.mode = MBProgressHUDModeIndeterminate;
|
|
|
// [_HUD show:YES];
|
|
|
[g_window addSubview:_HUD];
|
|
|
-
|
|
|
+
|
|
|
callBackCount = 1;
|
|
|
RACSignal * deallocSignal = [self rac_signalForSelector:@selector(viewWillDisappear:)];
|
|
|
@weakify(self);
|
|
|
[[[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"ALIPAY_SDK_BACK" object:nil] takeUntil:deallocSignal] subscribeNext:^(NSNotification * _Nullable noti) {
|
|
|
@strongify(self)
|
|
|
-
|
|
|
+
|
|
|
int resultStatus = [noti.object[@"resultStatus"] intValue];
|
|
|
[self payResultWith:resultStatus];
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
self.isAgree = YES;
|
|
|
self.SelectStatus = YES;
|
|
|
-
|
|
|
+
|
|
|
UIView *contentV = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 340)];
|
|
|
contentV.backgroundColor = [UIColor whiteColor];
|
|
|
[self addSubview:contentV];
|
|
|
@@ -94,13 +94,13 @@
|
|
|
deleBtn.frame = CGRectMake(self.width-25, 5, 20, 20);
|
|
|
[deleBtn setImage:[UIImage imageNamed:@"uu_work_delete"] forState:UIControlStateNormal];
|
|
|
[contentV addSubview:deleBtn];
|
|
|
-
|
|
|
+
|
|
|
[[deleBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
|
|
@strongify(self)
|
|
|
[self hidePayView];
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
for (int i = 0; i<4; i++) {
|
|
|
UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(22+((SCREEN_WIDTH-44-30)/4+10)*i, 59, (SCREEN_WIDTH-44-30)/4, 30)];
|
|
|
[btn setTitle:amountArr[i] forState:UIControlStateNormal];
|
|
|
@@ -124,13 +124,13 @@
|
|
|
[contentV addSubview:btn];
|
|
|
}
|
|
|
self.PayMoney = @"1";
|
|
|
-
|
|
|
+
|
|
|
UILabel * contentLable = [[UILabel alloc]initWithFrame:CGRectMake(22, 100, 115+cellScale*2, 30)];
|
|
|
contentLable.userInteractionEnabled = YES;
|
|
|
contentLable.layer.borderColor = Color(153, 153, 153, 1).CGColor;
|
|
|
contentLable.layer.borderWidth = 0.5;
|
|
|
[_contentV addSubview:contentLable];
|
|
|
-
|
|
|
+
|
|
|
UITextField * moneyTextField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0,90+cellScale*2, 30)];
|
|
|
moneyTextField.font = FONT_SIZE(13);
|
|
|
moneyTextField.textAlignment = NSTextAlignmentCenter;
|
|
|
@@ -146,23 +146,23 @@
|
|
|
CustomeLable.textAlignment = NSTextAlignmentCenter;
|
|
|
CustomeLable.font = FONT_SIZE(13);
|
|
|
[contentLable addSubview:CustomeLable];
|
|
|
-
|
|
|
+
|
|
|
WLDecimalKeyboard *inputView = [[WLDecimalKeyboard alloc] init];
|
|
|
moneyTextField.delegate = self;
|
|
|
moneyTextField.inputView = inputView;
|
|
|
[moneyTextField reloadInputViews];
|
|
|
inputView.done = ^{
|
|
|
-
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
};
|
|
|
self.inputView = inputView;
|
|
|
UIView *bgview = [UIView new];
|
|
|
bgview.backgroundColor = HexColor(@"#F4F4F4");
|
|
|
bgview.frame = CGRectMake(0, CGRectGetMaxY(contentLable.frame), SCREEN_WIDTH, 10);
|
|
|
[contentV addSubview:bgview];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
UILabel * Waylable = [[UILabel alloc]initWithFrame:CGRectMake(22, CGRectGetMaxY(bgview.frame), 80+2*cellScale, 30)];
|
|
|
Waylable.text = @"付款方式";
|
|
|
Waylable.font = FONT_SIZE(14);
|
|
|
@@ -174,7 +174,7 @@
|
|
|
|
|
|
self.wxButton = [self ButtonWithFrame:CGRectMake(20,CGRectGetMaxY(Waylable.frame)+1, SCREEN_WIDTH-40, 40) Image:@"uu_work_wxPay" title:@"微信支付"];
|
|
|
// self.wxButton.selected = YES;
|
|
|
-
|
|
|
+
|
|
|
[[self.wxButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
|
|
@strongify(self)
|
|
|
self.PayWay = @"wxPay";
|
|
|
@@ -185,15 +185,15 @@
|
|
|
self.wxButton.selected = YES;
|
|
|
self.alipayButton.selected = NO;
|
|
|
[UASMethodTools popAnimationWithView:self.wxButton.imageView];
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
self.alipayButton = [self ButtonWithFrame:CGRectMake(20,CGRectGetMaxY(self.wxButton.frame), SCREEN_WIDTH-40, 40) Image:@"uu_work_aliPay" title:@"支付宝支付"];
|
|
|
self.alipayButton.selected = YES;
|
|
|
UIImageView *slectImage = [self.alipayButton viewWithTag:1001];
|
|
|
-
|
|
|
+
|
|
|
slectImage.hidden = NO;
|
|
|
-
|
|
|
+
|
|
|
//设置默认支付方式
|
|
|
self.PayWay = @"aliPay";
|
|
|
[[self.alipayButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
|
|
@@ -206,7 +206,7 @@
|
|
|
self.alipayButton.selected = YES;
|
|
|
self.wxButton.selected = NO;
|
|
|
[UASMethodTools popAnimationWithView:self.alipayButton.imageView];
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
|
|
|
UIButton * AgreeBtn = [[UIButton alloc]initWithFrame:CGRectMake(Waylable.x, CGRectGetMaxY(self.alipayButton.frame)+10, 80+cellScale*3, 20)];
|
|
|
@@ -236,10 +236,10 @@
|
|
|
__strong typeof(ZXPayView) *strongSelf = weakSelf;
|
|
|
[strongSelf hidePayView];
|
|
|
BLOCK_EXEC(strongSelf->_PushWebBlock,);
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
[self.contentV addSubview:xiyiDonationBtn];
|
|
|
-
|
|
|
+
|
|
|
UIButton * donationBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, 250+40, SCREEN_WIDTH, 50)];
|
|
|
[donationBtn setFont:FONT_SIZE(15)];
|
|
|
[donationBtn setTitle:@"立即捐款" forState:UIControlStateNormal];
|
|
|
@@ -255,46 +255,46 @@
|
|
|
strongSelf.donationBtn.userInteractionEnabled = NO;
|
|
|
[strongSelf hidePayView];
|
|
|
[strongSelf->_HUD show:YES];
|
|
|
-
|
|
|
+
|
|
|
if (strongSelf.ProId.length == 0) {
|
|
|
-
|
|
|
+
|
|
|
[UASAlertView showWithTitle:@"配置异常" content:@"服务器配置异常" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([strongSelf.PayWay isEqualToString:@"aliPay"]) {
|
|
|
-
|
|
|
+
|
|
|
NSDictionary *dic = @{@"projectName": @"测试",
|
|
|
@"amount":strongSelf.moneyTextField.text.length == 0?strongSelf.PayMoney: strongSelf.moneyTextField.text,
|
|
|
@"proId":strongSelf.ProId,
|
|
|
@"imid":[UASUserInfo shareManager].imid,
|
|
|
@"way":@"支付宝",
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
[[ZXPayWayViewModel singalForOrderPaySignal:dic] subscribeNext:^(NSString * responderObject) {
|
|
|
-
|
|
|
+
|
|
|
[strongSelf->_HUD hide:YES];
|
|
|
- [[AlipaySDK defaultService] payOrder:responderObject
|
|
|
- fromScheme:@"alipaySchemes"
|
|
|
- callback:^(NSDictionary *resultDic) {
|
|
|
- BLOCK_EXEC(strongSelf.payWebBackBlock,resultDic);
|
|
|
-// DLog(@"支付宝支付1111111:%@-----",resultDic);
|
|
|
- int resultStatus = [resultDic[@"resultStatus"] intValue];
|
|
|
-//
|
|
|
- [strongSelf payResultWith:resultStatus];
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
+// [[AlipaySDK defaultService] payOrder:responderObject
|
|
|
+// fromScheme:@"alipaySchemes"
|
|
|
+// callback:^(NSDictionary *resultDic) {
|
|
|
+// BLOCK_EXEC(strongSelf.payWebBackBlock,resultDic);
|
|
|
+//// DLog(@"支付宝支付1111111:%@-----",resultDic);
|
|
|
+// int resultStatus = [resultDic[@"resultStatus"] intValue];
|
|
|
+////
|
|
|
+// [strongSelf payResultWith:resultStatus];
|
|
|
+// }];
|
|
|
+
|
|
|
+
|
|
|
} error:^(NSError * _Nullable error) {
|
|
|
[strongSelf->_HUD hide:YES];
|
|
|
NSData *returnData = [[error userInfo] objectForKey:@"com.alamofire.serialization.response.error.data"];
|
|
|
if (returnData) {
|
|
|
NSDictionary *content = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:nil];//转换数据格式
|
|
|
-
|
|
|
+
|
|
|
NSString *errorStr = [NSString stringWithFormat:@"%@",[content objectForKey:@"exceptionInfo"]];
|
|
|
-
|
|
|
+
|
|
|
DLog(@"错误的原因:%@",errorStr);
|
|
|
BLOCK_EXEC(strongSelf.RequestInfoBackBlock,errorStr);
|
|
|
}
|
|
|
@@ -302,11 +302,11 @@
|
|
|
BLOCK_EXEC(strongSelf.RequestInfoBackBlock,@"请检查网络情况");
|
|
|
}
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}else if([strongSelf.PayWay isEqualToString:@"wxPay"]){
|
|
|
-
|
|
|
+
|
|
|
NSString *wxUrl = [NSString stringWithFormat:@"http://lj.ubtob.com/wxpay/appPay"];
|
|
|
-
|
|
|
+
|
|
|
NSDictionary *dic = @{@"projectName": @"测试",
|
|
|
@"amount":strongSelf.moneyTextField.text.length == 0?strongSelf.PayMoney: strongSelf.moneyTextField.text,
|
|
|
@"proId":strongSelf.ProId,
|
|
|
@@ -314,70 +314,70 @@
|
|
|
@"way":@"微信"
|
|
|
};
|
|
|
UASNetworkManager *manager = [UASNetworkManager shareManager];
|
|
|
-
|
|
|
+
|
|
|
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
|
|
|
-
|
|
|
+
|
|
|
NSData *data = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:nil];
|
|
|
-
|
|
|
+
|
|
|
NSString *jsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
+
|
|
|
NSDictionary *paraDic = @{
|
|
|
@"jsonStr": jsonStr,
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
[manager request:wxUrl method:POST parameters:paraDic progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
-
|
|
|
+
|
|
|
[strongSelf->_HUD hide:YES];
|
|
|
NSDictionary *dict = [NSDictionary dictionary];
|
|
|
-
|
|
|
+
|
|
|
if ([responseObject isKindOfClass:[NSData class]]) {
|
|
|
-
|
|
|
+
|
|
|
dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:nil];
|
|
|
-
|
|
|
+
|
|
|
if (!dict || [[dict objectForKey:@"retcode"] intValue] != 0) {
|
|
|
-
|
|
|
+
|
|
|
NSString *strOne = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
+
|
|
|
if (strOne.length > 1) {
|
|
|
-
|
|
|
+
|
|
|
if ([[strOne substringToIndex:1] isEqualToString:@"\""]) {
|
|
|
-
|
|
|
+
|
|
|
strOne = [strOne stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@""];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([[strOne substringFromIndex:strOne.length - 1] isEqualToString:@"\""]) {
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
strOne = [strOne stringByReplacingCharactersInRange:NSMakeRange(strOne.length - 1, 1) withString:@""];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
SBJsonParser *parser = [[SBJsonParser alloc] init];
|
|
|
-
|
|
|
+
|
|
|
NSError *error;
|
|
|
-
|
|
|
+
|
|
|
dict = [parser objectWithString:strOne error:&error ];
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
dict = (NSDictionary *)responseObject;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(dict != nil){
|
|
|
NSMutableString *retcode = [dict objectForKey:@"retcode"];
|
|
|
if (retcode.intValue == 0){
|
|
|
NSMutableString *stamp = [dict objectForKey:@"timestamp"];
|
|
|
-
|
|
|
+
|
|
|
//调起微信支付
|
|
|
PayReq* req = [[PayReq alloc] init];
|
|
|
-
|
|
|
+
|
|
|
req.partnerId = [dict objectForKey:@"partnerid"];
|
|
|
req.prepayId = [dict objectForKey:@"prepayid"];
|
|
|
req.nonceStr = [dict objectForKey:@"noncestr"];
|
|
|
@@ -386,109 +386,109 @@
|
|
|
req.sign = [dict objectForKey:@"sign"];
|
|
|
// [WXApi sendReq:req];
|
|
|
[WXApi sendReq:req completion:^(BOOL success) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
if (strongSelf.RequestInfoBackBlock) {
|
|
|
-
|
|
|
+
|
|
|
strongSelf.RequestInfoBackBlock(@"服务器开小差了");
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
} failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
[strongSelf->_HUD hide:YES];
|
|
|
NSData *returnData = [[error userInfo] objectForKey:@"com.alamofire.serialization.response.error.data"];
|
|
|
if (returnData) {
|
|
|
NSDictionary *content = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:nil];//转换数据格式
|
|
|
-
|
|
|
+
|
|
|
NSString *errorStr = [NSString stringWithFormat:@"%@",[content objectForKey:@"exceptionInfo"]];
|
|
|
-
|
|
|
+
|
|
|
if (strongSelf.RequestInfoBackBlock) {
|
|
|
-
|
|
|
+
|
|
|
strongSelf.RequestInfoBackBlock(errorStr);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else{
|
|
|
if (strongSelf.RequestInfoBackBlock) {
|
|
|
-
|
|
|
+
|
|
|
strongSelf.RequestInfoBackBlock(@"请检查网络情况");
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/* RAC */
|
|
|
RAC(donationBtn,enabled) = [RACSignal combineLatest:@[RACObserve(self,SelectStatus),RACObserve(self, isAgree)]
|
|
|
reduce:^(NSNumber *isAgree,NSNumber * SelectStatus){
|
|
|
return @(isAgree.boolValue&&SelectStatus.boolValue);
|
|
|
}];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)payResultWith:(int )status{
|
|
|
-
|
|
|
+
|
|
|
if (callBackCount == 1) {
|
|
|
callBackCount ++;
|
|
|
switch (status) {
|
|
|
case 9000:
|
|
|
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"感谢您的爱心捐赠" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case 8000:
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"正在处理中" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case 4000:
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"支付失败" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case 6001:
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"支付取消" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case 6002:
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"网络错误" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
default:
|
|
|
[UASAlertView YYJshowWithTitle:nil content:@"未知错误" sureTitle:Localized(@"UU_custom_sure") cancelTitle:nil click:^(NSInteger index) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#pragma mark -- show and hidden
|
|
|
@@ -499,9 +499,9 @@
|
|
|
@strongify(self)
|
|
|
self.alpha = 1;
|
|
|
self.contentV.frame = CGRectMake(0, SCREEN_HEIGHT-340, SCREEN_WIDTH, 340);
|
|
|
-
|
|
|
+
|
|
|
} completion:^(BOOL finished) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
}
|
|
|
- (void)hidePayView{
|
|
|
@@ -515,42 +515,42 @@
|
|
|
@strongify(self)
|
|
|
self.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
|
[self removeFromSuperview];
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)clickMoneyBtn:(UIButton *)sender{
|
|
|
-
|
|
|
+
|
|
|
NSString * MoneyStr = sender.titleLabel.text;
|
|
|
self.SelectStatus = YES;
|
|
|
self.moneyTextField.text = @"";
|
|
|
for (UIButton * btn in self.contentV.subviews) {
|
|
|
if (btn.tag>=10000&&btn.tag<=10004) {
|
|
|
-
|
|
|
+
|
|
|
if (btn.tag == sender.tag) {
|
|
|
sender.selected = YES;
|
|
|
self.SelectBtn = sender;
|
|
|
self.PayMoney = [MoneyStr substringToIndex:MoneyStr.length-1];
|
|
|
// [sender.layer setBorderColor:Color(239, 97, 59, 1).CGColor];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else{
|
|
|
// [btn.layer setBorderColor:Color(153,153, 153, 1).CGColor];
|
|
|
btn.selected = NO;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)alipayCallBack:(NSNotification * )noti{
|
|
|
// noti.object[@"resultStatus"];
|
|
|
[self hidePayView];
|
|
|
-
|
|
|
+
|
|
|
int resultStatus = [noti.object[@"resultStatus"] intValue];
|
|
|
|
|
|
if (callBackCount == 1) {
|
|
|
@@ -577,15 +577,15 @@
|
|
|
}
|
|
|
}
|
|
|
callBackCount ++;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(UIButton *)ButtonWithFrame:(CGRect)Frame Image:(NSString *)imageStr title:(NSString *)title{
|
|
|
UIButton *btn = [[UIButton alloc]initWithFrame:Frame];
|
|
|
btn.imageRect = CGRectMake(15, 5, 30, 30);
|
|
|
-
|
|
|
+
|
|
|
btn.titleRect = CGRectMake(50, 5, 100, 30);
|
|
|
-
|
|
|
+
|
|
|
[btn setImage:[UIImage imageNamed:imageStr] forState:UIControlStateNormal];
|
|
|
// [btn setBackgroundImage:[UIImage imageNamed:@"RMB_NOR"] forState:UIControlStateNormal];
|
|
|
// [btn setBackgroundImage:[UIImage imageNamed:@"RMB_SEL"] forState:UIControlStateSelected];
|
|
|
@@ -595,7 +595,7 @@
|
|
|
// btn.titleLabel.text = title;
|
|
|
// [btn.layer setBorderColor:Color(153, 153, 153, 1).CGColor];
|
|
|
// [btn.layer setBorderWidth:0.5];
|
|
|
-
|
|
|
+
|
|
|
UIImageView *selcetImage = [UIImageView new];
|
|
|
[btn addSubview:selcetImage];
|
|
|
selcetImage.image = [UIImage imageNamed:@"uu_work_selectImg"];
|
|
|
@@ -611,32 +611,32 @@
|
|
|
// btn.backgroundColor = [UIColor orangeColor];
|
|
|
[_contentV addSubview:btn];
|
|
|
return btn;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
|
|
|
-
|
|
|
+
|
|
|
[UIView animateWithDuration:0.25f animations:^{
|
|
|
// self.alpha = 1;
|
|
|
_contentV.frame = CGRectMake(0, SCREEN_HEIGHT-(140+self.inputView.frame.size.height), SCREEN_WIDTH, 340);
|
|
|
-
|
|
|
+
|
|
|
} completion:^(BOOL finished) {
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
return YES;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(BOOL)textFieldShouldEndEditing:(UITextField *)textField{
|
|
|
-
|
|
|
+
|
|
|
[UIView animateWithDuration:0.2f animations:^{
|
|
|
self.alpha = 1;
|
|
|
_contentV.frame = CGRectMake(0, SCREEN_HEIGHT-340, SCREEN_WIDTH, 340);
|
|
|
} completion:^(BOOL finished) {
|
|
|
-
|
|
|
+
|
|
|
// self.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
|
-
|
|
|
+
|
|
|
}];
|
|
|
|
|
|
BOOL ispure = [UASMethodTools isPureInt:self.moneyTextField.text];
|
|
|
@@ -672,18 +672,18 @@
|
|
|
if ([string isEqualToString:@" "]) {
|
|
|
return NO;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([textField.text rangeOfString:@"."].location == NSNotFound) {
|
|
|
isHaveDian = NO;
|
|
|
}
|
|
|
if ([string length] > 0) {
|
|
|
-
|
|
|
+
|
|
|
unichar single = [string characterAtIndex:0];//当前输入的字符
|
|
|
if ((single >= '0' && single <= '9') || single == '.') {//数据格式正确
|
|
|
-
|
|
|
+
|
|
|
if([textField.text length] == 0){
|
|
|
if(single == '.') {
|
|
|
-
|
|
|
+
|
|
|
[textField.text stringByReplacingCharactersInRange:range withString:@""];
|
|
|
return NO;
|
|
|
}
|
|
|
@@ -697,31 +697,31 @@
|
|
|
{
|
|
|
isHaveDian = YES;
|
|
|
return YES;
|
|
|
-
|
|
|
+
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
[textField.text stringByReplacingCharactersInRange:range withString:@""];
|
|
|
return NO;
|
|
|
}
|
|
|
}else{
|
|
|
if (isHaveDian) {//存在小数点
|
|
|
-
|
|
|
+
|
|
|
//判断小数点的位数
|
|
|
NSRange ran = [textField.text rangeOfString:@"."];
|
|
|
if (range.location - ran.location <= 2) {
|
|
|
return YES;
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
return NO;
|
|
|
}
|
|
|
}else{
|
|
|
return YES;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}else{//输入的数据格式不正确
|
|
|
-
|
|
|
+
|
|
|
[textField.text stringByReplacingCharactersInRange:range withString:@""];
|
|
|
return NO;
|
|
|
}
|
|
|
@@ -734,25 +734,25 @@
|
|
|
}
|
|
|
|
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|
|
-
|
|
|
+
|
|
|
CGPoint point = [[touches allObjects].firstObject locationInView:self];
|
|
|
-
|
|
|
+
|
|
|
if (point.y<self.contentV.frame.origin.y) {
|
|
|
-
|
|
|
+
|
|
|
[self hidePayView];
|
|
|
-
|
|
|
+
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
[super touchesBegan:touches withEvent:event];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
-(void)dealloc{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@end
|