Commit 2ac5ba34 by lee

u login u address

parent 737cd3ae
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_address.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -35,8 +35,8 @@
<constraint firstAttribute="height" constant="24" id="x1H-Jw-5lD"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="v 1.5.8" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ytF-B2-drm">
<rect key="frame" x="168" y="631" width="39" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="v 1.5.10" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ytF-B2-drm">
<rect key="frame" x="165" y="631" width="45" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......
......@@ -52,9 +52,20 @@
self.vLine.backgroundColor = [UIColor colorWithRed:244.0/255 green:245.0/255 blue:247.0/255 alpha:1];
searchArr = [NSMutableArray array];
[self initTableView];
[self loadStaticData];
[self RequestBrandsAPI];
}
- (void) loadStaticData {
NSArray *brands = @[@"Amelie Wang",@"Babywalker",@"Beau Loves",@"Billieblush",@"Billybandit",@"Bonpoint",@"Burberry",@"Caramel",@"Chloé",@"Dolce & Gabbana",@"Emile et Ida",@"Fendi",@"Givenchy",@"Gucci",@"Hucklebones",@"Il Gufo",@"Indikidual",@"Karl Lagerfeld Kids",@"Kenzo",@"Lanvin",@"Little Marc Jacobs",@"Loud Apparel",@"Louis Louise",@"Louise Misha",@"Marie-Chantal",@"Marni",@"Mini Melissa",@"Mini Rodini",@"Mischka Aoki",@"Moncler",@"MOSCHINO",@"MSGM",@"Nailmatic",@"Nana Huchy",@"Noukie's",@"Oeuf",@"Patachou",@"Paul Smith",@"PèPè",@"Sons + Daughters Eyewear",@"Stella McCartney Kids",@"Story Loris",@"Tartine et Chocolat",@"The Animals Observatory",@"Tiny Cottons",@"Tip Toey Joey",@"Veja",@"Wolf & Rita",@"Young Versace",@"Zadig & Voltaire"];
NSArray *indexArray= [[brands rx_filterWithBlock:^BOOL(id each) {
return each && each != [NSNull null];
}] arrayWithPinYinFirstLetterFormat];
_dataArray =[NSMutableArray arrayWithArray:indexArray];
[self.tbvSearchBrand reloadData];
}
- (void)initHeaderView{
_searchBrandView = [[KWMSearchBrandView alloc] initWithFrame:CGRectMake(0, 20, UI_SCREEN_WIDTH, 44)];
[self.view addSubview:_searchBrandView];
......@@ -292,11 +303,11 @@ static NSString *identify = @"KWMSearchBrandsCell";
- (void)RequestBrandsAPI{
__weak KWMSearchBrandVC *weakSelf = self;
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
[weakSelf hideLoading];
[weakSelf showError:error];
// [weakSelf hideLoading];
// [weakSelf showError:error];
};
void(^success)(NSURLSessionDataTask *,KWMBrandsResult *) = ^(NSURLSessionDataTask *task,KWMBrandsResult *result){
[weakSelf hideLoading];
// [weakSelf hideLoading];
if([weakSelf hasCemaroseError:result]){
return ;
}
......@@ -308,7 +319,7 @@ static NSString *identify = @"KWMSearchBrandsCell";
[weakSelf.tbvSearchBrand reloadData];
};
[self.api getAllBrand:nil success:success failure:failure];
[self showLoading];
// [self showLoading];
}
@end
......@@ -93,11 +93,15 @@
//点击下一步
- (IBAction)onClickNextBtn:(id)sender {
[self emailLogin];
[self emailLogin:YES];
}
- (void)emailLogin{
- (IBAction)signupAction:(id)sender {
[self emailLogin:NO];
}
- (void)emailLogin:(BOOL) islogin{
if ([KWMStringUtil isEmpty:self.tfEmail.text]) {
[self showToast:@"请输入邮箱"];
return;
......@@ -110,7 +114,8 @@
}
[self setData];
[self showLoading];
if (_customer && _token) {
// if (_customer && _token) {
if (islogin) {
[self requestLoginAPI];
}else{
[self requestRegisterAPI];
......@@ -160,7 +165,7 @@
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
if (textField.tag == 1002) {
[self emailLogin];
[self emailLogin:YES];
}
return YES;
}
......@@ -199,6 +204,7 @@
// NSLog(@"NSHomeDirectory == %@",path);
}else{
[self hideLoading];
[self showError:error];
if (error.code == 401) {
[self showToast:@"密码错误"];
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="PingFang.ttc">
<string>PingFangSC-Light</string>
<string>PingFangSC-Medium</string>
<string>PingFangSC-Regular</string>
</array>
</customFonts>
<scenes>
<!--注册-->
<scene sceneID="6su-a8-JNt">
......@@ -1036,7 +1043,7 @@
<constraints>
<constraint firstAttribute="height" constant="44" id="jp3-NO-3f6"/>
</constraints>
<state key="normal" title="下一步">
<state key="normal" title="登陆">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
......@@ -1057,13 +1064,27 @@
<action selector="onClickForgetPasswordBtn:" destination="REn-6o-ZnY" eventType="touchUpInside" id="hbu-0x-Bfq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9c6-ew-bca">
<rect key="frame" x="44" y="599" width="287" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="rjk-lv-YEm"/>
</constraints>
<state key="normal" title="注册新帐号">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="signupAction:" destination="REn-6o-ZnY" eventType="touchUpInside" id="Ics-UX-pmd"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Zxn-i4-X7g" firstAttribute="bottom" secondItem="smV-C2-4Ap" secondAttribute="bottom" id="4jF-52-ti3"/>
<constraint firstItem="DMu-Rk-MZg" firstAttribute="centerY" secondItem="smV-C2-4Ap" secondAttribute="centerY" id="E6u-Nb-RMh"/>
<constraint firstItem="YUM-QH-hXq" firstAttribute="top" secondItem="Bhz-8A-a2G" secondAttribute="bottom" constant="40" id="ETT-8y-mFE"/>
<constraint firstItem="9c6-ew-bca" firstAttribute="leading" secondItem="4Qb-31-ul2" secondAttribute="leading" constant="44" id="FUp-Yg-v1L"/>
<constraint firstItem="GQR-9Z-fvw" firstAttribute="leading" secondItem="4Qb-31-ul2" secondAttribute="leading" constant="44" id="FpO-AV-K87"/>
<constraint firstItem="9c6-ew-bca" firstAttribute="top" secondItem="GQR-9Z-fvw" secondAttribute="bottom" constant="10" id="GBn-hz-WsG"/>
<constraint firstItem="0gu-gR-TJ0" firstAttribute="centerX" secondItem="4Qb-31-ul2" secondAttribute="centerX" id="Hvn-cL-MxL"/>
<constraint firstItem="VwP-JL-neq" firstAttribute="top" secondItem="4Qb-31-ul2" secondAttribute="top" constant="32" id="Igl-ZD-CMg"/>
<constraint firstItem="smV-C2-4Ap" firstAttribute="top" secondItem="4Qb-31-ul2" secondAttribute="top" constant="280" id="KXt-FE-2pI"/>
......@@ -1079,6 +1100,7 @@
<constraint firstItem="Zxn-i4-X7g" firstAttribute="centerX" secondItem="4Qb-31-ul2" secondAttribute="centerX" id="nGg-pN-wVA"/>
<constraint firstItem="vyH-ra-OxA" firstAttribute="centerX" secondItem="4Qb-31-ul2" secondAttribute="centerX" id="sj1-eD-9VW"/>
<constraint firstItem="Bhz-8A-a2G" firstAttribute="top" secondItem="Mqf-fp-b8Y" secondAttribute="bottom" id="sv9-Tw-Lkd"/>
<constraint firstAttribute="trailing" secondItem="9c6-ew-bca" secondAttribute="trailing" constant="44" id="x39-GC-ZqE"/>
<constraint firstItem="VwP-JL-neq" firstAttribute="leading" secondItem="4Qb-31-ul2" secondAttribute="leading" constant="15" id="xg5-JL-Jed"/>
<constraint firstItem="Bhz-8A-a2G" firstAttribute="centerX" secondItem="smV-C2-4Ap" secondAttribute="centerX" id="yLb-dw-rWJ"/>
</constraints>
......
......@@ -15,6 +15,7 @@
#import "KWMLoginVC.h"
#import "KWMMineTitleView.h"
#import "KWMFilterVC.h"
#import "KWMSelectAddressVC.h"
@interface KWMMineVC ()
@property (nonatomic) KWMMineTitleView *vTitle;
......@@ -122,6 +123,18 @@
[self.navigationController pushViewController:contactVC animated:YES];
}
-(IBAction)onClickAddress {
if(!_user.status) {
KWMLoginVC *loginVc = (KWMLoginVC *)[KWMBaseVC findControllerBy:[KWMLoginVC kwmTag] fromStoryboard:@"Login"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:loginVc];
[self presentViewController:nav animated:YES completion:nil];
}else{
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
addressVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:addressVC animated:YES];
}
}
- (IBAction)onClickLogout:(id)sender {
if (_user.status) {
self.btnLogin.userInteractionEnabled = NO;
......
......@@ -319,10 +319,7 @@
// }
// if(self.address){
if([self checkAddress:self.address]){
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
addressVC.checkout = checkout;
addressVC.delegate = self;
[self.navigationController pushViewController:addressVC animated:YES];
[self jumpToSelectAddress];
return;
}
if([KWMStringUtil isEmpty:self.address.firstName]){
......@@ -349,7 +346,12 @@
}
}
- (void) jumpToSelectAddress {
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
// addressVC.checkout = checkout;
addressVC.delegate = self;
[self.navigationController pushViewController:addressVC animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......@@ -557,6 +559,9 @@
// 170922 所有订单全部刷新地址
// if (checkout || this.cartCookie) {
newReq.HTTPMethod = @"PATCH";
// checkout.shippingAddress.identifier = nil;
// checkout.shippingAddress.provinceCode = nil;
// checkout.billingAddress = checkout.shippingAddress;
[newReq setHTTPBody:[NSJSONSerialization dataWithJSONObject:[checkout jsonDictionaryForCheckout] options:0 error:nil]];
// }
return newReq;
......@@ -568,6 +573,12 @@
this.checkout = checkout;
[self flushCheckout:responseObject[@"checkout"]];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:[error userInfo][@"com.alamofire.serialization.response.error.data"] options:NSJSONReadingMutableLeaves error:nil];
if (json[@"errors"][@"checkout"][@"shipping_address"]) {
[this showToast:@"地址出现问题请重新选择"];
[this jumpToSelectAddress];
return;
}
[this hideLoading];
[this showError:error];
}];
......@@ -578,9 +589,9 @@
[self.userDao saveCheckoutCache:dic];
if (!self.checkout.shippingAddress && self.address) {
[self kwm_setAddress:self.address];
} else if(self.checkout.shippingAddress && !self.checkout.shippingRate) {
}// else if(self.checkout.shippingAddress && !self.checkout.shippingRate) {
[self requestShippingData];
}
//}
}
-(void)requestShippingData{
......
......@@ -179,7 +179,9 @@
}
- (void)updateCheckAddress:(BUYAddress *)address{
if (self.delegate == nil) {
return;
}
NSString *errorMsg = [KWMValidateUtil validateAddress:address];
if (!errorMsg) {
[self.delegate kwm_setAddress:address];
......@@ -277,6 +279,9 @@
}
-(BOOL) navigationShouldPopOnBackButton {
if (self.delegate == nil) {
return YES;
}
self.needAddressView.hidden = NO;
return NO; // Ignore 'Back' button this time
}
......
......@@ -239,7 +239,7 @@
[this hideLoading];
if(product){
KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"];
KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"];
variantsVC.product = product;
variantsVC.delegate = self;
variantsVC.shopCartModel = shopCartModel;
......@@ -269,6 +269,7 @@
- (void)kwm_addShopWithVariantId:(NSNumber *)identifier quantity:(NSInteger)quantity variant:(BUYProductVariant *) variant buyNow:(BOOL)buyNow callback:(void (^)(BOOL))callback {
__weak KWMShopCartVC *this = self;
void(^success)(NSError*,KWMCartResult*) = ^(NSError *error,KWMCartResult *cart){
[[KWMShoppingCart sharedInstance] setSync:NO];
if (!error) {
[this refresh];
callback(YES);
......@@ -278,23 +279,25 @@
}
};
if (_changeModel.identifier.integerValue == identifier.integerValue) {
[[KWMShoppingCart sharedInstance] setSync:YES];
[[KWMShoppingCart sharedInstance] changeProductWithVariantId:identifier quantity:quantity callback:success];
}else{
NSNumber *oldId = @(_changeModel.identifier.integerValue);
KWMShopCartModel *model = _changeModel;
// KWMShopCartModel *model = _changeModel;
_changeModel = nil;
NSArray<NSNumber *> *variantIds = @[oldId,identifier];
NSArray<NSNumber *> *quantities = @[@0,@(quantity)];
[[KWMShoppingCart sharedInstance] setSync:YES];
[[KWMShoppingCart sharedInstance] updateProductWithVariantIds:variantIds quantitties:quantities callback:^(NSError *error, KWMCartResult *cart) {
if (!cart.items.firstObject.product_id) {
KWMShopCartModel *tmp = cart.items.firstObject;
tmp.imageStr = model.imageStr;
tmp.size = variant.title;
tmp.brand = model.brand;
tmp.name = model.name;
tmp.price = variant.price;
tmp.product_id = model.product_id;
}
// if (!cart.items.firstObject.product_id) {
// KWMShopCartModel *tmp = cart.items.firstObject;
// tmp.imageStr = model.imageStr;
// tmp.size = variant.title;
// tmp.brand = model.brand;
// tmp.name = model.name;
// tmp.price = variant.price;
// tmp.product_id = model.product_id;
// }
success(error,cart);
}];
// [[KWMShoppingCart sharedInstance] deleteProductWithVariantId:oldId callback:^(NSError *error, KWMCartResult *cart) {
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.8</string>
<string>1.5.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
......@@ -56,7 +56,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.5.8.3</string>
<string>1.5.10</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
......
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