Commit 97e77983 by houweibin

新商品选择规格页添加颜色逻辑

parent 52b6375a
...@@ -123,8 +123,8 @@ ...@@ -123,8 +123,8 @@
C03120AA1EF2AC5A00E49EFA /* KWMWechatPayData.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120A91EF2AC5A00E49EFA /* KWMWechatPayData.m */; }; C03120AA1EF2AC5A00E49EFA /* KWMWechatPayData.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120A91EF2AC5A00E49EFA /* KWMWechatPayData.m */; };
C03120AD1EF2AC6700E49EFA /* KWMCheckoutPayResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */; }; C03120AD1EF2AC6700E49EFA /* KWMCheckoutPayResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */; };
C03120B01EF2B26B00E49EFA /* KWMPayUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */; }; C03120B01EF2B26B00E49EFA /* KWMPayUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */; };
C032D3041DD87E07008D3155 /* KWMImagesResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3031DD87E07008D3155 /* KWMImagesResult.m */; }; C032D3041DD87E07008D3155 /* KWMMetafieldResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3031DD87E07008D3155 /* KWMMetafieldResult.m */; };
C032D3071DD87E5F008D3155 /* KWMImage.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3061DD87E5F008D3155 /* KWMImage.m */; }; C032D3071DD87E5F008D3155 /* KWMMetafield.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3061DD87E5F008D3155 /* KWMMetafield.m */; };
C034E68F1D6AEB12006EE129 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E68E1D6AEB12006EE129 /* main.m */; }; C034E68F1D6AEB12006EE129 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E68E1D6AEB12006EE129 /* main.m */; };
C034E6921D6AEB12006EE129 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E6911D6AEB12006EE129 /* AppDelegate.m */; }; C034E6921D6AEB12006EE129 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E6911D6AEB12006EE129 /* AppDelegate.m */; };
C034E6951D6AEB12006EE129 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E6941D6AEB12006EE129 /* ViewController.m */; }; C034E6951D6AEB12006EE129 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E6941D6AEB12006EE129 /* ViewController.m */; };
...@@ -239,6 +239,7 @@ ...@@ -239,6 +239,7 @@
C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C066650E1D7675FC00F02EF4 /* KWMAboutUsVC.m */; }; C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C066650E1D7675FC00F02EF4 /* KWMAboutUsVC.m */; };
C06665121D767A0A00F02EF4 /* KWMContactUsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C06665111D767A0A00F02EF4 /* KWMContactUsVC.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 */; }; 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 */; }; C077966F1EEAA2BE00CD6859 /* KWMFilterUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C077966E1EEAA2BE00CD6859 /* KWMFilterUtil.m */; };
C084F4531D6D8CA700A0625D /* KWMBlogCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C084F4511D6D8CA700A0625D /* KWMBlogCell.m */; }; C084F4531D6D8CA700A0625D /* KWMBlogCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C084F4511D6D8CA700A0625D /* KWMBlogCell.m */; };
C084F4541D6D8CA700A0625D /* KWMBlogCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C084F4521D6D8CA700A0625D /* KWMBlogCell.xib */; }; C084F4541D6D8CA700A0625D /* KWMBlogCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C084F4521D6D8CA700A0625D /* KWMBlogCell.xib */; };
...@@ -564,10 +565,10 @@ ...@@ -564,10 +565,10 @@
C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCheckoutPayResult.m; sourceTree = "<group>"; }; 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>"; }; 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>"; }; C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPayUtil.m; sourceTree = "<group>"; };
C032D3021DD87E07008D3155 /* KWMImagesResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMImagesResult.h; sourceTree = "<group>"; }; C032D3021DD87E07008D3155 /* KWMMetafieldResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMMetafieldResult.h; sourceTree = "<group>"; };
C032D3031DD87E07008D3155 /* KWMImagesResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMImagesResult.m; sourceTree = "<group>"; }; C032D3031DD87E07008D3155 /* KWMMetafieldResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMMetafieldResult.m; sourceTree = "<group>"; };
C032D3051DD87E5F008D3155 /* KWMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMImage.h; sourceTree = "<group>"; }; C032D3051DD87E5F008D3155 /* KWMMetafield.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMMetafield.h; sourceTree = "<group>"; };
C032D3061DD87E5F008D3155 /* KWMImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMImage.m; sourceTree = "<group>"; }; C032D3061DD87E5F008D3155 /* KWMMetafield.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; }; 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>"; }; 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>"; }; C034E6901D6AEB12006EE129 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../AppDelegate.h; sourceTree = "<group>"; };
...@@ -782,6 +783,8 @@ ...@@ -782,6 +783,8 @@
C06665111D767A0A00F02EF4 /* KWMContactUsVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMContactUsVC.m; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; C084F4501D6D8CA700A0625D /* KWMBlogCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMBlogCell.h; sourceTree = "<group>"; };
...@@ -1356,8 +1359,8 @@ ...@@ -1356,8 +1359,8 @@
805C04341DD1FA4900ACC071 /* KWMBrandsTypeModel.m */, 805C04341DD1FA4900ACC071 /* KWMBrandsTypeModel.m */,
C03943BE1DD1FCE900141475 /* KWMProductType.h */, C03943BE1DD1FCE900141475 /* KWMProductType.h */,
C03943BF1DD1FCE900141475 /* KWMProductType.m */, C03943BF1DD1FCE900141475 /* KWMProductType.m */,
C032D3051DD87E5F008D3155 /* KWMImage.h */, C032D3051DD87E5F008D3155 /* KWMMetafield.h */,
C032D3061DD87E5F008D3155 /* KWMImage.m */, C032D3061DD87E5F008D3155 /* KWMMetafield.m */,
C091EE341DDEEA9400A382B9 /* KWMVariants.h */, C091EE341DDEEA9400A382B9 /* KWMVariants.h */,
C091EE351DDEEA9400A382B9 /* KWMVariants.m */, C091EE351DDEEA9400A382B9 /* KWMVariants.m */,
C0F4AF491DF1149500BDA719 /* KWMProduct.h */, C0F4AF491DF1149500BDA719 /* KWMProduct.h */,
...@@ -1382,6 +1385,8 @@ ...@@ -1382,6 +1385,8 @@
C043927C1F0F9A2A0027ABA3 /* KWMAdvertisement.m */, C043927C1F0F9A2A0027ABA3 /* KWMAdvertisement.m */,
C043927E1F0F9A3D0027ABA3 /* KWMHotSales.h */, C043927E1F0F9A3D0027ABA3 /* KWMHotSales.h */,
C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */, C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */,
C07267831F1616E500C5A869 /* KWMColor.h */,
C07267841F1616E500C5A869 /* KWMColor.m */,
); );
path = Model; path = Model;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1897,8 +1902,8 @@ ...@@ -1897,8 +1902,8 @@
805C04371DD1FA7100ACC071 /* KWMBrandsTypeResult.m */, 805C04371DD1FA7100ACC071 /* KWMBrandsTypeResult.m */,
C03943C11DD1FD3F00141475 /* KWMProductTypeResult.h */, C03943C11DD1FD3F00141475 /* KWMProductTypeResult.h */,
C03943C21DD1FD3F00141475 /* KWMProductTypeResult.m */, C03943C21DD1FD3F00141475 /* KWMProductTypeResult.m */,
C032D3021DD87E07008D3155 /* KWMImagesResult.h */, C032D3021DD87E07008D3155 /* KWMMetafieldResult.h */,
C032D3031DD87E07008D3155 /* KWMImagesResult.m */, C032D3031DD87E07008D3155 /* KWMMetafieldResult.m */,
C0F4AF461DF110EF00BDA719 /* KWMProductResult.h */, C0F4AF461DF110EF00BDA719 /* KWMProductResult.h */,
C0F4AF471DF110F000BDA719 /* KWMProductResult.m */, C0F4AF471DF110F000BDA719 /* KWMProductResult.m */,
C0219A931DF53EB200711099 /* KWMExchangeRateResult.h */, C0219A931DF53EB200711099 /* KWMExchangeRateResult.h */,
...@@ -2560,7 +2565,7 @@ ...@@ -2560,7 +2565,7 @@
80ED0A4C1D93B99E00B28DF2 /* KWMShopCartData.m in Sources */, 80ED0A4C1D93B99E00B28DF2 /* KWMShopCartData.m in Sources */,
C034E85C1D6B10A0006EE129 /* UIView+PBExtend.m in Sources */, C034E85C1D6B10A0006EE129 /* UIView+PBExtend.m in Sources */,
C0F5867E1E24F820001248E2 /* KWMNewGoodsCell.m in Sources */, C0F5867E1E24F820001248E2 /* KWMNewGoodsCell.m in Sources */,
C032D3071DD87E5F008D3155 /* KWMImage.m in Sources */, C032D3071DD87E5F008D3155 /* KWMMetafield.m in Sources */,
9BE61CFE1ECD66BC0031D21E /* KWMShoppingCart.m in Sources */, 9BE61CFE1ECD66BC0031D21E /* KWMShoppingCart.m in Sources */,
C04834341F1325A000A5BFB4 /* KWMClothingSetsHeader.m in Sources */, C04834341F1325A000A5BFB4 /* KWMClothingSetsHeader.m in Sources */,
C0F586761E24F820001248E2 /* KWMCollectionCell.m in Sources */, C0F586761E24F820001248E2 /* KWMCollectionCell.m in Sources */,
...@@ -2662,6 +2667,7 @@ ...@@ -2662,6 +2667,7 @@
C0219A951DF53EB200711099 /* KWMExchangeRateResult.m in Sources */, C0219A951DF53EB200711099 /* KWMExchangeRateResult.m in Sources */,
9B18C11F1EF1270A001DD59B /* BUYProductVariant+Currency.m in Sources */, 9B18C11F1EF1270A001DD59B /* BUYProductVariant+Currency.m in Sources */,
C034E85A1D6B10A0006EE129 /* SVProgressHUD.m in Sources */, C034E85A1D6B10A0006EE129 /* SVProgressHUD.m in Sources */,
C07267851F1616E500C5A869 /* KWMColor.m in Sources */,
C0243BBE1EFBD5A10013CFA7 /* KWMLeftCategoryCell.m in Sources */, C0243BBE1EFBD5A10013CFA7 /* KWMLeftCategoryCell.m in Sources */,
807AF4A81DC984950000A326 /* KWMSearchResult.m in Sources */, 807AF4A81DC984950000A326 /* KWMSearchResult.m in Sources */,
C04834231F13215500A5BFB4 /* KWMBannerView.m in Sources */, C04834231F13215500A5BFB4 /* KWMBannerView.m in Sources */,
...@@ -2723,7 +2729,7 @@ ...@@ -2723,7 +2729,7 @@
C03846911DB87BCA008C3BAB /* KWMCustomer.m in Sources */, C03846911DB87BCA008C3BAB /* KWMCustomer.m in Sources */,
8091DFAC1D6EA11E0020519C /* KWMLastView.m in Sources */, 8091DFAC1D6EA11E0020519C /* KWMLastView.m in Sources */,
C0CC14161D79826F007B5986 /* KWMAddressCell.m in Sources */, C0CC14161D79826F007B5986 /* KWMAddressCell.m in Sources */,
C032D3041DD87E07008D3155 /* KWMImagesResult.m in Sources */, C032D3041DD87E07008D3155 /* KWMMetafieldResult.m in Sources */,
804771881D6D769C0086B4DC /* KWMEmailVC.m in Sources */, 804771881D6D769C0086B4DC /* KWMEmailVC.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
#import "KWMCemaroseResult.h" #import "KWMCemaroseResult.h"
@interface KWMImagesResult : KWMCemaroseResult @interface KWMMetafieldResult : KWMCemaroseResult
@property (nonatomic) id<Optional> metafields; @property (nonatomic) id<Optional> metafields;
@end @end
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
// Copyright © 2016年 kollway. All rights reserved. // Copyright © 2016年 kollway. All rights reserved.
// //
#import "KWMImagesResult.h" #import "KWMMetafieldResult.h"
@implementation KWMImagesResult @implementation KWMMetafieldResult
- (instancetype)initWithDictionary:(NSDictionary *)dict - (instancetype)initWithDictionary:(NSDictionary *)dict
modelClass:(Class)modelClass modelClass:(Class)modelClass
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#import "KWMProductTypeResult.h" #import "KWMProductTypeResult.h"
#import "KWMProductType.h" #import "KWMProductType.h"
#import "KWMBrandsTypeResult.h" #import "KWMBrandsTypeResult.h"
#import "KWMImagesResult.h" #import "KWMMetafieldResult.h"
#import "KWMImage.h" #import "KWMMetafield.h"
#import "KWMAppVersion.h" #import "KWMAppVersion.h"
#import "KWMProductResult.h" #import "KWMProductResult.h"
#import "KWMProduct.h" #import "KWMProduct.h"
...@@ -208,11 +208,11 @@ ...@@ -208,11 +208,11 @@
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure; failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/** /**
* 获取产品相关图片--API * 获取产品扩展字段--API
* @return NSURLSessionDataTask * @return NSURLSessionDataTask
*/ */
- (NSURLSessionDataTask *) getProductImages:(NSDictionary *)parameters productId:(NSNumber *)productId - (NSURLSessionDataTask *) getProductMetafield:(NSDictionary *)parameters productId:(NSNumber *)productId
success:(void(^)(NSURLSessionDataTask *task,KWMImagesResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMMetafieldResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure; failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/** /**
......
...@@ -682,10 +682,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -682,10 +682,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
/** /**
* 获取相关图片api * 获取产品扩展字段--API
*/ */
- (NSURLSessionDataTask *) getProductImages:(NSDictionary *)parameters productId:(NSNumber *)productId - (NSURLSessionDataTask *) getProductMetafield:(NSDictionary *)parameters productId:(NSNumber *)productId
success:(void(^)(NSURLSessionDataTask *task,KWMImagesResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMMetafieldResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{ failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [[NSString alloc] initWithFormat:@"https://%@/admin/products/%@/metafields.json",Shopify_SHOP_DOMAIN,productId.stringValue]; NSString *apiPath = [[NSString alloc] initWithFormat:@"https://%@/admin/products/%@/metafields.json",Shopify_SHOP_DOMAIN,productId.stringValue];
...@@ -693,8 +693,8 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -693,8 +693,8 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
return [self startSessionTask:KWMHTTPMethodGET return [self startSessionTask:KWMHTTPMethodGET
apiPath:apiPath apiPath:apiPath
parameters:parameters parameters:parameters
result:[KWMImagesResult class] result:[KWMMetafieldResult class]
model:[KWMImage class] model:[KWMMetafield class]
success:success success:success
failure:failure]; failure:failure];
} }
......
//
// 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
//
// KWMColor.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMColor.h"
@implementation KWMColor
@end
// //
// KWMImage.h // KWMMetafield
// iCemarose // iCemarose
// //
// Created by HouWeiBin on 2016/11/13. // Created by HouWeiBin on 2016/11/13.
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
#import "KWMBaseModel.h" #import "KWMBaseModel.h"
//旧获取图片api所用到的modal,已废弃 @interface KWMMetafield : KWMBaseModel
@interface KWMImage : KWMBaseModel //域名,与APP无关
//服务器图片域名,与APP无关
@property(nonatomic) NSString *namespace; @property(nonatomic) NSString *namespace;
//标示,pe_related_1标示约定为颜色
@property(nonatomic) NSString *key; @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; @property(nonatomic) NSString *value;
//string //string
...@@ -32,14 +31,5 @@ ...@@ -32,14 +31,5 @@
@property(nonatomic) NSString *updatedAt; @property(nonatomic) NSString *updatedAt;
//获取小图片
-(NSString *)getSmallImage;
//获取中图片
-(NSString *)getNormalImage;
//获取大图片
-(NSString *)getBigImage;
@end @end
...@@ -6,27 +6,11 @@ ...@@ -6,27 +6,11 @@
// Copyright © 2016年 kollway. All rights reserved. // Copyright © 2016年 kollway. All rights reserved.
// //
#import "KWMImage.h" #import "KWMMetafield.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "KWMImageUtil.h" #import "KWMImageUtil.h"
@implementation KWMImage @implementation KWMMetafield
-(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 @"";
}
@end @end
...@@ -8,10 +8,13 @@ ...@@ -8,10 +8,13 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "Buy/Buy.h" #import "Buy/Buy.h"
#import "KWMColor.h"
@interface KWMProductColorCell : UICollectionViewCell @interface KWMProductColorCell : UICollectionViewCell
@property(nonatomic) BOOL isSelect; @property(nonatomic) BOOL isSelect;
@property(nonatomic) KWMColor *data;
@end @end
...@@ -9,16 +9,19 @@ ...@@ -9,16 +9,19 @@
#import "KWMProductColorCell.h" #import "KWMProductColorCell.h"
#import "UIColor+SAMAdditions.h" #import "UIColor+SAMAdditions.h"
#import "UIView+Prettify.h" #import "UIView+Prettify.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface KWMProductColorCell() @interface KWMProductColorCell()
@property(nonatomic,weak) IBOutlet UIImageView *ivProduct; @property(nonatomic,weak) IBOutlet UIImageView *ivColor;
@property(nonatomic,weak) IBOutlet UIImageView *ivSelected; @property(nonatomic,weak) IBOutlet UIImageView *ivSelected;
@property(nonatomic,weak) IBOutlet UIView *vProduct; @property(nonatomic,weak) IBOutlet UIView *vProduct;
@property(nonatomic,weak) IBOutlet UILabel *lbTitle;
@end @end
...@@ -27,13 +30,27 @@ ...@@ -27,13 +30,27 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[super awakeFromNib]; [super awakeFromNib];
// Initialization code // Initialization code
[self.ivProduct setBorder:1 cornerRadius:1 borderColor:[UIColor sam_colorWithHex:@"D8DBDE"]]; [self.ivColor setBorder:1 cornerRadius:1 borderColor:[UIColor sam_colorWithHex:@"D8DBDE"]];
} }
-(void)setIsSelect:(BOOL)isSelect{ -(void)setIsSelect:(BOOL)isSelect{
_isSelect = isSelect; _isSelect = isSelect;
[self.ivProduct setBorder:1 cornerRadius:1 borderColor:isSelect?[UIColor sam_colorWithHex:@"F1929A"]:[UIColor sam_colorWithHex:@"D8DBDE"]]; [self.ivColor setBorder:1 cornerRadius:1 borderColor:isSelect?[UIColor sam_colorWithHex:@"F1929A"]:[UIColor sam_colorWithHex:@"D8DBDE"]];
self.ivSelected.hidden = !isSelect; 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 @end
...@@ -85,8 +85,9 @@ ...@@ -85,8 +85,9 @@
<constraint firstAttribute="bottom" secondItem="LIy-sM-Sa7" secondAttribute="bottom" id="SCB-9p-0lM"/> <constraint firstAttribute="bottom" secondItem="LIy-sM-Sa7" secondAttribute="bottom" id="SCB-9p-0lM"/>
</constraints> </constraints>
<connections> <connections>
<outlet property="ivProduct" destination="m0M-BD-5Uv" id="WFe-t0-yhM"/> <outlet property="ivColor" destination="m0M-BD-5Uv" id="bGX-e5-tgh"/>
<outlet property="ivSelected" destination="PXf-2y-qN1" id="ei9-v0-z6q"/> <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"/> <outlet property="vProduct" destination="5sQ-H3-h9f" id="fkM-xP-spq"/>
</connections> </connections>
</collectionViewCell> </collectionViewCell>
......
...@@ -28,7 +28,17 @@ ...@@ -28,7 +28,17 @@
@property (weak, nonatomic) IBOutlet UIImageView *ivShare; @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; @property (nonatomic) BOOL isLikeVariant;
...@@ -57,24 +67,40 @@ ...@@ -57,24 +67,40 @@
-(void)initView{ -(void)initView{
[self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal]; [self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal];
self.productId = @(4746085766); self.productId = @(7436196294);
self.detailView1.delegate = self; self.detailView1.delegate = self;
self.colorArray = [NSMutableArray array];
[self requestProductDetail]; [self requestProductDetail];
[self requestBrandProducts:1]; [self requestBrandProducts:1];
[self requestCategoryProducts: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{ -(IBAction)onClickClose:(id)sender{
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
-(IBAction)onClickShare:(id)sender{ -(IBAction)onClickShare:(id)sender{
KWMWishListVC *wishVC = (KWMWishListVC *)[KWMBaseVC findControllerBy:[KWMWishListVC kwmTag] fromStoryboard:@"NewProduct"];
[self.navigationController pushViewController:wishVC animated:YES];
return;
if(self.product){ if(self.product){
KWMShareVC *shareVC = (KWMShareVC *)[KWMBaseVC findControllerBy:[KWMShareVC kwmTag] fromStoryboard:@"New"]; KWMShareVC *shareVC = (KWMShareVC *)[KWMBaseVC findControllerBy:[KWMShareVC kwmTag] fromStoryboard:@"New"];
shareVC.shareUrl = [NSString stringWithFormat:@"https://www.cemarose.com/products/%@",self.product.handle]; shareVC.shareUrl = [NSString stringWithFormat:@"https://www.cemarose.com/products/%@",self.product.handle];
...@@ -97,6 +123,7 @@ ...@@ -97,6 +123,7 @@
-(void)kwm_onClickSizeBtn{ -(void)kwm_onClickSizeBtn{
KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"]; KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"];
variantsVC.product = self.product; variantsVC.product = self.product;
variantsVC.colorArray = self.colorArray;
variantsVC.delegate = self; variantsVC.delegate = self;
CGSize size = [UIScreen mainScreen].bounds.size; CGSize size = [UIScreen mainScreen].bounds.size;
[self showPresentation:variantsVC size:size tapOutsideClose:YES style:MZFormSheetPresentationTransitionStyleFade]; [self showPresentation:variantsVC size:size tapOutsideClose:YES style:MZFormSheetPresentationTransitionStyleFade];
...@@ -133,11 +160,11 @@ ...@@ -133,11 +160,11 @@
} }
#pragma mark - KWMVariantsVCDelegate #pragma mark - KWMVariantsVCDelegate
-(void)kwm_setVariant:(KWMVariantsVC *)variantsVC variant:(BUYProductVariant *)variant color:(KWMColor *)color{
-(void)kwm_setVariant:(KWMVariantsVC *)variantsVC variant:(BUYProductVariant *)variant{ [self.btnLike setImage:[UIImage imageNamed:@"ic_like"] forState:UIControlStateNormal];
self.detailView1.variant = variant; self.detailView1.variant = variant;
self.variant = variant; self.variant = variant;
[self.btnLike setImage:[UIImage imageNamed:@"ic_like"] forState:UIControlStateNormal]; self.color = color;
self.isLikeVariant = NO; self.isLikeVariant = NO;
[self requestWishList]; [self requestWishList];
} }
...@@ -207,6 +234,21 @@ ...@@ -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{ -(void)requestBrandProducts:(NSInteger)page{
// if(!self.product){ // if(!self.product){
// return; // return;
...@@ -248,6 +290,30 @@ ...@@ -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{ -(void)requestWishList{
__weak KWMNewProductVC *weakSelf = self; __weak KWMNewProductVC *weakSelf = self;
NSDictionary *customerDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"customer"]; NSDictionary *customerDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"customer"];
...@@ -357,4 +423,5 @@ ...@@ -357,4 +423,5 @@
@end @end
...@@ -13,28 +13,31 @@ ...@@ -13,28 +13,31 @@
#import "KWMShopCartData.h" #import "KWMShopCartData.h"
#import "KWMVariants.h" #import "KWMVariants.h"
#import "KWMWish.h" #import "KWMWish.h"
#import "KWMColor.h"
@class KWMVariantsVC; @class KWMVariantsVC;
@protocol KWMVariantsVCDelegate <NSObject> @protocol KWMVariantsVCDelegate <NSObject>
- (void)kwm_addShopWithVariantId:(NSNumber *) identifier quantity:(NSInteger) quantity variant:(BUYProductVariant *) variant buyNow:(BOOL) buyNow callback:(void(^)(BOOL)) callback; - (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 @end
@interface KWMVariantsVC : KWMBaseVC<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout> @interface KWMVariantsVC : KWMBaseVC<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
//required 回调用的delegate
@property (weak, nonatomic) id<KWMVariantsVCDelegate> delegate; @property (weak, nonatomic) id<KWMVariantsVCDelegate> delegate;
//請求api拿到的admin 規格列表,主要使用到其中的庫存剩餘字段 //required 商品模型,必须有
@property (nonatomic) NSArray<KWMVariants *> *adminVariantArray;
@property (nonatomic) NSArray<BUYProductVariant *> *variantArray;
@property (nonatomic) KWMShopCartModel *shopCartModel;
@property (nonatomic) BUYProduct *product; @property (nonatomic) BUYProduct *product;
//optional 有颜色可选时,需要赋值该字段.
@property (nonatomic) NSArray<KWMColor *> *colorArray;
//optional 愿望单页跳转来时,需要赋值该字段。
@property (nonatomic) KWMWish *wish; @property (nonatomic) KWMWish *wish;
//optional 购物车页跳转来时,需要赋值该字段。
@property (nonatomic) KWMShopCartModel *shopCartModel;
@end @end
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
@property(nonatomic) IBOutlet UILabel *lbCount; @property(nonatomic) IBOutlet UILabel *lbCount;
@property(nonatomic) NSInteger count; @property(nonatomic) NSInteger count;
@property(nonatomic) NSDecimalNumber *totalPrice; @property(nonatomic) NSDecimalNumber *totalPrice;
...@@ -33,6 +35,12 @@ ...@@ -33,6 +35,12 @@
@property(nonatomic) KWMVariants *selectAdminVariant; @property(nonatomic) KWMVariants *selectAdminVariant;
@property(nonatomic) KWMColor *selectColor;
@property (nonatomic) NSArray<BUYProductVariant *> *variantArray;
//請求api拿到的admin 規格列表,主要使用到其中的庫存剩餘字段
@property (nonatomic) NSArray<KWMVariants *> *adminVariantArray;
@end @end
...@@ -92,6 +100,14 @@ ...@@ -92,6 +100,14 @@
} }
-(void)initView{ -(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 initUI];
[self initCollectionView]; [self initCollectionView];
[self initContentHeight]; [self initContentHeight];
...@@ -149,11 +165,13 @@ ...@@ -149,11 +165,13 @@
-(IBAction)onClickAdd:(id)sender{ -(IBAction)onClickAdd:(id)sender{
if(self.selectVariant){ if(self.selectVariant){
if(self.selectAdminVariant && self.count + 1 > self.selectAdminVariant.inventoryQuantity.integerValue){ NSInteger maxCount = self.selectAdminVariant?self.selectAdminVariant.inventoryQuantity.integerValue:9999;
[self showToast:@"商品剩余数量不足"]; if(self.count + 1 > maxCount){
return; self.count = maxCount;
[self showToast:[NSString stringWithFormat:@"商品剩余库存仅有%ld件",maxCount]];
}else{
self.count ++;
} }
self.count ++;
[self initUI]; [self initUI];
}else{ }else{
[self showToast:@"请选择您想要的规格"]; [self showToast:@"请选择您想要的规格"];
...@@ -194,8 +212,9 @@ ...@@ -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]; [self dismissViewControllerAnimated:YES completion:nil];
} }
...@@ -205,14 +224,18 @@ ...@@ -205,14 +224,18 @@
#pragma mark -- UICollectionViewDataSource UICollectionViewDelegate #pragma mark -- UICollectionViewDataSource UICollectionViewDelegate
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ -(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{ -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if(section == 0){ if(section == 0){
return self.variantArray.count; return self.variantArray?self.variantArray.count:0;
}else{ }else{
return 8; return self.colorArray?self.colorArray.count:0;
} }
} }
...@@ -223,6 +246,7 @@ ...@@ -223,6 +246,7 @@
UICollectionReusableView *headView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionViewHeader" forIndexPath:indexPath]; UICollectionReusableView *headView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionViewHeader" forIndexPath:indexPath];
NSString *colorTitle = @"颜色";
NSString *sizeTitle = @"尺寸"; NSString *sizeTitle = @"尺寸";
if(self.selectAdminVariant && self.selectAdminVariant.inventoryQuantity.integerValue <= 5){ if(self.selectAdminVariant && self.selectAdminVariant.inventoryQuantity.integerValue <= 5){
sizeTitle = [NSString stringWithFormat:@"尺寸 (仅剩%@件)",self.selectAdminVariant.inventoryQuantity.stringValue]; sizeTitle = [NSString stringWithFormat:@"尺寸 (仅剩%@件)",self.selectAdminVariant.inventoryQuantity.stringValue];
...@@ -233,10 +257,9 @@ ...@@ -233,10 +257,9 @@
UILabel *headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(35, 15, UI_SCREEN_WIDTH-80,30)]; UILabel *headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(35, 15, UI_SCREEN_WIDTH-80,30)];
headerLabel.textColor = [UIColor sam_colorWithHex:@"393939"]; headerLabel.textColor = [UIColor sam_colorWithHex:@"393939"];
headerLabel.font = [UIFont systemFontOfSize:12.5]; headerLabel.font = [UIFont systemFontOfSize:12.5];
headerLabel.text = indexPath.section == 0?sizeTitle:@"颜色"; headerLabel.text = indexPath.section == 0?sizeTitle:colorTitle;
[headView addSubview:headerLabel]; [headView addSubview:headerLabel];
return headView; return headView;
} }
...@@ -249,7 +272,7 @@ ...@@ -249,7 +272,7 @@
KWMVariants *adminVariant = nil; KWMVariants *adminVariant = nil;
if(self.adminVariantArray && self.adminVariantArray.count>indexPath.row){ if(self.adminVariantArray && self.adminVariantArray.count>indexPath.row){
for(KWMVariants *mAdminVariant in self.adminVariantArray){ for(KWMVariants *mAdminVariant in self.adminVariantArray){
if(variant.identifier.integerValue == mAdminVariant.id.integerValue){ if([variant.identifier isEqualToNumber:mAdminVariant.id]){
adminVariant = mAdminVariant; adminVariant = mAdminVariant;
} }
} }
...@@ -263,8 +286,10 @@ ...@@ -263,8 +286,10 @@
cell.productVariant = variant; cell.productVariant = variant;
return cell; return cell;
}else{ }else{
KWMColor *color = [self.colorArray objectAtIndex:indexPath.row];
KWMProductColorCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMProductColorCell class]) forIndexPath:indexPath]; 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; return cell;
} }
} }
...@@ -294,13 +319,19 @@ ...@@ -294,13 +319,19 @@
if(isSellOut){ if(isSellOut){
return; return;
} }
if(!self.selectVariant || self.selectVariant.identifierValue != variant.identifierValue){ if(!self.selectVariant || ![self.selectVariant.identifier isEqualToNumber:variant.identifier]){
self.count = 1; self.count = 1;
} }
self.selectVariant = variant; self.selectVariant = variant;
self.selectAdminVariant = adminVariant; self.selectAdminVariant = adminVariant;
[self.cvVariants reloadData]; [self.cvVariants reloadData];
[self initUI]; [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 @@ ...@@ -338,7 +369,7 @@
-(BOOL)isSelect:(BUYProductVariant *)variant{ -(BOOL)isSelect:(BUYProductVariant *)variant{
if(variant && self.selectVariant){ if(variant && self.selectVariant){
return variant.identifier.integerValue == self.selectVariant.identifier.integerValue; return [variant.identifier isEqualToNumber:self.selectVariant.identifier];
}; };
return NO; return NO;
} }
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
+ (UIImage *)imageWithImage:(UIImage *)image scaledToPixelSize:(CGSize)newSize; + (UIImage *)imageWithImage:(UIImage *)image scaledToPixelSize:(CGSize)newSize;
+ (UIImage *)imageAfterZoom:(UIImage *)image scale:(float)scale; + (UIImage *)imageAfterZoom:(UIImage *)image scale:(float)scale;
//传入图片需为kwmimage类型
+ (NSArray *)checkImage:(NSArray *)imagesArray;
//获取商品图片列表 //获取商品图片列表
+ (NSArray *)getProductImageUrls:(id)product ImageSize:(NSInteger)ImageSize; + (NSArray *)getProductImageUrls:(id)product ImageSize:(NSInteger)ImageSize;
......
...@@ -125,29 +125,6 @@ ...@@ -125,29 +125,6 @@
return [self imageWithImage:image scaledToPixelSize:CGSizeMake(newWidth, newHeight)]; 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{ +(NSArray *)getOriginalImages1:(BUYProduct *)product{
NSMutableArray *productImages = [[NSMutableArray alloc]init]; NSMutableArray *productImages = [[NSMutableArray alloc]init];
if(!product){ if(!product){
......
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