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
e3ae9c68
Commit
e3ae9c68
authored
7 years ago
by
lee
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.oschina.net:kollway-kollway/newcemarose
parents
4a5ae8d8
9c04c731
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
378 additions
and
184 deletions
+378
-184
project.pbxproj
iCemarose.xcodeproj/project.pbxproj
+6
-0
KWMOrderListResult.h
iCemarose/Class/Api/Cemarose/KWMOrderListResult.h
+28
-0
KWMOrderListResult.m
iCemarose/Class/Api/Cemarose/KWMOrderListResult.m
+50
-0
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+9
-0
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+43
-8
KWMCheckoutPayResult.m
iCemarose/Class/Api/KWMCheckoutPayResult.m
+3
-1
Brand.storyboard
iCemarose/Class/UI/Brand/Brand.storyboard
+2
-11
KWMBasePageVC.m
iCemarose/Class/UI/KWMBasePageVC.m
+3
-0
KWMOrderCell.m
iCemarose/Class/UI/Mine/Cell/KWMOrderCell.m
+4
-0
KWMOrderCell.xib
iCemarose/Class/UI/Mine/Cell/KWMOrderCell.xib
+10
-4
KWMOrderVC.h
iCemarose/Class/UI/Mine/KWMOrderVC.h
+3
-1
KWMOrderVC.m
iCemarose/Class/UI/Mine/KWMOrderVC.m
+174
-89
Mine.storyboard
iCemarose/Class/UI/Mine/Mine.storyboard
+12
-7
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+18
-54
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+3
-4
KWMBeforePayVC.m
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
+1
-0
KWMPaySuccessVC.h
iCemarose/Class/UI/ShopCart/KWMPaySuccessVC.h
+3
-0
KWMPaySuccessVC.m
iCemarose/Class/UI/ShopCart/KWMPaySuccessVC.m
+1
-0
ShopCart.storyboard
iCemarose/Class/UI/ShopCart/ShopCart.storyboard
+5
-5
No files found.
iCemarose.xcodeproj/project.pbxproj
View file @
e3ae9c68
...
...
@@ -84,6 +84,7 @@
C0028ECB1F0E2B3500744C14
/* KWMAdditionalListResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0028ECA1F0E2B3500744C14
/* KWMAdditionalListResult.m */
;
};
C00D40941F187C9500DEA685
/* KWMCategoryTitleView.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C00D40931F187C9500DEA685
/* KWMCategoryTitleView.xib */
;
};
C00D40971F187CAB00DEA685
/* KWMCategoryTitleView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C00D40961F187CAB00DEA685
/* KWMCategoryTitleView.m */
;
};
C01573F11FC7C674001ECACA
/* KWMOrderListResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
;
};
C0219A951DF53EB200711099
/* KWMExchangeRateResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0219A941DF53EB200711099
/* KWMExchangeRateResult.m */
;
};
C0243BBD1EFBD5A10013CFA7
/* Category.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0243BAF1EFBD5A10013CFA7
/* Category.storyboard */
;
};
C0243BBE1EFBD5A10013CFA7
/* KWMLeftCategoryCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0243BB21EFBD5A10013CFA7
/* KWMLeftCategoryCell.m */
;
};
...
...
@@ -518,6 +519,8 @@
C00D40931F187C9500DEA685
/* KWMCategoryTitleView.xib */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.xib
;
path
=
KWMCategoryTitleView.xib
;
sourceTree
=
"<group>"
;
};
C00D40951F187CAB00DEA685
/* KWMCategoryTitleView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMCategoryTitleView.h
;
sourceTree
=
"<group>"
;
};
C00D40961F187CAB00DEA685
/* KWMCategoryTitleView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMCategoryTitleView.m
;
sourceTree
=
"<group>"
;
};
C01573EF1FC7C674001ECACA
/* KWMOrderListResult.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMOrderListResult.h
;
sourceTree
=
"<group>"
;
};
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMOrderListResult.m
;
sourceTree
=
"<group>"
;
};
C0219A931DF53EB200711099
/* KWMExchangeRateResult.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMExchangeRateResult.h
;
sourceTree
=
"<group>"
;
};
C0219A941DF53EB200711099
/* KWMExchangeRateResult.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMExchangeRateResult.m
;
sourceTree
=
"<group>"
;
};
C0243BAF1EFBD5A10013CFA7
/* Category.storyboard */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.storyboard
;
path
=
Category.storyboard
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1977,6 +1980,8 @@
9BE61D001ECD71610031D21E
/* KWMCartResult.m */
,
DA4E36901F1613C70007E4D0
/* KWMHomeDataResult.h */
,
DA4E36911F1613C70007E4D0
/* KWMHomeDataResult.m */
,
C01573EF1FC7C674001ECACA
/* KWMOrderListResult.h */
,
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
,
);
path
=
Cemarose
;
sourceTree
=
"<group>"
;
...
...
@@ -2782,6 +2787,7 @@
807AF4A41DC984950000A326
/* KWMBrandsResult.m in Sources */
,
C048342B1F1324B400A5BFB4
/* KWMAdHeader.m in Sources */
,
C034E8471D6B10A0006EE129
/* UIColor+Extend.m in Sources */
,
C01573F11FC7C674001ECACA
/* KWMOrderListResult.m in Sources */
,
DA7457681F692D67000E192E
/* KWMProductSameBrandView.m in Sources */
,
C0DD53351EE55190002D1E0C
/* ArcToCircleLayer.m in Sources */
,
C091EE361DDEEA9400A382B9
/* KWMVariants.m in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/Api/Cemarose/KWMOrderListResult.h
0 → 100644
View file @
e3ae9c68
//
// KWMOrderListResult.h
// iCemarose
//
// Created by HouWeiBin on 2017/11/24.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KWMCemaroseResult.h"
#import <JSONModel/JSONModel.h>
#import "Buy/Buy.h"
@interface
KWMOrderListResult
:
KWMCemaroseResult
//结果状态。success:正常;fail:错误
@property
(
nonatomic
)
NSString
<
Optional
>
*
status
;
//状态码
@property
(
nonatomic
)
NSNumber
<
Optional
>
*
code
;
//错误/成功提示
@property
(
nonatomic
)
NSString
<
Optional
>
*
message
;
//数据--存放解析后的model。
@property
(
nonatomic
)
id
<
Ignore
>
data
;
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/Api/Cemarose/KWMOrderListResult.m
0 → 100644
View file @
e3ae9c68
//
// KWMOrderListResult.m
// iCemarose
//
// Created by HouWeiBin on 2017/11/24.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMOrderListResult.h"
@implementation
KWMOrderListResult
-
(
instancetype
)
initWithDictionary
:(
NSDictionary
*
)
dict
modelClass
:(
Class
)
modelClass
error
:(
NSError
**
)
err
{
self
=
[
super
initWithDictionary
:
dict
error
:
err
];
if
(
self
)
{
id
dataDict
=
dict
[
@"data"
];
if
(
modelClass
&&
dataDict
){
self
.
data
=
[
self
buildData
:
dataDict
];
}
}
return
self
;
}
-
(
id
)
buildData
:(
NSDictionary
*
)
jsonDictionary
{
id
result
=
nil
;
if
(
jsonDictionary
){
@try
{
NSArray
*
array
=
(
NSArray
*
)
jsonDictionary
;
if
(
array
){
// for(NSDictionary *dict in array){
BUYModelManager
*
modelManager
=
[[
BUYModelManager
alloc
]
init
];
result
=
[
modelManager
buy_objectsWithEntityName
:[
BUYOrder
entityName
]
JSONArray
:
array
];
// }
}
}
@catch
(
NSException
*
exception
){
NSLog
(
@"exception Name: %@"
,
exception
.
name
);
NSLog
(
@"exception Reason: %@"
,
exception
.
reason
);
}
}
return
result
;
}
+
(
JSONKeyMapper
*
)
keyMapper
{
return
[
JSONKeyMapper
mapperForSnakeCase
];
}
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/Api/KWMAPIManager.h
View file @
e3ae9c68
...
...
@@ -39,6 +39,7 @@
#import "KWMWish.h"
#import "KWMHomeDataResult.h"
#import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
...
...
@@ -332,4 +333,12 @@
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMAdditionalListResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
* 获得所有订单 API
* @return NSURLSessionDataTask
*/
-
(
NSURLSessionDataTask
*
)
getOrderList
:(
NSDictionary
*
)
parameters
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/Api/KWMAPIManager.m
View file @
e3ae9c68
...
...
@@ -20,6 +20,7 @@
#import "KWMBrandsTypeResult.h"
#import "KWMBrandsTypeModel.h"
#import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
#import <RegexKitLite/RegexKitLite.h>
#import <SAMKeychain/SAMKeychain.h>
#import "KWMUserModel.h"
...
...
@@ -233,10 +234,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
-
(
AFHTTPSessionManager
*
)
buildSessionManager
{
return
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
];
return
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
isUseClientAuth
:
NO
];
}
-
(
AFHTTPSessionManager
*
)
buildSessionManager
:
(
BOOL
)
isJsonParameter
afSessionManage
:
(
AFHTTPSessionManager
*
)
afSessionManage
{
-
(
AFHTTPSessionManager
*
)
buildSessionManager
:
(
BOOL
)
isJsonParameter
afSessionManage
:
(
AFHTTPSessionManager
*
)
afSessionManage
isUseClientAuth
:
(
BOOL
)
isUseClientAuth
{
NSURL
*
url
=
[
NSURL
URLWithString
:
self
.
baseUrl
];
AFHTTPSessionManager
*
sessionManager
;
...
...
@@ -267,9 +268,24 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
else
{
[
sessionManager
.
requestSerializer
setAuthorizationHeaderFieldWithUsername
:
userName
password
:
password
];
}
id
tokenDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
];
if
(
tokenDict
){
BUYCustomerToken
*
token
=
[
BUYCustomerToken
customerTokenWithJSONDictionary
:
tokenDict
];
if
(
token
){
NSString
*
accessToken
=
token
.
accessToken
?:
@""
;
[
sessionManager
.
requestSerializer
setValue
:
accessToken
forHTTPHeaderField
:
@"X-Shopify-Customer-Access-Token"
];
}
}
if
(
isUseClientAuth
){
[
sessionManager
.
requestSerializer
setValue
:
@"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM=="
forHTTPHeaderField
:
@"Authorization"
];
}
return
sessionManager
;
}
-
(
BOOL
)
isUserClientAuth
:
(
Class
)
result
{
return
result
==
[
KWMOrderListResult
class
];
}
-
(
NSURLSessionDataTask
*
)
startSessionTask
:
(
KWMHTTPMethod
)
httpMethod
...
...
@@ -291,8 +307,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
||
result
==
[
KWMCheckoutPayResult
class
]
||
result
==
[
KWMCemaroseResult
class
]
||
[
result
isSubclassOfClass
:[
KWMCemaroseResult
class
]]),
@"result class must either be KWMRequestResult or KWMRequestListResult!"
);
NSAssert
((
!
model
||
(
model
&&
[
model
isSubclassOfClass
:[
JSONModel
class
]])),
@"model class must be sub class of JSONModel"
);
// NSAssert((!model || (model && [model isSubclassOfClass:[JSONModel class]])),
// @"model class must be sub class of JSONModel");
BOOL
isUseClientAuth
=
[
self
isUserClientAuth
:
result
];
//使用sessionManager请求时用到的callback
void
(
^
successCallback
)(
NSURLSessionDataTask
*
,
id
)
=
[
self
buildSuccessCallbackWithResultClass
:
result
modelClass
:
model
...
...
@@ -312,7 +329,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
//使用PPNetworkHelper请求失败时用到的callback
void
(
^
newFailedCallback
)(
NSError
*
error
)
=
[
self
buildNewFaliedCallback
:
failure
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
nil
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
nil
isUseClientAuth
:
isUseClientAuth
];
if
(
timeout
)
{
[
sessionManager
.
requestSerializer
setTimeoutInterval
:
timeout
];
}
...
...
@@ -332,7 +349,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
if
(
timeout
)
{
[
sessionManager
.
requestSerializer
setTimeoutInterval
:
timeout
];
}
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
sessionManager
];
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
sessionManager
isUseClientAuth
:
isUseClientAuth
];
}];
if
(
filePaths
!=
nil
&&
filePaths
.
count
>
0
)
{
...
...
@@ -461,7 +478,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
modelClass
:
model
success
:
success
failure
:
failure
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
isUseClientAuth
:
NO
];
NSString
*
method
=
httpMethod
==
KWMHTTPMethodPOST
?
@"POST"
:
@"GET"
;
NSURLRequest
*
request
=
[
sessionManager
.
requestSerializer
requestWithMethod
:
method
URLString
:
apiPath
parameters
:
parameters
error
:
nil
];
__block
id
task
=
[
sessionManager
dataTaskWithRequest
:
request
completionHandler
:
^
(
NSURLResponse
*
_Nonnull
response
,
id
_Nullable
responseObject
,
NSError
*
_Nullable
error
)
{
...
...
@@ -1131,7 +1148,25 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure
:
failure
];
}
/**
* 清空愿望单 API
* @param customer_id 用户ID
* @param customer_email 用户邮箱
* @param shop 店铺名(cemarose-test.myshopify.com)
*/
-
(
NSURLSessionDataTask
*
)
getOrderList
:
(
NSDictionary
*
)
parameters
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
{
NSString
*
apiPath
=
[
NSString
stringWithFormat
:
@"https://%@/customer/orders/custom-orders"
,
WishList_API_DOMAIN
];
apiPath
=
@"https://peter.tofnews.com/customer/orders/custom-orders"
;
return
[
self
startSessionTask
:
KWMHTTPMethodGET
apiPath
:
apiPath
parameters
:
parameters
result
:
[
KWMOrderListResult
class
]
model
:
[
BUYOrder
class
]
success
:
success
failure
:
failure
];
}
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/Api/KWMCheckoutPayResult.m
View file @
e3ae9c68
...
...
@@ -42,6 +42,8 @@
return
result
;
}
+
(
JSONKeyMapper
*
)
keyMapper
{
return
[
JSONKeyMapper
mapperFromUnderscoreCaseToCamelCase
];
}
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Brand/Brand.storyboard
View file @
e3ae9c68
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13
196
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13
529
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13
174
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13
527
"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<customFonts
key=
"customFonts"
>
...
...
@@ -197,14 +197,6 @@
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"default"
rowHeight=
"44"
sectionHeaderHeight=
"28"
sectionFooterHeight=
"28"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"gJI-aS-DRK"
>
<rect
key=
"frame"
x=
"0.0"
y=
"65"
width=
"375"
height=
"602"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<view
key=
"tableHeaderView"
contentMode=
"scaleToFill"
id=
"k52-E9-JpG"
userLabel=
"vLine"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"375"
height=
"5"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"backgroundColor"
red=
"0.82461414700000002"
green=
"0.82461414700000002"
blue=
"0.82461414700000002"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"5"
id=
"clL-qM-kLl"
/>
</constraints>
</view>
<connections>
<outlet
property=
"dataSource"
destination=
"dZB-o0-0V5"
id=
"av9-pj-b89"
/>
<outlet
property=
"delegate"
destination=
"dZB-o0-0V5"
id=
"eFV-p7-3lX"
/>
...
...
@@ -235,7 +227,6 @@
<connections>
<outlet
property=
"tbvSearchBrand"
destination=
"gJI-aS-DRK"
id=
"dl1-OG-S3y"
/>
<outlet
property=
"vBackground"
destination=
"Tbn-TE-Ey2"
id=
"exj-ix-Ign"
/>
<outlet
property=
"vLine"
destination=
"k52-E9-JpG"
id=
"3of-VM-esW"
/>
</connections>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"nbs-Cn-9zP"
userLabel=
"First Responder"
sceneMemberID=
"firstResponder"
/>
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/KWMBasePageVC.m
View file @
e3ae9c68
...
...
@@ -162,6 +162,9 @@
//数据为空的时候显示Loading框
if
([
self
.
targetTableView
respondsToSelector
:
@selector
(
numberOfSections
)])
{
NSInteger
sectionCount
=
[
self
.
targetTableView
numberOfSections
];
if
(
sectionCount
==
0
){
[
super
showLoading
];
}
for
(
NSInteger
i
=
0
;
i
<
sectionCount
;
i
++
){
if
([
self
.
targetTableView
numberOfRowsInSection
:
i
]
<=
0
){
[
super
showLoading
];
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Mine/Cell/KWMOrderCell.m
View file @
e3ae9c68
...
...
@@ -76,8 +76,12 @@
// self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:lineItem.price];
self
.
lbPrice
.
text
=
[[
KWMCurrencyUtil
sharedInstance
]
priceFormatted
:
lineItem
.
price
currencyCode
:
@"EUR"
];
self
.
lbName
.
text
=
lineItem
.
title
;
if
([
KWMStringUtil
isEmpty
:
lineItem
.
variantTitle
]){
self
.
lbSize
.
text
=
[
NSString
stringWithFormat
:
@"x%@"
,
lineItem
.
quantity
];
}
else
{
self
.
lbSize
.
text
=
[
NSString
stringWithFormat
:
@"x%@/%@"
,
lineItem
.
quantity
,
lineItem
.
variantTitle
];
}
}
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Mine/Cell/KWMOrderCell.xib
View file @
e3ae9c68
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
2120"
systemVersion=
"16F73
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
3529
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"1
2088
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"1
3527
"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<customFonts
key=
"customFonts"
>
<array
key=
"PingFang.ttc"
>
<string>
PingFangSC-Regular
</string>
</array>
</customFonts>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
...
...
@@ -112,13 +117,13 @@
</constraints>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"CAMAREL"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"McB-3J-L1c"
>
<rect
key=
"frame"
x=
"109"
y=
"5"
width=
"
69.5
"
height=
"18"
/>
<rect
key=
"frame"
x=
"109"
y=
"5"
width=
"
256
"
height=
"18"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"15"
/>
<color
key=
"textColor"
red=
"0.30588235294117649"
green=
"0.30588235294117649"
blue=
"0.30588235294117649"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<nil
key=
"highlightedColor"
/>
</label>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"x1/2A/藏青"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"gA4-v1-va1"
>
<rect
key=
"frame"
x=
"109"
y=
"50.5"
width=
"60
.5
"
height=
"14.5"
/>
<rect
key=
"frame"
x=
"109"
y=
"50.5"
width=
"60"
height=
"14.5"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"12"
/>
<color
key=
"textColor"
red=
"0.30588235289999999"
green=
"0.30588235289999999"
blue=
"0.30588235289999999"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<nil
key=
"highlightedColor"
/>
...
...
@@ -136,6 +141,7 @@
<constraint
firstItem=
"z2N-M1-Gfa"
firstAttribute=
"bottom"
secondItem=
"nIn-Ka-NkB"
secondAttribute=
"bottom"
id=
"574-Ns-CTp"
/>
<constraint
firstAttribute=
"height"
constant=
"80"
id=
"5sn-3g-rcJ"
/>
<constraint
firstItem=
"gA4-v1-va1"
firstAttribute=
"bottom"
secondItem=
"nIn-Ka-NkB"
secondAttribute=
"bottom"
id=
"6ui-1w-H10"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"McB-3J-L1c"
secondAttribute=
"trailing"
constant=
"10"
id=
"N8P-W1-4mc"
/>
<constraint
firstItem=
"nIn-Ka-NkB"
firstAttribute=
"leading"
secondItem=
"ijW-ut-DIo"
secondAttribute=
"leading"
constant=
"27"
id=
"dfp-Nc-CW8"
/>
<constraint
firstItem=
"nIn-Ka-NkB"
firstAttribute=
"top"
secondItem=
"ijW-ut-DIo"
secondAttribute=
"top"
constant=
"5"
id=
"dsB-67-ssI"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"z2N-M1-Gfa"
secondAttribute=
"trailing"
constant=
"27"
id=
"fuI-TM-gUP"
/>
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Mine/KWMOrderVC.h
View file @
e3ae9c68
...
...
@@ -7,11 +7,13 @@
//
#import "KWMBaseVC.h"
#import "KWMBasePageVC.h"
#import "KWMOrderCell.h"
@interface
KWMOrderVC
:
KWMBase
VC
<
UITableViewDelegate
,
UITableViewDataSource
,
KWMOrderCellDelegate
>
@interface
KWMOrderVC
:
KWMBase
PageVC
<
KWMOrderCellDelegate
>
@property
(
weak
,
nonatomic
)
IBOutlet
UITableView
*
tbvOrder
;
@property
(
nonatomic
)
BUYCheckout
*
paidCheckout
;
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Mine/KWMOrderVC.m
View file @
e3ae9c68
...
...
@@ -11,15 +11,14 @@
#import "KWMNewProductVC.h"
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "MJRefresh.h"
@interface
KWMOrderVC
()
@property
(
nonatomic
)
NSMutableArray
<
BUYOrder
*>
*
orderList
;
//订单列表
@property
(
nonatomic
)
NSMutableArray
*
productList
;
//订单商品列表
@property
(
nonatomic
)
NSMutableArray
*
expandOrderId
;
//标记展开的section
@end
@implementation
KWMOrderVC
{
NSMutableArray
*
sectionArr
;
//标记展开的section
}
+
(
NSString
*
)
kwmTag
{
...
...
@@ -30,89 +29,146 @@
[
super
awakeFromNib
];
self
.
title
=
@"我的订单"
;
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
NO
];
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
self
.
orderList
=
[
NSMutableArray
array
];
[
self
setUpData
];
}
-
(
void
)
setUpData
{
self
.
productList
=
[
NSMutableArray
array
];
sectionArr
=
[
NSMutableArray
array
];
[
self
requestOrderAPI
];
self
.
expandOrderId
=
[
NSMutableArray
array
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
-
(
void
)
loadData
{
[
self
requestNewOrderAPI
];
}
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
self
.
orderList
.
count
;
-
(
UITableView
*
)
targetTableView
{
return
self
.
tbvOrder
;
}
-
(
BUYOrder
*
)
getPaidOrder
{
if
(
self
.
paidCheckout
){
BUYOrder
*
order
=
[[
BUYOrder
alloc
]
init
];
order
.
checkout
=
self
.
paidCheckout
;
order
.
lineItems
=
self
.
paidCheckout
.
lineItems
;
order
.
totalPrice
=
self
.
paidCheckout
.
totalPrice
;
return
order
;
}
else
{
return
nil
;
}
}
-
(
NSString
*
)
getProductImage
:
(
NSNumber
*
)
productId
{
NSString
*
productImage
=
@""
;
if
(
productId
){
for
(
BUYProduct
*
product
in
self
.
productList
){
if
([
product
.
identifier
isEqualToNumber
:
productId
]){
productImage
=
[
KWMImageUtil
getProductImageUrl
:
product
ImageSize
:
LowImage
];
}
}
}
return
productImage
;
}
-
(
BOOL
)
isContainId
:
(
NSArray
*
)
productIds
productId
:
(
NSNumber
*
)
productId
{
for
(
NSNumber
*
mProductId
in
productIds
){
if
([
mProductId
isEqualToNumber
:
productId
]){
return
YES
;
}
}
return
NO
;
}
//每一个section有多少行
-
(
NSInteger
)
getRowCountBySection
:
(
NSInteger
)
section
{
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
section
];
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
return
arr
?
arr
.
count
:
0
;
}
//将商品数量小于4的订单(完全展开的订单)添加到openSection中
-
(
void
)
refreshOpenSection
:
(
NSArray
<
BUYOrder
*>
*
)
array
{
if
(
!
array
){
return
;
}
for
(
BUYOrder
*
order
in
array
){
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
if
(
arr
&&
arr
.
count
>
4
){
return
;
}
else
if
(
order
.
identifier
&&
!
[
self
.
expandOrderId
containsObject
:
order
.
identifier
]){
[
self
.
expandOrderId
addObject
:
order
.
identifier
];
}
}
}
#pragma mark -- UITableView Delegate
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
self
.
dataList
.
count
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
BUYOrder
*
order
=
[
self
.
orderList
objectAtIndex
:
section
];
bool
isExpend
=
YES
;
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
section
];
NSArray
<
BUYLineItem
*>
*
lineItems
=
[
order
.
lineItems
array
];
bool
isShowOther
=
[
sectionArr
containsObject
:[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
section
]];
if
(
order
.
identifier
){
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
if
(
!
lineItems
){
return
0
;
}
if
(
!
is
ShowOther
&&
lineItems
.
count
>=
4
){
if
(
!
is
Expend
&&
lineItems
.
count
>=
4
){
return
4
;
}
return
lineItems
.
count
;
}
//每一个section有多少行
-
(
NSInteger
)
returnSectionRow
:
(
NSInteger
)
section
{
BUYOrder
*
order
=
[
self
.
orderList
objectAtIndex
:
section
];
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
return
arr
?
arr
.
count
:
0
;
}
#pragma mark UITableViewDelegate
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
//总高度200,头部80,底部按钮40
//如果是尾行
bool
isShowOther
=
[
sectionArr
containsObject
:[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
indexPath
.
section
]];
if
(
indexPath
.
row
==
3
&&
!
isShowOther
){
//return 200-80;
return
165
-
45
;
}
NSInteger
allRow
=
[
self
returnSectionRow
:
indexPath
.
section
];
if
(
indexPath
.
row
==
(
allRow
-
1
)
&&
allRow
>
4
)
{
//最后一行
//return 200-80;
return
165
-
45
;
}
//如果是首行
if
(
indexPath
.
row
==
0
){
//return 200-40;
return
165
-
40
;
}
//如果是中间几行
//return 200 - 80 -40;
return
165
-
45
-
40
;
bool
isExpend
=
YES
;
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
indexPath
.
section
];
if
(
order
.
identifier
){
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
NSInteger
rowCount
=
[
self
getRowCountBySection
:
indexPath
.
section
];
NSInteger
lastRow
=
rowCount
-
1
;
NSInteger
firstRow
=
0
;
CGFloat
h
=
165
;
CGFloat
head
=
45
;
CGFloat
bot
=
40
;
if
(
indexPath
.
row
==
3
&&
!
isExpend
){
return
h
-
head
;
}
if
(
indexPath
.
row
==
lastRow
&&
rowCount
>
4
){
return
h
-
head
;
}
if
(
indexPath
.
row
==
firstRow
){
return
h
-
bot
;
}
return
h
-
head
-
bot
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
NSString
*
indentifier
=
@"KWMOrderCell"
;
bool
isExpend
=
YES
;
KWMOrderCell
*
orderCell
=
[
tableView
dequeueReusableCellWithIdentifier
:
indentifier
];
if
(
!
orderCell
)
{
[
tableView
registerNib
:[
UINib
nibWithNibName
:
indentifier
bundle
:
nil
]
forCellReuseIdentifier
:
indentifier
];
orderCell
=
[
tableView
dequeueReusableCellWithIdentifier
:
indentifier
];
}
//设置cell图片为默认图
orderCell
.
ivImage
.
image
=
[
UIImage
imageNamed
:
@"ic_loading"
];
orderCell
.
markSection
=
indexPath
.
section
;
bool
isShowOther
=
[
sectionArr
containsObject
:[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
indexPath
.
section
]];
BUYOrder
*
order
=
[
self
.
orderList
objectAtIndex
:
indexPath
.
section
];
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
indexPath
.
section
];
if
(
order
.
identifier
){
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
if
(
!
arr
){
return
orderCell
;
...
...
@@ -120,28 +176,29 @@
BUYLineItem
*
lineItem
=
[
arr
objectAtIndex
:
indexPath
.
row
];
orderCell
.
lineItem
=
lineItem
;
//当前section行数
orderCell
.
lineCount
=
[
self
returnSectionRow
:
indexPath
.
section
];
orderCell
.
order
=
[
self
.
order
List
objectAtIndex
:
indexPath
.
section
];
orderCell
.
lineCount
=
[
self
getRowCountBySection
:
indexPath
.
section
];
orderCell
.
order
=
[
self
.
data
List
objectAtIndex
:
indexPath
.
section
];
orderCell
.
markSection
=
indexPath
.
section
;
orderCell
.
imageUrl
=
[
self
getProductImage
:
lineItem
.
productId
];
[
orderCell
updateUI
:
indexPath
.
row
productCount
:
arr
.
count
showAll
:
isShowOther
];
[
orderCell
updateUI
:
indexPath
.
row
productCount
:
arr
.
count
showAll
:
isExpend
];
orderCell
.
delegate
=
self
;
return
orderCell
;
}
#pragma mark -- KWMOrderCellDelegate
-
(
void
)
kwm_onClickShowAllWith
:
(
NSInteger
)
markSection
And
:
(
BOOL
)
showAll
{
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
markSection
];
if
(
order
.
identifier
){
if
(
showAll
)
{
[
sectionArr
removeObject
:[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
markSection
]
];
[
self
.
expandOrderId
removeObject
:
order
.
identifier
];
}
else
{
[
sectionArr
addObject
:[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
markSection
]];
[
self
.
expandOrderId
addObject
:
order
.
identifier
];
}
}
[
self
.
tbvOrder
reloadData
];
}
-
(
void
)
kwm_onClickProduct
:
(
NSNumber
*
)
productId
{
// KWMProductDetailVC *productDetailVC = (KWMProductDetailVC *)[KWMProductDetailVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
KWMNewProductVC
*
productDetailVC
=
[
KWMNewProductVC
getNewInstance
];
productDetailVC
.
productId
=
productId
;
[
self
.
navigationController
pushViewController
:
productDetailVC
animated
:
YES
];
...
...
@@ -152,60 +209,88 @@
}
-
(
void
)
kwm_onClickCancelOrder
:
(
BUYOrder
*
)
order
{
if
(
order
){
// [self requestCancelOrder:order.identifier];
//取消订单前先获取订单状态,因为取消订单api,暂不可使用,所以隐藏取消api按钮
[
self
requestOrderStatus
:
order
.
identifier
];
}
}
-
(
NSString
*
)
getProductImage
:
(
NSNumber
*
)
productId
{
NSString
*
productImage
=
@""
;
if
(
productId
){
for
(
BUYProduct
*
product
in
self
.
productList
){
if
([
product
.
identifier
isEqualToNumber
:
productId
]){
productImage
=
[
KWMImageUtil
getProductImageUrl
:
product
ImageSize
:
LowImage
];
#pragma mark -- API
//获取全部订单API
-
(
void
)
requestNewOrderAPI
{
[
self
showLoading
];
__weak
KWMOrderVC
*
weakSelf
=
self
;
NSInteger
targetPage
=
self
.
currentPage
.
integerValue
+
1
;
self
.
tbvOrder
.
mj_footer
.
hidden
=
YES
;
NSDictionary
*
parameters
=
@{
@"page"
:
@
(
targetPage
).
stringValue
};
[
self
.
api
getOrderList
:
parameters
success
:
^
(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
)
{
[
weakSelf
hideLoading
];
if
(
!
result
.
code
||
result
.
code
.
integerValue
!=
1000
){
if
(
result
.
message
){
[
weakSelf
showToast
:
result
.
message
];
}
return
;
}
if
(
result
.
data
)
{
NSMutableArray
*
showOrders
=
[
NSMutableArray
arrayWithArray
:
result
.
data
];
BUYOrder
*
paidOrder
=
[
self
getPaidOrder
];
if
(
paidOrder
&&
targetPage
==
1
){
[
showOrders
insertObject
:
paidOrder
atIndex
:
0
];
}
return
productImage
;
}
-
(
BOOL
)
isContainId
:
(
NSArray
*
)
productIds
productId
:
(
NSNumber
*
)
productId
{
for
(
NSNumber
*
mProductId
in
productIds
){
if
([
mProductId
isEqualToNumber
:
productId
]){
return
YES
;
// if(showOrders.count <= 50){
// weakSelf.hasNextPage = false;
// weakSelf.tbvOrder.mj_footer.hidden = YES;
// }else{
// weakSelf.hasNextPage = true;
// weakSelf.tbvOrder.mj_footer.hidden = NO;
// }
if
(
targetPage
==
1
){
[
weakSelf
.
dataList
removeAllObjects
];
[
self
.
expandOrderId
removeAllObjects
];
}
[
weakSelf
refreshOpenSection
:
showOrders
];
[
weakSelf
appendDataList
:
showOrders
setPage
:
targetPage
];
[
weakSelf
requestProductsApi
];
}
return
NO
;
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
[
weakSelf
hideLoading
];
[
weakSelf
showError
:
error
];
}];
}
//获取订单API
-
(
void
)
requestOrderAPI
{
[
self
showLoading
];
//
[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
)
{
[
weakSelf
.
orderList
removeAllObjects
];
[
weakSelf
.
orderList
addObjectsFromArray
:
orders
];
[
weakSelf
.
tbvOrder
reloadData
];
[
weakSelf
requestProductsApi
];
}
else
if
(
error
!=
nil
){
[
weakSelf
showError
:
error
];
}
// [weakSelf hideLoading];
// NSMutableArray *showOrders = [NSMutableArray arrayWithArray:orders];
// if (error == nil && orders != nil ) {
// BUYOrder *paidOrder = [self getPaidOrder];
// if(paidOrder){
// [showOrders insertObject:paidOrder atIndex:0];
// }
// [weakSelf.dataList removeAllObjects];
// [weakSelf refreshOpenSection:showOrders];
// [weakSelf appendDataList:showOrders setPage:1];
// weakSelf.hasNextPage = false;
// [weakSelf requestProductsApi];
// }else if (error != nil){
// [weakSelf showError:error];
// }
}];
}
//获取订单商品列表,从而拿到图片(因为订单api返回的订单数据中没有商品图片数据)
-
(
void
)
requestProductsApi
{
if
(
!
self
.
order
List
){
if
(
!
self
.
data
List
){
return
;
}
NSMutableArray
*
productIds
=
[
NSMutableArray
array
];
for
(
BUYOrder
*
order
in
self
.
order
List
){
for
(
BUYOrder
*
order
in
self
.
data
List
){
NSArray
*
lineItems
=
order
.
lineItemsArray
;
if
(
lineItems
){
for
(
BUYLineItem
*
lineItem
in
lineItems
){
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/Mine/Mine.storyboard
View file @
e3ae9c68
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"1
2120"
systemVersion=
"16G
29"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"1
35
29"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"1
2088
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"1
3527
"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<customFonts
key=
"customFonts"
>
<array
key=
"PingFang.ttc"
>
<string>
PingFangSC-Regular
</string>
</array>
</customFonts>
<scenes>
<!--OrderVC-->
<scene
sceneID=
"sv6-Dq-cKt"
>
...
...
@@ -22,14 +27,14 @@
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Dkl-7G-f7l"
userLabel=
"vLine"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
64
"
width=
"375"
height=
"1"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
20
"
width=
"375"
height=
"1"
/>
<color
key=
"backgroundColor"
red=
"0.82338023559999995"
green=
"0.82338023559999995"
blue=
"0.82338023559999995"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"1"
id=
"r0c-J0-ZXk"
/>
</constraints>
</view>
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"none"
allowsSelection=
"NO"
rowHeight=
"44"
sectionHeaderHeight=
"28"
sectionFooterHeight=
"28"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"YW5-m6-sF5"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
65"
width=
"375"
height=
"602
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
20"
width=
"375"
height=
"647
"
/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<connections>
<outlet
property=
"dataSource"
destination=
"fub-2P-w8Y"
id=
"rlF-zh-XLR"
/>
...
...
@@ -40,13 +45,13 @@
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<constraints>
<constraint
firstItem=
"YW5-m6-sF5"
firstAttribute=
"leading"
secondItem=
"Puz-FY-kmG"
secondAttribute=
"leading"
id=
"1eF-y4-KbG"
/>
<constraint
firstItem=
"
YW5-m6-sF5"
firstAttribute=
"top"
secondItem=
"Puz-FY-kmG"
secondAttribute=
"top"
constant=
"65"
id=
"7DW-9k-7vn
"
/>
<constraint
first
Attribute=
"bottom"
secondItem=
"YW5-m6-sF5"
secondAttribute=
"bottom"
id=
"8eD-ia-gT
T"
/>
<constraint
firstItem=
"
D4p-vJ-TZ7"
firstAttribute=
"top"
secondItem=
"YW5-m6-sF5"
secondAttribute=
"bottom"
id=
"EnE-Ux-wNa
"
/>
<constraint
first
Item=
"Dkl-7G-f7l"
firstAttribute=
"top"
secondItem=
"y2z-ec-nhN"
secondAttribute=
"bottom"
id=
"RQa-Q0-oy
T"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"YW5-m6-sF5"
secondAttribute=
"trailing"
id=
"Sp2-MW-ldC"
/>
<constraint
firstItem=
"YW5-m6-sF5"
firstAttribute=
"top"
secondItem=
"y2z-ec-nhN"
secondAttribute=
"bottom"
id=
"Tp4-49-Kch"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"Dkl-7G-f7l"
secondAttribute=
"trailing"
id=
"qgL-EZ-hOo"
/>
<constraint
firstItem=
"Dkl-7G-f7l"
firstAttribute=
"leading"
secondItem=
"Puz-FY-kmG"
secondAttribute=
"leading"
id=
"r6y-XY-UDI"
/>
<constraint
firstItem=
"
Dkl-7G-f7l"
firstAttribute=
"top"
secondItem=
"Puz-FY-kmG"
secondAttribute=
"top"
constant=
"64"
id=
"rkJ-xF-SNd
"
/>
<constraint
firstItem=
"
YW5-m6-sF5"
firstAttribute=
"top"
secondItem=
"y2z-ec-nhN"
secondAttribute=
"bottom"
id=
"tkN-kt-ssY
"
/>
</constraints>
<variation
key=
"default"
>
<mask
key=
"constraints"
>
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
e3ae9c68
...
...
@@ -61,6 +61,8 @@ typedef enum{
@property
(
nonatomic
)
NSMutableDictionary
*
dataMapping
;
@property
(
nonatomic
)
BOOL
isRefreshUI
;
//@property(nonatomic) NSString *clotingSetsHandle;
@end
...
...
@@ -77,7 +79,6 @@ typedef enum{
self
.
page
=
1
;
// [self requestProduct:@""];
[
self
loadHomeData
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
...
...
@@ -89,6 +90,11 @@ typedef enum{
[
self
.
titleView
resumeView
];
}
[
self
.
cvHome
reloadData
];
if
(
self
.
isRefreshUI
){
self
.
isRefreshUI
=
YES
;
}
else
{
[
self
loadHomeData
];
}
}
-
(
void
)
viewDidDisappear
:
(
BOOL
)
animated
{
...
...
@@ -331,44 +337,22 @@ typedef enum{
}
#pragma makr - api
//- (void)requestProduct:(NSString *)tag{
// NSMutableArray *tags = nil;
// if(tag){
// tags = [NSMutableArray array];
// [tags addObject:tag];
// }
//
// __weak KWMNewHomeVC *weakSelf = self;
// [self showLoading];
// [self.client getProductsPage:1 inCollection:@(Collection_All_ID) withTags:tags sortOrder:BUYCollectionSortBestSelling completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
// [weakSelf hideLoading];
// if(error){
// [weakSelf showError:error];
// }
// else if(products && products.count>0){
// weakSelf.productArray = products;
// [weakSelf.cvHome reloadData];
//// [weakSelf initTestData];
// }
// }];
//}
-
(
void
)
requestProductWithHandle
:
(
NSString
*
)
handle
tags
:
(
NSArray
*
)
tags
valueKeyPath
:
(
NSString
*
)
valueKeyPath
{
[
self
showLoading
];
BOOL
isHome
=
[
handle
isEqualToString
:
@"products-list-app-homepage"
];
NSInteger
cpage
=
isHome
?
self
.
page
:
1
;
NSDictionary
*
parameters
=
[
self
getProductCacheKeyDictionary
:
cpage
tags
:
tags
handle
:
handle
];
BOOL
isUseCache
=
[
self
isUseProductDataCache
:
parameters
valueKeyPath
:
valueKeyPath
page
:
cpage
isHome
:
isHome
];
if
(
!
self
.
isRefreshUI
){
BOOL
useHomeDataCache
=
[
self
useProductDataCache
:
parameters
valueKeyPath
:
valueKeyPath
page
:
cpage
isHome
:
isHome
];
}
[
self
.
client
getCollectionByHandle
:
handle
completion
:
^
(
BUYCollection
*
_Nullable
collection
,
NSError
*
_Nullable
error
)
{
[
self
hideLoading
];
if
(
!
error
)
{
[
self
.
client
getProductsPage
:
cpage
inCollection
:
collection
.
identifier
withTags
:
tags
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
_Nullable
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
_Nullable
error
)
{
if
(
!
error
)
{
[
KWMPPCacheUtil
saveDataToCache
:
parameters
urlKey
:
CACHE_KEY_SDK_getCollectionByHandle_getProductsPage
products
:
products
];
if
(
!
isUseCache
){
[
self
setValue
:
products
forKeyPath
:
valueKeyPath
];
[
self
.
cvHome
reloadData
];
}
}
else
{
// [self showError:error];
}
...
...
@@ -383,33 +367,15 @@ typedef enum{
}];
}
//- (void) requestProductWithId:(NSNumber *) identifier tags:(NSArray *) tags valueKeyPath:(NSString *) valueKeyPath home:(BOOL) isHome page:(NSInteger) cpage{
// [self showLoading];
// [self.client getProductsPage:cpage inCollection:identifier withTags:tags sortOrder:BUYCollectionSortCollectionDefault completion:^(NSArray<BUYProduct *> * _Nullable products, NSUInteger page, BOOL reachedEnd, NSError * _Nullable error) {
// [self hideLoading];
//
// if (!error) {
// [self setValue:products forKeyPath:valueKeyPath];
// [self.cvHome reloadData];
// }else{
// [self showError:error];
// }
// if (isHome) {
// self.page = self.page + 1;
// products.count ? [self.cvHome.mj_footer endRefreshing] : [self.cvHome.mj_footer endRefreshingWithNoMoreData];
// }
// }];
//}
-
(
void
)
loadHomeData
{
-
(
void
)
loadHomeData
{
[
self
requestProductWithHandle
:
@"hot-sell-app"
tags
:
nil
valueKeyPath
:
@"recommendHeader.productArray"
];
BOOL
isUseCache
=
[
self
isUseHomeDataCache
];
if
(
!
self
.
isRefreshUI
){
BOOL
useCache
=
[
self
useHomeDataCache
];
}
[
self
.
api
getHomeDataWithSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMHomeDataResult
*
result
)
{
[
KWMPPCacheUtil
saveDataToCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
homeData
:
result
.
data
];
if
(
!
isUseCache
){
self
.
homeData
=
result
.
data
;
[
self
.
cvHome
reloadData
];
}
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// [self showError:error];
}];
...
...
@@ -460,17 +426,15 @@ typedef enum{
#pragma mark -cache
/** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isUseHomeDataCache
{
if
(
!
kIsNetwork
){
-
(
BOOL
)
useHomeDataCache
{
KWMHomeData
*
homeData
=
[
KWMPPCacheUtil
getHomeDataByCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
];
if
(
homeData
){
self
.
homeData
=
homeData
;
[
self
.
cvHome
reloadData
];
return
true
;
}
else
{
return
false
;
}
}
return
!
kIsNetwork
;
}
//初始化缓存parameters key
...
...
@@ -491,8 +455,8 @@ typedef enum{
}
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isU
seProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
if
(
!
kIsNetwork
){
-
(
BOOL
)
u
seProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
if
(
!
kIsNetwork
||
page
==
1
){
[
self
hideLoading
];
NSArray
*
products
=
[
KWMPPCacheUtil
getProductDataByCache
:
cacheKeyDictionary
urlKey
:
CACHE_KEY_SDK_getCollectionByHandle_getProductsPage
];
if
(
products
&&
products
.
count
>
0
){
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
e3ae9c68
...
...
@@ -128,13 +128,12 @@
-
(
void
)
initBottomViewHidden
{
if
(
self
.
product
){
NSString
*
productVendor
=
self
.
product
.
vendor
;
NSString
*
targetVendor
=
@"Moncler"
;
NSString
*
productVendor
=
self
.
product
.
vendor
?:
@""
;
productVendor
=
[
productVendor
lowercaseString
];
NSString
*
targetVendor
=
@"moncler"
;
BOOL
isShowContactUs
=
[
productVendor
isEqualToString
:
targetVendor
];
self
.
vBottomBar
.
hidden
=
isShowContactUs
;
self
.
btnContactUs
.
hidden
=
!
isShowContactUs
;
self
.
vBottomBar
.
hidden
=
NO
;
}
}
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
View file @
e3ae9c68
...
...
@@ -736,6 +736,7 @@
-
(
void
)
paySuccess
{
[
self
clearCheckout
];
KWMPaySuccessVC
*
successVC
=
(
KWMPaySuccessVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMPaySuccessVC
kwmTag
]
fromStoryboard
:
@"ShopCart"
];
successVC
.
paidCheckout
=
self
.
checkout
;
[
self
.
navigationController
pushViewController
:
successVC
animated
:
YES
];
}
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/ShopCart/KWMPaySuccessVC.h
View file @
e3ae9c68
...
...
@@ -22,4 +22,7 @@
-
(
IBAction
)
onClickMyOrder
:(
id
)
sender
;
//用于在跳转后的订单列表页面生成即时订单(支付后的订单需要一定时间后才能从订单列表获取)
@property
(
nonatomic
)
BUYCheckout
*
paidCheckout
;
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/ShopCart/KWMPaySuccessVC.m
View file @
e3ae9c68
...
...
@@ -66,6 +66,7 @@
-
(
void
)
onClickMyOrder
:
(
id
)
sender
{
KWMOrderVC
*
orderVC
=
(
KWMOrderVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMOrderVC
kwmTag
]
fromStoryboard
:
@"Mine"
];
orderVC
.
paidCheckout
=
self
.
paidCheckout
;
[
self
.
navigationController
pushViewController
:
orderVC
animated
:
YES
];
}
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/ShopCart/ShopCart.storyboard
View file @
e3ae9c68
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13
196
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13
529
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13
174
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13
527
"
/>
<capability
name=
"Constraints with non-1.0 multipliers"
minToolsVersion=
"5.1"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
...
...
@@ -1646,7 +1646,7 @@
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"puG-Vo-gdd"
>
<rect
key=
"frame"
x=
"0.0"
y=
"2
59"
width=
"375"
height=
"15
0"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"2
24"
width=
"375"
height=
"22
0"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"你可能关心的问题"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"T4V-4O-WbC"
>
<rect
key=
"frame"
x=
"128"
y=
"0.0"
width=
"120"
height=
"21"
/>
...
...
@@ -1682,7 +1682,7 @@
<action
selector=
"onClickGetTime:"
destination=
"iFV-ZT-0zX"
eventType=
"touchUpInside"
id=
"27h-gg-ltV"
/>
</connections>
</button>
<button
hidden=
"YES"
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"3ni-BC-6WW"
>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"3ni-BC-6WW"
>
<rect
key=
"frame"
x=
"132"
y=
"177"
width=
"110"
height=
"26"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"110"
id=
"N0D-kQ-eGq"
/>
...
...
@@ -1704,7 +1704,7 @@
<constraint
firstItem=
"3ni-BC-6WW"
firstAttribute=
"centerX"
secondItem=
"puG-Vo-gdd"
secondAttribute=
"centerX"
id=
"CqI-1L-ERJ"
/>
<constraint
firstItem=
"3ni-BC-6WW"
firstAttribute=
"top"
secondItem=
"3iW-9e-nhE"
secondAttribute=
"bottom"
constant=
"35"
id=
"ISt-z3-thL"
/>
<constraint
firstItem=
"T4V-4O-WbC"
firstAttribute=
"centerX"
secondItem=
"puG-Vo-gdd"
secondAttribute=
"centerX"
id=
"MvE-KT-EgQ"
/>
<constraint
firstAttribute=
"height"
constant=
"
15
0"
id=
"Wbe-Fv-YHk"
/>
<constraint
firstAttribute=
"height"
constant=
"
22
0"
id=
"Wbe-Fv-YHk"
/>
<constraint
firstItem=
"3MF-En-1mW"
firstAttribute=
"top"
secondItem=
"T4V-4O-WbC"
secondAttribute=
"bottom"
constant=
"34"
id=
"b1r-Lb-cP7"
/>
<constraint
firstItem=
"3MF-En-1mW"
firstAttribute=
"centerX"
secondItem=
"puG-Vo-gdd"
secondAttribute=
"centerX"
id=
"sVI-Au-PtI"
/>
<constraint
firstItem=
"3iW-9e-nhE"
firstAttribute=
"top"
secondItem=
"3MF-En-1mW"
secondAttribute=
"bottom"
constant=
"35"
id=
"wpN-Nc-3yi"
/>
...
...
This diff is collapsed.
Click to expand it.
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