Commit f8f9c8a3 by lee

u chechout logic

parent 5ce74fef
...@@ -119,8 +119,8 @@ ...@@ -119,8 +119,8 @@
this.address = address; this.address = address;
this.checkout = checkout; this.checkout = checkout;
[this showToast:@"更新地址成功"]; [this showToast:@"更新地址成功"];
[this flushCheckout:dictionary];
[this initData]; // [this initData];
// [this.userDao saveCheckoutCache:checkout.JSONDictionary]; // [this.userDao saveCheckoutCache:checkout.JSONDictionary];
} }
else { else {
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
if (!checkoutCache || self.cartCookie) { if (!checkoutCache || self.cartCookie) {
checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil]; checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil];
} }
if(self.address){ // if(self.address){
if([self checkAddress:self.address]){ if([self checkAddress:self.address]){
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"]; KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
addressVC.checkout = checkout; addressVC.checkout = checkout;
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
} }
checkout.shippingAddress = self.address; checkout.shippingAddress = self.address;
checkout.billingAddress = self.address; checkout.billingAddress = self.address;
} // }
checkout.email = self.customer.email; checkout.email = self.customer.email;
checkout.customerId = self.customer.identifier; checkout.customerId = self.customer.identifier;
// self.client.urlScheme = @"CemaroseApp://"; // self.client.urlScheme = @"CemaroseApp://";
...@@ -565,17 +565,21 @@ ...@@ -565,17 +565,21 @@
[this hideLoading]; [this hideLoading];
BUYCheckout *checkout = [this.client.modelManager insertCheckoutWithJSONDictionary:responseObject[@"checkout"]]; BUYCheckout *checkout = [this.client.modelManager insertCheckoutWithJSONDictionary:responseObject[@"checkout"]];
this.checkout = checkout; this.checkout = checkout;
[this initData]; [self flushCheckout:responseObject[@"checkout"]];
[this.userDao saveCheckoutCache:responseObject[@"checkout"]];
if(this.checkout.shippingAddress && !this.checkout.shippingRate) {
[this requestShippingData];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[this hideLoading]; [this hideLoading];
[this showError:error]; [this showError:error];
}]; }];
} }
-(void) flushCheckout:(NSDictionary *) dic {
[self initData];
[self.userDao saveCheckoutCache:dic];
if(self.checkout.shippingAddress && !self.checkout.shippingRate) {
[self requestShippingData];
}
}
-(void)requestShippingData{ -(void)requestShippingData{
if(self.checkout==nil){ if(self.checkout==nil){
return; return;
......
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