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
97e77983
Commit
97e77983
authored
Jul 12, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新商品选择规格页添加颜色逻辑
parent
52b6375a
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
241 additions
and
123 deletions
+241
-123
project.pbxproj
iCemarose.xcodeproj/project.pbxproj
+18
-12
KWMMetafieldResult.h
iCemarose/Class/Api/Cemarose/KWMMetafieldResult.h
+1
-2
KWMMetafieldResult.m
iCemarose/Class/Api/Cemarose/KWMMetafieldResult.m
+2
-2
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+5
-5
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+5
-5
KWMColor.h
iCemarose/Class/Model/KWMColor.h
+27
-0
KWMColor.m
iCemarose/Class/Model/KWMColor.m
+15
-0
KWMMetafield.h
iCemarose/Class/Model/KWMMetafield.h
+5
-15
KWMMetafield.m
iCemarose/Class/Model/KWMMetafield.m
+2
-18
KWMProductColorCell.h
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.h
+3
-0
KWMProductColorCell.m
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.m
+21
-4
KWMProductColorCell.xib
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.xib
+2
-1
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+78
-11
KWMVariantsVC.h
iCemarose/Class/UI/NewProduct/KWMVariantsVC.h
+11
-8
KWMVariantsVC.m
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
+46
-15
KWMImageUtil.h
iCemarose/Class/Util/KWMImageUtil.h
+0
-2
KWMImageUtil.m
iCemarose/Class/Util/KWMImageUtil.m
+0
-23
No files found.
iCemarose.xcodeproj/project.pbxproj
View file @
97e77983
...
...
@@ -123,8 +123,8 @@
C03120AA1EF2AC5A00E49EFA
/* KWMWechatPayData.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C03120A91EF2AC5A00E49EFA
/* KWMWechatPayData.m */
;
};
C03120AD1EF2AC6700E49EFA
/* KWMCheckoutPayResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C03120AC1EF2AC6700E49EFA
/* KWMCheckoutPayResult.m */
;
};
C03120B01EF2B26B00E49EFA
/* KWMPayUtil.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C03120AF1EF2B26B00E49EFA
/* KWMPayUtil.m */
;
};
C032D3041DD87E07008D3155
/* KWM
ImagesResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C032D3031DD87E07008D3155
/* KWMImages
Result.m */
;
};
C032D3071DD87E5F008D3155
/* KWM
Image.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C032D3061DD87E5F008D3155
/* KWMImage
.m */
;
};
C032D3041DD87E07008D3155
/* KWM
MetafieldResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C032D3031DD87E07008D3155
/* KWMMetafield
Result.m */
;
};
C032D3071DD87E5F008D3155
/* KWM
Metafield.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C032D3061DD87E5F008D3155
/* KWMMetafield
.m */
;
};
C034E68F1D6AEB12006EE129
/* main.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C034E68E1D6AEB12006EE129
/* main.m */
;
};
C034E6921D6AEB12006EE129
/* AppDelegate.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C034E6911D6AEB12006EE129
/* AppDelegate.m */
;
};
C034E6951D6AEB12006EE129
/* ViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C034E6941D6AEB12006EE129
/* ViewController.m */
;
};
...
...
@@ -239,6 +239,7 @@
C066650F1D7675FC00F02EF4
/* KWMAboutUsVC.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C066650E1D7675FC00F02EF4
/* KWMAboutUsVC.m */
;
};
C06665121D767A0A00F02EF4
/* KWMContactUsVC.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C06665111D767A0A00F02EF4
/* KWMContactUsVC.m */
;
};
C07267821F15D62400C5A869
/* NSLayoutConstraint+Multiplier.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C07267811F15D62400C5A869
/* NSLayoutConstraint+Multiplier.m */
;
};
C07267851F1616E500C5A869
/* KWMColor.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C07267841F1616E500C5A869
/* KWMColor.m */
;
};
C077966F1EEAA2BE00CD6859
/* KWMFilterUtil.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C077966E1EEAA2BE00CD6859
/* KWMFilterUtil.m */
;
};
C084F4531D6D8CA700A0625D
/* KWMBlogCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C084F4511D6D8CA700A0625D
/* KWMBlogCell.m */
;
};
C084F4541D6D8CA700A0625D
/* KWMBlogCell.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C084F4521D6D8CA700A0625D
/* KWMBlogCell.xib */
;
};
...
...
@@ -564,10 +565,10 @@
C03120AC1EF2AC6700E49EFA
/* KWMCheckoutPayResult.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMCheckoutPayResult.m
;
sourceTree
=
"<group>"
;
};
C03120AE1EF2B26B00E49EFA
/* KWMPayUtil.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMPayUtil.h
;
sourceTree
=
"<group>"
;
};
C03120AF1EF2B26B00E49EFA
/* KWMPayUtil.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMPayUtil.m
;
sourceTree
=
"<group>"
;
};
C032D3021DD87E07008D3155
/* KWM
ImagesResult.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMImages
Result.h
;
sourceTree
=
"<group>"
;
};
C032D3031DD87E07008D3155
/* KWM
ImagesResult.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMImages
Result.m
;
sourceTree
=
"<group>"
;
};
C032D3051DD87E5F008D3155
/* KWM
Image.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMImage
.h
;
sourceTree
=
"<group>"
;
};
C032D3061DD87E5F008D3155
/* KWM
Image.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMImage
.m
;
sourceTree
=
"<group>"
;
};
C032D3021DD87E07008D3155
/* KWM
MetafieldResult.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMMetafield
Result.h
;
sourceTree
=
"<group>"
;
};
C032D3031DD87E07008D3155
/* KWM
MetafieldResult.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMMetafield
Result.m
;
sourceTree
=
"<group>"
;
};
C032D3051DD87E5F008D3155
/* KWM
Metafield.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMMetafield
.h
;
sourceTree
=
"<group>"
;
};
C032D3061DD87E5F008D3155
/* KWM
Metafield.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMMetafield
.m
;
sourceTree
=
"<group>"
;
};
C034E68A1D6AEB12006EE129
/* Cemarose.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
Cemarose.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
C034E68E1D6AEB12006EE129
/* main.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
main.m
;
sourceTree
=
"<group>"
;
};
C034E6901D6AEB12006EE129
/* AppDelegate.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
AppDelegate.h
;
path
=
../AppDelegate.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -782,6 +783,8 @@
C06665111D767A0A00F02EF4
/* KWMContactUsVC.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMContactUsVC.m
;
sourceTree
=
"<group>"
;
};
C07267801F15D62400C5A869
/* NSLayoutConstraint+Multiplier.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSLayoutConstraint+Multiplier.h"
;
sourceTree
=
"<group>"
;
};
C07267811F15D62400C5A869
/* NSLayoutConstraint+Multiplier.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSLayoutConstraint+Multiplier.m"
;
sourceTree
=
"<group>"
;
};
C07267831F1616E500C5A869
/* KWMColor.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMColor.h
;
sourceTree
=
"<group>"
;
};
C07267841F1616E500C5A869
/* KWMColor.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMColor.m
;
sourceTree
=
"<group>"
;
};
C077966D1EEAA2BE00CD6859
/* KWMFilterUtil.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMFilterUtil.h
;
sourceTree
=
"<group>"
;
};
C077966E1EEAA2BE00CD6859
/* KWMFilterUtil.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMFilterUtil.m
;
sourceTree
=
"<group>"
;
};
C084F4501D6D8CA700A0625D
/* KWMBlogCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMBlogCell.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1356,8 +1359,8 @@
805C04341DD1FA4900ACC071
/* KWMBrandsTypeModel.m */
,
C03943BE1DD1FCE900141475
/* KWMProductType.h */
,
C03943BF1DD1FCE900141475
/* KWMProductType.m */
,
C032D3051DD87E5F008D3155
/* KWM
Image
.h */
,
C032D3061DD87E5F008D3155
/* KWM
Image
.m */
,
C032D3051DD87E5F008D3155
/* KWM
Metafield
.h */
,
C032D3061DD87E5F008D3155
/* KWM
Metafield
.m */
,
C091EE341DDEEA9400A382B9
/* KWMVariants.h */
,
C091EE351DDEEA9400A382B9
/* KWMVariants.m */
,
C0F4AF491DF1149500BDA719
/* KWMProduct.h */
,
...
...
@@ -1382,6 +1385,8 @@
C043927C1F0F9A2A0027ABA3
/* KWMAdvertisement.m */
,
C043927E1F0F9A3D0027ABA3
/* KWMHotSales.h */
,
C043927F1F0F9A3D0027ABA3
/* KWMHotSales.m */
,
C07267831F1616E500C5A869
/* KWMColor.h */
,
C07267841F1616E500C5A869
/* KWMColor.m */
,
);
path
=
Model
;
sourceTree
=
"<group>"
;
...
...
@@ -1897,8 +1902,8 @@
805C04371DD1FA7100ACC071
/* KWMBrandsTypeResult.m */
,
C03943C11DD1FD3F00141475
/* KWMProductTypeResult.h */
,
C03943C21DD1FD3F00141475
/* KWMProductTypeResult.m */
,
C032D3021DD87E07008D3155
/* KWM
Images
Result.h */
,
C032D3031DD87E07008D3155
/* KWM
Images
Result.m */
,
C032D3021DD87E07008D3155
/* KWM
Metafield
Result.h */
,
C032D3031DD87E07008D3155
/* KWM
Metafield
Result.m */
,
C0F4AF461DF110EF00BDA719
/* KWMProductResult.h */
,
C0F4AF471DF110F000BDA719
/* KWMProductResult.m */
,
C0219A931DF53EB200711099
/* KWMExchangeRateResult.h */
,
...
...
@@ -2560,7 +2565,7 @@
80ED0A4C1D93B99E00B28DF2
/* KWMShopCartData.m in Sources */
,
C034E85C1D6B10A0006EE129
/* UIView+PBExtend.m in Sources */
,
C0F5867E1E24F820001248E2
/* KWMNewGoodsCell.m in Sources */
,
C032D3071DD87E5F008D3155
/* KWM
Image
.m in Sources */
,
C032D3071DD87E5F008D3155
/* KWM
Metafield
.m in Sources */
,
9BE61CFE1ECD66BC0031D21E
/* KWMShoppingCart.m in Sources */
,
C04834341F1325A000A5BFB4
/* KWMClothingSetsHeader.m in Sources */
,
C0F586761E24F820001248E2
/* KWMCollectionCell.m in Sources */
,
...
...
@@ -2662,6 +2667,7 @@
C0219A951DF53EB200711099
/* KWMExchangeRateResult.m in Sources */
,
9B18C11F1EF1270A001DD59B
/* BUYProductVariant+Currency.m in Sources */
,
C034E85A1D6B10A0006EE129
/* SVProgressHUD.m in Sources */
,
C07267851F1616E500C5A869
/* KWMColor.m in Sources */
,
C0243BBE1EFBD5A10013CFA7
/* KWMLeftCategoryCell.m in Sources */
,
807AF4A81DC984950000A326
/* KWMSearchResult.m in Sources */
,
C04834231F13215500A5BFB4
/* KWMBannerView.m in Sources */
,
...
...
@@ -2723,7 +2729,7 @@
C03846911DB87BCA008C3BAB
/* KWMCustomer.m in Sources */
,
8091DFAC1D6EA11E0020519C
/* KWMLastView.m in Sources */
,
C0CC14161D79826F007B5986
/* KWMAddressCell.m in Sources */
,
C032D3041DD87E07008D3155
/* KWM
Images
Result.m in Sources */
,
C032D3041DD87E07008D3155
/* KWM
Metafield
Result.m in Sources */
,
804771881D6D769C0086B4DC
/* KWMEmailVC.m in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
iCemarose/Class/Api/Cemarose/KWM
Images
Result.h
→
iCemarose/Class/Api/Cemarose/KWM
Metafield
Result.h
View file @
97e77983
...
...
@@ -8,9 +8,8 @@
#import "KWMCemaroseResult.h"
@interface
KWM
Images
Result
:
KWMCemaroseResult
@interface
KWM
Metafield
Result
:
KWMCemaroseResult
@property
(
nonatomic
)
id
<
Optional
>
metafields
;
@end
iCemarose/Class/Api/Cemarose/KWM
Images
Result.m
→
iCemarose/Class/Api/Cemarose/KWM
Metafield
Result.m
View file @
97e77983
...
...
@@ -6,9 +6,9 @@
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWM
Images
Result.h"
#import "KWM
Metafield
Result.h"
@implementation
KWM
Images
Result
@implementation
KWM
Metafield
Result
-
(
instancetype
)
initWithDictionary
:(
NSDictionary
*
)
dict
modelClass
:(
Class
)
modelClass
...
...
iCemarose/Class/Api/KWMAPIManager.h
View file @
97e77983
...
...
@@ -20,8 +20,8 @@
#import "KWMProductTypeResult.h"
#import "KWMProductType.h"
#import "KWMBrandsTypeResult.h"
#import "KWM
Images
Result.h"
#import "KWM
Image
.h"
#import "KWM
Metafield
Result.h"
#import "KWM
Metafield
.h"
#import "KWMAppVersion.h"
#import "KWMProductResult.h"
#import "KWMProduct.h"
...
...
@@ -208,11 +208,11 @@
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
* 获取产品
相关图片
--API
* 获取产品
扩展字段
--API
* @return NSURLSessionDataTask
*/
-
(
NSURLSessionDataTask
*
)
getProduct
Images
:(
NSDictionary
*
)
parameters
productId
:(
NSNumber
*
)
productId
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWM
Images
Result
*
result
))
success
-
(
NSURLSessionDataTask
*
)
getProduct
Metafield
:(
NSDictionary
*
)
parameters
productId
:(
NSNumber
*
)
productId
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWM
Metafield
Result
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
...
...
iCemarose/Class/Api/KWMAPIManager.m
View file @
97e77983
...
...
@@ -682,10 +682,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
/**
* 获取
相关图片api
* 获取
产品扩展字段--API
*/
-
(
NSURLSessionDataTask
*
)
getProduct
Images
:
(
NSDictionary
*
)
parameters
productId
:
(
NSNumber
*
)
productId
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWM
Images
Result
*
result
))
success
-
(
NSURLSessionDataTask
*
)
getProduct
Metafield
:
(
NSDictionary
*
)
parameters
productId
:
(
NSNumber
*
)
productId
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWM
Metafield
Result
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
{
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/products/%@/metafields.json"
,
Shopify_SHOP_DOMAIN
,
productId
.
stringValue
];
...
...
@@ -693,8 +693,8 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
return
[
self
startSessionTask
:
KWMHTTPMethodGET
apiPath
:
apiPath
parameters
:
parameters
result
:
[
KWM
Images
Result
class
]
model
:
[
KWM
Image
class
]
result
:
[
KWM
Metafield
Result
class
]
model
:
[
KWM
Metafield
class
]
success
:
success
failure
:
failure
];
}
...
...
iCemarose/Class/Model/KWMColor.h
0 → 100644
View file @
97e77983
//
// KWMColor.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
#import "KWMProduct.h"
#import <Buy/BUYProduct.h>
@interface
KWMColor
:
KWMBaseModel
//颜色名 eg:blue,red
@property
(
nonatomic
)
NSString
*
title
;
//颜色代表的商品的handle
@property
(
nonatomic
)
NSString
*
handle
;
//颜色代表的商品
@property
(
nonatomic
)
BUYProduct
*
prodcut
;
//admin拿到的商品,在选择规格的页面才会去请求拿到给它赋值
@property
(
nonatomic
)
KWMProduct
*
adminProduct
;
@end
iCemarose/Class/Model/KWMColor.m
0 → 100644
View file @
97e77983
//
// KWMColor.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMColor.h"
@implementation
KWMColor
@end
iCemarose/Class/Model/KWM
Image
.h
→
iCemarose/Class/Model/KWM
Metafield
.h
View file @
97e77983
//
// KWM
Image.h
// KWM
Metafield
// iCemarose
//
// Created by HouWeiBin on 2016/11/13.
...
...
@@ -8,16 +8,15 @@
#import "KWMBaseModel.h"
//旧获取图片api所用到的modal,已废弃
@interface
KWMMetafield
:
KWMBaseModel
@interface
KWMImage
:
KWMBaseModel
//服务器图片域名,与APP无关
//域名,与APP无关
@property
(
nonatomic
)
NSString
*
namespace
;
//标示,pe_related_1标示约定为颜色
@property
(
nonatomic
)
NSString
*
key
;
//
图片名
//
内容,当key为pe_related_1时,该值为kenzo-13201,blue,7436196294-1.jpg;kenzo-13203,red,7436196614-1.jpg;kenzo-13202,pink,7436196358-1.jpg
@property
(
nonatomic
)
NSString
*
value
;
//string
...
...
@@ -32,14 +31,5 @@
@property
(
nonatomic
)
NSString
*
updatedAt
;
//获取小图片
-
(
NSString
*
)
getSmallImage
;
//获取中图片
-
(
NSString
*
)
getNormalImage
;
//获取大图片
-
(
NSString
*
)
getBigImage
;
@end
iCemarose/Class/Model/KWM
Image
.m
→
iCemarose/Class/Model/KWM
Metafield
.m
View file @
97e77983
...
...
@@ -6,27 +6,11 @@
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWM
Image
.h"
#import "KWM
Metafield
.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
@implementation
KWMImage
-
(
NSString
*
)
getSmallImage
{
//return [KWMImageUtil getProductImageUrl2:self.value ImageSize:SmallImage];
return
@""
;
}
-
(
NSString
*
)
getNormalImage
{
//return [KWMImageUtil getProductImageUrl2:self.value ImageSize:NormalImage];
return
@""
;
}
//200*200
-
(
NSString
*
)
getBigImage
{
//return [KWMImageUtil getProductImageUrl2:self.value ImageSize:BigImage];
return
@""
;
}
@implementation
KWMMetafield
@end
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.h
View file @
97e77983
...
...
@@ -8,10 +8,13 @@
#import <UIKit/UIKit.h>
#import "Buy/Buy.h"
#import "KWMColor.h"
@interface
KWMProductColorCell
:
UICollectionViewCell
@property
(
nonatomic
)
BOOL
isSelect
;
@property
(
nonatomic
)
KWMColor
*
data
;
@end
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.m
View file @
97e77983
...
...
@@ -9,16 +9,19 @@
#import "KWMProductColorCell.h"
#import "UIColor+SAMAdditions.h"
#import "UIView+Prettify.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface
KWMProductColorCell
()
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
iv
Product
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
iv
Color
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
ivSelected
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
vProduct
;
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
lbTitle
;
@end
...
...
@@ -27,13 +30,27 @@
-
(
void
)
awakeFromNib
{
[
super
awakeFromNib
];
// Initialization code
[
self
.
iv
Product
setBorder
:
1
cornerRadius
:
1
borderColor
:
[
UIColor
sam_colorWithHex
:
@"D8DBDE"
]];
[
self
.
iv
Color
setBorder
:
1
cornerRadius
:
1
borderColor
:
[
UIColor
sam_colorWithHex
:
@"D8DBDE"
]];
}
-
(
void
)
setIsSelect
:
(
BOOL
)
isSelect
{
_isSelect
=
isSelect
;
[
self
.
iv
Product
setBorder
:
1
cornerRadius
:
1
borderColor
:
isSelect
?[
UIColor
sam_colorWithHex
:
@"F1929A"
]:[
UIColor
sam_colorWithHex
:
@"D8DBDE"
]];
[
self
.
iv
Color
setBorder
:
1
cornerRadius
:
1
borderColor
:
isSelect
?[
UIColor
sam_colorWithHex
:
@"F1929A"
]:[
UIColor
sam_colorWithHex
:
@"D8DBDE"
]];
self
.
ivSelected
.
hidden
=
!
isSelect
;
}
-
(
void
)
setData
:
(
KWMColor
*
)
data
{
_data
=
data
;
if
(
data
){
BUYProduct
*
product
=
data
.
prodcut
;
NSString
*
imageUrl
=
[
KWMImageUtil
getProductImageUrl
:
product
ImageSize
:
SmallImage
];
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
imageUrl
];
[
self
.
ivColor
sd_setImageWithURL
:
imageURL
placeholderImage
:[
UIImage
imageNamed
:
@"ic_loading"
]];
self
.
lbTitle
.
text
=
data
.
title
;
}
}
@end
iCemarose/Class/UI/NewProduct/Cell/KWMProductColorCell.xib
View file @
97e77983
...
...
@@ -85,8 +85,9 @@
<constraint
firstAttribute=
"bottom"
secondItem=
"LIy-sM-Sa7"
secondAttribute=
"bottom"
id=
"SCB-9p-0lM"
/>
</constraints>
<connections>
<outlet
property=
"iv
Product"
destination=
"m0M-BD-5Uv"
id=
"WFe-t0-yhM
"
/>
<outlet
property=
"iv
Color"
destination=
"m0M-BD-5Uv"
id=
"bGX-e5-tgh
"
/>
<outlet
property=
"ivSelected"
destination=
"PXf-2y-qN1"
id=
"ei9-v0-z6q"
/>
<outlet
property=
"lbTitle"
destination=
"iFV-Ut-KXO"
id=
"Kc1-lf-ATT"
/>
<outlet
property=
"vProduct"
destination=
"5sQ-H3-h9f"
id=
"fkM-xP-spq"
/>
</connections>
</collectionViewCell>
...
...
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
97e77983
...
...
@@ -28,7 +28,17 @@
@property
(
weak
,
nonatomic
)
IBOutlet
UIImageView
*
ivShare
;
@property
(
nonatomic
)
BUYProductVariant
*
variant
;
//颜色扩展字段
@property
(
nonatomic
)
KWMMetafield
*
colorMeterfield
;
//颜色列表,由颜色扩展字段请求api拿到对应product后封装而来
@property
(
nonatomic
)
NSMutableArray
<
KWMColor
*>
*
colorArray
;
//选中的variant
@property
(
nonatomic
)
BUYProductVariant
*
variant
;
//选中的颜色
@property
(
nonatomic
)
KWMColor
*
color
;
@property
(
nonatomic
)
BOOL
isLikeVariant
;
...
...
@@ -57,24 +67,40 @@
-
(
void
)
initView
{
[
self
.
btnLike
setImage
:[
UIImage
imageNamed
:
@"ic_like_unable"
]
forState
:
UIControlStateNormal
];
self
.
productId
=
@
(
4746085766
);
self
.
productId
=
@
(
7436196294
);
self
.
detailView1
.
delegate
=
self
;
self
.
colorArray
=
[
NSMutableArray
array
];
[
self
requestProductDetail
];
[
self
requestBrandProducts
:
1
];
[
self
requestCategoryProducts
:
1
];
[
self
requestColorMetafield
];
}
//请求API得到颜色Meterfield后才会调用这个.
-
(
void
)
initColorData
{
if
(
!
self
.
colorMeterfield
||
[
KWMStringUtil
isEmpty
:
self
.
colorMeterfield
.
value
]){
return
;
}
//kenzo-13201,blue,7436196294-1.jpg;kenzo-13203,red,7436196614-1.jpg;kenzo-13202,pink,7436196358-1.jpg
NSArray
*
colorStringArray
=
[
self
.
colorMeterfield
.
value
componentsSeparatedByString
:
@";"
];
for
(
NSString
*
colorString
in
colorStringArray
){
NSArray
*
colorInfo
=
[
colorString
componentsSeparatedByString
:
@","
];
if
(
colorInfo
.
count
==
3
){
//加上判断,以后要是修改了,至少不会程序崩溃。。
KWMColor
*
color
=
[
KWMColor
new
];
color
.
handle
=
colorInfo
[
0
];
color
.
title
=
colorInfo
[
1
];
[
self
requestProductByColor
:
color
];
}
}
}
-
(
IBAction
)
onClickClose
:
(
id
)
sender
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
-
(
IBAction
)
onClickShare
:
(
id
)
sender
{
KWMWishListVC
*
wishVC
=
(
KWMWishListVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMWishListVC
kwmTag
]
fromStoryboard
:
@"NewProduct"
];
[
self
.
navigationController
pushViewController
:
wishVC
animated
:
YES
];
return
;
if
(
self
.
product
){
KWMShareVC
*
shareVC
=
(
KWMShareVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMShareVC
kwmTag
]
fromStoryboard
:
@"New"
];
shareVC
.
shareUrl
=
[
NSString
stringWithFormat
:
@"https://www.cemarose.com/products/%@"
,
self
.
product
.
handle
];
...
...
@@ -97,6 +123,7 @@
-
(
void
)
kwm_onClickSizeBtn
{
KWMVariantsVC
*
variantsVC
=
(
KWMVariantsVC
*
)[
KWMVariantsVC
findControllerBy
:[
KWMVariantsVC
kwmTag
]
fromStoryboard
:
@"NewProduct"
];
variantsVC
.
product
=
self
.
product
;
variantsVC
.
colorArray
=
self
.
colorArray
;
variantsVC
.
delegate
=
self
;
CGSize
size
=
[
UIScreen
mainScreen
].
bounds
.
size
;
[
self
showPresentation
:
variantsVC
size
:
size
tapOutsideClose
:
YES
style
:
MZFormSheetPresentationTransitionStyleFade
];
...
...
@@ -133,11 +160,11 @@
}
#pragma mark - KWMVariantsVCDelegate
-
(
void
)
kwm_setVariant
:
(
KWMVariantsVC
*
)
variantsVC
variant
:
(
BUYProductVariant
*
)
variant
{
-
(
void
)
kwm_setVariant
:
(
KWMVariantsVC
*
)
variantsVC
variant
:
(
BUYProductVariant
*
)
variant
color
:
(
KWMColor
*
)
color
{
[
self
.
btnLike
setImage
:[
UIImage
imageNamed
:
@"ic_like"
]
forState
:
UIControlStateNormal
];
self
.
detailView1
.
variant
=
variant
;
self
.
variant
=
variant
;
[
self
.
btnLike
setImage
:[
UIImage
imageNamed
:
@"ic_like"
]
forState
:
UIControlStateNormal
]
;
self
.
color
=
color
;
self
.
isLikeVariant
=
NO
;
[
self
requestWishList
];
}
...
...
@@ -207,6 +234,21 @@
}];
}
-
(
void
)
requestProductByColor
:
(
KWMColor
*
)
color
{
__weak
KWMNewProductVC
*
weakSelf
=
self
;
[
weakSelf
showLoading
];
[
self
.
client
getProductByHandle
:
color
.
handle
completion
:
^
(
BUYProduct
*
_Nullable
product
,
NSError
*
_Nullable
error
)
{
[
weakSelf
hideLoading
];
if
(
error
){
}
else
if
(
product
){
color
.
prodcut
=
product
;
[
weakSelf
.
colorArray
addObject
:
color
];
}
}];
}
-
(
void
)
requestBrandProducts
:
(
NSInteger
)
page
{
// if(!self.product){
// return;
...
...
@@ -248,6 +290,30 @@
}];
}
#pragma mark apimanager
-
(
void
)
requestColorMetafield
{
__weak
KWMNewProductVC
*
weakSelf
=
self
;
void
(
^
failure
)(
NSURLSessionDataTask
*
,
NSError
*
)
=
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
){
[
weakSelf
showError
:
error
];
};
void
(
^
success
)(
NSURLSessionDataTask
*
,
KWMMetafieldResult
*
)
=
^
(
NSURLSessionDataTask
*
task
,
KWMMetafieldResult
*
result
){
if
(
!
result
.
metafields
){
return
;
}
NSArray
*
array
=
(
NSArray
*
)
result
.
metafields
;
for
(
KWMMetafield
*
metafield
in
array
){
if
([
metafield
.
key
isEqualToString
:
@"pe_related_1"
]){
weakSelf
.
colorMeterfield
=
metafield
;
[
weakSelf
initColorData
];
return
;
}
}
};
[
self
.
api
getProductMetafield
:
nil
productId
:
@
(
7436196294
)
success
:
success
failure
:
failure
];
}
-
(
void
)
requestWishList
{
__weak
KWMNewProductVC
*
weakSelf
=
self
;
NSDictionary
*
customerDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"customer"
];
...
...
@@ -357,4 +423,5 @@
@end
iCemarose/Class/UI/NewProduct/KWMVariantsVC.h
View file @
97e77983
...
...
@@ -13,28 +13,31 @@
#import "KWMShopCartData.h"
#import "KWMVariants.h"
#import "KWMWish.h"
#import "KWMColor.h"
@class
KWMVariantsVC
;
@protocol
KWMVariantsVCDelegate
<
NSObject
>
-
(
void
)
kwm_addShopWithVariantId
:
(
NSNumber
*
)
identifier
quantity
:
(
NSInteger
)
quantity
variant
:
(
BUYProductVariant
*
)
variant
buyNow
:
(
BOOL
)
buyNow
callback
:
(
void
(
^
)(
BOOL
))
callback
;
-
(
void
)
kwm_setVariant
:(
KWMVariantsVC
*
)
variantsVC
variant
:(
BUYProductVariant
*
)
variant
;
-
(
void
)
kwm_setVariant
:(
KWMVariantsVC
*
)
variantsVC
variant
:(
BUYProductVariant
*
)
variant
color
:(
KWMColor
*
)
color
;
@end
@interface
KWMVariantsVC
:
KWMBaseVC
<
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UICollectionViewDelegateFlowLayout
>
//required 回调用的delegate
@property
(
weak
,
nonatomic
)
id
<
KWMVariantsVCDelegate
>
delegate
;
//請求api拿到的admin 規格列表,主要使用到其中的庫存剩餘字段
@property
(
nonatomic
)
NSArray
<
KWMVariants
*>
*
adminVariantArray
;
@property
(
nonatomic
)
NSArray
<
BUYProductVariant
*>
*
variantArray
;
@property
(
nonatomic
)
KWMShopCartModel
*
shopCartModel
;
//required 商品模型,必须有
@property
(
nonatomic
)
BUYProduct
*
product
;
//optional 有颜色可选时,需要赋值该字段.
@property
(
nonatomic
)
NSArray
<
KWMColor
*>
*
colorArray
;
//optional 愿望单页跳转来时,需要赋值该字段。
@property
(
nonatomic
)
KWMWish
*
wish
;
//optional 购物车页跳转来时,需要赋值该字段。
@property
(
nonatomic
)
KWMShopCartModel
*
shopCartModel
;
@end
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
View file @
97e77983
...
...
@@ -25,6 +25,8 @@
@property
(
nonatomic
)
IBOutlet
UILabel
*
lbCount
;
@property
(
nonatomic
)
NSInteger
count
;
@property
(
nonatomic
)
NSDecimalNumber
*
totalPrice
;
...
...
@@ -33,6 +35,12 @@
@property
(
nonatomic
)
KWMVariants
*
selectAdminVariant
;
@property
(
nonatomic
)
KWMColor
*
selectColor
;
@property
(
nonatomic
)
NSArray
<
BUYProductVariant
*>
*
variantArray
;
//請求api拿到的admin 規格列表,主要使用到其中的庫存剩餘字段
@property
(
nonatomic
)
NSArray
<
KWMVariants
*>
*
adminVariantArray
;
@end
...
...
@@ -92,6 +100,14 @@
}
-
(
void
)
initView
{
if
(
self
.
product
&&
self
.
colorArray
){
for
(
KWMColor
*
color
in
self
.
colorArray
){
if
([
color
.
handle
isEqual
:
self
.
product
.
handle
]){
self
.
selectColor
=
color
;
break
;
}
}
}
[
self
initUI
];
[
self
initCollectionView
];
[
self
initContentHeight
];
...
...
@@ -149,11 +165,13 @@
-
(
IBAction
)
onClickAdd
:
(
id
)
sender
{
if
(
self
.
selectVariant
){
if
(
self
.
selectAdminVariant
&&
self
.
count
+
1
>
self
.
selectAdminVariant
.
inventoryQuantity
.
integerValue
){
[
self
showToast
:
@"商品剩余数量不足"
];
return
;
NSInteger
maxCount
=
self
.
selectAdminVariant
?
self
.
selectAdminVariant
.
inventoryQuantity
.
integerValue
:
9999
;
if
(
self
.
count
+
1
>
maxCount
){
self
.
count
=
maxCount
;
[
self
showToast
:[
NSString
stringWithFormat
:
@"商品剩余库存仅有%ld件"
,
maxCount
]];
}
else
{
self
.
count
++
;
}
self
.
count
++
;
[
self
initUI
];
}
else
{
[
self
showToast
:
@"请选择您想要的规格"
];
...
...
@@ -194,8 +212,9 @@
// }
// }];
// }
//现在不是添加到购物车了,而是显示在商品详情页。
[
self
.
delegate
kwm_setVariant
:
self
variant
:
self
.
selectVariant
];
//商品详情页现在不是添加到购物车了,而是先显示。
//所以现在是回调出去。各个页面需要干嘛自己干嘛。
[
self
.
delegate
kwm_setVariant
:
self
variant
:
self
.
selectVariant
color
:
self
.
selectColor
];
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
...
...
@@ -205,14 +224,18 @@
#pragma mark -- UICollectionViewDataSource UICollectionViewDelegate
-
(
NSInteger
)
numberOfSectionsInCollectionView
:
(
UICollectionView
*
)
collectionView
{
return
2
;
if
(
self
.
colorArray
&&
self
.
colorArray
.
count
>
0
){
return
2
;
}
else
{
return
1
;
}
}
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
){
return
self
.
variantArray
.
count
;
return
self
.
variantArray
?
self
.
variantArray
.
count
:
0
;
}
else
{
return
8
;
return
self
.
colorArray
?
self
.
colorArray
.
count
:
0
;
}
}
...
...
@@ -223,6 +246,7 @@
UICollectionReusableView
*
headView
=
[
collectionView
dequeueReusableSupplementaryViewOfKind
:
UICollectionElementKindSectionHeader
withReuseIdentifier
:
@"UICollectionViewHeader"
forIndexPath
:
indexPath
];
NSString
*
colorTitle
=
@"颜色"
;
NSString
*
sizeTitle
=
@"尺寸"
;
if
(
self
.
selectAdminVariant
&&
self
.
selectAdminVariant
.
inventoryQuantity
.
integerValue
<=
5
){
sizeTitle
=
[
NSString
stringWithFormat
:
@"尺寸 (仅剩%@件)"
,
self
.
selectAdminVariant
.
inventoryQuantity
.
stringValue
];
...
...
@@ -233,10 +257,9 @@
UILabel
*
headerLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
35
,
15
,
UI_SCREEN_WIDTH
-
80
,
30
)];
headerLabel
.
textColor
=
[
UIColor
sam_colorWithHex
:
@"393939"
];
headerLabel
.
font
=
[
UIFont
systemFontOfSize
:
12
.
5
];
headerLabel
.
text
=
indexPath
.
section
==
0
?
sizeTitle
:
@"颜色"
;
headerLabel
.
text
=
indexPath
.
section
==
0
?
sizeTitle
:
colorTitle
;
[
headView
addSubview
:
headerLabel
];
return
headView
;
}
...
...
@@ -249,7 +272,7 @@
KWMVariants
*
adminVariant
=
nil
;
if
(
self
.
adminVariantArray
&&
self
.
adminVariantArray
.
count
>
indexPath
.
row
){
for
(
KWMVariants
*
mAdminVariant
in
self
.
adminVariantArray
){
if
(
variant
.
identifier
.
integerValue
==
mAdminVariant
.
id
.
integerValue
){
if
(
[
variant
.
identifier
isEqualToNumber
:
mAdminVariant
.
id
]
){
adminVariant
=
mAdminVariant
;
}
}
...
...
@@ -263,8 +286,10 @@
cell
.
productVariant
=
variant
;
return
cell
;
}
else
{
KWMColor
*
color
=
[
self
.
colorArray
objectAtIndex
:
indexPath
.
row
];
KWMProductColorCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
NSStringFromClass
([
KWMProductColorCell
class
])
forIndexPath
:
indexPath
];
cell
.
isSelect
=
indexPath
.
row
==
1
;
cell
.
isSelect
=
self
.
selectColor
?[
self
.
selectColor
.
handle
isEqualToString
:
color
.
handle
]:
NO
;
cell
.
data
=
color
;
return
cell
;
}
}
...
...
@@ -294,13 +319,19 @@
if
(
isSellOut
){
return
;
}
if
(
!
self
.
selectVariant
||
self
.
selectVariant
.
identifierValue
!=
variant
.
identifierValue
){
if
(
!
self
.
selectVariant
||
!
[
self
.
selectVariant
.
identifier
isEqualToNumber
:
variant
.
identifier
]
){
self
.
count
=
1
;
}
self
.
selectVariant
=
variant
;
self
.
selectAdminVariant
=
adminVariant
;
[
self
.
cvVariants
reloadData
];
[
self
initUI
];
}
else
if
(
indexPath
.
section
==
1
){
KWMColor
*
color
=
[
self
.
colorArray
objectAtIndex
:
indexPath
.
row
];
self
.
selectColor
=
color
;
self
.
variantArray
=
self
.
selectColor
.
prodcut
.
variantsArray
;
[
self
.
cvVariants
reloadData
];
//TODO 这里还需要更新页面高度。
}
}
...
...
@@ -338,7 +369,7 @@
-
(
BOOL
)
isSelect
:
(
BUYProductVariant
*
)
variant
{
if
(
variant
&&
self
.
selectVariant
){
return
variant
.
identifier
.
integerValue
==
self
.
selectVariant
.
identifier
.
integerValue
;
return
[
variant
.
identifier
isEqualToNumber
:
self
.
selectVariant
.
identifier
]
;
};
return
NO
;
}
...
...
iCemarose/Class/Util/KWMImageUtil.h
View file @
97e77983
...
...
@@ -41,8 +41,6 @@
+
(
UIImage
*
)
imageWithImage
:(
UIImage
*
)
image
scaledToPixelSize
:(
CGSize
)
newSize
;
+
(
UIImage
*
)
imageAfterZoom
:(
UIImage
*
)
image
scale
:(
float
)
scale
;
//传入图片需为kwmimage类型
+
(
NSArray
*
)
checkImage
:(
NSArray
*
)
imagesArray
;
//获取商品图片列表
+
(
NSArray
*
)
getProductImageUrls
:(
id
)
product
ImageSize
:(
NSInteger
)
ImageSize
;
...
...
iCemarose/Class/Util/KWMImageUtil.m
View file @
97e77983
...
...
@@ -125,29 +125,6 @@
return
[
self
imageWithImage
:
image
scaledToPixelSize
:
CGSizeMake
(
newWidth
,
newHeight
)];
}
+
(
NSArray
*
)
checkImage
:
(
NSArray
*
)
imagesArray
{
NSMutableArray
*
images
=
[[
NSMutableArray
alloc
]
initWithCapacity
:
100
];
if
(
imagesArray
==
nil
){
return
[
images
copy
];
}
for
(
KWMImage
*
image
in
imagesArray
){
if
(
image
!=
nil
&&
!
[
KWMStringUtil
isEmpty
:
image
.
value
]){
if
(
[
image
.
value
rangeOfString
:
@"jpg"
options
:
NSCaseInsensitiveSearch
].
location
!=
NSNotFound
||
[
image
.
value
rangeOfString
:
@"jpeg"
options
:
NSCaseInsensitiveSearch
].
location
!=
NSNotFound
||
[
image
.
value
rangeOfString
:
@"png"
options
:
NSCaseInsensitiveSearch
].
location
!=
NSNotFound
||
[
image
.
value
rangeOfString
:
@"gif"
options
:
NSCaseInsensitiveSearch
].
location
!=
NSNotFound
){
[
images
addObject
:
image
];
}
}
}
return
[
images
copy
];
}
+
(
NSArray
*
)
getOriginalImages1
:
(
BUYProduct
*
)
product
{
NSMutableArray
*
productImages
=
[[
NSMutableArray
alloc
]
init
];
if
(
!
product
){
...
...
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