Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
0185d337
Commit
0185d337
authored
Jul 19, 2017
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ui,fix checkout does not have uid,fix address country can not input 中国,App.Home data cache 24H
parent
e2b375ed
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
529 additions
and
516 deletions
+529
-516
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+3
-1
KWMRightProductCell.m
iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m
+1
-0
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+4
-0
KWMVariantsVC.m
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
+1
-1
KWMNewVC.h
iCemarose/Class/UI/Product/KWMNewVC.h
+48
-48
KWMNewVC.m
iCemarose/Class/UI/Product/KWMNewVC.m
+456
-456
KWMBeforePayVC.m
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
+7
-4
KWMEditAddressVC.m
iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m
+2
-1
KWMShopCartVC.m
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
+5
-3
Info.plist
iCemarose/Info.plist
+2
-2
No files found.
iCemarose/Class/Api/KWMAPIManager.m
View file @
0185d337
...
...
@@ -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
];
}
...
...
iCemarose/Class/UI/Category/Cell/KWMRightProductCell.m
View file @
0185d337
...
...
@@ -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];
...
...
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
0185d337
...
...
@@ -56,6 +56,10 @@
self
.
title
=
@"分类"
;
}
+
(
NSString
*
)
kwmBoard
{
return
@"Main"
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initData
];
...
...
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
View file @
0185d337
...
...
@@ -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
]
priceFormatted
ByCurrencyCode
:
self
.
totalPrice
];
}
-
(
void
)
initCollectionView
{
...
...
iCemarose/Class/UI/Product/KWMNewVC.h
View file @
0185d337
////
//// 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
iCemarose/Class/UI/Product/KWMNewVC.m
View file @
0185d337
////
//// 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 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;
// }
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
.
01
f
:
173
.
0
f
;
}
-
(
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
.
01
f
:
60
.
0
f
;
return
60
.
0
f
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForFooterInSection
:
(
NSInteger
)
section
{
return
0
.
01
f
;
}
//请求新品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
// 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
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
View file @
0185d337
...
...
@@ -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"
];
// });
}];
// [[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
];
...
...
iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m
View file @
0185d337
...
...
@@ -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
];
...
...
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
View file @
0185d337
...
...
@@ -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
{
...
...
iCemarose/Info.plist
View file @
0185d337
...
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.5.
0
<
/string
>
<
string
>
1.5.
1
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleURLTypes
<
/k
e
y
>
...
...
@@ -56,7 +56,7 @@
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
2017071
812
<
/string
>
<
string
>
2017071
910
<
/string
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
weixin
<
/string
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment