Bladeren bron

提交一下给小西

wangwei 6 jaren geleden
bovenliggende
commit
96e7ecde0b
22 gewijzigde bestanden met toevoegingen van 726 en 74 verwijderingen
  1. BIN
      .DS_Store
  2. 6 0
      KXCardHelp.xcodeproj/project.pbxproj
  3. BIN
      KXCardHelp.xcworkspace/xcuserdata/wangwei.xcuserdatad/UserInterfaceState.xcuserstate
  4. 0 32
      KXCardHelp.xcworkspace/xcuserdata/wangwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  5. BIN
      KXCardHelp/.DS_Store
  6. 3 3
      KXCardHelp/AppDelegate/HFile/LVKBDefineHeader.h
  7. 2 2
      KXCardHelp/AppDelegate/HFile/LVKBURLHeader.h
  8. 2 2
      KXCardHelp/Base/Tab/LVKBBaseTabBarViewController.m
  9. 13 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/KXInstallmentViewController.h
  10. 384 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/KXInstallmentViewController.m
  11. 1 1
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckAddCardViewController.h
  12. 44 3
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckAddCardViewController.m
  13. 34 1
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckExpenseCountVC.m
  14. 30 8
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckHomeViewController.m
  15. 1 1
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.m
  16. 8 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckAddCardInfoCell.h
  17. 10 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckAddCardInfoCell.m
  18. 7 7
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckHomeCardCell.m
  19. 78 1
      KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m
  20. 93 10
      KXCardHelp/Main/Home/Receipt/VC/LVKBHomeReceiptViewController.m
  21. 4 0
      KXCardHelp/Main/Home/Receipt/creditCard/VC/LVKBHomeCreditCardViewController.h
  22. 6 3
      KXCardHelp/Main/Home/Receipt/creditCard/VC/LVKBHomeCreditCardViewController.m

BIN
.DS_Store


+ 6 - 0
KXCardHelp.xcodeproj/project.pbxproj

@@ -190,6 +190,7 @@
190 190
 		4AAC109221B8F9D4004BE83C /* XJCustomWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC109121B8F9D4004BE83C /* XJCustomWebViewController.m */; };
191 191
 		4AAC10AD21B908DF004BE83C /* WWCheckCardListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC10AC21B908DF004BE83C /* WWCheckCardListViewController.m */; };
192 192
 		4AAC10B021B914B2004BE83C /* WWCheckCardListDetailVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC10AF21B914B2004BE83C /* WWCheckCardListDetailVC.m */; };
193
+		4AAC10B321BA5A3F004BE83C /* KXInstallmentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC10B121BA5A3E004BE83C /* KXInstallmentViewController.m */; };
193 194
 		5B982B19B445B1CF86AEC93C /* libPods-KXCardHelp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E6ACD581411C8CD82F0EE3FF /* libPods-KXCardHelp.a */; };
194 195
 /* End PBXBuildFile section */
195 196
 
@@ -536,6 +537,8 @@
536 537
 		4AAC10AC21B908DF004BE83C /* WWCheckCardListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WWCheckCardListViewController.m; sourceTree = "<group>"; };
537 538
 		4AAC10AE21B914B2004BE83C /* WWCheckCardListDetailVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WWCheckCardListDetailVC.h; sourceTree = "<group>"; };
538 539
 		4AAC10AF21B914B2004BE83C /* WWCheckCardListDetailVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WWCheckCardListDetailVC.m; sourceTree = "<group>"; };
540
+		4AAC10B121BA5A3E004BE83C /* KXInstallmentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KXInstallmentViewController.m; sourceTree = "<group>"; };
541
+		4AAC10B221BA5A3E004BE83C /* KXInstallmentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KXInstallmentViewController.h; sourceTree = "<group>"; };
539 542
 		E6ACD581411C8CD82F0EE3FF /* libPods-KXCardHelp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KXCardHelp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
540 543
 /* End PBXFileReference section */
541 544
 
@@ -1835,6 +1838,8 @@
1835 1838
 		4AAC103C21B508D1004BE83C /* Controller */ = {
1836 1839
 			isa = PBXGroup;
1837 1840
 			children = (
1841
+				4AAC10B221BA5A3E004BE83C /* KXInstallmentViewController.h */,
1842
+				4AAC10B121BA5A3E004BE83C /* KXInstallmentViewController.m */,
1838 1843
 				4AAC103D21B508D1004BE83C /* WWCheckHomeViewController.h */,
1839 1844
 				4AAC103E21B508D1004BE83C /* WWCheckHomeViewController.m */,
1840 1845
 				4AAC105921B6470B004BE83C /* WWCheckAddCardViewController.h */,
@@ -2195,6 +2200,7 @@
2195 2200
 				4AAC10AD21B908DF004BE83C /* WWCheckCardListViewController.m in Sources */,
2196 2201
 				119A9FE72138E0350020C78E /* LVKBHomeMessageViewController.m in Sources */,
2197 2202
 				119AA0182138E0350020C78E /* LVKBPersonRecordTableViewCell.m in Sources */,
2203
+				4AAC10B321BA5A3F004BE83C /* KXInstallmentViewController.m in Sources */,
2198 2204
 				4AAC107121B7709C004BE83C /* WWDatePickerView.m in Sources */,
2199 2205
 				119A9FDC2138E0350020C78E /* LVKBCreditBankAuthenticationViewController.m in Sources */,
2200 2206
 				119A9FFA2138E0350020C78E /* KXNewsWebViewController.m in Sources */,

BIN
KXCardHelp.xcworkspace/xcuserdata/wangwei.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 32
KXCardHelp.xcworkspace/xcuserdata/wangwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -13,37 +13,5 @@
13 13
             stopOnStyle = "0">
14 14
          </BreakpointContent>
15 15
       </BreakpointProxy>
16
-      <BreakpointProxy
17
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
18
-         <BreakpointContent
19
-            shouldBeEnabled = "Yes"
20
-            ignoreCount = "0"
21
-            continueAfterRunningActions = "No"
22
-            filePath = "KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m"
23
-            timestampString = "565840923.926773"
24
-            startingColumnNumber = "9223372036854775807"
25
-            endingColumnNumber = "9223372036854775807"
26
-            startingLineNumber = "139"
27
-            endingLineNumber = "139"
28
-            landmarkName = "-clickCellButton:"
29
-            landmarkType = "7">
30
-         </BreakpointContent>
31
-      </BreakpointProxy>
32
-      <BreakpointProxy
33
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
34
-         <BreakpointContent
35
-            shouldBeEnabled = "Yes"
36
-            ignoreCount = "0"
37
-            continueAfterRunningActions = "No"
38
-            filePath = "KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m"
39
-            timestampString = "565840923.9273961"
40
-            startingColumnNumber = "9223372036854775807"
41
-            endingColumnNumber = "9223372036854775807"
42
-            startingLineNumber = "136"
43
-            endingLineNumber = "136"
44
-            landmarkName = "-clickCellButton:"
45
-            landmarkType = "7">
46
-         </BreakpointContent>
47
-      </BreakpointProxy>
48 16
    </Breakpoints>
49 17
 </Bucket>

BIN
KXCardHelp/.DS_Store


+ 3 - 3
KXCardHelp/AppDelegate/HFile/LVKBDefineHeader.h

@@ -38,7 +38,7 @@
38 38
 #define KXAlertTextDate @"KXAlertTextDate"
39 39
 
40 40
 //渠道号
41
-#define CHCHANNEL_ID        @"2002"//--
41
+#define CHCHANNEL_ID        @"2008"//--
42 42
 #define HomeAdvID           @"17"//弹窗
43 43
 #define AppdelegateAdvID    @"18"//启动图
44 44
 
@@ -48,8 +48,8 @@
48 48
 #define  UMAPP_KEY  @"5b7e1f9fb27b0a6573000010"//--
49 49
 #define  BUGLY_ID   @"2b8be66cb7"//--
50 50
 #define APPLE_APP_ID @"1433874143"//--
51
-#define BAIDU_APP_ID @"fLeeuCReuMCTlBFeQzIKjXhm"//--
52
-#define BAIDU_SECRET @"98fXjaxW73HHCt4QhYmhfCdCu4md2NgK"//--
51
+#define BAIDU_APP_ID @"RmyUkQQ5zGPztDATQAcb8LRB"//--
52
+#define BAIDU_SECRET @"v05kUTuG3gwvXKdgLoXTbMl7RCgOWz0b"//--
53 53
 //公钥
54 54
 #define RSAPublicKey @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4G6ZCXm4oFZD4cW3wHxUPBfeEKJJmfyGruOMwvT4W/r6FbD1ptEPrcnCDjmhqXwA2egxEWWojgXwxd7/JXFYRxiahPcwQBK4UfY7C7evpwp5J2v/v6FMeV6k/DWaVHX6z7un8W12E6LEosAFL+JLF11y3cXaHwITkQMToVhfz9QIDAQAB"
55 55
 

+ 2 - 2
KXCardHelp/AppDelegate/HFile/LVKBURLHeader.h

@@ -12,12 +12,12 @@
12 12
 #define CHURLHeader_h
13 13
 
14 14
 //测试环境
15
-#define BaseURL  @"http://182.92.118.1:5240"
15
+//#define BaseURL  @"http://182.92.118.1:5240"
16 16
 //static NSString *const advURL = @"http://182.92.118.1:8070/api";   //广告测试URL
17 17
 
18 18
 
19 19
 //真实环
20
-//#define BaseURL     @"https://api.lanjiekuan.com"
20
+#define BaseURL     @"https://api.lanjiekuan.com"
21 21
 static NSString *const advURL = @"http://ads.726p.com/api";   //广告线上URL
22 22
 
23 23
 /**********************************************************/

+ 2 - 2
KXCardHelp/Base/Tab/LVKBBaseTabBarViewController.m

@@ -23,7 +23,7 @@
23 23
     [self.tabBar setBarTintColor:[UIColor whiteColor]];
24 24
     
25 25
     NSNumber *num=[[NSUserDefaults standardUserDefaults]objectForKey:IOS_TYPE];
26
-    if (num &&[num integerValue]==1) {   //0
26
+    if (num &&[num integerValue]==0) {   //0
27 27
         [self initViewControllers];
28 28
         self.initViewFlag=YES;
29 29
     }
@@ -60,7 +60,7 @@
60 60
         [[NSUserDefaults standardUserDefaults]setObject:ios forKey:IOS_TYPE];
61 61
         [[NSUserDefaults standardUserDefaults] synchronize];
62 62
         if (!self.initViewFlag) {
63
-            if ([ios integerValue]==1) {   //0
63
+            if ([ios integerValue]==0) {   //0
64 64
                 [self initViewControllers];
65 65
             }else{
66 66
                 [self initViewControllers2];

+ 13 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/KXInstallmentViewController.h

@@ -0,0 +1,13 @@
1
+//
2
+//  KXInstallmentViewController.h
3
+//  CAISHEN
4
+//
5
+//  Created by jcymac on 2017/11/9.
6
+//  Copyright © 2017年 kuxuan. All rights reserved.
7
+//
8
+
9
+#import "LVKBBaseViewController.h"
10
+
11
+@interface KXInstallmentViewController : LVKBBaseViewController
12
+
13
+@end

+ 384 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/KXInstallmentViewController.m

@@ -0,0 +1,384 @@
1
+//
2
+//  KXInstallmentViewController.m
3
+//  CAISHEN
4
+//
5
+//  Created by jcymac on 2017/11/9.
6
+//  Copyright © 2017年 kuxuan. All rights reserved.
7
+//
8
+
9
+#import "KXInstallmentViewController.h"
10
+#import <ReactiveCocoa/ReactiveCocoa.h>
11
+
12
+@interface KXInstallmentViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
13
+@property(nonatomic,strong)UITableView *tableView;
14
+
15
+@property(nonatomic,strong)UIView *headView;
16
+@property(nonatomic,strong)UIView *footerView;
17
+@property(nonatomic,copy)NSString *result;
18
+@property(nonatomic,strong)NSArray *array;
19
+@property(nonatomic,strong)UITextField *money;
20
+@property(nonatomic,strong)UITextField *date;
21
+@property(nonatomic,strong)UITextField *rate;
22
+@property(nonatomic,strong)UIButton *btn;
23
+@property(nonatomic,strong)UILabel *lableDown;
24
+@property(nonatomic,strong)UIView *leftView;
25
+@property(nonatomic,strong)UIView *RightView;
26
+@property(nonatomic,strong)UILabel *paymentlLabel;
27
+@property(nonatomic,strong)UILabel *repaymentLabel;
28
+
29
+@property(nonatomic,assign)float resultInt;
30
+@end
31
+
32
+@implementation KXInstallmentViewController
33
+
34
+- (void)viewDidLoad {
35
+    [super viewDidLoad];
36
+    // Do any additional setup after loading the view.
37
+    [self createNavBar];
38
+    [self setupView];
39
+    [self setPosition];
40
+}
41
+-(void)setPosition{
42
+    //左边数字
43
+    CGRect leftRect=self.leftView.bounds;
44
+    leftRect.size.height=leftRect.size.height/2;
45
+    leftRect.origin.y=leftRect.size.height;
46
+    self.paymentlLabel.frame=leftRect;
47
+    //右边数字
48
+    CGRect rightRect=self.RightView.bounds;
49
+    rightRect.size.height=rightRect.size.height/2;
50
+    rightRect.origin.y=rightRect.size.height;
51
+    self.repaymentLabel.frame=rightRect;
52
+}
53
+
54
+
55
+-(UILabel *)paymentlLabel{//左边那个
56
+    if (!_paymentlLabel) {
57
+        _paymentlLabel=[[UILabel alloc]init];
58
+        _paymentlLabel.textColor=[UIColor CHColorWithHex:0x000000];
59
+        _paymentlLabel.font=[UIFont systemFontOfSize:26/2];
60
+        _paymentlLabel.textAlignment=NSTextAlignmentCenter;
61
+        _paymentlLabel.text=@"0";
62
+    }
63
+    return _paymentlLabel;
64
+    
65
+}
66
+
67
+-(UILabel *)repaymentLabel{//右边那个
68
+    if (!_repaymentLabel) {
69
+        _repaymentLabel=[[UILabel alloc]init];
70
+        _repaymentLabel.textColor=[UIColor CHColorWithHex:0x000000];
71
+        _repaymentLabel.font=[UIFont systemFontOfSize:26/2];
72
+        _repaymentLabel.textAlignment=NSTextAlignmentCenter;
73
+        _repaymentLabel.text=@"0";
74
+    }
75
+    return _repaymentLabel;
76
+}
77
+
78
+-(UIView *)leftView{
79
+    if (!_leftView) {
80
+        _leftView=[[UIView alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH/2, 80)];
81
+//        _leftView.backgroundColor=[UIColor redColor];
82
+        //支付利息(元)
83
+        CGRect rect=_leftView.bounds;
84
+        rect.size.height=rect.size.height/2;
85
+        UILabel *label=[[UILabel alloc]initWithFrame:rect];
86
+        label.text=@"支付利息(元)";
87
+        label.textAlignment=NSTextAlignmentCenter;
88
+        label.font=[UIFont systemFontOfSize:22/2];
89
+        label.textColor=[UIColor CHColorWithHex:0x414141];
90
+        [_leftView addSubview:label];
91
+    }
92
+    return _leftView;
93
+}
94
+
95
+-(UIView *)RightView{
96
+    if (!_RightView) {
97
+        _RightView=[[UIView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2, 100, SCREEN_WIDTH/2, 80)];
98
+        CGRect rect=_RightView.bounds;
99
+        rect.size.height=rect.size.height/2;
100
+        UILabel *label=[[UILabel alloc]initWithFrame:rect];
101
+        label.text=@"还款总额(元)";
102
+        label.textAlignment=NSTextAlignmentCenter;
103
+        label.font=[UIFont systemFontOfSize:22/2];
104
+        label.textColor=[UIColor CHColorWithHex:0x414141];
105
+        [_RightView addSubview:label];
106
+    }
107
+    return _RightView;
108
+}
109
+
110
+
111
+-(UIButton *)btn{
112
+    if (!_btn) {
113
+        _btn= [UIButton buttonWithType:UIButtonTypeCustom];
114
+        _btn.frame=CGRectMake(0, 0, 484/2, 80/2);
115
+        _btn.backgroundColor=[UIColor  baseColor];
116
+        [_btn setTitle:@"我要分期" forState:UIControlStateNormal];
117
+        _btn.titleLabel.font=[UIFont systemFontOfSize:FITSIZE(14)];
118
+        [_btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
119
+        _btn.layer.cornerRadius = 80/4;
120
+        [_btn addTarget:self action:@selector(individualIncomeGo:) forControlEvents:UIControlEventTouchUpInside];
121
+    }
122
+    return _btn;
123
+}
124
+
125
+
126
+
127
+-(void)individualIncomeGo:(UIButton *)sender{
128
+    //总利息
129
+    self.paymentlLabel.text=[self individualIncomeSalary:self.money.text Threshold:self.date.text];
130
+    //还款总额
131
+    self.repaymentLabel.text=[NSString stringWithFormat:@"%.2f",([self.paymentlLabel.text floatValue]+[self.money.text intValue])];
132
+    //每月月供
133
+    self.lableDown.text=[NSString stringWithFormat:@"%.2f",([self.repaymentLabel.text floatValue]/[self.date.text intValue])];
134
+}
135
+-(NSString * )individualIncomeSalary:(NSString *)money Threshold:(NSString *)date{
136
+    NSInteger moneyInt=[money intValue];
137
+    NSInteger dateInt=[date intValue];
138
+    NSString *result=[NSString stringWithFormat:@"%.2f",moneyInt*dateInt*0.0048];
139
+    return result;
140
+}
141
+-(NSArray *)array{
142
+    if (!_array) {
143
+        _array= [NSArray arrayWithObjects:
144
+                @{@"name":@"分期金额",@"placeholder":@"请输入金额"},
145
+                @{@"name":@"分期期数",@"placeholder":@"请输入期数"},
146
+                @{@"name":@"月利率(%)",@"text":@"0.48"},nil];
147
+    }
148
+    return _array;
149
+}
150
+
151
+-(NSString *)result{
152
+    return [NSString stringWithFormat:@"%.2f",self.resultInt];
153
+    
154
+}
155
+- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section{
156
+    return 30;
157
+    
158
+}
159
+
160
+
161
+- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
162
+    UIView *header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
163
+    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(34/2, 0, SCREEN_WIDTH-34, 30)];
164
+    label.text=@"请输入分期信息";
165
+    label.font=[UIFont systemFontOfSize:26/2];
166
+    label.textColor=[UIColor CHColorWithHex:0x9a9a9a];
167
+    [header addSubview:label];
168
+    return header;
169
+}
170
+
171
+-(UIView *)footerView{
172
+    if (!_footerView) {
173
+        _footerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
174
+        [_footerView addSubview:self.btn];
175
+        self.btn.center=_footerView.center;
176
+    }
177
+    
178
+    return _footerView;
179
+}
180
+
181
+-(UILabel *)lableDown{
182
+    if (!_lableDown) {
183
+        _lableDown=[[UILabel alloc]init];
184
+        _lableDown.text=@"0";
185
+        _lableDown.font=[UIFont systemFontOfSize:40/2];
186
+        _lableDown.textColor=[UIColor CHColorWithHex:0xe42a4a];
187
+        _lableDown.textAlignment=NSTextAlignmentCenter;
188
+    }
189
+    return _lableDown;
190
+}
191
+-(UIView *)headView{
192
+    if (!_headView) {
193
+        _headView=[[UIView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 200)];
194
+        _headView.backgroundColor=[UIColor whiteColor];
195
+        UILabel *lableTop=[[UILabel alloc]initWithFrame:CGRectMake(0, 50/2, SCREEN_WIDTH, 30)];
196
+        lableTop.text=@"每月月供(元)";
197
+        lableTop.font=[UIFont systemFontOfSize:26/2];
198
+        lableTop.textColor=[UIColor CHColorWithHex:0x414141];
199
+        lableTop.textAlignment=NSTextAlignmentCenter;
200
+        self.lableDown.frame=CGRectMake(0, lableTop.frame.origin.y+lableTop.frame.size.height+10, SCREEN_WIDTH, 30);
201
+        [_headView addSubview:lableTop];
202
+        [_headView addSubview:self.lableDown];
203
+        
204
+        
205
+    }
206
+    return _headView;
207
+}
208
+-(UITableView *)tableView{
209
+    if (!_tableView) {
210
+        _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, NavBarHeight,SCREEN_WIDTH, SCREEN_HEIGHT - NavBarHeight) style:UITableViewStylePlain];
211
+        _tableView.tableHeaderView=self.headView;
212
+        _tableView.tableFooterView=self.footerView;
213
+        _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
214
+        _tableView.delegate=self;
215
+        _tableView.dataSource=self;
216
+        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"individualIncome"];
217
+    }
218
+    return _tableView;
219
+}
220
+
221
+
222
+
223
+
224
+-(void)setupView{
225
+    [self.view addSubview:self.tableView];
226
+    [self.headView addSubview:self.leftView];
227
+    [self.headView addSubview:self.RightView];
228
+    [self.leftView addSubview:self.paymentlLabel];
229
+    [self.RightView addSubview:self.repaymentLabel];
230
+    
231
+}
232
+-(void)createNavBar{
233
+    self.navigationBar.backgroundColor = [UIColor checkBaseColor];
234
+    [self.navigationBar setNavTitle:@"分期计算器"];
235
+    self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
236
+    self.navigationBar.navTitleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 18];
237
+    UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
238
+    [leftBtn setImage:[UIImage imageNamed:@"back_black"] forState:UIControlStateNormal];
239
+    [[leftBtn rac_signalForControlEvents:UIControlEventTouchUpInside]subscribeNext:^(id x) {
240
+        [self.navigationController popViewControllerAnimated:YES];
241
+    }];
242
+    [self.navigationBar setCustomLeftButtons:@[leftBtn]];
243
+}
244
+
245
+//RAC 添加信号,处理计算按钮是否可点击
246
+- (void)addSingal {
247
+    UITextField *textField1 = (UITextField *)[self.view viewWithTag:1000+0];
248
+    UITextField *textField2 = (UITextField *)[self.view viewWithTag:1000+1];
249
+    UITextField *textField3 = (UITextField *)[self.view viewWithTag:1000+2];
250
+    
251
+    if (!(textField1 && textField2)) {
252
+        return;
253
+    }
254
+    
255
+    RACSignal *textSingal1 = [textField1.rac_textSignal map:^id(NSString * value) {
256
+        return @(value.length > 0);
257
+    }];
258
+    RACSignal *textSingal2 = [textField2.rac_textSignal map:^id(NSString * value) {
259
+        return @(value.length > 0);
260
+    }];
261
+    RACSignal *textSingal3 = [textField3.rac_textSignal map:^id(NSString * value) {
262
+        return @(value.length > 0);
263
+    }];
264
+    
265
+    RACSignal *calculActiveSignal = [RACSignal
266
+                                     combineLatest:@[
267
+                                                     textSingal1,
268
+                                                     textSingal2,
269
+                                                     textSingal3
270
+                                                     ]
271
+                                     reduce:^id(NSNumber *textSingal1, NSNumber *textSingal2, NSNumber *textSingal3) {
272
+                                         return @([textSingal1 boolValue] && [textSingal2 boolValue] && [textSingal3 boolValue]);
273
+                                     }];
274
+    
275
+    [calculActiveSignal subscribeNext:^(NSNumber *calculEnble) {
276
+        self.btn.enabled = [calculEnble boolValue];
277
+        self.btn.backgroundColor = [UIColor checkBaseColor];
278
+        [self.btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
279
+    }];
280
+}
281
+
282
+
283
+-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath{
284
+    return 98/2;
285
+}
286
+
287
+
288
+#pragma mark UITableViewDataSource
289
+
290
+-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
291
+{
292
+    if([indexPath row] == ((NSIndexPath*)[[tableView indexPathsForVisibleRows] lastObject]).row){
293
+        [self addSingal];
294
+    }
295
+}
296
+
297
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
298
+    return self.array.count;
299
+}
300
+
301
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
302
+    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"individualIncome"];
303
+    if (!cell) {
304
+        
305
+        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"individualIncome"];
306
+    }
307
+    NSDictionary *dic=self.array[indexPath.row];
308
+    cell.selectionStyle = UITableViewCellSelectionStyleNone;
309
+    UITextField *text=[[UITextField alloc]initWithFrame:CGRectMake(34/2,0, SCREEN_WIDTH-34,cell.bounds.size.height-1)];
310
+    text.tag = 1000 + indexPath.row;
311
+    text.delegate=self;
312
+    text.placeholder=dic[@"placeholder"];
313
+    text.text=dic[@"text"];
314
+    [text setFont:[UIFont systemFontOfSize:26/2]];
315
+    text.textColor=[UIColor CHColorWithHex:0x414141];
316
+    text.keyboardType=UIKeyboardTypeNumberPad;
317
+    text.textAlignment=NSTextAlignmentRight;
318
+    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0,100, text.bounds.size.height)];
319
+    label.text=dic[@"name"];
320
+    [label setFont:[UIFont systemFontOfSize:26/2]];
321
+    label.textColor=[UIColor CHColorWithHex:0x414141];
322
+    text.leftView=label;
323
+    text.leftViewMode=UITextFieldViewModeAlways;
324
+    [cell addSubview:text];
325
+    //自定义下划线
326
+    if (indexPath.row<2) {
327
+        UIView *separator=[[UIView alloc]initWithFrame:CGRectMake(34/2, cell.bounds.size.height-0.5, SCREEN_WIDTH-34, 0.5)];
328
+        separator.backgroundColor=[UIColor CHColorWithHex:0xe6e8e6];
329
+        [cell addSubview:separator];
330
+    }
331
+//    else{
332
+//        cell.userInteractionEnabled=NO;
333
+//    }
334
+    //计算数据
335
+    switch (indexPath.row) {
336
+        case 0:
337
+            self.money=text;
338
+            break;
339
+        case 1:
340
+            self.date=text;
341
+            break;
342
+        case 2:
343
+            text.keyboardType=UIKeyboardTypeDecimalPad;
344
+            self.rate=text;
345
+    }
346
+    
347
+    
348
+    return cell;
349
+}
350
+
351
+//只允许输入数字和点
352
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
353
+    if (range.length==1) {
354
+        return YES;
355
+    }
356
+    NSLog(@"aa");
357
+    //有点
358
+    if (textField==self.rate) {
359
+        if (([textField.text rangeOfString:@"."].location!=NSNotFound )&& ([string isEqualToString:@"."])) {
360
+            return NO;
361
+        }
362
+        if ([@"0123456789." rangeOfString:string].location == NSNotFound) {
363
+            return NO;
364
+        }
365
+        if([textField.text length]>10){
366
+            return NO;
367
+        }
368
+    }else{
369
+    
370
+        if ([@"0123456789" rangeOfString:string].location == NSNotFound) {
371
+            return NO;
372
+        }
373
+        if([textField.text length]>10){
374
+            return NO;
375
+        }
376
+        
377
+    }
378
+    return YES;
379
+}
380
+
381
+
382
+
383
+
384
+@end

