Commit e3ae9c68 by lee

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

parents 4a5ae8d8 9c04c731
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
C0028ECB1F0E2B3500744C14 /* KWMAdditionalListResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C0028ECA1F0E2B3500744C14 /* KWMAdditionalListResult.m */; }; C0028ECB1F0E2B3500744C14 /* KWMAdditionalListResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C0028ECA1F0E2B3500744C14 /* KWMAdditionalListResult.m */; };
C00D40941F187C9500DEA685 /* KWMCategoryTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C00D40931F187C9500DEA685 /* KWMCategoryTitleView.xib */; }; C00D40941F187C9500DEA685 /* KWMCategoryTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C00D40931F187C9500DEA685 /* KWMCategoryTitleView.xib */; };
C00D40971F187CAB00DEA685 /* KWMCategoryTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = C00D40961F187CAB00DEA685 /* KWMCategoryTitleView.m */; }; 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 */; }; C0219A951DF53EB200711099 /* KWMExchangeRateResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C0219A941DF53EB200711099 /* KWMExchangeRateResult.m */; };
C0243BBD1EFBD5A10013CFA7 /* Category.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0243BAF1EFBD5A10013CFA7 /* Category.storyboard */; }; C0243BBD1EFBD5A10013CFA7 /* Category.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0243BAF1EFBD5A10013CFA7 /* Category.storyboard */; };
C0243BBE1EFBD5A10013CFA7 /* KWMLeftCategoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0243BB21EFBD5A10013CFA7 /* KWMLeftCategoryCell.m */; }; C0243BBE1EFBD5A10013CFA7 /* KWMLeftCategoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0243BB21EFBD5A10013CFA7 /* KWMLeftCategoryCell.m */; };
...@@ -518,6 +519,8 @@ ...@@ -518,6 +519,8 @@
C00D40931F187C9500DEA685 /* KWMCategoryTitleView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMCategoryTitleView.xib; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; C0243BAF1EFBD5A10013CFA7 /* Category.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Category.storyboard; sourceTree = "<group>"; };
...@@ -1977,6 +1980,8 @@ ...@@ -1977,6 +1980,8 @@
9BE61D001ECD71610031D21E /* KWMCartResult.m */, 9BE61D001ECD71610031D21E /* KWMCartResult.m */,
DA4E36901F1613C70007E4D0 /* KWMHomeDataResult.h */, DA4E36901F1613C70007E4D0 /* KWMHomeDataResult.h */,
DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */, DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */,
C01573EF1FC7C674001ECACA /* KWMOrderListResult.h */,
C01573F01FC7C674001ECACA /* KWMOrderListResult.m */,
); );
path = Cemarose; path = Cemarose;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2782,6 +2787,7 @@ ...@@ -2782,6 +2787,7 @@
807AF4A41DC984950000A326 /* KWMBrandsResult.m in Sources */, 807AF4A41DC984950000A326 /* KWMBrandsResult.m in Sources */,
C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */, C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */,
C034E8471D6B10A0006EE129 /* UIColor+Extend.m in Sources */, C034E8471D6B10A0006EE129 /* UIColor+Extend.m in Sources */,
C01573F11FC7C674001ECACA /* KWMOrderListResult.m in Sources */,
DA7457681F692D67000E192E /* KWMProductSameBrandView.m in Sources */, DA7457681F692D67000E192E /* KWMProductSameBrandView.m in Sources */,
C0DD53351EE55190002D1E0C /* ArcToCircleLayer.m in Sources */, C0DD53351EE55190002D1E0C /* ArcToCircleLayer.m in Sources */,
C091EE361DDEEA9400A382B9 /* KWMVariants.m in Sources */, C091EE361DDEEA9400A382B9 /* KWMVariants.m in Sources */,
......
//
// 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
//
// 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
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#import "KWMWish.h" #import "KWMWish.h"
#import "KWMHomeDataResult.h" #import "KWMHomeDataResult.h"
#import "KWMDictionaryResult.h" #import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
...@@ -332,4 +333,12 @@ ...@@ -332,4 +333,12 @@
success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure; 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 @end
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#import "KWMBrandsTypeResult.h" #import "KWMBrandsTypeResult.h"
#import "KWMBrandsTypeModel.h" #import "KWMBrandsTypeModel.h"
#import "KWMDictionaryResult.h" #import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
#import <RegexKitLite/RegexKitLite.h> #import <RegexKitLite/RegexKitLite.h>
#import <SAMKeychain/SAMKeychain.h> #import <SAMKeychain/SAMKeychain.h>
#import "KWMUserModel.h" #import "KWMUserModel.h"
...@@ -233,10 +234,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -233,10 +234,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (AFHTTPSessionManager *)buildSessionManager{ - (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]; NSURL *url = [NSURL URLWithString:self.baseUrl];
AFHTTPSessionManager *sessionManager; AFHTTPSessionManager *sessionManager;
...@@ -267,9 +268,24 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -267,9 +268,24 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
else{ else{
[sessionManager.requestSerializer setAuthorizationHeaderFieldWithUsername:userName password:password]; [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; return sessionManager;
} }
-(BOOL)isUserClientAuth:(Class)result{
return result == [KWMOrderListResult class];
}
- (NSURLSessionDataTask *)startSessionTask:(KWMHTTPMethod)httpMethod - (NSURLSessionDataTask *)startSessionTask:(KWMHTTPMethod)httpMethod
...@@ -291,8 +307,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -291,8 +307,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
|| result == [KWMCheckoutPayResult class] || result == [KWMCheckoutPayResult class]
|| result == [KWMCemaroseResult class] || [result isSubclassOfClass:[KWMCemaroseResult class]]), || result == [KWMCemaroseResult class] || [result isSubclassOfClass:[KWMCemaroseResult class]]),
@"result class must either be KWMRequestResult or KWMRequestListResult!"); @"result class must either be KWMRequestResult or KWMRequestListResult!");
NSAssert((!model || (model && [model isSubclassOfClass:[JSONModel class]])), // NSAssert((!model || (model && [model isSubclassOfClass:[JSONModel class]])),
@"model class must be sub class of JSONModel"); // @"model class must be sub class of JSONModel");
BOOL isUseClientAuth = [self isUserClientAuth:result];
//使用sessionManager请求时用到的callback //使用sessionManager请求时用到的callback
void(^successCallback)(NSURLSessionDataTask *, id ) = [self buildSuccessCallbackWithResultClass:result void(^successCallback)(NSURLSessionDataTask *, id ) = [self buildSuccessCallbackWithResultClass:result
modelClass:model modelClass:model
...@@ -312,7 +329,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -312,7 +329,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
//使用PPNetworkHelper请求失败时用到的callback //使用PPNetworkHelper请求失败时用到的callback
void(^newFailedCallback)(NSError *error) = [self buildNewFaliedCallback:failure]; 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) { if (timeout) {
[sessionManager.requestSerializer setTimeoutInterval:timeout]; [sessionManager.requestSerializer setTimeoutInterval:timeout];
} }
...@@ -332,7 +349,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -332,7 +349,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
if (timeout) { if (timeout) {
[sessionManager.requestSerializer setTimeoutInterval:timeout]; [sessionManager.requestSerializer setTimeoutInterval:timeout];
} }
[self buildSessionManager:isJsonParameter afSessionManage:sessionManager]; [self buildSessionManager:isJsonParameter afSessionManage:sessionManager isUseClientAuth:isUseClientAuth];
}]; }];
if (filePaths != nil && filePaths.count > 0) { if (filePaths != nil && filePaths.count > 0) {
...@@ -461,7 +478,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -461,7 +478,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
modelClass:model modelClass:model
success:success success:success
failure:failure]; failure:failure];
AFHTTPSessionManager *sessionManager = [self buildSessionManager:NO afSessionManage:nil]; AFHTTPSessionManager *sessionManager = [self buildSessionManager:NO afSessionManage:nil isUseClientAuth:NO];
NSString *method = httpMethod == KWMHTTPMethodPOST ? @"POST" : @"GET"; NSString *method = httpMethod == KWMHTTPMethodPOST ? @"POST" : @"GET";
NSURLRequest *request = [sessionManager.requestSerializer requestWithMethod:method URLString:apiPath parameters:parameters error:nil]; 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) { __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"; ...@@ -1131,7 +1148,25 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure:failure]; 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];
}
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
return result; return result;
} }
+(JSONKeyMapper*)keyMapper {
return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}
@end @end
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<customFonts key="customFonts"> <customFonts key="customFonts">
...@@ -197,14 +197,6 @@ ...@@ -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"> <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"/> <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"/> <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> <connections>
<outlet property="dataSource" destination="dZB-o0-0V5" id="av9-pj-b89"/> <outlet property="dataSource" destination="dZB-o0-0V5" id="av9-pj-b89"/>
<outlet property="delegate" destination="dZB-o0-0V5" id="eFV-p7-3lX"/> <outlet property="delegate" destination="dZB-o0-0V5" id="eFV-p7-3lX"/>
...@@ -235,7 +227,6 @@ ...@@ -235,7 +227,6 @@
<connections> <connections>
<outlet property="tbvSearchBrand" destination="gJI-aS-DRK" id="dl1-OG-S3y"/> <outlet property="tbvSearchBrand" destination="gJI-aS-DRK" id="dl1-OG-S3y"/>
<outlet property="vBackground" destination="Tbn-TE-Ey2" id="exj-ix-Ign"/> <outlet property="vBackground" destination="Tbn-TE-Ey2" id="exj-ix-Ign"/>
<outlet property="vLine" destination="k52-E9-JpG" id="3of-VM-esW"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="nbs-Cn-9zP" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="nbs-Cn-9zP" userLabel="First Responder" sceneMemberID="firstResponder"/>
......
...@@ -162,6 +162,9 @@ ...@@ -162,6 +162,9 @@
//数据为空的时候显示Loading框 //数据为空的时候显示Loading框
if ([self.targetTableView respondsToSelector:@selector(numberOfSections)]) { if ([self.targetTableView respondsToSelector:@selector(numberOfSections)]) {
NSInteger sectionCount = [self.targetTableView numberOfSections]; NSInteger sectionCount = [self.targetTableView numberOfSections];
if(sectionCount == 0){
[super showLoading];
}
for(NSInteger i = 0; i < sectionCount; i++){ for(NSInteger i = 0; i < sectionCount; i++){
if([self.targetTableView numberOfRowsInSection:i] <= 0){ if([self.targetTableView numberOfRowsInSection:i] <= 0){
[super showLoading]; [super showLoading];
......
...@@ -76,7 +76,11 @@ ...@@ -76,7 +76,11 @@
// self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:lineItem.price]; // self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:lineItem.price];
self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormatted:lineItem.price currencyCode:@"EUR"]; self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormatted:lineItem.price currencyCode:@"EUR"];
self.lbName.text = lineItem.title; self.lbName.text = lineItem.title;
self.lbSize.text = [NSString stringWithFormat:@"x%@/%@",lineItem.quantity,lineItem.variantTitle]; if([KWMStringUtil isEmpty:lineItem.variantTitle]){
self.lbSize.text = [NSString stringWithFormat:@"x%@",lineItem.quantity];
}else{
self.lbSize.text = [NSString stringWithFormat:@"x%@/%@",lineItem.quantity,lineItem.variantTitle];
}
} }
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<customFonts key="customFonts">
<array key="PingFang.ttc">
<string>PingFangSC-Regular</string>
</array>
</customFonts>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
...@@ -112,13 +117,13 @@ ...@@ -112,13 +117,13 @@
</constraints> </constraints>
</imageView> </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"> <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"/> <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"/> <color key="textColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </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"> <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"/> <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"/> <color key="textColor" red="0.30588235289999999" green="0.30588235289999999" blue="0.30588235289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
...@@ -136,6 +141,7 @@ ...@@ -136,6 +141,7 @@
<constraint firstItem="z2N-M1-Gfa" firstAttribute="bottom" secondItem="nIn-Ka-NkB" secondAttribute="bottom" id="574-Ns-CTp"/> <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 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 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="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 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"/> <constraint firstAttribute="trailing" secondItem="z2N-M1-Gfa" secondAttribute="trailing" constant="27" id="fuI-TM-gUP"/>
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
// //
#import "KWMBaseVC.h" #import "KWMBaseVC.h"
#import "KWMBasePageVC.h"
#import "KWMOrderCell.h" #import "KWMOrderCell.h"
@interface KWMOrderVC : KWMBaseVC<UITableViewDelegate,UITableViewDataSource,KWMOrderCellDelegate> @interface KWMOrderVC : KWMBasePageVC<KWMOrderCellDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tbvOrder; @property (weak, nonatomic) IBOutlet UITableView *tbvOrder;
@property (nonatomic) BUYCheckout *paidCheckout;
@end @end
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<customFonts key="customFonts">
<array key="PingFang.ttc">
<string>PingFangSC-Regular</string>
</array>
</customFonts>
<scenes> <scenes>
<!--OrderVC--> <!--OrderVC-->
<scene sceneID="sv6-Dq-cKt"> <scene sceneID="sv6-Dq-cKt">
...@@ -22,14 +27,14 @@ ...@@ -22,14 +27,14 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dkl-7G-f7l" userLabel="vLine"> <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"/> <color key="backgroundColor" red="0.82338023559999995" green="0.82338023559999995" blue="0.82338023559999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="1" id="r0c-J0-ZXk"/> <constraint firstAttribute="height" constant="1" id="r0c-J0-ZXk"/>
</constraints> </constraints>
</view> </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"> <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"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections> <connections>
<outlet property="dataSource" destination="fub-2P-w8Y" id="rlF-zh-XLR"/> <outlet property="dataSource" destination="fub-2P-w8Y" id="rlF-zh-XLR"/>
...@@ -40,13 +45,13 @@ ...@@ -40,13 +45,13 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="YW5-m6-sF5" firstAttribute="leading" secondItem="Puz-FY-kmG" secondAttribute="leading" id="1eF-y4-KbG"/> <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 firstItem="D4p-vJ-TZ7" firstAttribute="top" secondItem="YW5-m6-sF5" secondAttribute="bottom" id="EnE-Ux-wNa"/>
<constraint firstAttribute="bottom" secondItem="YW5-m6-sF5" secondAttribute="bottom" id="8eD-ia-gTT"/> <constraint firstItem="Dkl-7G-f7l" firstAttribute="top" secondItem="y2z-ec-nhN" secondAttribute="bottom" id="RQa-Q0-oyT"/>
<constraint firstAttribute="trailing" secondItem="YW5-m6-sF5" secondAttribute="trailing" id="Sp2-MW-ldC"/> <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 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 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="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> </constraints>
<variation key="default"> <variation key="default">
<mask key="constraints"> <mask key="constraints">
......
...@@ -61,6 +61,8 @@ typedef enum{ ...@@ -61,6 +61,8 @@ typedef enum{
@property(nonatomic) NSMutableDictionary *dataMapping; @property(nonatomic) NSMutableDictionary *dataMapping;
@property(nonatomic) BOOL isRefreshUI;
//@property(nonatomic) NSString *clotingSetsHandle; //@property(nonatomic) NSString *clotingSetsHandle;
@end @end
...@@ -77,7 +79,6 @@ typedef enum{ ...@@ -77,7 +79,6 @@ typedef enum{
self.page = 1; self.page = 1;
// [self requestProduct:@""]; // [self requestProduct:@""];
[self loadHomeData]; [self loadHomeData];
} }
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillAppear:(BOOL)animated{
...@@ -89,6 +90,11 @@ typedef enum{ ...@@ -89,6 +90,11 @@ typedef enum{
[self.titleView resumeView]; [self.titleView resumeView];
} }
[self.cvHome reloadData]; [self.cvHome reloadData];
if(self.isRefreshUI){
self.isRefreshUI = YES;
}else{
[self loadHomeData];
}
} }
-(void)viewDidDisappear:(BOOL)animated{ -(void)viewDidDisappear:(BOOL)animated{
...@@ -331,44 +337,22 @@ typedef enum{ ...@@ -331,44 +337,22 @@ typedef enum{
} }
#pragma makr - api #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 { - (void) requestProductWithHandle:(NSString *) handle tags:(NSArray *) tags valueKeyPath:(NSString *) valueKeyPath {
[self showLoading]; [self showLoading];
BOOL isHome = [handle isEqualToString:@"products-list-app-homepage"]; BOOL isHome = [handle isEqualToString:@"products-list-app-homepage"];
NSInteger cpage = isHome ? self.page : 1; NSInteger cpage = isHome ? self.page : 1;
NSDictionary *parameters = [self getProductCacheKeyDictionary:cpage tags:tags handle:handle]; 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.client getCollectionByHandle:handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
[self hideLoading]; [self hideLoading];
if (!error) { 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) { [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) { if (!error) {
[KWMPPCacheUtil saveDataToCache:parameters urlKey:CACHE_KEY_SDK_getCollectionByHandle_getProductsPage products:products]; [KWMPPCacheUtil saveDataToCache:parameters urlKey:CACHE_KEY_SDK_getCollectionByHandle_getProductsPage products:products];
if(!isUseCache){ [self setValue:products forKeyPath:valueKeyPath];
[self setValue:products forKeyPath:valueKeyPath]; [self.cvHome reloadData];
[self.cvHome reloadData];
}
}else{ }else{
// [self showError:error]; // [self showError:error];
} }
...@@ -383,33 +367,15 @@ typedef enum{ ...@@ -383,33 +367,15 @@ typedef enum{
}]; }];
} }
//- (void) requestProductWithId:(NSNumber *) identifier tags:(NSArray *) tags valueKeyPath:(NSString *) valueKeyPath home:(BOOL) isHome page:(NSInteger) cpage{ - (void) loadHomeData{
// [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 {
[self requestProductWithHandle:@"hot-sell-app" tags:nil valueKeyPath:@"recommendHeader.productArray"]; [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) { [self.api getHomeDataWithSuccess:^(NSURLSessionDataTask *task, KWMHomeDataResult *result) {
[KWMPPCacheUtil saveDataToCache:nil urlKey:CACHE_KEY_getHomeDataWithSuccess homeData:result.data]; [KWMPPCacheUtil saveDataToCache:nil urlKey:CACHE_KEY_getHomeDataWithSuccess homeData:result.data];
if(!isUseCache){
self.homeData = result.data; self.homeData = result.data;
[self.cvHome reloadData]; [self.cvHome reloadData];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) { } failure:^(NSURLSessionDataTask *task, NSError *error) {
// [self showError:error]; // [self showError:error];
}]; }];
...@@ -460,17 +426,15 @@ typedef enum{ ...@@ -460,17 +426,15 @@ typedef enum{
#pragma mark -cache #pragma mark -cache
/** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/ /** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。 //缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-(BOOL)isUseHomeDataCache{ -(BOOL)useHomeDataCache{
if(!kIsNetwork){
KWMHomeData *homeData = [KWMPPCacheUtil getHomeDataByCache:nil urlKey:CACHE_KEY_getHomeDataWithSuccess]; KWMHomeData *homeData = [KWMPPCacheUtil getHomeDataByCache:nil urlKey:CACHE_KEY_getHomeDataWithSuccess];
if(homeData){ if(homeData){
self.homeData = homeData; self.homeData = homeData;
[self.cvHome reloadData]; [self.cvHome reloadData];
return true;
}else{ }else{
return false; return false;
} }
}
return !kIsNetwork;
} }
//初始化缓存parameters key //初始化缓存parameters key
...@@ -491,8 +455,8 @@ typedef enum{ ...@@ -491,8 +455,8 @@ typedef enum{
} }
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。 //缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-(BOOL)isUseProductDataCache:(NSDictionary *)cacheKeyDictionary valueKeyPath:(NSString *)valueKeyPath page:(NSUInteger)page isHome:(BOOL)isHome{ -(BOOL)useProductDataCache:(NSDictionary *)cacheKeyDictionary valueKeyPath:(NSString *)valueKeyPath page:(NSUInteger)page isHome:(BOOL)isHome{
if(!kIsNetwork){ if(!kIsNetwork || page == 1){
[self hideLoading]; [self hideLoading];
NSArray *products = [KWMPPCacheUtil getProductDataByCache:cacheKeyDictionary urlKey:CACHE_KEY_SDK_getCollectionByHandle_getProductsPage]; NSArray *products = [KWMPPCacheUtil getProductDataByCache:cacheKeyDictionary urlKey:CACHE_KEY_SDK_getCollectionByHandle_getProductsPage];
if(products && products.count > 0){ if(products && products.count > 0){
......
...@@ -128,13 +128,12 @@ ...@@ -128,13 +128,12 @@
-(void)initBottomViewHidden{ -(void)initBottomViewHidden{
if(self.product){ if(self.product){
NSString *productVendor = self.product.vendor; NSString *productVendor = self.product.vendor ?:@"";
NSString *targetVendor = @"Moncler"; productVendor = [productVendor lowercaseString];
NSString *targetVendor = @"moncler";
BOOL isShowContactUs = [productVendor isEqualToString:targetVendor]; BOOL isShowContactUs = [productVendor isEqualToString:targetVendor];
self.vBottomBar.hidden = isShowContactUs; self.vBottomBar.hidden = isShowContactUs;
self.btnContactUs.hidden = !isShowContactUs; self.btnContactUs.hidden = !isShowContactUs;
self.vBottomBar.hidden = NO;
} }
} }
......
...@@ -736,6 +736,7 @@ ...@@ -736,6 +736,7 @@
-(void)paySuccess{ -(void)paySuccess{
[self clearCheckout]; [self clearCheckout];
KWMPaySuccessVC *successVC = (KWMPaySuccessVC *)[KWMBaseVC findControllerBy:[KWMPaySuccessVC kwmTag] fromStoryboard:@"ShopCart"]; KWMPaySuccessVC *successVC = (KWMPaySuccessVC *)[KWMBaseVC findControllerBy:[KWMPaySuccessVC kwmTag] fromStoryboard:@"ShopCart"];
successVC.paidCheckout = self.checkout;
[self.navigationController pushViewController:successVC animated:YES]; [self.navigationController pushViewController:successVC animated:YES];
} }
......
...@@ -22,4 +22,7 @@ ...@@ -22,4 +22,7 @@
- (IBAction)onClickMyOrder:(id)sender; - (IBAction)onClickMyOrder:(id)sender;
//用于在跳转后的订单列表页面生成即时订单(支付后的订单需要一定时间后才能从订单列表获取)
@property (nonatomic) BUYCheckout *paidCheckout;
@end @end
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
-(void)onClickMyOrder:(id)sender{ -(void)onClickMyOrder:(id)sender{
KWMOrderVC *orderVC = (KWMOrderVC *)[KWMBaseVC findControllerBy:[KWMOrderVC kwmTag] fromStoryboard:@"Mine"]; KWMOrderVC *orderVC = (KWMOrderVC *)[KWMBaseVC findControllerBy:[KWMOrderVC kwmTag] fromStoryboard:@"Mine"];
orderVC.paidCheckout = self.paidCheckout;
[self.navigationController pushViewController:orderVC animated:YES]; [self.navigationController pushViewController:orderVC animated:YES];
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
...@@ -1646,7 +1646,7 @@ ...@@ -1646,7 +1646,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="puG-Vo-gdd"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="puG-Vo-gdd">
<rect key="frame" x="0.0" y="259" width="375" height="150"/> <rect key="frame" x="0.0" y="224" width="375" height="220"/>
<subviews> <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"> <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"/> <rect key="frame" x="128" y="0.0" width="120" height="21"/>
...@@ -1682,7 +1682,7 @@ ...@@ -1682,7 +1682,7 @@
<action selector="onClickGetTime:" destination="iFV-ZT-0zX" eventType="touchUpInside" id="27h-gg-ltV"/> <action selector="onClickGetTime:" destination="iFV-ZT-0zX" eventType="touchUpInside" id="27h-gg-ltV"/>
</connections> </connections>
</button> </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"/> <rect key="frame" x="132" y="177" width="110" height="26"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="110" id="N0D-kQ-eGq"/> <constraint firstAttribute="width" constant="110" id="N0D-kQ-eGq"/>
...@@ -1704,7 +1704,7 @@ ...@@ -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="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="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 firstItem="T4V-4O-WbC" firstAttribute="centerX" secondItem="puG-Vo-gdd" secondAttribute="centerX" id="MvE-KT-EgQ"/>
<constraint firstAttribute="height" constant="150" id="Wbe-Fv-YHk"/> <constraint firstAttribute="height" constant="220" 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="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="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"/> <constraint firstItem="3iW-9e-nhE" firstAttribute="top" secondItem="3MF-En-1mW" secondAttribute="bottom" constant="35" id="wpN-Nc-3yi"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment