Commit a1f26c03 by houweibin

Merge branch 'master' of https://git.oschina.net/kollway-kollway/newcemarose

# Conflicts:
#	iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
parents 8183aac2 44091982
......@@ -29,5 +29,6 @@ pod 'SFFocusViewLayout', '~> 2.0'
pod 'YYWebImage'
pod 'MagicalRecord','~> 2.2'
pod 'Mobile-Buy-SDK',:git => 'https://github.com/houweibin/mobile-buy-sdk-ios'
#pod 'Mobile-Buy-SDK',:path => '../Pods/mobile-buy-sdk-ios'
end
......@@ -20,6 +20,7 @@
#import "MJRefresh.h"
#import "KWMFilterVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
@interface KWMBrandCaramelVC ()<UITableViewDelegate,UITableViewDataSource,KWMBrandCaramelCellDelegate>
@property (nonatomic) KWMBarandSelectView *barandSelectView;
......@@ -346,6 +347,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
NSInteger tagetPage = self.currentPage.integerValue + 1;
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
products = [products rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
if (error) {
[self showError:error];
NSLog(@"Error fetching products: %@", error);
......
......@@ -62,8 +62,9 @@
fulfilledCount += 1;
}
}];
NSString *fulfillmentStatus = fulfilledCount == 0 ? @"待发货" : fulfilledCount == order.lineItems.count ? @"已发货" : @"部分发货";
self.lbOrderStatus.text = fulfillmentStatus;
// TODO: 加入取消订单的状态
NSString *orderStatus = order.cancelled ? @"已取消" : fulfilledCount == 0 ? @"待发货" : fulfilledCount == order.lineItems.count ? @"已发货" : @"部分发货";
self.lbOrderStatus.text = orderStatus;
}
}
......
......@@ -211,6 +211,7 @@
[self showLoading];
__weak KWMOrderVC *weakSelf = self;
self.client.customerToken = [BUYCustomerToken customerTokenWithJSONDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:@"token"]];
[self.client getOrdersForCustomerCallback:^(NSArray<BUYOrder *> * _Nullable orders, NSError * _Nullable error) {
[weakSelf hideLoading];
if (error == nil && orders != nil ) {
......
......@@ -19,6 +19,7 @@
#import "UIColor+SAMAdditions.h"
#import "KWMProductDetailVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
@interface KWMNewVC ()
......@@ -418,6 +419,9 @@ static NSString * idStr = @"KWMNewGoodsCell";
[self.client getProductsPage:tagetPage inCollection:identify withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf hideLoading];
loadStatus.isLoading = NO;
products = [products rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
if (error == nil && products) {
if(tagetPage == 1){
[weakSelf.userDao saveCollectionCache:products collectionId:identify tags:tags];
......
......@@ -470,7 +470,12 @@
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
if (self.cartCookie) {
[manager.requestSerializer setHTTPShouldHandleCookies:NO];
NSString *cookie = [[KWMHttpUtil buildRequestCookieString] stringByReplacingOccurrencesOfRegex:@"cart=.*?;" withString:[NSString stringWithFormat:@"cart=%@;",self.cartCookie]];
NSString *cookie = [KWMHttpUtil buildRequestCookieString];
if ([cookie isMatchedByRegex:@"cart=.*?;"]) {
cookie = [cookie stringByReplacingOccurrencesOfRegex:@"cart=.*?;" withString:[NSString stringWithFormat:@"cart=%@;",self.cartCookie]];
}else{
cookie = [NSString stringWithFormat:@"cart=%@; %@",self.cartCookie,cookie];
}
[manager.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"];
}
[manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) {
......@@ -502,7 +507,7 @@
this.checkout = checkout;
[this initData];
[this.userDao saveCheckoutCache:responseObject[@"checkout"]];
if(!this.checkout.shippingRate) {
if(this.checkout.shippingAddress && !this.checkout.shippingRate) {
[this requestShippingData];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
......
......@@ -50,12 +50,17 @@
[self setTotalPrice];
__weak typeof(self) this = self;
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
[this refresh];
}];
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
dispatch_after(delay, dispatch_get_main_queue(), ^{
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
[this refresh];
}];
});
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (_shopCartList.count == 0) {
......
......@@ -10,7 +10,7 @@
#import <JRSwizzle/JRSwizzle.h>
@implementation UIViewController (AppearLog)
#if DEBUG
+ (void)load
{
[self jr_swizzleMethod:@selector(viewWillAppear:) withMethod:@selector(logViewWillAppear:) error:nil];
......@@ -21,4 +21,5 @@
NSLog(@"logViewWillAppear: %@",NSStringFromClass([self class]));
[self logViewWillAppear:animated];
}
#endif
@end
......@@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017060817</string>
<string>2017060917</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
......
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