+ 1 - 1
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckAddCardViewController.h

@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
13 13
 
14 14
 @interface WWCheckAddCardViewController : LVKBBaseViewController
15 15
 
16
-@property (nonatomic, copy)void(^addCardSuccessBlock)(void);
16
+//@property (nonatomic, copy)void(^addCardSuccessBlock)(void);
17 17
 
18 18
 @end
19 19
 

+ 44 - 3
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckAddCardViewController.m

@@ -20,7 +20,7 @@ static NSString *ScanCellID = @"ScanCellID";
20 20
 static NSString *TFCellID = @"TFCellID";
21 21
 static NSString *DateCellID = @"DateCellID";
22 22
 
23
-@interface WWCheckAddCardViewController ()<UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, WWDatePickerViewDelegate>
23
+@interface WWCheckAddCardViewController ()<UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, WWDatePickerViewDelegate, tapImageDelegate>
24 24
 
25 25
 @property (nonatomic, strong)UITableView *tableView;            //tableView
26 26
 @property (nonatomic, strong)NSMutableArray *dataArray;         //数据源
@@ -75,6 +75,7 @@ static NSString *DateCellID = @"DateCellID";
75 75
         cell.textField.placeholder = palceholderArray[indexPath.row];
76 76
         cell.textField.tag = indexPath.row + 1000;
