Commit 159e0c9f by houweibin

1,清关信息相关

parent 39541fe2
......@@ -218,6 +218,8 @@
C084F4571D6D975400A0625D /* KWMSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = C084F4561D6D975400A0625D /* KWMSearchBar.m */; };
C084F4591D6D976F00A0625D /* KWMSearchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = C084F4581D6D976F00A0625D /* KWMSearchBar.xib */; };
C08827A61E28B4AF006A8B91 /* KWMPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = C08827A51E28B4AF006A8B91 /* KWMPageControl.m */; };
C08870E81F0342B000C9C1C8 /* KWMCustomsClearanceVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C08870E71F0342B000C9C1C8 /* KWMCustomsClearanceVC.m */; };
C08870EB1F03481C00C9C1C8 /* KWMCustomsClearance.m in Sources */ = {isa = PBXBuildFile; fileRef = C08870EA1F03481C00C9C1C8 /* KWMCustomsClearance.m */; };
C08FDA271D9A5F3400EBDB0D /* KWMAddGiftCardVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C08FDA261D9A5F3400EBDB0D /* KWMAddGiftCardVC.m */; };
C08FDA2A1D9B583400EBDB0D /* KWMGiftCardVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C08FDA291D9B583400EBDB0D /* KWMGiftCardVC.m */; };
C091EE331DDB1FC500A382B9 /* KWMAppVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = C091EE321DDB1FC500A382B9 /* KWMAppVersion.m */; };
......@@ -715,6 +717,10 @@
C084F4581D6D976F00A0625D /* KWMSearchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMSearchBar.xib; sourceTree = "<group>"; };
C08827A41E28B4AF006A8B91 /* KWMPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMPageControl.h; sourceTree = "<group>"; };
C08827A51E28B4AF006A8B91 /* KWMPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPageControl.m; sourceTree = "<group>"; };
C08870E61F0342B000C9C1C8 /* KWMCustomsClearanceVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCustomsClearanceVC.h; sourceTree = "<group>"; };
C08870E71F0342B000C9C1C8 /* KWMCustomsClearanceVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCustomsClearanceVC.m; sourceTree = "<group>"; };
C08870E91F03481C00C9C1C8 /* KWMCustomsClearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCustomsClearance.h; sourceTree = "<group>"; };
C08870EA1F03481C00C9C1C8 /* KWMCustomsClearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCustomsClearance.m; sourceTree = "<group>"; };
C08FDA251D9A5F3400EBDB0D /* KWMAddGiftCardVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMAddGiftCardVC.h; sourceTree = "<group>"; };
C08FDA261D9A5F3400EBDB0D /* KWMAddGiftCardVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMAddGiftCardVC.m; sourceTree = "<group>"; };
C08FDA281D9B583400EBDB0D /* KWMGiftCardVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMGiftCardVC.h; sourceTree = "<group>"; };
......@@ -1031,6 +1037,8 @@
C08FDA291D9B583400EBDB0D /* KWMGiftCardVC.m */,
C0392DBB1DCC786F0051AC8E /* KWMShippingVC.h */,
C0392DBC1DCC786F0051AC8E /* KWMShippingVC.m */,
C08870E61F0342B000C9C1C8 /* KWMCustomsClearanceVC.h */,
C08870E71F0342B000C9C1C8 /* KWMCustomsClearanceVC.m */,
);
path = ShopCart;
sourceTree = "<group>";
......@@ -1277,6 +1285,8 @@
C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */,
9B18C11D1EF1270A001DD59B /* BUYProductVariant+Currency.h */,
9B18C11E1EF1270A001DD59B /* BUYProductVariant+Currency.m */,
C08870E91F03481C00C9C1C8 /* KWMCustomsClearance.h */,
C08870EA1F03481C00C9C1C8 /* KWMCustomsClearance.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -2395,6 +2405,7 @@
C0A6B3C41F01FC5300D85673 /* KWMSecondDetailView.m in Sources */,
9B8298E61EF237FC00743438 /* NSDecimalNumber+Currency.m in Sources */,
C034E6F51D6AF197006EE129 /* KWMPickView.m in Sources */,
C08870EB1F03481C00C9C1C8 /* KWMCustomsClearance.m in Sources */,
C034E8651D6B10A0006EE129 /* PhotoImageView.m in Sources */,
C034E6C81D6AED1F006EE129 /* KWMUser.m in Sources */,
C034E6F01D6AF13A006EE129 /* KWMBaseVC.m in Sources */,
......@@ -2450,6 +2461,7 @@
C0CC14081D7823B0007B5986 /* KWMSizeCell.m in Sources */,
C06665121D767A0A00F02EF4 /* KWMContactUsVC.m in Sources */,
C034E6CF1D6AEE39006EE129 /* KWMUserDao.m in Sources */,
C08870E81F0342B000C9C1C8 /* KWMCustomsClearanceVC.m in Sources */,
C0DD530F1EE54A9E002D1E0C /* KWMBarandSelectView.m in Sources */,
C034E8551D6B10A0006EE129 /* UIImageView+SD.m in Sources */,
C034E85E1D6B10A0006EE129 /* PhotoBroswerLayout.m in Sources */,
......
......@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import <Buy/Buy.h>
#import "KWMCustomsClearance.h"
@class KWMUser;
@class KWMRequestResult;
......@@ -20,6 +21,8 @@
@property (nonatomic, strong) NSString *currencyCode;
@property (nonatomic, strong) KWMCustomsClearance *customsClearance;
+ (KWMUserDao *)shareDao;
- (BOOL)checkSession;
- (KWMUser *)loginUser;
......
......@@ -42,6 +42,7 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
NSDecimalNumber *_exchangeRate;
}
@synthesize customsClearance = _customsClearance;
@synthesize currencyCode = _currencyCode;
+ (KWMUserDao *)shareDao {
......@@ -459,4 +460,17 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
[[NSUserDefaults standardUserDefaults] synchronize];
}
-(KWMCustomsClearance *)customsClearance{
if(!_customsClearance){
_customsClearance = [[NSUserDefaults standardUserDefaults] objectForKey:@"_customs_clearance"];
}
return _customsClearance;
}
-(void)setCustomsClearance:(KWMCustomsClearance *)customsClearance{
_customsClearance = customsClearance;
[[NSUserDefaults standardUserDefaults]setObject:customsClearance forKey:@"_customs_clearance"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end
//
// KWMCustomsClearance.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/28.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@interface KWMCustomsClearance : KWMBaseModel
//清关姓名
@property (nonatomic) NSString *name;
//清关身份证号
@property (nonatomic) NSString *idCode;
@end
//
// KWMCustomsClearance.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/28.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCustomsClearance.h"
@implementation KWMCustomsClearance
-(NSString *)name{
if(!_name){
return @"";
}
return _name;
}
-(NSString *)idCode{
if(!_idCode){
return @"";
}
return _idCode;
}
@end
......@@ -44,10 +44,15 @@
@property (weak, nonatomic) IBOutlet UILabel *lbShippingRate;
//清关信息
@property (weak, nonatomic) IBOutlet UILabel *lbCustomsClearance;
@property (weak, nonatomic) IBOutlet UIView *vPayType;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightPayType;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightCustomsClearance;
@property (nonatomic) BUYAddress *address;
//创建订单异步请求
......@@ -80,6 +85,8 @@
- (IBAction)onClickShipping:(id)sender;
- (IBAction)onClickCustomsClearance:(id)sender;
@end
......@@ -9,6 +9,7 @@
#import "KWMBeforePayVC.h"
#import "KWMDiscountVC.h"
#import "KWMSelectAddressVC.h"
#import "KWMCustomsClearanceVC.h"
#import "KWMPaySuccessVC.h"
#import "KWMShopCartModel.h"
#import "KWMStringUtil.h"
......@@ -391,6 +392,11 @@
giftCardVC.checkout = self.checkout;
[self.navigationController pushViewController:giftCardVC animated:YES];
}
//清关信息填写页面
-(void)onClickCustomsClearance:(id)sender{
}
//选择配送方式页面
-(void)onClickShipping:(id)sender{
......
//
// KWMCustomsClearanceVC.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/28.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseVC.h"
#import "KWMCustomsClearance.h"
@protocol KWMCustomsClearanceDelegate <NSObject>
- (void)kwm_customsClearance:(KWMCustomsClearance *)customsClearance;
@end
@interface KWMCustomsClearanceVC : KWMBaseVC<UITextFieldDelegate>
@property (weak, nonatomic) id<KWMCustomsClearanceDelegate>delegate;
@property (nonatomic) KWMCustomsClearance *customsClearance;
@end
//
// KWMCustomsClearanceVC.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/28.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCustomsClearanceVC.h"
#import "KWMStringUtil.h"
@interface KWMCustomsClearanceVC ()
@property (weak, nonatomic) IBOutlet UITextField *tfName;
@property (weak, nonatomic) IBOutlet UITextField *tfIdCode;
@end
@implementation KWMCustomsClearanceVC
- (void)viewDidLoad {
[super viewDidLoad];
[self initView];
}
-(void)initView{
[self initTitle];
[self initTf];
}
-(void)initTitle{
UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(onClickLeftButton)];
self.navigationItem.leftBarButtonItem = leftButton;
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"存储" style:UIBarButtonItemStylePlain target:self action:@selector(onClickRightButton)];
self.navigationItem.rightBarButtonItem = rightButton;
}
-(void)initTf{
self.tfName.borderStyle = UITextBorderStyleNone;
self.tfIdCode.borderStyle = UITextBorderStyleNone;
self.tfIdCode.delegate = self;
self.customsClearance = [KWMCustomsClearance new];
self.customsClearance.name = @"侯卫彬";
self.customsClearance.idCode = @"445222199211153557";
if(self.customsClearance){
self.tfName.text = self.customsClearance.name;
self.tfIdCode.text = self.customsClearance.idCode;
if(self.customsClearance.idCode.length >10){
self.tfIdCode.text = [self halfSecretCode:self.customsClearance.idCode];
}
}else{
self.customsClearance = [KWMCustomsClearance new];
}
}
-(void)onClickLeftButton{
[self.navigationController popViewControllerAnimated:YES];
}
-(void)onClickRightButton{
NSString *name = self.tfName.text;
NSString *idCode = self.tfIdCode.text;
if([KWMStringUtil isEmpty:name]){
[self showToast:@"请填写姓名"];
}else if([KWMStringUtil isEmpty:idCode]){
[self showToast:@"请填写身份证号"];
}else{
//身份证是否为没有编辑过--如果是且仍为半密文状态.
BOOL noEdited = [self.tfIdCode.text rangeOfString:@"***"].location != NSNotFound;
self.customsClearance.name = self.tfName.text;
self.customsClearance.idCode = noEdited?self.customsClearance.idCode:self.tfIdCode.text;
if(self.delegate){
[self.delegate kwm_customsClearance:self.customsClearance];
}
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark -- idCode StringUtil
//替换字符串 445555199011123333 => 44555************3
-(NSString *)halfSecretCode:(NSString *)idCode{
NSString *mIdCode = self.customsClearance.idCode;
NSMutableString *secretCode = [[NSMutableString alloc] init];
for (NSInteger i = 0; i < idCode.length - 6; i++) {
[secretCode appendString:@"*"];
}
NSString *halfSecretCode = [mIdCode stringByReplacingCharactersInRange:NSMakeRange(5, mIdCode.length-6) withString:secretCode];
return halfSecretCode;
}
#pragma mark -- UITextFiledDelegate
-(void)textFieldDidBeginEditing:(UITextField *)textField{
textField.clearsOnBeginEditing = NO;
}
//简单的输入限制 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSCharacterSet *cs = [[NSCharacterSet characterSetWithCharactersInString:ALPHANUM] invertedSet];
NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
return [string isEqualToString:filtered];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment