From 0185d337233f6cd6cd564aae44046e05917b7e23 Mon Sep 17 00:00:00 2001
From: lee <627051222@qq.com>
Date: Wed, 19 Jul 2017 14:20:10 +0800
Subject: [PATCH] fix ui,fix checkout does not have uid,fix address country can not input 中国,App.Home data cache 24H

---
 iCemarose/Class/Api/KWMAPIManager.m                    |   4 +++-
 iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m |   1 +
 iCemarose/Class/UI/Category/KWMCategoryVC.m            |   4 ++++
 iCemarose/Class/UI/NewProduct/KWMVariantsVC.m          |   2 +-
 iCemarose/Class/UI/Product/KWMNewVC.h                  |  96 ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------
 iCemarose/Class/UI/Product/KWMNewVC.m                  | 912 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m           |  13 ++++++++-----
 iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m         |   3 ++-
 iCemarose/Class/UI/ShopCart/KWMShopCartVC.m            |   8 +++++---
 iCemarose/Info.plist                                   |   4 ++--
 10 files changed, 530 insertions(+), 517 deletions(-)

diff --git a/iCemarose/Class/Api/KWMAPIManager.m b/iCemarose/Class/Api/KWMAPIManager.m
index b7aa6f3..03449c6 100644
--- a/iCemarose/Class/Api/KWMAPIManager.m
+++ b/iCemarose/Class/Api/KWMAPIManager.m
@@ -696,7 +696,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
 }
 
 - (NSURLSessionDataTask *)getHomeDataWithSuccess:(void (^)(NSURLSessionDataTask *, KWMHomeDataResult *))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure {
-    NSString *apiPath = @"https://ogbgohpla.qnssl.com/App.Home.json?32";
+    NSInteger st = [[NSDate date] timeIntervalSince1970];
+    st = st - st % 86400 - 28800;
+    NSString *apiPath = [NSString stringWithFormat:@"https://ogbgohpla.qnssl.com/App.Home.json?%ld",st];
     return [self startSessionTask:KWMHTTPMethodGET apiPath:apiPath parameters:nil result:[KWMHomeDataResult class] model:nil success:success failure:failure];
 }
 
diff --git a/iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m b/iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m
index 0da360e..1fec140 100644
--- a/iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m
+++ b/iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m
@@ -42,6 +42,7 @@
     }
     _product = product;
     NSArray *variantsArray = product.variantsArray;
+    self.lbTitle.text = product.vendor;
     if(variantsArray && variantsArray.count > 0){
         BUYProductVariant *variant = variantsArray.firstObject;
 //        self.lbPrice.text = [KWMStringUtil price:variant.price];
diff --git a/iCemarose/Class/UI/Category/KWMCategoryVC.m b/iCemarose/Class/UI/Category/KWMCategoryVC.m
index bc7e221..faaa391 100644
--- a/iCemarose/Class/UI/Category/KWMCategoryVC.m
+++ b/iCemarose/Class/UI/Category/KWMCategoryVC.m
@@ -56,6 +56,10 @@
     self.title = @"分类";
 }
 
++ (NSString *)kwmBoard {
+    return @"Main";
+}
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     [self initData];
diff --git a/iCemarose/Class/UI/NewProduct/KWMVariantsVC.m b/iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
index d77ce93..e56e993 100644
--- a/iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
+++ b/iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
@@ -150,7 +150,7 @@
     }
     self.vCount.hidden = self.wish?YES:NO;
     self.lbCount.text = [NSString stringWithFormat:@"%ld",(long)self.count];
-    self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormatted:self.totalPrice];
+    self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:self.totalPrice];
 }
 
 -(void)initCollectionView{
diff --git a/iCemarose/Class/UI/Product/KWMNewVC.h b/iCemarose/Class/UI/Product/KWMNewVC.h
index 778279a..cd1b0b6 100644
--- a/iCemarose/Class/UI/Product/KWMNewVC.h
+++ b/iCemarose/Class/UI/Product/KWMNewVC.h
@@ -1,49 +1,49 @@
+////
+////  KWMNewVC.h
+////  iCemarose
+////
+////  Created by 陈荣科 on 16/8/23.
+////  Copyright © 2016年 kollway. All rights reserved.
+////
 //
-//  KWMNewVC.h
-//  iCemarose
-//
-//  Created by 陈荣科 on 16/8/23.
-//  Copyright © 2016年 kollway. All rights reserved.
-//
-
-#import "KWMBasePageVC.h"
-#import "KWMSearchBar.h"
-#import "KWMNewGoodsCell.h"
-#import "KWMTBVSectionHeardView.h"
-#import "UIColor+SAMAdditions.h"
-
-//tab页-商品
-@interface KWMNewVC : KWMBasePageVC<UITableViewDelegate,UITableViewDataSource,KWMSearchBarDelegate,KWMNewGoodsCellDelegate,KWMTBVSectionHeardViewDelegate>
-
-@property (weak, nonatomic) IBOutlet UIButton *btnBaby;
-
-@property (weak, nonatomic) IBOutlet UIButton *btnGirl;
-
-@property (weak, nonatomic) IBOutlet UIButton *btnBoy;
-
-@property (weak, nonatomic) IBOutlet UIButton *btnShoes;
-
-@property (weak, nonatomic) IBOutlet UIButton *btnNewGoods;
-
-@property (weak, nonatomic) IBOutlet UIButton *btnDiscount;
-
-@property (weak, nonatomic) IBOutlet UITableView *tbvNewGoods;
-
-@property (weak, nonatomic) IBOutlet UIView *vLine;
-
-@property (weak, nonatomic) IBOutlet UIView *vBackground; 
-
-
-- (IBAction)onClickBabyBtn:(id)sender;
-
-- (IBAction)onClickGirlBtn:(id)sender;
-
-- (IBAction)onClickBoyBtn:(id)sender;
-
-- (IBAction)onClickShoesBtn:(id)sender;
-
-- (IBAction)onClickNewGoodsBtn:(id)sender;
-
-- (IBAction)onClickDiscountBtn:(id)sender;
-
-@end
+//#import "KWMBasePageVC.h"
+//#import "KWMSearchBar.h"
+//#import "KWMNewGoodsCell.h"
+//#import "KWMTBVSectionHeardView.h"
+//#import "UIColor+SAMAdditions.h"
+//
+////tab页-商品
+//@interface KWMNewVC : KWMBasePageVC<UITableViewDelegate,UITableViewDataSource,KWMSearchBarDelegate,KWMNewGoodsCellDelegate,KWMTBVSectionHeardViewDelegate>
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnBaby;
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnGirl;
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnBoy;
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnShoes;
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnNewGoods;
+//
+//@property (weak, nonatomic) IBOutlet UIButton *btnDiscount;
+//
+//@property (weak, nonatomic) IBOutlet UITableView *tbvNewGoods;
+//
+//@property (weak, nonatomic) IBOutlet UIView *vLine;
+//
+//@property (weak, nonatomic) IBOutlet UIView *vBackground; 
+//
+//
+//- (IBAction)onClickBabyBtn:(id)sender;
+//
+//- (IBAction)onClickGirlBtn:(id)sender;
+//
+//- (IBAction)onClickBoyBtn:(id)sender;
+//
+//- (IBAction)onClickShoesBtn:(id)sender;
+//
+//- (IBAction)onClickNewGoodsBtn:(id)sender;
+//
+//- (IBAction)onClickDiscountBtn:(id)sender;
+//
+//@end
diff --git a/iCemarose/Class/UI/Product/KWMNewVC.m b/iCemarose/Class/UI/Product/KWMNewVC.m
index 36608c2..9db22a6 100644
--- a/iCemarose/Class/UI/Product/KWMNewVC.m
+++ b/iCemarose/Class/UI/Product/KWMNewVC.m
@@ -1,458 +1,458 @@
+////
+////  KWMNewVC.m
+////  iCemarose
+////
+////  Created by 陈荣科 on 16/8/23.
+////  Copyright © 2016年 kollway. All rights reserved.
+////
 //
-//  KWMNewVC.m
-//  iCemarose
-//
-//  Created by 陈荣科 on 16/8/23.
-//  Copyright © 2016年 kollway. All rights reserved.
-//
-
-#import "KWMNewVC.h"
-#import "KWMStringUtil.h"
-#import "KWMSelectedGoodsVC.h"
-#import "KWMNewTypeSelectedVC.h"
-#import "KWMSearchFeedbackVC.h"
-#import "KWMShopCartVC.h"
-#import "KWMShopCartData.h"
-#import "KWMNewGoodsModel.h"
-#import "KWMLoadStatus.h"
-#import "KWMSelectedGoodsVC.h"
-#import "KWMBrandCaramelVC.h"
-#import "UIColor+SAMAdditions.h"
-#import "KWMNewProductVC.h"
-#import "KWMShoppingCart.h"
-
-
-@interface KWMNewVC ()
-@property (nonatomic) KWMSearchBar *searchBar;
-//@property (nonatomic) KWMNewGoodsModel *goodsModel;
-@end
-
-@implementation KWMNewVC{
-    NSArray *collections;
-    NSArray *discountCollections;
-    NSArray *newCollections;
-    NSMutableDictionary *newsDict;
-    NSMutableDictionary *discountDic;
-    BOOL isNew;//判断当前显示的是新品还是折扣列表
-}
-
-static NSString * idStr = @"KWMNewGoodsCell";
-+(NSString *)kwmTag{
-    return @"KWMNewVC";
-}
-
-- (void)viewDidDisappear:(BOOL)animated{
-    [super viewDidDisappear:animated];
-    [_searchBar removeFromSuperview];
-}
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    
-    [self initNotification];
-    // Do any additional setup after loading the view.
-    self.automaticallyAdjustsScrollViewInsets = NO;
-    self.tbvNewGoods.showsVerticalScrollIndicator = NO;
-    collections = [NSArray array];
-    discountCollections = [NSArray array];
-    newCollections = [NSArray array];
-    newsDict = [[NSMutableDictionary alloc] init];
-    discountDic = [[NSMutableDictionary alloc] init];
-    
-    isNew = YES;
-    [self initView];
-    [self requestNewProductsCollection];
-
-}
-
-- (void)initNotification{
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(onBack)
-                                                 name:UIApplicationDidBecomeActiveNotification object:nil];
-}
-
--(void)removreNotification{
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
--(void)dealloc{
-    [self removreNotification];
-}
-
--(void)onBack{
-    [self.tbvNewGoods reloadData];
-}
-
-- (void)awakeFromNib{
-    [super awakeFromNib];
-    
-    self.title = @"商品";
-}
-
-- (void)viewWillAppear:(BOOL)animated{
-    [super viewWillAppear:animated];
-    [self initHeaderView];
-    [self.navigationController setNavigationBarHidden:YES];
-    [self.tabBarController setHidesBottomBarWhenPushed:NO];
-    if (_searchBar) {
-        NSInteger count = [[KWMShoppingCart sharedInstance] count].integerValue;
-        _searchBar.count = count;
-    }
-    [_searchBar resumeView];
-    _vBackground.hidden = YES;
-    [self.tbvNewGoods reloadData];
-}
-- (void)viewWillDisappear:(BOOL)animated{
-    [super viewWillDisappear:animated];
-    [_searchBar removeFromSuperview];
-}
-
-
-- (UITableView *)targetTableView{
-    return self.tbvNewGoods;
-}
-
-- (void)loadData{
-    
-    if (isNew) {
-        [self requestNewProductsCollection];
-    }else{
-        [self requestDiscountCollection];
-    }
-}
-- (void)reLoadData{
-    if (isNew) {
-        [self requestNewProductsCollection];
-    }else{
-        [self requestDiscountCollection];
-    }
-}
-
-- (void)initHeaderView{
-    //添加頭部header
-    _searchBar = [[KWMSearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
-    _searchBar.delegate = self;
-    
-    [self.view addSubview:_searchBar];
-}
-
-- (void)initView{
-    
-    [self.tbvNewGoods registerClass:[KWMNewGoodsCell class] forCellReuseIdentifier:@"KWMNewGoodsCell"];
-    
-    //新品
-    self.btnNewGoods.selected = YES;
-    self.btnNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"F19291"];
-    
-    self.btnNewGoods.layer.borderColor = [UIColor sam_colorWithHex:@"F19291"].CGColor;
-    self.btnNewGoods.layer.borderWidth = 0.5;
-    //打折
-    self.btnDiscount.selected = NO;
-    self.btnDiscount.layer.borderWidth = 0.5;
-    self.btnDiscount.layer.borderColor =  [UIColor sam_colorWithHex:@"F19291"].CGColor;
-    
-    self.tbvNewGoods.delegate = self;
-    self.tbvNewGoods.separatorStyle = UITableViewCellSelectionStyleNone;
-    self.tbvNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"FFFFFF"];
-    [self.tbvNewGoods registerNib:[UINib nibWithNibName:idStr bundle:nil] forCellReuseIdentifier:idStr];
-    
-    self.vLine.backgroundColor = [UIColor sam_colorWithHex:@"F5F5F5"];
-    
-    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickBackgroundView:)];
-    [self.vBackground addGestureRecognizer:tapGesture];
-}
-
-- (void)onClickBackgroundView:(UITapGestureRecognizer *)tapGesture{
-    [_searchBar.tfSearch resignFirstResponder];
-    _searchBar.tfSearch.text = nil;
-    self.vBackground.hidden = YES;
-    [_searchBar stopSearch];
-}
-
-//点击婴儿
-- (IBAction)onClickBabyBtn:(id)sender {
-    if([TestModel isEqualToString:@"YES"]){
-        KWMSelectedGoodsVC * selectedGoodsVC = (KWMSelectedGoodsVC *)[KWMBaseVC findControllerBy:[KWMSelectedGoodsVC kwmTag] fromStoryboard:@"New"];
-        BUYCollection *collection = [BUYCollection new];
-        collection.identifier = @(441199887);
-        selectedGoodsVC.collection = collection;
-        [self.navigationController pushViewController:selectedGoodsVC animated:YES];
-//        KWMProductDetailVC *vc = (KWMProductDetailVC *)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
-//        vc.productId = @(11406082255);
-//        [self.navigationController pushViewController:vc animated:YES];
-        
-        return;
-    }
-    [self JumpToNewSelectedVCWith:self.btnBaby.titleLabel.text type:0];
-}
-//点击女孩
-- (IBAction)onClickGirlBtn:(id)sender {
-    [self JumpToNewSelectedVCWith:self.btnGirl.titleLabel.text type:1];
-}
-//点击男孩
-- (IBAction)onClickBoyBtn:(id)sender {
-    [self JumpToNewSelectedVCWith:self.btnBoy.titleLabel.text type:2];
-}
-//点击鞋类
-- (IBAction)onClickShoesBtn:(id)sender {
-    [self JumpToNewSelectedVCWith:self.btnShoes.titleLabel.text type:3];
-}
-
-- (void)JumpToNewSelectedVCWith:(NSString *)title type:(NSInteger)type{
-    KWMNewTypeSelectedVC *newTypeSelectedVC = (KWMNewTypeSelectedVC*)[KWMBaseVC findControllerBy:[KWMNewTypeSelectedVC kwmTag] fromStoryboard:@"New"];
-    newTypeSelectedVC.navTitle = title;
-    newTypeSelectedVC.pageType = type;
-    [self.navigationController pushViewController:newTypeSelectedVC animated:YES];
-}
-
-//点击新品
-- (IBAction)onClickNewGoodsBtn:(id)sender {
-    if (!isNew) {
-        isNew = YES;
-        if (!newCollections || newCollections.count == 0) {
-            [self requestNewProductsCollection];
-        }else{
-            collections = newCollections;
-            [self.tbvNewGoods reloadData];
-        }
-    }
-    self.btnNewGoods.selected = YES;
-    self.btnDiscount.selected = NO;
-    self.btnDiscount.backgroundColor = [UIColor clearColor];
-    self.btnNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"F88C99"];
-}
-//点击打折
-- (IBAction)onClickDiscountBtn:(id)sender {
-    if (isNew) {
-        isNew = NO;
-        if (!discountCollections || discountCollections.count == 0) {
-            collections = [NSArray array];
-            [self requestDiscountCollection];
-        }else{
-            collections = discountCollections;
-            [self.tbvNewGoods reloadData];
-        }
-    }
-    self.btnDiscount.selected = YES;
-    self.btnNewGoods.selected = NO;
-    self.btnDiscount.backgroundColor =  [UIColor sam_colorWithHex:@"F88C99"];
-    self.btnNewGoods.backgroundColor = [UIColor clearColor];
-    
-}
-
-#pragma mark -- KWMTBVSectionHeardViewDelegate
-- (void)kwm_watchMoreProductsByBrand:(KWMNewGoodsModel *)goodsModel AndTitle:(NSString *)titel{
-    KWMBrandCaramelVC *brandVC = (KWMBrandCaramelVC *)[KWMBrandCaramelVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
-    brandVC.brand = titel;
-    brandVC.goodModel = goodsModel;
-    brandVC.isSale = !isNew;
-    
-    [self.navigationController pushViewController:brandVC animated:YES];
-}
-
-#pragma mark -- KWMSearchBarDelegate
-- (void)kwm_tfSearchBeginEditing{
-    self.vBackground.hidden = NO;
-}
-
-- (void)kwm_onCancel{
-    self.vBackground.hidden = YES;
-}
-
-- (void)kwm_tfSearchFinished:(NSString *)text{
-    if ([text isEqualToString:@""] || text == nil) {
-        [self showToast:@"请输入需要搜索的内容"];
-        return;
-    }
-    KWMSearchFeedbackVC *searchFBVC = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
-    searchFBVC.searchText = text;
-    [self.navigationController pushViewController:searchFBVC animated:YES];
-}
-
-- (void)kwm_onClickShopCar{
-    
-    KWMShopCartVC *contactVC = (KWMShopCartVC *)[KWMBaseVC findControllerBy:[KWMShopCartVC kwmTag] fromStoryboard:@"ShopCart"];
-    [self.navigationController pushViewController:contactVC animated:YES];
-    
-}
-
-#pragma mark -- KWMNewGoodsCellDelegate
-- (void)kwm_selectCollectionCell:(BUYProduct *)product{
-    if (product == nil) {
-        return;
-    }
-//    KWMProductDetailVC *goodsDetailvc = (KWMProductDetailVC *)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
-    KWMNewProductVC *goodsDetailvc = [KWMNewProductVC getNewInstance];
-    goodsDetailvc.product = product;
-    [self.navigationController pushViewController:goodsDetailvc animated:YES];
-}
-
-#pragma mark - UITableViewDelegate
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-    return collections?collections.count:0 ;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-    return 1;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-    
-    KWMNewGoodsCell *newGoodsCell = [tableView dequeueReusableCellWithIdentifier:idStr forIndexPath:indexPath];
-//    if(!newGoodsCell){
-//        [tableView registerNib:[UINib nibWithNibName:idStr bundle:nil] forCellReuseIdentifier:idStr];
-//        newGoodsCell = [tableView dequeueReusableCellWithIdentifier:idStr forIndexPath:indexPath];
+//#import "KWMNewVC.h"
+//#import "KWMStringUtil.h"
+//#import "KWMSelectedGoodsVC.h"
+//#import "KWMNewTypeSelectedVC.h"
+//#import "KWMSearchFeedbackVC.h"
+//#import "KWMShopCartVC.h"
+//#import "KWMShopCartData.h"
+//#import "KWMNewGoodsModel.h"
+//#import "KWMLoadStatus.h"
+//#import "KWMSelectedGoodsVC.h"
+//#import "KWMBrandCaramelVC.h"
+//#import "UIColor+SAMAdditions.h"
+//#import "KWMNewProductVC.h"
+//#import "KWMShoppingCart.h"
+//
+//
+//@interface KWMNewVC ()
+//@property (nonatomic) KWMSearchBar *searchBar;
+////@property (nonatomic) KWMNewGoodsModel *goodsModel;
+//@end
+//
+//@implementation KWMNewVC{
+//    NSArray *collections;
+//    NSArray *discountCollections;
+//    NSArray *newCollections;
+//    NSMutableDictionary *newsDict;
+//    NSMutableDictionary *discountDic;
+//    BOOL isNew;//判断当前显示的是新品还是折扣列表
+//}
+//
+//static NSString * idStr = @"KWMNewGoodsCell";
+//+(NSString *)kwmTag{
+//    return @"KWMNewVC";
+//}
+//
+//- (void)viewDidDisappear:(BOOL)animated{
+//    [super viewDidDisappear:animated];
+//    [_searchBar removeFromSuperview];
+//}
+//
+//- (void)viewDidLoad {
+//    [super viewDidLoad];
+//    
+//    [self initNotification];
+//    // Do any additional setup after loading the view.
+//    self.automaticallyAdjustsScrollViewInsets = NO;
+//    self.tbvNewGoods.showsVerticalScrollIndicator = NO;
+//    collections = [NSArray array];
+//    discountCollections = [NSArray array];
+//    newCollections = [NSArray array];
+//    newsDict = [[NSMutableDictionary alloc] init];
+//    discountDic = [[NSMutableDictionary alloc] init];
+//    
+//    isNew = YES;
+//    [self initView];
+//    [self requestNewProductsCollection];
+//
+//}
+//
+//- (void)initNotification{
+//    [[NSNotificationCenter defaultCenter] addObserver:self
+//                                             selector:@selector(onBack)
+//                                                 name:UIApplicationDidBecomeActiveNotification object:nil];
+//}
+//
+//-(void)removreNotification{
+//    [[NSNotificationCenter defaultCenter] removeObserver:self];
+//}
+//
+//-(void)dealloc{
+//    [self removreNotification];
+//}
+//
+//-(void)onBack{
+//    [self.tbvNewGoods reloadData];
+//}
+//
+//- (void)awakeFromNib{
+//    [super awakeFromNib];
+//    
+//    self.title = @"商品";
+//}
+//
+//- (void)viewWillAppear:(BOOL)animated{
+//    [super viewWillAppear:animated];
+//    [self initHeaderView];
+//    [self.navigationController setNavigationBarHidden:YES];
+//    [self.tabBarController setHidesBottomBarWhenPushed:NO];
+//    if (_searchBar) {
+//        NSInteger count = [[KWMShoppingCart sharedInstance] count].integerValue;
+//        _searchBar.count = count;
+//    }
+//    [_searchBar resumeView];
+//    _vBackground.hidden = YES;
+//    [self.tbvNewGoods reloadData];
+//}
+//- (void)viewWillDisappear:(BOOL)animated{
+//    [super viewWillDisappear:animated];
+//    [_searchBar removeFromSuperview];
+//}
+//
+//
+//- (UITableView *)targetTableView{
+//    return self.tbvNewGoods;
+//}
+//
+//- (void)loadData{
+//    
+//    if (isNew) {
+//        [self requestNewProductsCollection];
+//    }else{
+//        [self requestDiscountCollection];
+//    }
+//}
+//- (void)reLoadData{
+//    if (isNew) {
+//        [self requestNewProductsCollection];
+//    }else{
+//        [self requestDiscountCollection];
+//    }
+//}
+//
+//- (void)initHeaderView{
+//    //添加頭部header
+//    _searchBar = [[KWMSearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
+//    _searchBar.delegate = self;
+//    
+//    [self.view addSubview:_searchBar];
+//}
+//
+//- (void)initView{
+//    
+//    [self.tbvNewGoods registerClass:[KWMNewGoodsCell class] forCellReuseIdentifier:@"KWMNewGoodsCell"];
+//    
+//    //新品
+//    self.btnNewGoods.selected = YES;
+//    self.btnNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"F19291"];
+//    
+//    self.btnNewGoods.layer.borderColor = [UIColor sam_colorWithHex:@"F19291"].CGColor;
+//    self.btnNewGoods.layer.borderWidth = 0.5;
+//    //打折
+//    self.btnDiscount.selected = NO;
+//    self.btnDiscount.layer.borderWidth = 0.5;
+//    self.btnDiscount.layer.borderColor =  [UIColor sam_colorWithHex:@"F19291"].CGColor;
+//    
+//    self.tbvNewGoods.delegate = self;
+//    self.tbvNewGoods.separatorStyle = UITableViewCellSelectionStyleNone;
+//    self.tbvNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"FFFFFF"];
+//    [self.tbvNewGoods registerNib:[UINib nibWithNibName:idStr bundle:nil] forCellReuseIdentifier:idStr];
+//    
+//    self.vLine.backgroundColor = [UIColor sam_colorWithHex:@"F5F5F5"];
+//    
+//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickBackgroundView:)];
+//    [self.vBackground addGestureRecognizer:tapGesture];
+//}
+//
+//- (void)onClickBackgroundView:(UITapGestureRecognizer *)tapGesture{
+//    [_searchBar.tfSearch resignFirstResponder];
+//    _searchBar.tfSearch.text = nil;
+//    self.vBackground.hidden = YES;
+//    [_searchBar stopSearch];
+//}
+//
+////点击婴儿
+//- (IBAction)onClickBabyBtn:(id)sender {
+//    if([TestModel isEqualToString:@"YES"]){
+//        KWMSelectedGoodsVC * selectedGoodsVC = (KWMSelectedGoodsVC *)[KWMBaseVC findControllerBy:[KWMSelectedGoodsVC kwmTag] fromStoryboard:@"New"];
+//        BUYCollection *collection = [BUYCollection new];
+//        collection.identifier = @(441199887);
+//        selectedGoodsVC.collection = collection;
+//        [self.navigationController pushViewController:selectedGoodsVC animated:YES];
+////        KWMProductDetailVC *vc = (KWMProductDetailVC *)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
+////        vc.productId = @(11406082255);
+////        [self.navigationController pushViewController:vc animated:YES];
+//        
+//        return;
+//    }
+//    [self JumpToNewSelectedVCWith:self.btnBaby.titleLabel.text type:0];
+//}
+////点击女孩
+//- (IBAction)onClickGirlBtn:(id)sender {
+//    [self JumpToNewSelectedVCWith:self.btnGirl.titleLabel.text type:1];
+//}
+////点击男孩
+//- (IBAction)onClickBoyBtn:(id)sender {
+//    [self JumpToNewSelectedVCWith:self.btnBoy.titleLabel.text type:2];
+//}
+////点击鞋类
+//- (IBAction)onClickShoesBtn:(id)sender {
+//    [self JumpToNewSelectedVCWith:self.btnShoes.titleLabel.text type:3];
+//}
+//
+//- (void)JumpToNewSelectedVCWith:(NSString *)title type:(NSInteger)type{
+//    KWMNewTypeSelectedVC *newTypeSelectedVC = (KWMNewTypeSelectedVC*)[KWMBaseVC findControllerBy:[KWMNewTypeSelectedVC kwmTag] fromStoryboard:@"New"];
+//    newTypeSelectedVC.navTitle = title;
+//    newTypeSelectedVC.pageType = type;
+//    [self.navigationController pushViewController:newTypeSelectedVC animated:YES];
+//}
+//
+////点击新品
+//- (IBAction)onClickNewGoodsBtn:(id)sender {
+//    if (!isNew) {
+//        isNew = YES;
+//        if (!newCollections || newCollections.count == 0) {
+//            [self requestNewProductsCollection];
+//        }else{
+//            collections = newCollections;
+//            [self.tbvNewGoods reloadData];
+//        }
+//    }
+//    self.btnNewGoods.selected = YES;
+//    self.btnDiscount.selected = NO;
+//    self.btnDiscount.backgroundColor = [UIColor clearColor];
+//    self.btnNewGoods.backgroundColor =  [UIColor sam_colorWithHex:@"F88C99"];
+//}
+////点击打折
+//- (IBAction)onClickDiscountBtn:(id)sender {
+//    if (isNew) {
+//        isNew = NO;
+//        if (!discountCollections || discountCollections.count == 0) {
+//            collections = [NSArray array];
+//            [self requestDiscountCollection];
+//        }else{
+//            collections = discountCollections;
+//            [self.tbvNewGoods reloadData];
+//        }
+//    }
+//    self.btnDiscount.selected = YES;
+//    self.btnNewGoods.selected = NO;
+//    self.btnDiscount.backgroundColor =  [UIColor sam_colorWithHex:@"F88C99"];
+//    self.btnNewGoods.backgroundColor = [UIColor clearColor];
+//    
+//}
+//
+//#pragma mark -- KWMTBVSectionHeardViewDelegate
+//- (void)kwm_watchMoreProductsByBrand:(KWMNewGoodsModel *)goodsModel AndTitle:(NSString *)titel{
+//    KWMBrandCaramelVC *brandVC = (KWMBrandCaramelVC *)[KWMBrandCaramelVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
+//    brandVC.brand = titel;
+//    brandVC.goodModel = goodsModel;
+//    brandVC.isSale = !isNew;
+//    
+//    [self.navigationController pushViewController:brandVC animated:YES];
+//}
+//
+//#pragma mark -- KWMSearchBarDelegate
+//- (void)kwm_tfSearchBeginEditing{
+//    self.vBackground.hidden = NO;
+//}
+//
+//- (void)kwm_onCancel{
+//    self.vBackground.hidden = YES;
+//}
+//
+//- (void)kwm_tfSearchFinished:(NSString *)text{
+//    if ([text isEqualToString:@""] || text == nil) {
+//        [self showToast:@"请输入需要搜索的内容"];
+//        return;
+//    }
+//    KWMSearchFeedbackVC *searchFBVC = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
+//    searchFBVC.searchText = text;
+//    [self.navigationController pushViewController:searchFBVC animated:YES];
+//}
+//
+//- (void)kwm_onClickShopCar{
+//    
+//    KWMShopCartVC *contactVC = (KWMShopCartVC *)[KWMBaseVC findControllerBy:[KWMShopCartVC kwmTag] fromStoryboard:@"ShopCart"];
+//    [self.navigationController pushViewController:contactVC animated:YES];
+//    
+//}
+//
+//#pragma mark -- KWMNewGoodsCellDelegate
+//- (void)kwm_selectCollectionCell:(BUYProduct *)product{
+//    if (product == nil) {
+//        return;
+//    }
+////    KWMProductDetailVC *goodsDetailvc = (KWMProductDetailVC *)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
+//    KWMNewProductVC *goodsDetailvc = [KWMNewProductVC getNewInstance];
+//    goodsDetailvc.product = product;
+//    [self.navigationController pushViewController:goodsDetailvc animated:YES];
+//}
+//
+//#pragma mark - UITableViewDelegate
+//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
+//    return collections?collections.count:0 ;
+//}
+//
+//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
+//    return 1;
+//}
+//
+//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
+//    
+//    KWMNewGoodsCell *newGoodsCell = [tableView dequeueReusableCellWithIdentifier:idStr forIndexPath:indexPath];
+////    if(!newGoodsCell){
+////        [tableView registerNib:[UINib nibWithNibName:idStr bundle:nil] forCellReuseIdentifier:idStr];
+////        newGoodsCell = [tableView dequeueReusableCellWithIdentifier:idStr forIndexPath:indexPath];
+////    }
+//    newGoodsCell.isDetail = NO;
+//    newGoodsCell.delegate = self;
+//    
+//    if(!collections || collections.count <= indexPath.section){
+//        return newGoodsCell;
+//    }
+//    KWMNewGoodsModel *goodsModel = [collections objectAtIndex:indexPath.section];
+//    if(!goodsModel){
+//        return newGoodsCell;
+//    }
+//    NSString *row = @(indexPath.section).stringValue;
+//    NSMutableDictionary *selectDict = isNew?newsDict:discountDic;
+//    KWMLoadStatus *loadStatus = [selectDict objectForKey:row];
+//    if (!loadStatus) {
+//        loadStatus = [[KWMLoadStatus alloc] init];
+//        [selectDict setObject:loadStatus forKey:row];
+//        //設置緩存數據
+//        loadStatus.cacheData = [self.userDao getCollectionCache:goodsModel.id tags:isNew?nil:[NSArray arrayWithObjects:@"sale", nil]];
+//    }
+//    //如果该行未拿到数据(包括空数据),向服务器请求数据
+//    if (!loadStatus.firstLoad && !loadStatus.isLoading) {
+//        [self requesProductList:BUYCollectionSortCreatedDescending WithCollectionId:goodsModel.id AndIndex:row];
 //    }
-    newGoodsCell.isDetail = NO;
-    newGoodsCell.delegate = self;
-    
-    if(!collections || collections.count <= indexPath.section){
-        return newGoodsCell;
-    }
-    KWMNewGoodsModel *goodsModel = [collections objectAtIndex:indexPath.section];
-    if(!goodsModel){
-        return newGoodsCell;
-    }
-    NSString *row = @(indexPath.section).stringValue;
-    NSMutableDictionary *selectDict = isNew?newsDict:discountDic;
-    KWMLoadStatus *loadStatus = [selectDict objectForKey:row];
-    if (!loadStatus) {
-        loadStatus = [[KWMLoadStatus alloc] init];
-        [selectDict setObject:loadStatus forKey:row];
-        //設置緩存數據
-        loadStatus.cacheData = [self.userDao getCollectionCache:goodsModel.id tags:isNew?nil:[NSArray arrayWithObjects:@"sale", nil]];
-    }
-    //如果该行未拿到数据(包括空数据),向服务器请求数据
-    if (!loadStatus.firstLoad && !loadStatus.isLoading) {
-        [self requesProductList:BUYCollectionSortCreatedDescending WithCollectionId:goodsModel.id AndIndex:row];
-    }
-    [newGoodsCell setLoadStatusData:loadStatus];
-    return newGoodsCell;
-}
-
-#pragma mark - UITableViewDataSource
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-    NSString *row = @(indexPath.section).stringValue;
-    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
-    return [self isEmptyCollection:loadStatus]? 0.01f:173.0f;
-}
-
-- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
-    
-    NSString *row = @(section).stringValue;
-    KWMNewGoodsModel *goodsModel = [collections objectAtIndex:section];
-    KWMTBVSectionHeardView * vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 60)];
-    vTBVSectionHeard.goodsModel = goodsModel;
-    vTBVSectionHeard.delegate = self;
-    vTBVSectionHeard.clipsToBounds = YES;
-    vTBVSectionHeard.backgroundColor = [UIColor whiteColor];
-    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
-    //判断该collection是否有数据来隐藏头部,如果第一次请求成功且并没有请求到数据
-    vTBVSectionHeard.hidden = [self isEmptyCollection:loadStatus];
-    return vTBVSectionHeard;
-}
-
-//判斷該collection是否為空
-- (BOOL)isEmptyCollection:(KWMLoadStatus *)loadStatus{
-    if(!loadStatus){
-        return NO;
-    }
-    return (loadStatus.firstLoad && (!loadStatus.data || loadStatus.data.count == 0));
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
-    NSString * row = @(section).stringValue;
-    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
-    return [self isEmptyCollection:loadStatus]? 0.01f:60.0f;
-    return 60.0f;
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
-    return 0.01f;
-}
-
-//请求新品collection列表
-- (void)requestNewProductsCollection{
-    BOOL mIsNew = isNew;
-    __weak KWMNewVC *weakSelf = self;
-    [self.api getNewProducts:nil success:^(NSURLSessionDataTask *task, KWMNewProducts *result) {
-        [weakSelf hideLoading];
-        newCollections = result.collections;
-        if(mIsNew == isNew){
-            collections = newCollections;
-            [self.tbvNewGoods reloadData];
-        }
-    } failure:^(NSURLSessionDataTask *task, NSError *error) {
-        [weakSelf showError:error];
-        NSLog(@"error");
-    }];
-    [self showLoading];
-}
-
-//请求打折collection列表
-- (void)requestDiscountCollection{
-    BOOL mIsNew = isNew;
-    __weak KWMNewVC *weakSelf = self;
-    [self.api getDiscountProducts:nil success:^(NSURLSessionDataTask *task, KWMNewProducts *result) {
-        [weakSelf hideLoading];
-        [result setCollectionsTag];
-        discountCollections = result.collections;
-        if(mIsNew == isNew){
-            collections = discountCollections;
-            [self.tbvNewGoods reloadData];
-        }
-    } failure:^(NSURLSessionDataTask *task, NSError *error) {
-        [self showError:error];
-        NSLog(@"error");
-    }];
-    [self showLoading];
-}
-
-//请求product列表
-- (void)requesProductList:(BUYCollectionSort)collectionSort WithCollectionId:(NSNumber *)identify AndIndex:(NSString *)keyStr{
-    BOOL mIsNew = isNew;
-    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:keyStr]:[discountDic objectForKey:keyStr];
-    if(!loadStatus){
-        return;
-    }
-    //设置该行状态为正在加载
-    loadStatus.isLoading = YES;
-    __weak KWMNewVC *weakSelf = self;
-    NSInteger tagetPage = 1;
-    NSArray *tags = nil;
-    if(!isNew){
-        NSString *tag;
-        tag = @"sale";
-        tags = [NSArray arrayWithObjects:tag, nil];
-    }
-    [self.client getProductsPage:tagetPage inCollection:identify withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
-        [weakSelf hideLoading];
-        loadStatus.isLoading = NO;
-        if (error == nil && products) {
-            if(tagetPage == 1){
-                [weakSelf.userDao saveCollectionCache:products collectionId:identify tags:tags];
-            }
-            weakSelf.hasNextPage = !reachedEnd;
-            loadStatus.data = products;
-            //设置第一次加载的状态为已成功加载
-            loadStatus.firstLoad = YES;
-            if(mIsNew == isNew ){
-                if([KWMStringUtil isEmpty:keyStr]){
-                    return ;
-                }
-                NSInteger section = keyStr.integerValue;
-                if(section < (collections?collections.count:0)){
-                                   [weakSelf.tbvNewGoods reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationNone];
-                }
-            }
-        }else {
-            [self showError:error];
-            NSLog(@"Error fetching products: %@", error);
-        }
-    }];
-    [self showLoading];
-}
-
-
-
-@end
+//    [newGoodsCell setLoadStatusData:loadStatus];
+//    return newGoodsCell;
+//}
+//
+//#pragma mark - UITableViewDataSource
+//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+//    NSString *row = @(indexPath.section).stringValue;
+//    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
+//    return [self isEmptyCollection:loadStatus]? 0.01f:173.0f;
+//}
+//
+//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
+//    
+//    NSString *row = @(section).stringValue;
+//    KWMNewGoodsModel *goodsModel = [collections objectAtIndex:section];
+//    KWMTBVSectionHeardView * vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 60)];
+//    vTBVSectionHeard.goodsModel = goodsModel;
+//    vTBVSectionHeard.delegate = self;
+//    vTBVSectionHeard.clipsToBounds = YES;
+//    vTBVSectionHeard.backgroundColor = [UIColor whiteColor];
+//    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
+//    //判断该collection是否有数据来隐藏头部,如果第一次请求成功且并没有请求到数据
+//    vTBVSectionHeard.hidden = [self isEmptyCollection:loadStatus];
+//    return vTBVSectionHeard;
+//}
+//
+////判斷該collection是否為空
+//- (BOOL)isEmptyCollection:(KWMLoadStatus *)loadStatus{
+//    if(!loadStatus){
+//        return NO;
+//    }
+//    return (loadStatus.firstLoad && (!loadStatus.data || loadStatus.data.count == 0));
+//}
+//
+//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
+//    NSString * row = @(section).stringValue;
+//    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:row]:[discountDic objectForKey:row];
+//    return [self isEmptyCollection:loadStatus]? 0.01f:60.0f;
+//    return 60.0f;
+//}
+//
+//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
+//    return 0.01f;
+//}
+//
+////请求新品collection列表
+//- (void)requestNewProductsCollection{
+//    BOOL mIsNew = isNew;
+//    __weak KWMNewVC *weakSelf = self;
+//    [self.api getNewProducts:nil success:^(NSURLSessionDataTask *task, KWMNewProducts *result) {
+//        [weakSelf hideLoading];
+//        newCollections = result.collections;
+//        if(mIsNew == isNew){
+//            collections = newCollections;
+//            [self.tbvNewGoods reloadData];
+//        }
+//    } failure:^(NSURLSessionDataTask *task, NSError *error) {
+//        [weakSelf showError:error];
+//        NSLog(@"error");
+//    }];
+//    [self showLoading];
+//}
+//
+////请求打折collection列表
+//- (void)requestDiscountCollection{
+//    BOOL mIsNew = isNew;
+//    __weak KWMNewVC *weakSelf = self;
+//    [self.api getDiscountProducts:nil success:^(NSURLSessionDataTask *task, KWMNewProducts *result) {
+//        [weakSelf hideLoading];
+//        [result setCollectionsTag];
+//        discountCollections = result.collections;
+//        if(mIsNew == isNew){
+//            collections = discountCollections;
+//            [self.tbvNewGoods reloadData];
+//        }
+//    } failure:^(NSURLSessionDataTask *task, NSError *error) {
+//        [self showError:error];
+//        NSLog(@"error");
+//    }];
+//    [self showLoading];
+//}
+//
+////请求product列表
+//- (void)requesProductList:(BUYCollectionSort)collectionSort WithCollectionId:(NSNumber *)identify AndIndex:(NSString *)keyStr{
+//    BOOL mIsNew = isNew;
+//    KWMLoadStatus *loadStatus = isNew ? [newsDict objectForKey:keyStr]:[discountDic objectForKey:keyStr];
+//    if(!loadStatus){
+//        return;
+//    }
+//    //设置该行状态为正在加载
+//    loadStatus.isLoading = YES;
+//    __weak KWMNewVC *weakSelf = self;
+//    NSInteger tagetPage = 1;
+//    NSArray *tags = nil;
+//    if(!isNew){
+//        NSString *tag;
+//        tag = @"sale";
+//        tags = [NSArray arrayWithObjects:tag, nil];
+//    }
+//    [self.client getProductsPage:tagetPage inCollection:identify withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
+//        [weakSelf hideLoading];
+//        loadStatus.isLoading = NO;
+//        if (error == nil && products) {
+//            if(tagetPage == 1){
+//                [weakSelf.userDao saveCollectionCache:products collectionId:identify tags:tags];
+//            }
+//            weakSelf.hasNextPage = !reachedEnd;
+//            loadStatus.data = products;
+//            //设置第一次加载的状态为已成功加载
+//            loadStatus.firstLoad = YES;
+//            if(mIsNew == isNew ){
+//                if([KWMStringUtil isEmpty:keyStr]){
+//                    return ;
+//                }
+//                NSInteger section = keyStr.integerValue;
+//                if(section < (collections?collections.count:0)){
+//                                   [weakSelf.tbvNewGoods reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationNone];
+//                }
+//            }
+//        }else {
+//            [self showError:error];
+//            NSLog(@"Error fetching products: %@", error);
+//        }
+//    }];
+//    [self showLoading];
+//}
+//
+//
+//
+//@end
diff --git a/iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m b/iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
index 18f18b1..1b8aa58 100644
--- a/iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
+++ b/iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
@@ -333,6 +333,7 @@
             checkout.billingAddress = self.address;
         }
         checkout.email = self.customer.email;