77 77
         cell.textField.delegate = self;
78
+        cell.delegate = self;
78 79
         return cell;
79 80
     } else if (indexPath.row == 3 || indexPath.row == 4) {
80 81
         WWCheckAddCardDateCell *cell = [tableView dequeueReusableCellWithIdentifier:DateCellID forIndexPath:indexPath];
@@ -129,14 +130,15 @@ static NSString *DateCellID = @"DateCellID";
129 130
     
130 131
     [LVKBHttp post:checkAddCardRequest params:self.paramaDict success:^(id json) {
131 132
         NSLog(@"%@", json);
132
-        self.addCardSuccessBlock();
133
+        [self.navigationController popViewControllerAnimated:YES];
133 134
     } failure:^(NSError *error) {
134 135
         NSLog(@"%@", error);
135 136
     }];
136 137
 }
137 138
 
138 139
 #pragma mark - 选择日期
139
-- (void)onClickDataPicker:(int)state{    
140
+- (void)onClickDataPicker:(int)state{
141
+    [self.view endEditing:YES];
140 142
     NSMutableArray *dateStrArr = [[NSMutableArray alloc] init];
141 143
     for (int i = 1; i < 32; i ++) {
142 144
         NSString *dateStr = [NSString stringWithFormat:@"%d日", i];
@@ -217,4 +219,43 @@ static NSString *DateCellID = @"DateCellID";
217 219
     return _paramaDict;
218 220
 }
219 221
 
222
+#pragma mark - 点击扫描信用卡  百度ocr
223
+- (void)tapImageAction {
224
+    if(![PublicFunction isCanUseCamera]){
225
+        [self showMessage:@"没有相机权限,请前往设置开启"];
226
+        return;
227
+    }
228
+    UIViewController * vc = [AipCaptureCardVC ViewControllerWithCardType:CardTypeBankCard andImageHandler:^(UIImage *image) {
229
+        [self dismissViewControllerAnimated:YES completion:nil];
230
+        
231
+        [[AipOcrService shardService] detectBankCardFromImage:image successHandler:^(id result) {
232
+            if ([NSThread currentThread]!=[NSThread mainThread]) {
233
+                dispatch_sync(dispatch_get_main_queue(), ^{
234
+
235
+                    NSString *bankNum = result[@"result"][@"bank_card_number"];  //卡号
236
+                    NSString *bankName = result[@"result"][@"bank_name"];        //所属银行
237
+                    
238
+                    UITextField *bankNumTF = [self.view viewWithTag:1000];
239
+                    UITextField *bankNameTF = [self.view viewWithTag:1001];
240
+                    
241
+                    bankNumTF.text = bankNum;
242
+                    bankNameTF.text = bankName;
243
+                    
244
+                    [self.paramaDict setValue:bankNum forKey:@"card_no"];
245
+                    [self.paramaDict setValue:bankName forKey:@"bank_name"];
246
+                    
247
+                });
248
+            } else {
249
+                //
250
+            }
251
+            
252
+        } failHandler:^(NSError *err) {
253
+            [self showMessage:@"识别失败"];
254
+        }];
255
+    }];
256
+    
257
+    [self presentViewController:vc animated:YES completion:nil];
258
+}
259
+
260
+
220 261
 @end

+ 34 - 1
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckExpenseCountVC.m

@@ -20,6 +20,7 @@ static NSString *cellID = @"cellID";
20 20
 @property (nonatomic, strong)UITableView *tableView;          //tableView
21 21
 @property (nonatomic, strong)NSMutableArray *dataArray;       //数据源
22 22
 @property (nonatomic, strong)WWCheckHomeDataView *cardDataView;       //卡片数据汇总
23
+@property (nonatomic, strong)UIView *noDataView;
23 24
 
24 25
 @end
25 26
 
@@ -58,7 +59,6 @@ static NSString *cellID = @"cellID";
58 59
     
59 60
     [LVKBHttp post:checkCardListRequest params:@{@"token" : token} success:^(id json) {
60 61
         
61
-        
62 62
         NSArray *array = [NSArray yy_modelArrayWithClass:[WWCheckCardListModel class] json:json[@"card_list"]];
63 63
         [self.dataArray addObjectsFromArray:array];
64 64
         [self.tableView reloadData];
@@ -67,6 +67,17 @@ static NSString *cellID = @"cellID";
67 67
         self.cardDataView.surplusAmount.text = [NSString stringWithFormat:@"剩余额度:%@", json[@"card_sum"][@"remaining_account"]];
68 68
         self.cardDataView.totalAmount.text = [NSString stringWithFormat:@"总额度:%@", json[@"card_sum"][@"all_credit_account"]];
69 69
         
70
+        if (array.count>0) {
71
+            self.noDataView.hidden = YES;
72
+            [self.dataArray addObjectsFromArray:array];
73
+            [self.tableView reloadData];
74
+            
75
+            self.cardDataView.useAmount.text = [NSString stringWithFormat:@"%@", json[@"card_sum"][@"all_bill_account"]];
76
+            self.cardDataView.surplusAmount.text = [NSString stringWithFormat:@"剩余额度:%@", json[@"card_sum"][@"remaining_account"]];
77
+            self.cardDataView.totalAmount.text = [NSString stringWithFormat:@"总额度:%@", json[@"card_sum"][@"all_credit_account"]];
78
+        } else {
79
+            self.noDataView.hidden = NO;
80
+        }
70 81
         
71 82
     } failure:^(NSError *error) {
72 83
         
@@ -138,4 +149,26 @@ static NSString *cellID = @"cellID";
138 149
     return _dataArray;
139 150
 }
140 151
 
152
+- (UIView *)noDataView {
153
+    if (!_noDataView) {
154
+        _noDataView = [[UIView alloc]initWithFrame:CGRectMake(0, 160*SCREEN_MUTI, SCREEN_WIDTH, 180*SCREEN_MUTI)];
155
+        
156
+        //图片
157
+        UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-180*SCREEN_MUTI)/2, 0, 180*SCREEN_MUTI, 130*SCREEN_MUTI)];
158
+        imgView.image = [UIImage imageNamed:@"home_bankAuthentication_no"];
159
+        [_noDataView addSubview:imgView];
160
+        
161
+        //文字
162
+        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, imgView.bottom + 20*SCREEN_MUTI, SCREEN_WIDTH, 20)];
163
+        label.text = @"您还没有信用卡消费记录";
164
+        label.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 14];
165
+        label.textColor = WWColor(128, 128, 128, 1);
166
+        label.textAlignment = NSTextAlignmentCenter;
167
+        [_noDataView addSubview:label];
168
+        
169
+        [self.view addSubview:_noDataView];
170
+    }
171
+    return _noDataView;
172
+}
173
+
141 174
 @end

+ 30 - 8
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckHomeViewController.m

@@ -10,6 +10,8 @@
10 10
 #import "WWCheckAddCardViewController.h"   //添加信用卡VC
11 11
 #import "WWCheckRemindMeViewController.h"  //智能提醒
12 12
 #import "WWCheckExpenseCountVC.h"          //消费统计
13
+#import "KXInstallmentViewController.h"    //账单分期
14
+#import "WWCheckCardListDetailVC.h"        //信用卡详情
13 15
 
14 16
 #import "WWCheckHomeDataView.h"    //卡片额度汇总数据
15 17
 #import "WWCheckHomeToolView.h"    //上面三个按钮View
@@ -44,9 +46,13 @@ static NSString *cellID = @"cellID";
44 46
     self.view.backgroundColor = [UIColor whiteColor];
45 47
     [self.view addSubview:self.tableView];
46 48
     [self.view addSubview:self.footView];
47
-    [self loadCardListData];   //加载卡片数据
48 49
 }
49 50
 
51
+- (void)viewWillAppear:(BOOL)animated {
52
+    [super viewWillAppear:animated];
53
+    
54
+    [self loadCardListData];   //加载卡片数据
55
+}
50 56
 
51 57
 
52 58
 #pragma mark - tableView
@@ -76,9 +82,16 @@ static NSString *cellID = @"cellID";
76 82
     cell.model = self.dataArray[indexPath.section];
77 83
     cell.delegate = self;
78 84
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
85
+    cell.delegate = self;
79 86
     return cell;
80 87
 }
81 88
 
89
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
90
+    WWCheckCardListDetailVC *detailVC = [[WWCheckCardListDetailVC alloc] init];
91
+    detailVC.cardModel = self.dataArray[indexPath.section];
92
+    [self.navigationController pushViewController:detailVC animated:YES];
93
+}
94
+
82 95
 #pragma mark - 点击上面三个按钮功能
83 96
 - (void)clickToolButtonWithIndex:(int)index {
84 97
     NSLog(@"%d", index);
@@ -89,7 +102,8 @@ static NSString *cellID = @"cellID";
89 102
         WWCheckExpenseCountVC *countVC = [[WWCheckExpenseCountVC alloc] init];
90 103
         [self.navigationController pushViewController:countVC animated:YES];
91 104
     } else {                  //账单分期
92
-        
105
+        KXInstallmentViewController *installmentVC = [[KXInstallmentViewController alloc] init];
106
+        [self.navigationController pushViewController:installmentVC animated:YES];
93 107
     }
94 108
 }
95 109
 
@@ -101,6 +115,7 @@ static NSString *cellID = @"cellID";
101 115
         return;
102 116
     }
103 117
     
118
+    [self.dataArray removeAllObjects];
104 119
     [LVKBHttp post:checkCardListRequest params:@{@"token" : token} success:^(id json) {
105 120
         
106 121
         [self. bannerView removeFromSuperview];
@@ -118,25 +133,32 @@ static NSString *cellID = @"cellID";
118 133
     } failure:^(NSError *error) {
119 134
         [self.cardDataView removeFromSuperview];
120 135
         [self. tableHeaderView addSubview:self.bannerView];
136
+        [self.tableView reloadData];
121 137
     }];
122 138
 }
123 139
 
124 140
 #pragma mark - 添加信用卡
125 141
 - (void)onClickAddCardBtn {
126 142
     WWCheckAddCardViewController *addVC = [[WWCheckAddCardViewController alloc] init];
127
-    addVC.addCardSuccessBlock = ^{
128
-        [self loadCardListData];
129
-    };
143
+//    addVC.addCardSuccessBlock = ^{
144
+//        [self loadCardListData];
145
+//    };
130 146
     [self.navigationController pushViewController:addVC animated:YES];
131 147
 }
132 148
 
133 149
 #pragma mark - 点击cell上按钮
134 150
 - (void)clickCellButton:(WWCheckCardListModel *)model {
135 151
     if ([model.status isEqualToString:@"1"]) {         //立即还款
152
+        [LVKBHttp post:checkeRefundCardRequest params:@{@"id" : model.ID} success:^(id json) {
153
+            //还款成功, 刷新数据
154
+            [self loadCardListData];
155
+        } failure:^(NSError *error) {
156
+            //
157
+            NSLog(@"%@", error);
158
+        }];
159
+    } else if ([model.status isEqualToString:@"2"]) {  //已还款
136 160
         //
137
-    } else if ([model.status isEqualToString:@"2"]) {  //已逾期
138
-        //
139
-    } else {   //已还款
161
+    } else {   //已逾期
140 162
         
141 163
     }
142 164
 }

+ 1 - 1
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.m

@@ -10,7 +10,7 @@
10 10
 
11 11
 @implementation WWCheckCardListModel
12 12
 
13
-- (NSDictionary *)modelCustomPropertyMapper {
13
++ (NSDictionary *)modelCustomPropertyMapper {
14 14
     return @{@"ID" : @"id"};
15 15
 }
16 16
 

+ 8 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckAddCardInfoCell.h

@@ -10,12 +10,20 @@
10 10
 
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13
+@protocol tapImageDelegate <NSObject>
14
+
15
+- (void)tapImageAction;
16
+
17
+@end
18
+
13 19
 @interface WWCheckAddCardInfoCell : UITableViewCell
14 20
 
15 21
 @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
16 22
 @property (weak, nonatomic) IBOutlet UITextField *textField;
17 23
 @property (weak, nonatomic) IBOutlet UIImageView *rightImage;
18 24
 
25
+@property (nonatomic, strong)id<tapImageDelegate>delegate;
26
+
19 27
 @end
20 28
 
21 29
 NS_ASSUME_NONNULL_END

+ 10 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckAddCardInfoCell.m

@@ -13,6 +13,10 @@
13 13
 - (void)awakeFromNib {
14 14
     [super awakeFromNib];
15 15
     // Initialization code
16
+    
17
+    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage)];
18
+    self.rightImage.userInteractionEnabled = YES;
19
+    [self.rightImage addGestureRecognizer:tap];
16 20
 }
17 21
 
18 22
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
@@ -21,4 +25,10 @@
21 25
     // Configure the view for the selected state
22 26
 }
23 27
 
28
+- (void)tapImage {
29
+    if (self.delegate && [self.delegate respondsToSelector:@selector(tapImageAction)]) {
30
+        [self.delegate tapImageAction];
31
+    }
32
+}
33
+
24 34
 @end

+ 7 - 7
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/View/WWCheckHomeCardCell.m

@@ -46,17 +46,17 @@
46 46
         self.bankDayState.text = @"天后出账";
47 47
         self.bankDayState.textColor = WWColor(83, 79, 79, 1);
48 48
         
49
-    } else if ([_model.status isEqualToString:@"2"]) {  //已逾期
50
-        [self.bankStateBtn setTitle:@"已逾期" forState:UIControlStateNormal];
51
-        self.bankDayNum.text = _model.overdue_days;
52
-        self.bankDayState.text = @"天已逾期";
53
-        self.bankDayState.textColor = [UIColor whiteColor];
54
-        
55
-    } else {   //已还款
49
+    } else if ([_model.status isEqualToString:@"2"]) {  //已还款
56 50
         [self.bankStateBtn setTitle:@"已还款" forState:UIControlStateNormal];
57 51
         self.bankDayNum.text = _model.charge_off_days;
58 52
         self.bankDayState.text = @"天后出账";
59 53
         self.bankDayState.textColor = WWColor(83, 79, 79, 1);
54
+        
55
+    } else {   //已还款
56
+        [self.bankStateBtn setTitle:@"已逾期" forState:UIControlStateNormal];
57
+        self.bankDayNum.text = _model.overdue_days;
58
+        self.bankDayState.text = @"天已逾期";
59
+        self.bankDayState.textColor = [UIColor whiteColor];
60 60
     }
61 61
     
62 62
     //到期时间

+ 78 - 1
KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m

@@ -7,6 +7,7 @@
7 7
 //
8 8
 
9 9
 #import "WWCheckCardListDetailVC.h"
10
+#import "WWCheckRemindMeViewController.h"   //智能提醒
10 11
 
11 12
 #import "WWCheckHomeCardCell.h"    //银行卡Cell
12 13
 
@@ -27,6 +28,7 @@ static NSString *cellID = @"cellID";
27 28
     
28 29
     [self createNaviBar];
29 30
     [self.view addSubview:self.tableView];
31
+    [self createBottonView];
30 32
 }
31 33
 
32 34
 #pragma mark - 创建导航栏
@@ -43,8 +45,82 @@ static NSString *cellID = @"cellID";
43 45
         [self.navigationController popViewControllerAnimated:YES];
44 46
     }];
45 47
     [self.navigationBar setCustomLeftButtons:@[leftBtn]];
48
+    
49
+    UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
50
+    [rightBtn setImage:[UIImage imageNamed:@"back_black"] forState:UIControlStateNormal];
51
+    [[rightBtn rac_signalForControlEvents:UIControlEventTouchUpInside]subscribeNext:^(id x) {
52
+        [self deleteCard];   //删除信用卡
53
+    }];
54
+    [self.navigationBar setCustomRightButtons:@[rightBtn]];
46 55
 }
47 56
 