+        checkout.customerId = self.customer.identifier;
 //        self.client.urlScheme = @"CemaroseApp://";
         // 走session的情况下应该不存在update 只是update cart自动会update到checkout
 //        if(checkoutCache){
@@ -719,13 +720,15 @@
     [self.navigationController pushViewController:successVC animated:YES];
 }
 
+
 -(void) clearCheckout {
     self.cartCookie = nil;
-    [[KWMShoppingCart sharedInstance] clearCartWithCallback:^(NSError *error, KWMCartResult *cart) {
-//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [KWMHttpUtil deleteCookie:@"cart"];
-//        });
-    }];
+    [KWMHttpUtil deleteCookie:@"cart"];
+//    [[KWMShoppingCart sharedInstance] clearCartWithCallback:^(NSError *error, KWMCartResult *cart) {
+////        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//            [KWMHttpUtil deleteCookie:@"cart"];
+////        });
+//    }];
 //    [KWMHttpUtil deleteCookie:@"cart"];
 //    [[KWMShopCartData alloc] removeAllItems];
     [self.userDao deleteCheckoutCache];
diff --git a/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m b/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m
index c56fedc..f241d66 100644
--- a/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m
+++ b/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m
@@ -145,6 +145,7 @@
     }else{
         requestAddress = [[BUYAddress alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil];
     }
+    NSString *country = [self.tfCountry.text trim];
     requestAddress.lastName = [self.tfName.text trim];
     requestAddress.phone = [self.tfPhone.text trim];
     requestAddress.province = [self.tfProvince.text trim];
@@ -152,7 +153,7 @@
     requestAddress.city = [self.tfCity.text trim];
     requestAddress.address1 = [self.tfAddress.text trim];
     requestAddress.address2 = [self.tfAddressDetail.text trim];
-    requestAddress.country = [self.tfCountry.text trim];
+    requestAddress.country = [country isEqualToString:@"中国"] ? @"China" : country;
     requestAddress.countryCode = @"";
     requestAddress.zip = [self.tfZip.text trim];
     requestAddress.firstName = [(requestAddress.firstName?requestAddress.firstName:@"") trim];
diff --git a/iCemarose/Class/UI/ShopCart/KWMShopCartVC.m b/iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
index eda751b..cddf5c1 100644
--- a/iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
+++ b/iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
@@ -13,7 +13,8 @@
 #import "KWMUserModel.h"
 #import "KWMLoginVC.h"
 #import "KWMShopCartData.h"
-#import "KWMNewVC.h"
+//#import "KWMNewVC.h"
+#import "KWMCategoryVC.h"
 #import "KWMStringUtil.h"
 #import "KWMShoppingCart.h"
 
@@ -93,9 +94,10 @@
 //点击随意逛逛
 - (IBAction)onClickRandomBtn:(id)sender {
     NSLog(@"点击了随意逛逛");
-    KWMNewVC *newVC = (KWMNewVC *)[KWMBaseVC findControllerBy:[KWMNewVC kwmTag] fromStoryboard:@"Main"];
+//    KWMNewVC *newVC = (KWMNewVC *)[KWMBaseVC findControllerBy:[KWMNewVC kwmTag] fromStoryboard:@"Main"];
     self.hidesBottomBarWhenPushed = NO;
-    [self.navigationController pushViewController:newVC animated:YES];
+    KWMCategoryVC *vc = [KWMCategoryVC getNewInstance];
+    [self.navigationController pushViewController:vc animated:YES];
 }
 
 - (void)onClickComplete:(id)sender{
diff --git a/iCemarose/Info.plist b/iCemarose/Info.plist
index 62e2d9f..1cc7436 100644
--- a/iCemarose/Info.plist
+++ b/iCemarose/Info.plist
@@ -15,7 +15,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.5.0</string>
+	<string>1.5.1</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
@@ -56,7 +56,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2017071812</string>
+	<string>2017071910</string>
 	<key>LSApplicationQueriesSchemes</key>
 	<array>
 		<string>weixin</string>
--
libgit2 0.26.0