57
+#pragma mark - 底部View  智能提醒/立即还款
58
+- (void)createBottonView {
59
+    //智能提醒
60
+    UIButton *remindBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 50, SCREEN_WIDTH/2, 50)];
61
+    remindBtn.backgroundColor = [UIColor whiteColor];
62
+    remindBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 16];
63
+    [remindBtn setTitle:@"智能提醒" forState:UIControlStateNormal];
64
+    remindBtn.layer.borderWidth = 1.0;
65
+    remindBtn.layer.borderColor = [UIColor checkBaseColor].CGColor;
66
+    [remindBtn setTitleColor:[UIColor checkBaseColor] forState:UIControlStateNormal];
67
+    [remindBtn addTarget:self action:@selector(onClickRemindBtn) forControlEvents:UIControlEventTouchUpInside];
68
+    [self.view addSubview:remindBtn];
69
+    
70
+    //立即还款 /已还清
71
+    UIButton *refundBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, SCREEN_HEIGHT - 50, SCREEN_WIDTH/2, 50)];
72
+    refundBtn.backgroundColor = [UIColor whiteColor];
73
+    refundBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 16];
74
+    
75
+    if ([self.cardModel.status isEqualToString:@"1"]) {   //立即还款
76
+        [refundBtn setTitle:@"立即还款" forState:UIControlStateNormal];
77
+        refundBtn.backgroundColor = [UIColor checkBaseColor];
78
+        [refundBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
79
+    } else if ([self.cardModel.status isEqualToString:@"2"]) {  //已还款
80
+        [refundBtn setTitle:@"已还款" forState:UIControlStateNormal];
81
+        refundBtn.backgroundColor = [UIColor lightGrayColor];
82
+        [refundBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
83
+    } else {   //已逾期
84
+        [refundBtn setTitle:@"已逾期" forState:UIControlStateNormal];
85
+        refundBtn.backgroundColor = [UIColor checkBaseColor];
86
+        [refundBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
87
+    }
88
+    
89
+    [refundBtn addTarget:self action:@selector(clickRefundBtn) forControlEvents:UIControlEventTouchUpInside];
90
+    [self.view addSubview:refundBtn];
91
+}
92
+
93
+#pragma mark - 智能提醒
94
+- (void)onClickRemindBtn {
95
+    WWCheckRemindMeViewController *remindVC = [[WWCheckRemindMeViewController alloc] init];
96
+    [self.navigationController pushViewController:remindVC animated:YES];
97
+}
98
+
99
+#pragma mark - 立即还款
100
+- (void)clickRefundBtn {
101
+    if ([self.cardModel.status isEqualToString:@"1"]) {   //立即还款
102
+        [LVKBHttp post:checkeRefundCardRequest params:@{@"id" : self.cardModel.ID} success:^(id json) {
103
+            //
104
+            [self.navigationController popViewControllerAnimated:YES];
105
+        } failure:^(NSError *error) {
106
+            //
107
+            NSLog(@"%@", error);
108
+            [MBProgressHUD showError:@"网络异常"];
109
+        }];
110
+    }
111
+}
112
+
113
+#pragma mark - 删除信用卡
114
+- (void)deleteCard {
115
+    [LVKBHttp post:checkeDelCarddCardRequest params:@{@"id" : self.cardModel.ID} success:^(id json) {
116
+        //
117
+        [self.navigationController popViewControllerAnimated:YES];
118
+    } failure:^(NSError *error) {
119
+        //
120
+        NSLog(@"%@", error);
121
+        [MBProgressHUD showError:@"网络异常"];
122
+    }];
123
+}
48 124
 
49 125
 #pragma mark - UITableView delegate
50 126
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
@@ -136,10 +212,11 @@ static NSString *cellID = @"cellID";
136 212
     if ([model.status isEqualToString:@"1"]) {   //立即还款
137 213
         [LVKBHttp post:checkeRefundCardRequest params:@{@"id" : model.ID} success:^(id json) {
138 214
             //
139
-            NSLog(@"%@", json);
215
+            [self.navigationController popViewControllerAnimated:YES];
140 216
         } failure:^(NSError *error) {
141 217
             //
142 218
             NSLog(@"%@", error);
219
+            [MBProgressHUD showError:@"网络异常"];
143 220
         }];
144 221
     }
145 222
 }

+ 93 - 10
KXCardHelp/Main/Home/Receipt/VC/LVKBHomeReceiptViewController.m

@@ -11,6 +11,9 @@
11 11
 #import "LVKBHomeReceiptOKViewController.h"
12 12
 #import "LVKBHomeCreditCardViewChild2Controller.h"
13 13
 #import "LVKBHomeReceiptWebViewController.h"
14
+
15
+#import "LVKBHomeCardsModel.h"
16
+
14 17
 @interface LVKBHomeReceiptViewController ()
15 18
 <
16 19
 UITextFieldDelegate
@@ -23,6 +26,9 @@ UITextFieldDelegate
23 26
 @property(nonatomic       )NSInteger savingID;
24 27
 @property(nonatomic       )BOOL      haveBankCard;
25 28
 @property(nonatomic       )NSInteger noOverRangeMoney;//实时计算状态  -2正在请求 -1未初始化  0数据错误  1正确
29
+
30
+@property (nonatomic, strong)NSMutableArray *dataArray;  //信用卡列表数组
31
+
26 32
 @end
27 33
 
28 34
 @implementation LVKBHomeReceiptViewController
@@ -36,15 +42,23 @@ UITextFieldDelegate
36 42
     [self initUI];
37 43
     [self adjustUI];
38 44
     [self request];
45
+    [self requestDefaultCard];  //请求信用卡列表, 默认显示第一个
39 46
 }
40 47
 
41 48
 -(void)viewWillAppear:(BOOL)animated{
42 49
     [super viewWillAppear:animated];
50
+    
51
+    //玉玲的需求,输入的金额要返回要显示
43 52
     UITextField        *centerBankTextField=[self.centerView viewWithTag:20008];
44
-    centerBankTextField.text=@"";
45
-    UILabel *centerTipLabel=[self.centerView viewWithTag:20010];
46
-    centerTipLabel.text=[NSString stringWithFormat:@"到账金额 ¥--.--"];
47
-    self.noOverRangeMoney=-1;
53
+    //    centerBankTextField.text=@"";
54
+    //    UILabel *centerTipLabel=[self.centerView viewWithTag:20010];
55
+    //    centerTipLabel.text=[NSString stringWithFormat:@"到账金额 ¥--.--"];
56
+    //    self.noOverRangeMoney=-1;
57
+    
58
+    //选卡返回后输入的金额还在,重新请求到账金额
59
+    if (centerBankTextField.text.length>0) {
60
+        [self performSelector:@selector(requestWithMoney:) withObject:centerBankTextField.text afterDelay:0.0f];
61
+    }
48 62
 }
49 63
 
50 64
 -(void)initUI{
@@ -78,14 +92,50 @@ UITextFieldDelegate
78 92
             if (amount) {
79 93
                 centerBankTextField.placeholder=[NSString stringWithFormat:@"每笔最高%.2f元",[amount floatValue]];
80 94
             }
81
-           
95
+            
82 96
             NSNumber *bank_card_id=data[@"id"];
83 97
             if (bank_card_id) {
84 98
                 self.savingID=[bank_card_id integerValue];
85 99
             }
86 100
         }
87 101
         
88
-      
102
+        
103
+    } failure:^(NSError *error) {
104
+        
105
+    }];
106
+}
107
+
108
+#pragma mark - 请求信用卡数据,默认显示第一个
109
+-(void)requestDefaultCard {
110
+    NSDictionary * paramsDict = @{@"card_type":@"CREDIT"};
111
+    [LVKBHttp get:cardListRequest params:paramsDict success:^(id json) {
112
+        [self.dataArray removeAllObjects];
113
+        NSArray *cardArray=[NSArray yy_modelArrayWithClass:[LVKBHomeCardsModel class] json:json];
114
+        [self.dataArray addObjectsFromArray:cardArray];
115
+        
116
+        if (cardArray.count > 0) {
117
+            UILabel *topTitleLabel = [self.topView viewWithTag:10004];
118
+            UILabel *topContentLabel = [self.topView viewWithTag:10005];
119
+            UIButton *topChangeBtn = [self.topView viewWithTag:10006];
120
+            UIButton *topAddBtn = [self.topView viewWithTag:10003];
121
+            
122
+            //已绑定信用卡
123
+            LVKBHomeCardsModel *model = cardArray.firstObject;
124
+            
125
+            topTitleLabel.text = model.bank_name;
126
+            
127
+            NSString *tailNum = [model.card_num substringFromIndex:(model.card_num.length-4>0?model.card_num.length-4:0)];
128
+            topContentLabel.text = [NSString stringWithFormat:@"尾号 %@",tailNum];
129
+            
130
+            topChangeBtn.hidden = NO;
131
+            [topAddBtn sd_setImageWithURL:[NSURL URLWithString:model.bank_icon] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"bank_icon_blue"]];
132
+            topAddBtn.layer.cornerRadius = 24;
133
+            topAddBtn.layer.masksToBounds = YES;
134
+            topAddBtn.userInteractionEnabled = NO;
135
+            self.creditID = [model.ID integerValue];
136
+            [self requestCreditcardamountRequestByCreditId:[model.ID integerValue]];
137
+        }
138
+        
89 139
     } failure:^(NSError *error) {
90 140
         
91 141
     }];
@@ -119,7 +169,7 @@ UITextFieldDelegate
119 169
     
120 170
     self.noOverRangeMoney=-2;
121 171
     [LVKBHttp post:creditcardamountRequest params:dic success:^(id json) {
122
-         UILabel *centerTipLabel=[self.centerView viewWithTag:20010];
172
+        UILabel *centerTipLabel=[self.centerView viewWithTag:20010];
123 173
         NSNumber *amount=json[@"amount"];
124 174
         if ([amount floatValue]>0) {
125 175
             self.noOverRangeMoney=1;
@@ -253,7 +303,7 @@ UITextFieldDelegate
253 303
         make.top.equalTo(centerBankY.mas_bottom);
254 304
     }];
255 305
     [centerTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
256
-       make.left.equalTo(centerBankTitle1.mas_left);
306
+        make.left.equalTo(centerBankTitle1.mas_left);
257 307
         make.top.equalTo(centerLine2.mas_bottom).offset(18);
258 308
     }];
259 309
     
@@ -303,7 +353,7 @@ UITextFieldDelegate
303 353
         return;
304 354
     }
305 355
     [self performSelector:@selector(requestWithMoney:) withObject:textField.text afterDelay:0.4f];
306
-//    [self  requestWithMoney:[textField.text floatValue]];
356
+    //    [self  requestWithMoney:[textField.text floatValue]];
307 357
     
308 358
 }
309 359
 
@@ -347,6 +397,16 @@ UITextFieldDelegate
347 397
             [self addCreditCard];
348 398
             LVKBHomeCreditCardViewController *vc=[[LVKBHomeCreditCardViewController alloc]init];
349 399
             vc.creditCardBlock = ^(NSString *creditBankName, NSString *creditBankCode,NSInteger creditID,NSString *bankBlueIcon) {
400
+                
401
+                LVKBHomeCardsModel *model = [[LVKBHomeCardsModel alloc] init];
402
+                model.ID = [NSNumber numberWithInteger:creditID];
403
+                model.bank_name = creditBankName;
404
+                model.bank_icon = bankBlueIcon;
405
+                model.is_main = self.dataArray.count>0 ? @"0" : @"1";
406
+                model.card_num = creditBankCode;
407
+                model.user_name = @"";
408
+                [self. dataArray addObject:model];
409
+                
350 410
                 topTitleLabel.text=creditBankName;
351 411
                 topContentLabel.text=[NSString stringWithFormat:@"尾号 %@",creditBankCode];
352 412
                 topChangeBtn.hidden=NO;
@@ -377,8 +437,24 @@ UITextFieldDelegate
377 437
         [[topChangeBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
378 438
             [self addCreditCard];
379 439
             LVKBHomeCreditCardViewController *vc=[[LVKBHomeCreditCardViewController alloc]init];
440
+            
441
+            if (self.dataArray.count > 1) {  //大于1张卡跳进信用卡列表
442
+                vc.sourceFlag = 1;
443
+            }
444
+            
380 445
             vc.creditCardBlock = ^(NSString *creditBankName, NSString *creditBankCode,NSInteger creditID,NSString *bankBlueIcon) {
381 446
                 
447
+                if (self.dataArray.count == 1) {  //之前只有一张卡,更换跳进新增,新增成功后添加到信用卡列表数组
448
+                    LVKBHomeCardsModel *model = [[LVKBHomeCardsModel alloc] init];
449
+                    model.ID = [NSNumber numberWithInteger:creditID];
450
+                    model.bank_name = creditBankName;
451
+                    model.bank_icon = bankBlueIcon;
452
+                    model.is_main = self.dataArray.count>0 ? @"0" : @"1";
453
+                    model.card_num = creditBankCode;
454
+                    model.user_name = @"";
455
+                    [self. dataArray addObject:model];
456
+                }
457
+                
382 458
                 topTitleLabel.text=creditBankName;
383 459
                 topContentLabel.text=[NSString stringWithFormat:@"尾号 %@",creditBankCode];
384 460
                 topChangeBtn.hidden=NO;
@@ -407,7 +483,7 @@ UITextFieldDelegate
407 483
         UITextField        *centerBankTextField=[[UITextField alloc]init];
408 484
         UIView             *centerLine2=[[UIView alloc]init];
409 485
         UILabel            *centerTipLabel=[[UILabel alloc]init];
410
-         UILabel            *rightTipLabel=[[UILabel alloc]init];
486
+        UILabel            *rightTipLabel=[[UILabel alloc]init];
411 487
         centerBankTitle1.tag   =20001;
412 488
         centerBankImageView.tag=20002;
413 489
         centerBankName.tag     =20003;
@@ -533,6 +609,13 @@ UITextFieldDelegate
533 609
     return _scrollView;
534 610
 }
535 611
 
612
+- (NSMutableArray *)dataArray {
613
+    if (!_dataArray) {
614
+        _dataArray = [NSMutableArray array];
615
+    }
616
+    return _dataArray;
617
+}
618
+
536 619
 
537 620
 
538 621
 @end

+ 4 - 0
KXCardHelp/Main/Home/Receipt/creditCard/VC/LVKBHomeCreditCardViewController.h

@@ -11,5 +11,9 @@ typedef void(^CreditCardBlock)(NSString *creditBankName,NSString *creditBankCode
11 11
 
12 12
 
13 13
 @interface LVKBHomeCreditCardViewController : LVKBBaseViewController
14
+
15
+@property (nonatomic, assign)int sourceFlag;  //新增进来 0 更换是1
16
+
14 17
 @property(nonatomic,copy)CreditCardBlock creditCardBlock;
18
+
15 19
 @end

+ 6 - 3
KXCardHelp/Main/Home/Receipt/creditCard/VC/LVKBHomeCreditCardViewController.m

@@ -62,6 +62,11 @@ CHHomeCreditCardViewChild2ControllerDelegate
62 62
     self.titleView.showIndex = 0;
63 63
     self.titleView.selectColor = [UIColor CHColorWithHex:0x222222];
64 64
     self.titleView.deSelectColor = [UIColor CHColorWithHex:0x222222];
65
+    
66
+    if (self.sourceFlag == 1) {  //更换
67
+        self.segScroll.showIndex = 1;  //
68
+    }
69
+    
65 70
     [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
66 71
         [self.view addSubview:self.titleView];
67 72
         [self.view addSubview:self.segScroll];
@@ -70,8 +75,6 @@ CHHomeCreditCardViewChild2ControllerDelegate
70 75
         [self.titleView addSubview:self.backBtn];
71 76
         [self.titleView bringSubviewToFront:self.backBtn];
72 77
     }];
73
-    
74
-    
75 78
 }
76 79
 
77 80
 -(void)jcy_cardViewChild1BankName:(NSString *)bankName bankCode:(NSString *)bankCode bankID:(NSInteger)bankID  bankBlueIcon:(NSString *)bankBlueIcon{
@@ -85,7 +88,7 @@ CHHomeCreditCardViewChild2ControllerDelegate
85 88
     if (self.creditCardBlock) {
86 89
         self.creditCardBlock(bankName, bankCode,bankID,bankBlueIcon);
87 90
     }
88
-     [self.navigationController popViewControllerAnimated:YES];
91
+    [self.navigationController popViewControllerAnimated:YES];
89 92
 }
90 93
 
91 94
 - (void)scrollOffsetScale:(CGFloat)scale{