Commit af1531be by houweibin

1,商品详情完善

2,fix error
parent 97e77983
......@@ -230,6 +230,8 @@
C04834561F13590500A5BFB4 /* KWMClothingSetsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C04834521F13590500A5BFB4 /* KWMClothingSetsCell.xib */; };
C048B8E21EF3C04B000DA7AF /* KWMBeforePayData.m in Sources */ = {isa = PBXBuildFile; fileRef = C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */; };
C048B8E51EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C048B8E41EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m */; };
C057C77D1F172D4C00B95034 /* KWMMidDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = C057C77C1F172D4C00B95034 /* KWMMidDetailView.m */; };
C057C77F1F172D8E00B95034 /* KWMMidDetailView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C057C77E1F172D8E00B95034 /* KWMMidDetailView.xib */; };
C05910941E34A729002990B3 /* KWMNewGiftCardCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C05910921E34A729002990B3 /* KWMNewGiftCardCell.m */; };
C05910951E34A729002990B3 /* KWMNewGiftCardCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C05910931E34A729002990B3 /* KWMNewGiftCardCell.xib */; };
C06665091D75A2E500F02EF4 /* KWMOrderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C06665041D75A2E500F02EF4 /* KWMOrderCell.m */; };
......@@ -260,8 +262,6 @@
C0A6B3C31F01FC5300D85673 /* KWMProductSizeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0A6B3B21F01FC5300D85673 /* KWMProductSizeCell.xib */; };
C0A6B3C41F01FC5300D85673 /* KWMSecondDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0A6B3B41F01FC5300D85673 /* KWMSecondDetailView.m */; };
C0A6B3C51F01FC5300D85673 /* KWMSecondDetailView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0A6B3B51F01FC5300D85673 /* KWMSecondDetailView.xib */; };
C0A6B3C61F01FC5300D85673 /* KWMThirdDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0A6B3B71F01FC5300D85673 /* KWMThirdDetailView.m */; };
C0A6B3C71F01FC5300D85673 /* KWMThirdDetailView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0A6B3B81F01FC5300D85673 /* KWMThirdDetailView.xib */; };
C0A6B3C81F01FC5300D85673 /* KWMNewProductVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C0A6B3BA1F01FC5300D85673 /* KWMNewProductVC.m */; };
C0A6B3C91F01FC5300D85673 /* KWMVariantsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C0A6B3BC1F01FC5300D85673 /* KWMVariantsVC.m */; };
C0A6B3CA1F01FC5300D85673 /* NewProduct.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0A6B3BD1F01FC5300D85673 /* NewProduct.storyboard */; };
......@@ -768,6 +768,9 @@
C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMBeforePayData.m; sourceTree = "<group>"; };
C048B8E31EF3F20B000DA7AF /* KWMCollectionRefreshUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCollectionRefreshUtil.h; sourceTree = "<group>"; };
C048B8E41EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCollectionRefreshUtil.m; sourceTree = "<group>"; };
C057C77B1F172D4C00B95034 /* KWMMidDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMMidDetailView.h; sourceTree = "<group>"; };
C057C77C1F172D4C00B95034 /* KWMMidDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMMidDetailView.m; sourceTree = "<group>"; };
C057C77E1F172D8E00B95034 /* KWMMidDetailView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMMidDetailView.xib; sourceTree = "<group>"; };
C05910911E34A729002990B3 /* KWMNewGiftCardCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KWMNewGiftCardCell.h; path = ../../ShopCart/Cell/KWMNewGiftCardCell.h; sourceTree = "<group>"; };
C05910921E34A729002990B3 /* KWMNewGiftCardCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KWMNewGiftCardCell.m; path = ../../ShopCart/Cell/KWMNewGiftCardCell.m; sourceTree = "<group>"; };
C05910931E34A729002990B3 /* KWMNewGiftCardCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = KWMNewGiftCardCell.xib; path = ../../ShopCart/Cell/KWMNewGiftCardCell.xib; sourceTree = "<group>"; };
......@@ -819,9 +822,6 @@
C0A6B3B31F01FC5300D85673 /* KWMSecondDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMSecondDetailView.h; sourceTree = "<group>"; };
C0A6B3B41F01FC5300D85673 /* KWMSecondDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMSecondDetailView.m; sourceTree = "<group>"; };
C0A6B3B51F01FC5300D85673 /* KWMSecondDetailView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMSecondDetailView.xib; sourceTree = "<group>"; };
C0A6B3B61F01FC5300D85673 /* KWMThirdDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMThirdDetailView.h; sourceTree = "<group>"; };
C0A6B3B71F01FC5300D85673 /* KWMThirdDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMThirdDetailView.m; sourceTree = "<group>"; };
C0A6B3B81F01FC5300D85673 /* KWMThirdDetailView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMThirdDetailView.xib; sourceTree = "<group>"; };
C0A6B3B91F01FC5300D85673 /* KWMNewProductVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNewProductVC.h; sourceTree = "<group>"; };
C0A6B3BA1F01FC5300D85673 /* KWMNewProductVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNewProductVC.m; sourceTree = "<group>"; };
C0A6B3BB1F01FC5300D85673 /* KWMVariantsVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMVariantsVC.h; sourceTree = "<group>"; };
......@@ -2007,18 +2007,18 @@
C0A6B3AA1F01FC5300D85673 /* KWMFirstDetailView.h */,
C0A6B3AB1F01FC5300D85673 /* KWMFirstDetailView.m */,
C0A6B3AC1F01FC5300D85673 /* KWMFirstDetailView.xib */,
C0A6B3B31F01FC5300D85673 /* KWMSecondDetailView.h */,
C0A6B3B41F01FC5300D85673 /* KWMSecondDetailView.m */,
C0A6B3B51F01FC5300D85673 /* KWMSecondDetailView.xib */,
C057C77B1F172D4C00B95034 /* KWMMidDetailView.h */,
C057C77C1F172D4C00B95034 /* KWMMidDetailView.m */,
C057C77E1F172D8E00B95034 /* KWMMidDetailView.xib */,
C0A6B3AD1F01FC5300D85673 /* KWMProductColorCell.h */,
C0A6B3AE1F01FC5300D85673 /* KWMProductColorCell.m */,
C0A6B3AF1F01FC5300D85673 /* KWMProductColorCell.xib */,
C0A6B3B01F01FC5300D85673 /* KWMProductSizeCell.h */,
C0A6B3B11F01FC5300D85673 /* KWMProductSizeCell.m */,
C0A6B3B21F01FC5300D85673 /* KWMProductSizeCell.xib */,
C0A6B3B31F01FC5300D85673 /* KWMSecondDetailView.h */,
C0A6B3B41F01FC5300D85673 /* KWMSecondDetailView.m */,
C0A6B3B51F01FC5300D85673 /* KWMSecondDetailView.xib */,
C0A6B3B61F01FC5300D85673 /* KWMThirdDetailView.h */,
C0A6B3B71F01FC5300D85673 /* KWMThirdDetailView.m */,
C0A6B3B81F01FC5300D85673 /* KWMThirdDetailView.xib */,
C029868C1F0F2663002EB25F /* KWMWishCell.h */,
C029868D1F0F2663002EB25F /* KWMWishCell.m */,
C029868E1F0F2663002EB25F /* KWMWishCell.xib */,
......@@ -2384,6 +2384,7 @@
C0392DBA1DCC38450051AC8E /* KWMShippingCell.xib in Resources */,
C0CCB3D01EEA765B00BC2FB8 /* KWMFilterTabItem.xib in Resources */,
80DD275B1DC2FE6800CDC5B5 /* Home.storyboard in Resources */,
C057C77F1F172D8E00B95034 /* KWMMidDetailView.xib in Resources */,
80A611AF1D6DB0CD00709E09 /* ShopCart.storyboard in Resources */,
C02C7D811E640D82008DC29C /* README.txt in Resources */,
C0DD531F1EE54F5D002D1E0C /* KWMMineTitleView.xib in Resources */,
......@@ -2413,7 +2414,6 @@
C0CCB3BA1EEA579900BC2FB8 /* KWMFilterView.xib in Resources */,
C0CCB3C21EEA59A200BC2FB8 /* KWMFilterViewCell.xib in Resources */,
C0CC14171D79826F007B5986 /* KWMAddressCell.xib in Resources */,
C0A6B3C71F01FC5300D85673 /* KWMThirdDetailView.xib in Resources */,
804771821D6D32A70086B4DC /* Login.storyboard in Resources */,
C0DD53241EE55062002D1E0C /* KWMCarCountView.xib in Resources */,
C0A6B3C51F01FC5300D85673 /* KWMSecondDetailView.xib in Resources */,
......@@ -2520,7 +2520,6 @@
C04834411F13350F00A5BFB4 /* KWMRecommendHeader.m in Sources */,
C0F586951E25C17A001248E2 /* KWMProductDetailVC.m in Sources */,
C0F586871E24F820001248E2 /* KWMNewTypeSelectedVC.m in Sources */,
C0A6B3C61F01FC5300D85673 /* KWMThirdDetailView.m in Sources */,
80598D471D99193400BF0F97 /* KWMInformationVC.m in Sources */,
C034E7B91D6B0A8D006EE129 /* KWMHomeVC.m in Sources */,
C0CCB3BD1EEA589200BC2FB8 /* KWMFilter.m in Sources */,
......@@ -2629,6 +2628,7 @@
C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */,
807AF4A31DC984950000A326 /* KWMBlogResult.m in Sources */,
C0CC14081D7823B0007B5986 /* KWMSizeCell.m in Sources */,
C057C77D1F172D4C00B95034 /* KWMMidDetailView.m in Sources */,
DAB6431A1F04CFE5002CD7FE /* AppDelegate+Deeplink.m in Sources */,
C06665121D767A0A00F02EF4 /* KWMContactUsVC.m in Sources */,
C034E6CF1D6AEE39006EE129 /* KWMUserDao.m in Sources */,
......
......@@ -870,7 +870,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *) saveWish:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-save",@"chris.tofnews.com"];
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-save",@"test.cemarose.com"];
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
......@@ -890,7 +890,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *) getWishList:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist",@"chris.tofnews.com"];
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist",@"test.cemarose.com"];
return [self startSessionTask:KWMHTTPMethodGET
apiPath:apiPath
parameters:parameters
......@@ -910,7 +910,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *) removeWish:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-prune",@"chris.tofnews.com"];
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-prune",@"test.cemarose.com"];
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
......@@ -929,7 +929,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *) clearWishList:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMAdditionalListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-delete",@"chris.tofnews.com"];
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/wishlist-delete",@"test.cemarose.com"];
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
......
......@@ -14,7 +14,7 @@
modelClass:(Class)modelClass
error:(NSError **)err {
self = [super initWithDictionary:dict error:err];
if (self) {
if (self && modelClass) {
NSArray *dataArray = dict[@"data"];
if(dataArray){
self.data = [self buildListData:modelClass jsonDictionary:dataArray];
......
......@@ -19,7 +19,7 @@
@property (nonatomic) NSString *handle;
//颜色代表的商品
@property (nonatomic) BUYProduct *prodcut;
@property (nonatomic) BUYProduct *product;
//admin拿到的商品,在选择规格的页面才会去请求拿到给它赋值
@property (nonatomic) KWMProduct *adminProduct;
......
......@@ -7,6 +7,7 @@
//
#import "Buy/Buy.h"
#import "KWMColor.h"
@protocol KWMFirstDetailViewDelegate <NSObject>
......@@ -20,7 +21,13 @@
@property (weak, nonatomic) id<KWMFirstDetailViewDelegate>delegate;
@property (nonatomic) BUYProductVariant *variant;
@property (nonatomic,readonly) BUYProductVariant *variant;
@property (nonatomic,readonly) KWMColor *color;
@property (nonatomic,readonly) NSInteger count;
-(void)setSelect:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count;
-(void)setData:(BUYProduct *)product;
......
......@@ -26,8 +26,6 @@
@property(nonatomic,weak) IBOutlet UILabel *lbOldPrice;
@property(nonatomic,weak) IBOutlet UILabel *lbDetail;
@property(nonatomic,weak) IBOutlet UILabel *lbVariant;
//单位label
......@@ -49,6 +47,10 @@
- (IBAction)onClickBlandBtn:(id)sender;
- (IBAction)onClickBuyNow:(id)sender;
- (IBAction)onClickAddToShopCart:(id)sender;
@end
@implementation KWMFirstDetailView
......@@ -139,6 +141,7 @@
if(product == nil){
return;
}
[self.imageScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
NSInteger imageCount = product.imagesArray == nil? 0:product.imagesArray.count;
self.imageArr = [NSMutableArray array];
CGFloat w = UI_SCREEN_WIDTH;
......@@ -168,8 +171,6 @@
}
self.pageControl.numberOfPages = imageCount;
self.pageControl.currentPage = 0;
// [self.pageControl setValue:[UIImage imageNamed:@"ic_page_2"] forKey:@"_currentPageImage"];
// [self.pageControl setValue:[UIImage imageNamed:@"ic_page_1"] forKey:@"_pageImage"];
self.pageControl.defaultImage = [UIImage imageNamed:@"ic_page_1"];
self.pageControl.currentImage = [UIImage imageNamed:@"ic_page_2"];
self.imageScrollView.contentSize = CGSizeMake(w*imageCount,0);
......@@ -184,11 +185,11 @@
[self.btnBrand setTitle:product.vendor forState:UIControlStateNormal];
self.lbName.text = product.title;
BUYProductVariant *productVariant= product.variants.firstObject;
NSAttributedString *detailAttr = [[NSAttributedString alloc] initWithData:[self.product.htmlDescription dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
self.lbDetail.attributedText = detailAttr;
self.lbPrice.text = [KWMStringUtil price:productVariant.price];
// self.lbPrice.text = [KWMStringUtil price:productVariant.price];
self.lbPrice.text = productVariant.price.priceValueFormatted;
if (productVariant.compareAtPrice) {
NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil price:productVariant.compareAtPrice]];
// NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil price:productVariant.compareAtPrice]];
NSString *priceString = productVariant.compareAtPrice.priceValueFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbOldPrice.attributedText = attribtStr;
......@@ -248,24 +249,34 @@
-(void)onClickSizeBtn:(id)sender{
if(self.delegate!=nil){
if(self.delegate){
[self.delegate kwm_onClickSizeBtn];
}
}
-(void)onClickBlandBtn:(id)sender{
if(self.delegate!=nil){
if(self.delegate){
[self.delegate kwm_goToBrandVC];
}
}
-(void)setVariant:(BUYProductVariant *)variant{
-(void)setSelect:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count{
_variant = variant;
if(variant){
self.lbVariant.text = variant.title;
_color = color;
_count = count;
if(!variant){
self.lbVariant.text = @"选择尺码/颜色";
}else{
NSString *colorString = color?[NSString stringWithFormat:@"%@ /",color.title]:@"";
self.lbVariant.text = [NSString stringWithFormat:@"已选择 %@ %@ / %ld",colorString,variant.title,count];
}
}
@end
......@@ -17,7 +17,6 @@
<outlet property="lbName" destination="SQm-rY-OyA" id="Fux-pg-fca"/>
<outlet property="lbOldPrice" destination="Mql-V1-hiE" id="Sh1-Fz-sfU"/>
<outlet property="lbPrice" destination="gpT-Sg-ghu" id="FGd-AA-Yiv"/>
<outlet property="lbUnit" destination="wfT-JC-g9d" id="MSn-kd-aQ2"/>
<outlet property="lbVariant" destination="o3P-oH-Xcb" id="i3M-ae-jhH"/>
<outlet property="pageControl" destination="M6v-TN-2WE" id="QPe-TI-LdG"/>
<outlet property="vView" destination="iN0-l3-epB" id="TQD-W9-jEg"/>
......@@ -32,10 +31,10 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lKe-L4-ROK" userLabel="vTop">
<rect key="frame" x="0.0" y="0.0" width="375" height="462"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="467"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h8J-3U-wMB">
<rect key="frame" x="0.0" y="43.5" width="375" height="375"/>
<rect key="frame" x="0.0" y="46.5" width="375" height="375"/>
<constraints>
<constraint firstAttribute="width" secondItem="h8J-3U-wMB" secondAttribute="height" multiplier="1:1" id="xTw-hD-9tf"/>
</constraints>
......@@ -50,13 +49,13 @@
</constraints>
</view>
<pageControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" translatesAutoresizingMaskIntoConstraints="NO" id="M6v-TN-2WE" customClass="KWMPageControl">
<rect key="frame" x="168" y="462" width="39" height="10"/>
<rect key="frame" x="168" y="467" width="39" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="n7t-N5-xKa"/>
</constraints>
</pageControl>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ymw-Cg-156" userLabel="vBottom">
<rect key="frame" x="0.0" y="472" width="375" height="195"/>
<rect key="frame" x="0.0" y="477" width="375" height="190"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iJa-Oj-Sd2" userLabel="商品数据">
<rect key="frame" x="0.0" y="0.0" width="375" height="130"/>
......@@ -80,23 +79,17 @@
<color key="textColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wfT-JC-g9d">
<rect key="frame" x="21" y="66" width="9" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gpT-Sg-ghu">
<rect key="frame" x="40" y="62" width="80.5" height="28"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无 " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gpT-Sg-ghu">
<rect key="frame" x="20" y="62" width="80" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="0Pv-kq-UND"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="0Pv-kq-UND"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="20"/>
<color key="textColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥ 暂无" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mql-V1-hiE">
<rect key="frame" x="120.5" y="68.5" width="51.5" height="18.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mql-V1-hiE">
<rect key="frame" x="100" y="68.5" width="26.5" height="18.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -184,25 +177,24 @@
</view>
</subviews>
<constraints>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" constant="3" id="0gt-hJ-gW7"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" id="2kJ-k6-7uE"/>
<constraint firstItem="efc-dz-O7V" firstAttribute="leading" secondItem="yYc-Lx-XMx" secondAttribute="trailing" id="ApX-Ec-ekY"/>
<constraint firstAttribute="trailing" secondItem="s6N-a3-C4Z" secondAttribute="trailing" constant="21" id="BH6-4A-Psp"/>
<constraint firstItem="KO2-yq-cZe" firstAttribute="top" secondItem="efc-dz-O7V" secondAttribute="top" id="D1C-JX-jqh"/>
<constraint firstItem="yYc-Lx-XMx" firstAttribute="top" secondItem="gpT-Sg-ghu" secondAttribute="bottom" constant="8" id="DMl-f6-dk5"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" id="Dqx-DG-mtd"/>
<constraint firstItem="efc-dz-O7V" firstAttribute="top" secondItem="yYc-Lx-XMx" secondAttribute="top" id="LXH-4U-H7T"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" id="LwR-CA-mq2"/>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="20" id="Qed-jX-eBU"/>
<constraint firstItem="s6N-a3-C4Z" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="Qm4-Ii-IA5"/>
<constraint firstItem="SQm-rY-OyA" firstAttribute="top" secondItem="s6N-a3-C4Z" secondAttribute="bottom" constant="4.5" id="TVX-ig-tsH"/>
<constraint firstItem="s6N-a3-C4Z" firstAttribute="top" secondItem="iJa-Oj-Sd2" secondAttribute="top" id="YxU-Rv-XEv"/>
<constraint firstItem="KO2-yq-cZe" firstAttribute="leading" secondItem="efc-dz-O7V" secondAttribute="trailing" id="ZGb-XR-j4Y"/>
<constraint firstItem="wfT-JC-g9d" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="ZU3-uY-xmf"/>
<constraint firstAttribute="trailing" secondItem="SQm-rY-OyA" secondAttribute="trailing" constant="21" id="dX6-4X-Blu"/>
<constraint firstItem="wfT-JC-g9d" firstAttribute="top" secondItem="SQm-rY-OyA" secondAttribute="bottom" constant="7.5" id="gcI-jU-lhJ"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="top" secondItem="SQm-rY-OyA" secondAttribute="bottom" constant="10" id="kEt-gI-pxw"/>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="top" secondItem="SQm-rY-OyA" secondAttribute="bottom" constant="3.5" id="lOo-gm-aCL"/>
<constraint firstItem="yYc-Lx-XMx" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="lTQ-qi-GT9"/>
<constraint firstAttribute="height" constant="130" id="nLX-8H-mni"/>
<constraint firstItem="SQm-rY-OyA" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="njb-yV-RRh"/>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="wfT-JC-g9d" secondAttribute="trailing" constant="10" id="o9j-pp-GRZ"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wgu-cH-TXa" userLabel="选择尺码/颜色" customClass="KWMItemView">
......@@ -222,7 +214,7 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Eqb-wS-Pj4" userLabel="line">
<rect key="frame" x="0.0" y="49" width="375" height="1"/>
<rect key="frame" x="20" y="49" width="355" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="PfY-sI-qsS"/>
......@@ -242,7 +234,7 @@
<constraint firstItem="JBu-QP-lhJ" firstAttribute="leading" secondItem="wgu-cH-TXa" secondAttribute="leading" constant="21" id="MPS-lz-BYC"/>
<constraint firstAttribute="bottom" secondItem="Eqb-wS-Pj4" secondAttribute="bottom" id="Ndv-Cn-fC4"/>
<constraint firstAttribute="trailing" secondItem="rd9-oQ-6Yd" secondAttribute="trailing" constant="20" id="dD7-bY-9ky"/>
<constraint firstItem="Eqb-wS-Pj4" firstAttribute="leading" secondItem="wgu-cH-TXa" secondAttribute="leading" id="eDd-wd-YoB"/>
<constraint firstItem="Eqb-wS-Pj4" firstAttribute="leading" secondItem="wgu-cH-TXa" secondAttribute="leading" constant="20" id="eDd-wd-YoB"/>
<constraint firstItem="o3P-oH-Xcb" firstAttribute="leading" secondItem="wgu-cH-TXa" secondAttribute="leading" constant="21" id="eYd-CZ-fBx"/>
<constraint firstItem="rd9-oQ-6Yd" firstAttribute="centerY" secondItem="wgu-cH-TXa" secondAttribute="centerY" id="ikC-7d-X6D"/>
<constraint firstAttribute="trailing" secondItem="JBu-QP-lhJ" secondAttribute="trailing" id="mGw-bx-abg"/>
......@@ -254,26 +246,16 @@
<outletCollection property="gestureRecognizers" destination="Bn3-BY-NZm" appends="YES" id="5YW-Qp-ioO"/>
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zmi-gQ-S6i">
<rect key="frame" x="0.0" y="190" width="375" height="5"/>
<color key="backgroundColor" red="0.95294117647058818" green="0.95686274509803915" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="5" id="PpS-Jc-blA"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="wgu-cH-TXa" secondAttribute="trailing" id="1BE-r2-etn"/>
<constraint firstItem="wgu-cH-TXa" firstAttribute="top" secondItem="iJa-Oj-Sd2" secondAttribute="bottom" constant="10" id="3E1-qY-lsE"/>
<constraint firstItem="zmi-gQ-S6i" firstAttribute="leading" secondItem="Ymw-Cg-156" secondAttribute="leading" id="4Id-i3-1mG"/>
<constraint firstItem="zmi-gQ-S6i" firstAttribute="top" secondItem="wgu-cH-TXa" secondAttribute="bottom" id="4Ld-Pc-ZRB"/>
<constraint firstAttribute="trailing" secondItem="iJa-Oj-Sd2" secondAttribute="trailing" id="8a6-sG-pwj"/>
<constraint firstItem="iJa-Oj-Sd2" firstAttribute="top" secondItem="Ymw-Cg-156" secondAttribute="top" id="Vl5-q8-AzT"/>
<constraint firstAttribute="trailing" secondItem="zmi-gQ-S6i" secondAttribute="trailing" id="YBd-mU-bgi"/>
<constraint firstItem="iJa-Oj-Sd2" firstAttribute="leading" secondItem="Ymw-Cg-156" secondAttribute="leading" id="hhQ-sM-yEW"/>
<constraint firstItem="wgu-cH-TXa" firstAttribute="leading" secondItem="Ymw-Cg-156" secondAttribute="leading" id="oIc-Ag-UZg"/>
<constraint firstAttribute="bottom" secondItem="zmi-gQ-S6i" secondAttribute="bottom" id="pzL-8F-jyX"/>
<constraint firstAttribute="bottom" secondItem="wgu-cH-TXa" secondAttribute="bottom" id="uTa-HP-Rfa"/>
</constraints>
</view>
</subviews>
......
//
// KWMThirdDetailView.h
// KWMMidDetailView.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/23.
// Created by HouWeiBin on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@interface KWMThirdDetailView : UIView
@interface KWMMidDetailView : UIView
@property(nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic,weak) BUYProduct *product;
@end
//
// KWMThirdDetailView.m
// KWMMidDetailView.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/23.
// Created by HouWeiBin on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMThirdDetailView.h"
@interface KWMThirdDetailView()
@property (weak, nonatomic) IBOutlet UIView *vView;
#import "KWMMidDetailView.h"
#import "KWMStringUtil.h"
@interface KWMMidDetailView()
@property(nonatomic,weak) IBOutlet UILabel *lbDetail;
@end
@implementation KWMThirdDetailView
@implementation KWMMidDetailView
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self initView];
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self initView];
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
......@@ -36,12 +42,23 @@
[super awakeFromNib];
}
-(void)initView{
-(void)addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
}
-(void)setProduct:(BUYProduct *)product{
_product = product;
if(product && ![KWMStringUtil isEmpty:product.stringDescription]){
self.lbDetail.text = product.stringDescription;
}else{
self.lbDetail.text = @"暂无商品描述";
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMMidDetailView">
<connections>
<outlet property="lbDetail" destination="16V-pg-zWo" id="GaV-86-xP9"/>
<outlet property="vView" destination="iN0-l3-epB" id="P0V-Yf-qbm"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="86.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0zT-PT-urZ" userLabel="商品详情">
<rect key="frame" x="0.0" y="0.0" width="375" height="86.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品详情" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pqF-X5-Xhf">
<rect key="frame" x="20" y="20" width="56" height="20"/>
<fontDescription key="fontDescription" name="PingFangSC-Light" family="PingFang SC" pointSize="14"/>
<color key="textColor" red="0.1529411765" green="0.14901960780000001" blue="0.21176470589999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无商品描述" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="16V-pg-zWo">
<rect key="frame" x="20" y="55" width="335" height="15.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Light" family="PingFang SC" pointSize="11"/>
<color key="textColor" red="0.1529411765" green="0.14901960780000001" blue="0.21176470589999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XNJ-x6-2qP" userLabel="line">
<rect key="frame" x="0.0" y="80.5" width="375" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="NJy-G1-cyA"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PrI-2Q-iZo">
<rect key="frame" x="0.0" y="81.5" width="375" height="5"/>
<color key="backgroundColor" red="0.95294117647058818" green="0.95686274509803915" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="5" id="sZO-dU-qbA"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="XNJ-x6-2qP" firstAttribute="leading" secondItem="0zT-PT-urZ" secondAttribute="leading" id="8BE-D2-yFW"/>
<constraint firstItem="16V-pg-zWo" firstAttribute="leading" secondItem="0zT-PT-urZ" secondAttribute="leading" constant="20" id="9FX-pD-wNv"/>
<constraint firstAttribute="trailing" secondItem="PrI-2Q-iZo" secondAttribute="trailing" id="D3a-eK-daj"/>
<constraint firstItem="pqF-X5-Xhf" firstAttribute="leading" secondItem="0zT-PT-urZ" secondAttribute="leading" constant="20" id="EzD-gc-lvx"/>
<constraint firstItem="pqF-X5-Xhf" firstAttribute="top" secondItem="0zT-PT-urZ" secondAttribute="top" constant="20" id="LEK-UP-dRE"/>
<constraint firstItem="PrI-2Q-iZo" firstAttribute="top" secondItem="XNJ-x6-2qP" secondAttribute="bottom" id="NNY-sX-Xqu"/>
<constraint firstItem="16V-pg-zWo" firstAttribute="top" secondItem="pqF-X5-Xhf" secondAttribute="bottom" constant="15" id="OZP-o7-VsQ"/>
<constraint firstItem="XNJ-x6-2qP" firstAttribute="leading" secondItem="0zT-PT-urZ" secondAttribute="leading" id="PcD-dE-uqp"/>
<constraint firstAttribute="trailing" secondItem="XNJ-x6-2qP" secondAttribute="trailing" id="QPz-Pw-Kko"/>
<constraint firstAttribute="bottom" secondItem="PrI-2Q-iZo" secondAttribute="bottom" id="YMF-oS-bPV"/>
<constraint firstAttribute="trailing" secondItem="XNJ-x6-2qP" secondAttribute="trailing" id="gfW-re-x8M"/>
<constraint firstItem="PrI-2Q-iZo" firstAttribute="leading" secondItem="0zT-PT-urZ" secondAttribute="leading" id="kX3-oP-46q"/>
<constraint firstAttribute="trailing" secondItem="16V-pg-zWo" secondAttribute="trailing" constant="20" id="nfa-gQ-E5a"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="0zT-PT-urZ" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="BdH-DG-45e"/>
<constraint firstAttribute="trailing" secondItem="0zT-PT-urZ" secondAttribute="trailing" id="Sff-qk-tGd"/>
<constraint firstItem="0zT-PT-urZ" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="g9K-fG-ixC"/>
<constraint firstAttribute="bottom" secondItem="0zT-PT-urZ" secondAttribute="bottom" id="iyD-4z-nH4"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
</document>
......@@ -42,7 +42,7 @@
-(void)setData:(KWMColor *)data{
_data = data;
if(data){
BUYProduct *product = data.prodcut;
BUYProduct *product = data.product;
NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage];
NSURL *imageURL = [NSURL URLWithString:imageUrl];
[self.ivColor sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
......
......@@ -6,7 +6,6 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -36,50 +35,39 @@
<rect key="frame" x="0.0" y="0.0" width="91" height="36"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cGu-OY-P4R" userLabel="size">
<rect key="frame" x="0.0" y="0.0" width="91" height="18"/>
<rect key="frame" x="0.0" y="0.0" width="91" height="36"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3A" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="whv-2v-7Jq">
<rect key="frame" x="0.0" y="0.0" width="91" height="18.5"/>
<rect key="frame" x="0.0" y="0.0" width="91" height="36.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" red="0.22352941176470587" green="0.22352941176470587" blue="0.22352941176470587" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dZq-jJ-iEe" userLabel="line">
<rect key="frame" x="22.5" y="8.5" width="45.5" height="1"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.50980392156862742" blue="0.54117647058823526" alpha="1" colorSpace="calibratedRGB"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_sell_out" translatesAutoresizingMaskIntoConstraints="NO" id="TdD-fg-gGm">
<rect key="frame" x="32" y="10" width="26" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="fKL-jv-avn"/>
<constraint firstAttribute="width" constant="26" id="Sem-we-wai"/>
<constraint firstAttribute="height" constant="15" id="ldd-Tb-DUK"/>
</constraints>
</view>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="TdD-fg-gGm" firstAttribute="centerY" secondItem="cGu-OY-P4R" secondAttribute="centerY" id="9YG-wq-dD4"/>
<constraint firstItem="TdD-fg-gGm" firstAttribute="centerX" secondItem="cGu-OY-P4R" secondAttribute="centerX" id="Dba-69-acf"/>
<constraint firstItem="whv-2v-7Jq" firstAttribute="top" secondItem="cGu-OY-P4R" secondAttribute="top" id="F83-Wt-SEu"/>
<constraint firstItem="whv-2v-7Jq" firstAttribute="leading" secondItem="cGu-OY-P4R" secondAttribute="leading" id="Jyt-in-reE"/>
<constraint firstItem="dZq-jJ-iEe" firstAttribute="centerX" secondItem="cGu-OY-P4R" secondAttribute="centerX" id="bqk-63-7jb"/>
<constraint firstAttribute="trailing" secondItem="whv-2v-7Jq" secondAttribute="trailing" id="diD-GC-atf"/>
<constraint firstAttribute="bottom" secondItem="whv-2v-7Jq" secondAttribute="bottom" id="maJ-HX-Qwr"/>
<constraint firstItem="dZq-jJ-iEe" firstAttribute="width" secondItem="cGu-OY-P4R" secondAttribute="width" multiplier="0.5" id="n2f-kj-OSA"/>
<constraint firstItem="dZq-jJ-iEe" firstAttribute="centerY" secondItem="cGu-OY-P4R" secondAttribute="centerY" id="rYK-at-zcZ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="到货提醒" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a1x-nK-a5r">
<rect key="frame" x="0.0" y="18" width="91" height="18"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="10"/>
<color key="textColor" red="0.22352941176470587" green="0.22352941176470587" blue="0.22352941176470587" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cGu-OY-P4R" firstAttribute="leading" secondItem="0cT-rD-xfN" secondAttribute="leading" id="6OR-DW-ehn"/>
<constraint firstAttribute="trailing" secondItem="cGu-OY-P4R" secondAttribute="trailing" id="9Xe-7j-CVp"/>
<constraint firstItem="cGu-OY-P4R" firstAttribute="height" secondItem="0cT-rD-xfN" secondAttribute="height" multiplier="0.5" id="P32-P7-2sr"/>
<constraint firstAttribute="trailing" secondItem="a1x-nK-a5r" secondAttribute="trailing" id="Thr-BQ-S1n"/>
<constraint firstAttribute="bottom" secondItem="cGu-OY-P4R" secondAttribute="bottom" id="MR2-a7-hda"/>
<constraint firstItem="cGu-OY-P4R" firstAttribute="top" secondItem="0cT-rD-xfN" secondAttribute="top" id="UlT-El-Qs2"/>
<constraint firstAttribute="bottom" secondItem="a1x-nK-a5r" secondAttribute="bottom" id="WfI-SI-Zh4"/>
<constraint firstItem="a1x-nK-a5r" firstAttribute="top" secondItem="cGu-OY-P4R" secondAttribute="bottom" id="uvz-SI-Sqb"/>
<constraint firstItem="a1x-nK-a5r" firstAttribute="leading" secondItem="0cT-rD-xfN" secondAttribute="leading" id="vEN-Ay-DEB"/>
</constraints>
</view>
</subviews>
......@@ -120,4 +108,7 @@
</connections>
</collectionViewCell>
</objects>
<resources>
<image name="ic_sell_out" width="26" height="16"/>
</resources>
</document>
......@@ -15,6 +15,7 @@
-(void)kwm_clickCollectionCell:(BUYProduct *)product;
@optional
-(void)kwm_loadNewPage:(BOOL)isSameBrand;
@end
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMThirdDetailView">
<connections>
<outlet property="vView" destination="iN0-l3-epB" id="jbE-sN-LZF"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="530"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="phf-Yh-r1z">
<rect key="frame" x="0.0" y="0.0" width="375" height="530"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="test_product_detail" translatesAutoresizingMaskIntoConstraints="NO" id="uQ5-LY-iWo">
<rect key="frame" x="0.0" y="20" width="375" height="510"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wfB-x3-Yg3">
<rect key="frame" x="0.0" y="0.0" width="375" height="40"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cRM-ik-mZ1" userLabel="vLine">
<rect key="frame" x="50" y="19" width="275" height="1"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="lEz-sk-YTa"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品详情" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aOi-sB-YXp">
<rect key="frame" x="112" y="10" width="150" height="20"/>
<color key="backgroundColor" red="0.99607843139999996" green="0.99607843139999996" blue="0.99607843139999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="150" id="LGk-89-dnF"/>
<constraint firstAttribute="height" constant="20" id="nGt-cs-4Ts"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Light" family="PingFang SC" pointSize="14"/>
<color key="textColor" red="0.25863381410000003" green="0.25863381410000003" blue="0.25863381410000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="nGt-cs-4Ts"/>
</mask>
</variation>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="4wL-Lc-vYc"/>
<constraint firstItem="aOi-sB-YXp" firstAttribute="centerX" secondItem="wfB-x3-Yg3" secondAttribute="centerX" id="6si-bK-rmk"/>
<constraint firstItem="cRM-ik-mZ1" firstAttribute="leading" secondItem="wfB-x3-Yg3" secondAttribute="leading" constant="50" id="MYj-rD-ToW"/>
<constraint firstAttribute="trailing" secondItem="cRM-ik-mZ1" secondAttribute="trailing" constant="50" id="bbe-zy-vGP"/>
<constraint firstItem="aOi-sB-YXp" firstAttribute="centerY" secondItem="wfB-x3-Yg3" secondAttribute="centerY" id="hzp-4O-sWn"/>
<constraint firstItem="cRM-ik-mZ1" firstAttribute="centerY" secondItem="wfB-x3-Yg3" secondAttribute="centerY" id="nbm-hB-C01"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="wfB-x3-Yg3" firstAttribute="leading" secondItem="phf-Yh-r1z" secondAttribute="leading" id="FBm-GK-tHj"/>
<constraint firstItem="wfB-x3-Yg3" firstAttribute="top" secondItem="phf-Yh-r1z" secondAttribute="top" id="Nql-eH-b43"/>
<constraint firstAttribute="bottom" secondItem="uQ5-LY-iWo" secondAttribute="bottom" id="X2e-xf-iXK"/>
<constraint firstAttribute="trailing" secondItem="uQ5-LY-iWo" secondAttribute="trailing" id="bcI-Xc-CAy"/>
<constraint firstItem="uQ5-LY-iWo" firstAttribute="top" secondItem="phf-Yh-r1z" secondAttribute="top" constant="20" id="rC7-ik-Dfr"/>
<constraint firstItem="uQ5-LY-iWo" firstAttribute="leading" secondItem="phf-Yh-r1z" secondAttribute="leading" id="xwA-Ce-VsC"/>
<constraint firstAttribute="trailing" secondItem="wfB-x3-Yg3" secondAttribute="trailing" id="yGC-ga-jQO"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="phf-Yh-r1z" secondAttribute="trailing" id="4Wq-hy-RLx"/>
<constraint firstItem="phf-Yh-r1z" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ebd-yK-Tec"/>
<constraint firstAttribute="bottom" secondItem="phf-Yh-r1z" secondAttribute="bottom" id="nDT-2t-8XL"/>
<constraint firstItem="phf-Yh-r1z" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="u0Z-64-52c"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
<image name="test_product_detail" width="375" height="534"/>
</resources>
</document>
......@@ -12,8 +12,9 @@
#import "KWMVariantsVC.h"
#import "KWMFirstDetailView.h"
#import "KWMSecondDetailView.h"
#import "KWMMidDetailView.h"
@interface KWMNewProductVC : KWMBaseVC<KWMFirstDetailViewDelegate,KWMVariantsVCDelegate>
@interface KWMNewProductVC : KWMBaseVC<KWMFirstDetailViewDelegate,KWMVariantsVCDelegate,KWMSecondDetailViewDelegate>
@property(nonatomic) BUYProduct *product;
......
......@@ -17,6 +17,7 @@
#import "KWMShoppingCart.h"
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "KWMShopCartVC.h"
@interface KWMNewProductVC ()
......@@ -24,9 +25,15 @@
@property (weak, nonatomic) IBOutlet KWMSecondDetailView *detailView2;
@property (weak, nonatomic) IBOutlet KWMMidDetailView *midDetailView;
@property (weak, nonatomic) IBOutlet UIButton *btnShopCart;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIButton *btnLike;
@property (weak, nonatomic) IBOutlet UIImageView *ivShare;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightMidView;
//颜色扩展字段
@property (nonatomic) KWMMetafield *colorMeterfield;
......@@ -40,14 +47,24 @@
//选中的颜色
@property (nonatomic) KWMColor *color;
//选中的数量
@property (nonatomic) NSInteger count;
@property (nonatomic) BOOL isLikeVariant;
@property (nonatomic) KWMProduct *adminProduct;
@end
@implementation KWMNewProductVC
- (void)viewDidLoad {
[super viewDidLoad];
self.productId = @(7436196294);
self.product = nil;
[self initView];
}
......@@ -66,16 +83,48 @@
}
-(void)initView{
[self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal];
self.productId = @(7436196294);
self.detailView1.delegate = self;
self.colorArray = [NSMutableArray array];
[self requestProductDetail];
[self requestBrandProducts:1];
[self requestCategoryProducts:1];
self.detailView1.delegate = self;
self.detailView2.delegate = self;
if(self.product){
self.midDetailView.product = self.product;
[self.detailView1 setData:self.product];
[self requestBrandProducts:1];
[self requestCategoryProducts:1];
}else{
[self requestProductDetail];
}
[self requestColorMetafield];
[self requestAdminProduct];
[self initShopCartCount];
[self initMidViewHight];
[self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal];
}
- (void)initShopCartCount{
NSNumber *count = [[KWMShoppingCart sharedInstance] count];
[self.btnShopCart setTitle:count.stringValue forState:UIControlStateNormal];
}
-(void)initMidViewHight{
if(self.product){
if([KWMStringUtil isEmpty:self.product.stringDescription]){
self.heightMidView.constant = 86.5;
}else{
NSString *detail = self.product.stringDescription;
//获得字体,计算文字显示所需高度
UIFont *font = [UIFont systemFontOfSize:11];
if(SYSTEM_VERSION_LESS_THAN(@"9.0")){
[UIFont fontWithName:@"PingFang SC" size:11];
}
NSInteger heightLbDetail = [KWMStringUtil getLabelHeight:detail labelFont:font textWidth:UI_SCREEN_WIDTH - 20].height;
self.heightMidView.constant = (86.5 - 15 + heightLbDetail);
}
}
}
//请求API得到颜色Meterfield后才会调用这个.
-(void)initColorData{
if(!self.colorMeterfield || [KWMStringUtil isEmpty:self.colorMeterfield.value]){
......@@ -89,10 +138,23 @@
KWMColor *color = [KWMColor new];
color.handle = colorInfo[0];
color.title = colorInfo[1];
[self requestProductByColor:color];
if(self.product && [color.handle isEqualToString:self.product.handle]){
color.product = self.product;
[self.colorArray addObject:color];
}else{
[self requestProductByColor:color];
}
}
}
}
-(void)clearSelect{
self.color = nil;
self.variant = nil;
self.count = 0;
if(self.detailView1){
[self.detailView1 setSelect:nil color:nil count:0];
}
}
......@@ -100,6 +162,11 @@
[self.navigationController popViewControllerAnimated:YES];
}
-(IBAction)onClickShopCart:(id)sender{
KWMShopCartVC *shopCartVC = (KWMShopCartVC *)[KWMBaseVC findControllerBy:[KWMShopCartVC kwmTag] fromStoryboard:@"ShopCart"];
[self.navigationController pushViewController:shopCartVC animated:YES];
}
-(IBAction)onClickShare:(id)sender{
if(self.product){
KWMShareVC *shareVC = (KWMShareVC *)[KWMBaseVC findControllerBy:[KWMShareVC kwmTag] fromStoryboard:@"New"];
......@@ -112,6 +179,14 @@
}
-(IBAction)onClickLike:(id)sender{
KWMUserModel *useModel = [KWMUserModel shareUser];
if (!useModel.status) {
//登录
KWMLoginVC *loginVc = (KWMLoginVC *)[KWMBaseVC findControllerBy:[KWMLoginVC kwmTag] fromStoryboard:@"Login"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:loginVc];
[self presentViewController:nav animated:YES completion:nil];
return;
}
if(self.isLikeVariant){
[self requestRemoveWish];
}else{
......@@ -119,70 +194,39 @@
}
}
#pragma mark -- KWMFirstDetailViewDelegate
-(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];
}
-(void)kwm_goToBrandVC{
if(self.product && self.product.vendor){
KWMBrandCaramelVC *brandCaramelVC = (KWMBrandCaramelVC *)[KWMBrandCaramelVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
NSString *brand = self.product.vendor;
brandCaramelVC.brand = brand;
brandCaramelVC.handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:brand];
brandCaramelVC.isSale = NO;
[self.navigationController pushViewController:brandCaramelVC animated:YES];
-(IBAction)onClickComplete:(UIButton *)sender{
BOOL buyNow = sender.tag == 1;
if(!self.variant){
[self showToast:@"请选择商品"];
return;
}
}
-(void)kwm_onClickImage:(NSMutableArray *)imageArr currentIndex:(NSInteger)currentIndex{
__weak KWMNewProductVC *weakSelf=self;
NSArray<NSString *> *imags = imageArr;
[PhotoBroswerVC show:self type:PhotoBroswerVCTypePush index:currentIndex isShowSaveBtn:YES photoModelBlock:^NSArray *{
NSArray *localImages = imags;
NSMutableArray *modelsM = [NSMutableArray arrayWithCapacity:localImages.count];
for (NSUInteger i = 0; i< localImages.count; i++) {
PhotoModel *pbModel=[[PhotoModel alloc] init];
pbModel.mid = i + 1;
//源frame
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, weakSelf.view.frame.size.width, weakSelf.view.frame.size.height)];
pbModel.sourceImageView = imageV;
pbModel.image_HD_U = [[KWMAPIManager sharedManager] toAbsoluteUrl:localImages[i]];
[modelsM addObject:pbModel];
[self showLoading];
__weak KWMNewProductVC *this = self;
[self addShopWithVariantId:self.variant.identifier quantity:self.count variant:self.variant buyNow:buyNow callback:^(BOOL success) {
[this hideLoading];
if(success) {
if(!buyNow){
[this initShopCartCount];
[this clearSelect];
}
//[this dismissViewControllerAnimated:YES completion:nil];
}
return modelsM;
}];
}
#pragma mark - KWMVariantsVCDelegate
-(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.color = color;
self.isLikeVariant = NO;
[self requestWishList];
}
- (void)kwm_addShopWithVariantId:(NSNumber *)identifier quantity:(NSInteger)quantity variant:(BUYProductVariant *) variant buyNow:(BOOL)buyNow callback:(void (^)(BOOL))callback {
//添加商品
- (void)addShopWithVariantId:(NSNumber *)identifier quantity:(NSInteger)quantity variant:(BUYProductVariant *) variant buyNow:(BOOL)buyNow callback:(void (^)(BOOL))callback {
__weak KWMNewProductVC *this = self;
if (!buyNow) {
[[KWMShoppingCart sharedInstance] increaseProductWithVariantId:identifier quantity:quantity callback:^(NSError *error, KWMCartResult *cart) {
if (cart.items.firstObject && !cart.items.firstObject.product_id) {
KWMShopCartModel *model = cart.items.firstObject;
BUYImageLink *il = this.product.images.firstObject;
// model.imageStr = [KWMImageUtil getProductImageUrl:this.product.identifier ImageSize:NormalImage];
model.imageStr = [KWMImageUtil getProductImageUrlByOriginalUrl:il.sourceURL.absoluteString ImageSize:NormalImage];
model.name = this.product.title;
model.brand = this.product.vendor;
model.size = variant.title;
// model.price = variant.price.floatValue;
model.price = variant.price;
model.price = variant.price;
model.product_id = this.product.identifier;
}
if (!error) {
......@@ -216,6 +260,77 @@
}
#pragma mark -- KWMSecondDetailViewDelegate
-(void)kwm_clickCollectionCell:(BUYProduct *)product{
if(!product){
return;
}
self.product = product;
self.productId = product.identifier;
[self.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
[self initView];
[self clearSelect];
}
#pragma mark -- KWMFirstDetailViewDelegate
-(void)kwm_onClickSizeBtn{
KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"];
variantsVC.product = self.product;
variantsVC.adminProduct = self.adminProduct;
variantsVC.colorArray = self.colorArray;
variantsVC.delegate = self;
if(self.variant){
[variantsVC setDefaultSelect:self.variant color:self.color count:self.count];
}
CGSize size = [UIScreen mainScreen].bounds.size;
[self showPresentation:variantsVC size:size tapOutsideClose:YES style:MZFormSheetPresentationTransitionStyleFade];
}
-(void)kwm_goToBrandVC{
if(self.product && self.product.vendor){
KWMBrandCaramelVC *brandCaramelVC = (KWMBrandCaramelVC *)[KWMBrandCaramelVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
NSString *brand = self.product.vendor;
brandCaramelVC.brand = brand;
brandCaramelVC.handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:brand];
brandCaramelVC.isSale = NO;
[self.navigationController pushViewController:brandCaramelVC animated:YES];
}
}
-(void)kwm_onClickImage:(NSMutableArray *)imageArr currentIndex:(NSInteger)currentIndex{
__weak KWMNewProductVC *weakSelf=self;
NSArray<NSString *> *imags = imageArr;
[PhotoBroswerVC show:self type:PhotoBroswerVCTypePush index:currentIndex isShowSaveBtn:YES photoModelBlock:^NSArray *{
NSArray *localImages = imags;
NSMutableArray *modelsM = [NSMutableArray arrayWithCapacity:localImages.count];
for (NSUInteger i = 0; i< localImages.count; i++) {
PhotoModel *pbModel=[[PhotoModel alloc] init];
pbModel.mid = i + 1;
//源frame
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, weakSelf.view.frame.size.width, weakSelf.view.frame.size.height)];
pbModel.sourceImageView = imageV;
pbModel.image_HD_U = [[KWMAPIManager sharedManager] toAbsoluteUrl:localImages[i]];
[modelsM addObject:pbModel];
}
return modelsM;
}];
}
#pragma mark - KWMVariantsVCDelegate
-(void)kwm_setVariant:(KWMVariantsVC *)variantsVC variant:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count{
[self.btnLike setImage:[UIImage imageNamed:@"ic_like"] forState:UIControlStateNormal];
[self.detailView1 setSelect:variant color:color count:count];
self.variant = variant;
self.color = color;
self.count = count;
self.isLikeVariant = NO;
[self requestWishList];
}
#pragma mark - API BUYClient+Storefront
-(void)requestProductDetail{
if(!self.productId && !self.product){
......@@ -229,7 +344,11 @@
[weakSelf showError:error];
}else if(product){
weakSelf.product = product;
[weakSelf initMidViewHight];
weakSelf.midDetailView.product = product;
[weakSelf.detailView1 setData:product];
[self requestBrandProducts:1];
[self requestCategoryProducts:1];
}
}];
}
......@@ -243,17 +362,17 @@
if(error){
}else if(product){
color.prodcut = product;
color.product = product;
[weakSelf.colorArray addObject:color];
}
}];
}
-(void)requestBrandProducts:(NSInteger)page{
// if(!self.product){
// return;
// }
NSString *handle = @"girls";
if(!self.product){
return;
}
NSString *handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:self.product.vendor];
self.detailView2.isLoadingSameBrand = YES;
__weak KWMNewProductVC *weakSelf = self;
[self.client getCollectionByHandle:handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
......@@ -271,10 +390,10 @@
}
-(void)requestCategoryProducts:(NSInteger)page{
// if(!self.product){
// return;
// }
NSString *handle = @"girls";
if(!self.product){
return;
}
NSString *handle = self.product.productType;
self.detailView2.isLoadingSameType = YES;
__weak KWMNewProductVC *weakSelf = self;
[self.client getCollectionByHandle:handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
......@@ -290,9 +409,24 @@
}];
}
#pragma mark -- API KWMApimanager
-(void)requestAdminProduct{
NSNumber *productId = self.product?self.product.identifier:self.productId;
__weak KWMNewProductVC *weakSelf = self;
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
};
void(^success)(NSURLSessionDataTask *,KWMProductResult *) = ^(NSURLSessionDataTask *task,KWMProductResult *result){
if(result!=nil && result.product!=nil){
KWMProduct* adminProduct = (KWMProduct *)result.product;
weakSelf.adminProduct = adminProduct;
}
};
[self.api getAdminProduct:nil productId:productId success:success failure:failure];
}
#pragma mark apimanager
-(void)requestColorMetafield{
NSNumber *productId = self.product?self.product.identifier:self.productId;
__weak KWMNewProductVC *weakSelf = self;
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
[weakSelf showError:error];
......@@ -310,7 +444,7 @@
}
}
};
[self.api getProductMetafield:nil productId:@(7436196294) success:success failure:failure];
[self.api getProductMetafield:nil productId:productId success:success failure:failure];
}
......@@ -325,7 +459,7 @@
NSDictionary *parament = @{
@"customer_id":customer.identifier.stringValue,
@"customer_email":customer.email,
@"varaint_id":variant.identifier.stringValue,
@"variant_id":variant.identifier.stringValue,
@"shop":Shopify_SHOP_DOMAIN
};
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
......@@ -342,7 +476,6 @@
weakSelf.isLikeVariant = YES;
}
}
};
[self.api getWishList:parament success:success failure:failure];
}
......
......@@ -18,9 +18,11 @@
@class KWMVariantsVC;
@protocol KWMVariantsVCDelegate <NSObject>
@optional
- (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 color:(KWMColor *)color;
@optional
- (void)kwm_setVariant:(KWMVariantsVC *)variantsVC variant:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count;
@end
@interface KWMVariantsVC : KWMBaseVC<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
......@@ -31,6 +33,9 @@
//required 商品模型,必须有
@property (nonatomic) BUYProduct *product;
//optional 可以传也可以不传,与product对应,用于填充库存显示
@property (nonatomic) KWMProduct *adminProduct;
//optional 有颜色可选时,需要赋值该字段.
@property (nonatomic) NSArray<KWMColor *> *colorArray;
......@@ -40,4 +45,6 @@
//optional 购物车页跳转来时,需要赋值该字段。
@property (nonatomic) KWMShopCartModel *shopCartModel;
-(void)setDefaultSelect:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count;
@end
......@@ -12,6 +12,7 @@
#import "KWMProductSizeCell.h"
#import "KWMProductColorCell.h"
#import "KWMCurrencyUtil.h"
#import "KWMStringUtil.h"
#import "BUYProductVariant+Currency.h"
#import "UIColor+SAMAdditions.h"
......@@ -25,8 +26,6 @@
@property(nonatomic) IBOutlet UILabel *lbCount;
@property(nonatomic) NSInteger count;
@property(nonatomic) NSDecimalNumber *totalPrice;
......@@ -69,6 +68,12 @@
return [NSArray array];
}
-(void)setDefaultSelect:(BUYProductVariant *)variant color:(KWMColor *)color count:(NSInteger)count{
self.selectColor = color;
self.selectVariant = variant;
self.count = count;
}
-(void)setAdminVariantArray:(NSArray<KWMVariants *> *)adminVariantArray{
_adminVariantArray = adminVariantArray;
if(adminVariantArray && self.selectVariant){
......@@ -82,11 +87,18 @@
-(void)setProduct:(BUYProduct *)product{
_product = product;
if(!_variantArray && product){
if(product){
self.variantArray = product.variantsArray;
}
}
-(void)setAdminProduct:(KWMProduct *)adminProduct{
_adminProduct = adminProduct;
if(adminProduct){
self.adminVariantArray = adminProduct.variants;
}
}
-(void)setShopCartModel:(KWMShopCartModel *)shopCartModel{
_shopCartModel = shopCartModel;
if(shopCartModel && self.variantArray){
......@@ -100,17 +112,28 @@
}
-(void)initView{
if(self.product && self.colorArray){
[self initDefaultColor];
[self initUI];
[self initCollectionView];
[self initContentHeight];
if(!self.adminProduct){
[self requestAdminProduct:self.product.identifier];
}
}
-(void)initDefaultColor{
if(self.product && self.colorArray && !self.selectColor){
for(KWMColor *color in self.colorArray){
if([color.handle isEqual:self.product.handle]){
self.selectColor = color;
break;
self.selectColor.adminProduct = self.adminProduct;
return;
}
}
}else if(self.selectColor && self.selectColor.product){
self.variantArray = self.selectColor.product.variantsArray;
}
[self initUI];
[self initCollectionView];
[self initContentHeight];
}
-(void)initUI{
......@@ -135,32 +158,9 @@
//初始化佈局高度
-(void)initContentHeight{
if(self.product != nil && self.product.variantsArray!=nil){
NSInteger sizesHeight = 0;
{
NSInteger cellCount = self.product.variantsArray.count;
if(cellCount <=0){
return;
}
NSInteger cellWidth = (UI_SCREEN_WIDTH - (30 + 30) - (10*3)) / 3;
NSInteger cellHeight = cellWidth * 0.4;
NSInteger lineCount = (cellCount +2) / 3;
sizesHeight = lineCount * cellHeight + 12 *(lineCount - 1) + 45;
}
NSInteger colorsHeight = 0;
{
NSInteger cellCount = 8;
NSInteger cellWidth = 50;
NSInteger cellHeight = 70;
NSInteger lineItmesNum = (UI_SCREEN_WIDTH - 70 - 12) / (12 + cellWidth);
NSInteger lineCount = (cellCount + lineItmesNum -1) / lineItmesNum;
colorsHeight = lineCount * cellHeight + 12 *(lineCount - 1) + 45;
}
NSInteger contentHeight = 173 + sizesHeight + colorsHeight;
NSInteger maxHeight = UI_SCREEN_HEITHT * 0.8;
self.vContentHeight.constant = fminl(contentHeight,maxHeight);
}
CGFloat height = self.cvVariants.collectionViewLayout.collectionViewContentSize.height;
self.vContentHeight.constant = height + 173;
[self.view layoutIfNeeded];
}
-(IBAction)onClickAdd:(id)sender{
......@@ -197,25 +197,25 @@
[self showToast:@"请选择您想要的规格"];
return;
}
// if (self.product && !self.product.JSONDictionary){
// [self showToast:@"该商品信息缺失"];
// return;
// }
// BOOL buyNow = sender.tag == 1;
// __weak id this = self;
// [self showLoading];
// if (self.delegate) {
// [self.delegate kwm_addShopWithVariantId:self.selectVariant.identifier quantity:self.count variant:self.selectVariant buyNow:buyNow callback:^(BOOL success) {
// [self hideLoading];
// if(success) {
// [this dismissViewControllerAnimated:YES completion:nil];
// }
// }];
// }
//商品详情页现在不是添加到购物车了,而是先显示。
//所以现在是回调出去。各个页面需要干嘛自己干嘛。
[self.delegate kwm_setVariant:self variant:self.selectVariant color:self.selectColor];
[self dismissViewControllerAnimated:YES completion:nil];
//购物车页面
if ([self.delegate respondsToSelector:@selector(kwm_addShopWithVariantId:quantity:variant:buyNow:callback:)]){
__weak id this = self;
[self showLoading];
if (self.delegate) {
[self.delegate kwm_addShopWithVariantId:self.selectVariant.identifier quantity:self.count variant:self.selectVariant buyNow:false callback:^(BOOL success) {
[self hideLoading];
if(success) {
[this dismissViewControllerAnimated:YES completion:nil];
}
}];
}
}
//商品详情页.愿望单页
//商品详情页现在不是添加到购物车了,而是先显示。所以现在是回调出去。
if ([self.delegate respondsToSelector:@selector(kwm_setVariant:variant:color:count:)]){
[self.delegate kwm_setVariant:self variant:self.selectVariant color:self.selectColor count:self.count];
[self dismissViewControllerAnimated:YES completion:nil];
}
}
-(IBAction)onClickBg:(id)sender{
......@@ -270,7 +270,7 @@
BUYProductVariant *variant = [self.variantArray objectAtIndex:indexPath.row];
KWMVariants *adminVariant = nil;
if(self.adminVariantArray && self.adminVariantArray.count>indexPath.row){
if(self.adminVariantArray){
for(KWMVariants *mAdminVariant in self.adminVariantArray){
if([variant.identifier isEqualToNumber:mAdminVariant.id]){
adminVariant = mAdminVariant;
......@@ -308,9 +308,9 @@
if(indexPath.section == 0){
BUYProductVariant *variant = [self.variantArray objectAtIndex:indexPath.row];
KWMVariants *adminVariant = nil;
if(self.adminVariantArray && self.adminVariantArray.count>indexPath.row){
if(self.adminVariantArray){
for(KWMVariants *mAdminVariant in self.adminVariantArray){
if(variant.identifier.integerValue == mAdminVariant.id.integerValue){
if([variant.identifier isEqualToNumber:mAdminVariant.id]){
adminVariant = mAdminVariant;
}
}
......@@ -328,10 +328,19 @@
[self initUI];
}else if(indexPath.section == 1){
KWMColor *color = [self.colorArray objectAtIndex:indexPath.row];
if(!color.product){
return;
}
self.selectColor = color;
self.variantArray = self.selectColor.prodcut.variantsArray;
self.selectVariant = nil;
self.selectAdminVariant = nil;
self.variantArray = color.product.variantsArray;
self.adminVariantArray = color.adminProduct?color.adminProduct.variants:nil;
[self.cvVariants reloadData];
//TODO 这里还需要更新页面高度。
[self initContentHeight];
if(!self.adminVariantArray){
[self requestAdminProduct:self.selectColor.product.identifier];
}
}
}
......@@ -350,6 +359,13 @@
NSArray<KWMVariants *> *adminVariants = adminProduct.variants;
weakSelf.adminVariantArray = adminVariants;
[weakSelf.cvVariants reloadData];
if(weakSelf.colorArray){
for(KWMColor *color in weakSelf.colorArray){
if(color.product && [color.product.identifier isEqualToNumber:productId]){
color.adminProduct = adminProduct;
}
}
}
}
};
[self.api getAdminProduct:nil productId:productId success:success failure:failure];
......@@ -362,7 +378,7 @@
isSellOut = variant.availableValue;
}
if(adminVariant && !isSellOut){
isSellOut = adminVariant.inventoryQuantity.integerValue == 0;
isSellOut = adminVariant.inventoryQuantity.integerValue <= 0;
}
return isSellOut;
}
......
......@@ -193,7 +193,6 @@
[weakSelf.tbvWish reloadData];
[weakSelf requestProductsApi];
}
};
[self.api getWishList:parament success:success failure:failure];
[self showLoading];
......
......@@ -22,7 +22,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kgb-zB-eBa">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kgb-zB-eBa" userLabel="头部">
<rect key="frame" x="0.0" y="20" width="375" height="30"/>
<subviews>
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BOo-eV-XG1">
......@@ -78,47 +78,45 @@
<rect key="frame" x="0.0" y="50" width="375" height="567"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X5Y-fo-qOg">
<rect key="frame" x="-0.5" y="0.0" width="375" height="1520"/>
<rect key="frame" x="-0.5" y="0.0" width="375" height="1093.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2KH-pA-K5l" customClass="KWMFirstDetailView">
<rect key="frame" x="0.0" y="0.0" width="375" height="550"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="567"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="t55-gT-VGG" customClass="KWMMidDetailView">
<rect key="frame" x="0.0" y="567" width="375" height="86.5"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="550" id="Glf-Jb-iqu"/>
<constraint firstAttribute="height" constant="86.5" id="Pwf-vg-Z3k"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyO-1P-iAa" customClass="KWMSecondDetailView">
<rect key="frame" x="0.0" y="550" width="375" height="440"/>
<rect key="frame" x="0.0" y="653.5" width="375" height="440"/>
<color key="backgroundColor" red="0.82745098039999998" green="0.83921568629999999" blue="0.85098039219999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="440" id="SH3-J6-rwf"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yY4-we-Oux" customClass="KWMThirdDetailView">
<rect key="frame" x="0.0" y="990" width="375" height="530"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.81960784310000001" blue="0.74117647060000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="530" id="54s-uW-LSA"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="yY4-we-Oux" firstAttribute="top" secondItem="pyO-1P-iAa" secondAttribute="bottom" id="04S-ES-xRD"/>
<constraint firstAttribute="trailing" secondItem="yY4-we-Oux" secondAttribute="trailing" id="4ES-7M-OJq"/>
<constraint firstItem="pyO-1P-iAa" firstAttribute="top" secondItem="t55-gT-VGG" secondAttribute="bottom" id="3ma-ng-9xU"/>
<constraint firstItem="2KH-pA-K5l" firstAttribute="top" secondItem="X5Y-fo-qOg" secondAttribute="top" id="8uT-aR-dQJ"/>
<constraint firstAttribute="bottom" secondItem="yY4-we-Oux" secondAttribute="bottom" id="Di8-tX-XHf"/>
<constraint firstItem="yY4-we-Oux" firstAttribute="leading" secondItem="X5Y-fo-qOg" secondAttribute="leading" id="JA6-VG-FgH"/>
<constraint firstItem="pyO-1P-iAa" firstAttribute="top" secondItem="2KH-pA-K5l" secondAttribute="bottom" id="LRX-8F-hu0"/>
<constraint firstItem="t55-gT-VGG" firstAttribute="top" secondItem="2KH-pA-K5l" secondAttribute="bottom" id="C2e-75-EH0"/>
<constraint firstItem="2KH-pA-K5l" firstAttribute="leading" secondItem="X5Y-fo-qOg" secondAttribute="leading" id="Mxu-Xv-sPL"/>
<constraint firstAttribute="trailing" secondItem="pyO-1P-iAa" secondAttribute="trailing" id="WDZ-oF-tpJ"/>
<constraint firstAttribute="bottom" secondItem="pyO-1P-iAa" secondAttribute="bottom" id="cfg-Kh-t6P"/>
<constraint firstAttribute="trailing" secondItem="2KH-pA-K5l" secondAttribute="trailing" id="etv-Gx-qLz"/>
<constraint firstItem="t55-gT-VGG" firstAttribute="leading" secondItem="X5Y-fo-qOg" secondAttribute="leading" id="opZ-sC-XyM"/>
<constraint firstAttribute="trailing" secondItem="t55-gT-VGG" secondAttribute="trailing" id="qp8-Hn-AW0"/>
<constraint firstItem="pyO-1P-iAa" firstAttribute="leading" secondItem="X5Y-fo-qOg" secondAttribute="leading" id="rsZ-aZ-dnV"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="X5Y-fo-qOg" firstAttribute="top" secondItem="T6J-Gp-5iu" secondAttribute="top" id="71V-OE-Ofi"/>
<constraint firstItem="2KH-pA-K5l" firstAttribute="height" secondItem="T6J-Gp-5iu" secondAttribute="height" id="FU7-kP-a8w"/>
<constraint firstAttribute="bottom" secondItem="X5Y-fo-qOg" secondAttribute="bottom" id="HoY-1Q-AcT"/>
<constraint firstItem="X5Y-fo-qOg" firstAttribute="leading" secondItem="T6J-Gp-5iu" secondAttribute="leading" id="h6q-Q9-Ege"/>
<constraint firstItem="X5Y-fo-qOg" firstAttribute="width" secondItem="T6J-Gp-5iu" secondAttribute="width" id="hDJ-lJ-uUw"/>
......@@ -132,16 +130,19 @@
<rect key="frame" x="0.0" y="0.0" width="80" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gbx-rg-A8B">
<rect key="frame" x="29" y="14" width="22" height="22"/>
<rect key="frame" x="27.5" y="12.5" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="LNO-nm-wog"/>
<constraint firstAttribute="width" constant="22" id="ou3-wY-jk0"/>
<constraint firstAttribute="height" constant="25" id="LNO-nm-wog"/>
<constraint firstAttribute="width" constant="25" id="ou3-wY-jk0"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<inset key="contentEdgeInsets" minX="7" minY="5" maxX="0.0" maxY="0.0"/>
<state key="normal" title="0" backgroundImage="btn_ nav_shop cart">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onClickShopCart:" destination="Vzq-D6-e57" eventType="touchUpInside" id="rOf-cw-IRH"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -151,13 +152,16 @@
<constraint firstItem="gbx-rg-A8B" firstAttribute="centerY" secondItem="p6D-hx-qVB" secondAttribute="centerY" id="fet-ki-2vJ"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YFr-wz-mgl">
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YFr-wz-mgl">
<rect key="frame" x="80" y="0.0" width="147.5" height="50"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<state key="normal" title="立即购买">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onClickComplete:" destination="Vzq-D6-e57" eventType="touchUpInside" id="Mm1-sD-3RM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oPf-c2-z7n">
<rect key="frame" x="227.5" y="0.0" width="147.5" height="50"/>
......@@ -166,6 +170,9 @@
<state key="normal" title="加入购物车">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onClickComplete:" destination="Vzq-D6-e57" eventType="touchUpInside" id="tO6-dz-eNt"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jxc-tQ-Uvl" userLabel="line">
<rect key="frame" x="0.0" y="0.0" width="375" height="1"/>
......@@ -211,13 +218,17 @@
</view>
<connections>
<outlet property="btnLike" destination="jLv-Vv-7Vi" id="sep-kb-Y2L"/>
<outlet property="btnShopCart" destination="gbx-rg-A8B" id="vel-Ab-0rI"/>
<outlet property="detailView1" destination="2KH-pA-K5l" id="ynO-by-UfZ"/>
<outlet property="detailView2" destination="pyO-1P-iAa" id="scJ-Iv-fnz"/>
<outlet property="heightMidView" destination="Pwf-vg-Z3k" id="h8Z-Kr-bXi"/>
<outlet property="midDetailView" destination="t55-gT-VGG" id="BRI-de-9Jz"/>
<outlet property="scrollView" destination="T6J-Gp-5iu" id="ZLc-Xh-Pyk"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="uHF-Hi-PUR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-298.39999999999998" y="68.815592203898049"/>
<point key="canvasLocation" x="-302" y="57"/>
</scene>
<!--选择规格-->
<scene sceneID="V5g-Le-Who">
......@@ -482,6 +493,7 @@
<constraints>
<constraint firstAttribute="trailing" secondItem="vHl-zd-90x" secondAttribute="trailing" id="6Su-re-kzG"/>
<constraint firstItem="fdk-xz-fYd" firstAttribute="top" secondItem="TiG-qk-9ZW" secondAttribute="bottom" id="KZO-B8-qIK"/>
<constraint firstItem="fdk-xz-fYd" firstAttribute="height" secondItem="FcM-Ya-Fa9" secondAttribute="height" multiplier="0.8" priority="999" id="YlW-WO-sB5"/>
<constraint firstAttribute="trailing" secondItem="fdk-xz-fYd" secondAttribute="trailing" id="kSN-FT-NaO"/>
<constraint firstItem="vHl-zd-90x" firstAttribute="top" secondItem="FcM-Ya-Fa9" secondAttribute="top" id="lDR-mG-00h"/>
<constraint firstItem="qc8-5Y-jmQ" firstAttribute="top" secondItem="fdk-xz-fYd" secondAttribute="bottom" id="lko-ph-zJP"/>
......@@ -501,7 +513,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="MKE-1G-zhs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1034" y="90"/>
<point key="canvasLocation" x="983" y="57"/>
</scene>
<!--我喜欢的-->
<scene sceneID="D2D-DR-hOl">
......
......@@ -9,8 +9,10 @@
#import "KWMBaseVC.h"
#import "KWMShopCarCell.h"
#import "KWMDeleteView.h"
#import "KWMVariantsVC.h"
@interface KWMShopCartVC : KWMBaseVC<KWMShopCarDelegate,KWMDeleteDelegate,UITableViewDelegate,UITableViewDataSource>
@interface KWMShopCartVC : KWMBaseVC<KWMShopCarDelegate,KWMDeleteDelegate,KWMVariantsVCDelegate,UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tbvCart;
......
......@@ -17,7 +17,7 @@
#import "KWMStringUtil.h"
#import "KWMShoppingCart.h"
@interface KWMShopCartVC ()<KWMSelectSizeVCDelegate>
@interface KWMShopCartVC ()
@property (nonatomic) NSMutableArray *shopCartList;
@end
......@@ -125,39 +125,31 @@
[self showLoading];
[self.client getProductById:shopCartModel.product_id completion:^(BUYProduct * _Nullable product, NSError * _Nullable error) {
[this hideLoading];
this.definesPresentationContext = YES;
KWMSelectSizeVC *editVC = (KWMSelectSizeVC *)[KWMBaseVC findControllerBy:[KWMSelectSizeVC kwmTag] fromStoryboard:@"ShopCart"];
editVC.delegate = this;
// BUYProduct * product = [[BUYProduct alloc] initWithModelManager:self.client.modelManager JSONDictionary:shopCartModel.shopCartDict];
editVC.isShopcart = YES;
editVC.product = product;
editVC.shopCartModel = shopCartModel;
if(product){
KWMVariantsVC *variantsVC = (KWMVariantsVC *)[KWMVariantsVC findControllerBy:[KWMVariantsVC kwmTag] fromStoryboard:@"NewProduct"];
variantsVC.product = product;
variantsVC.delegate = self;
variantsVC.shopCartModel = shopCartModel;
CGSize size = [UIScreen mainScreen].bounds.size;
[self showPresentation:variantsVC size:size tapOutsideClose:YES style:MZFormSheetPresentationTransitionStyleFade];
}
editVC.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
editVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
editVC.providesPresentationContextTransitionStyle = YES;
editVC.definesPresentationContext = YES;
[this presentViewController:editVC animated:YES completion:nil];
}];
//設置背景為透明
// if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
// this.definesPresentationContext = YES;
// KWMSelectSizeVC *editVC = (KWMSelectSizeVC *)[KWMBaseVC findControllerBy:[KWMSelectSizeVC kwmTag] fromStoryboard:@"ShopCart"];
// editVC.delegate = this;
// editVC.isShopcart = YES;
// editVC.product = product;
// editVC.shopCartModel = shopCartModel;
//
// editVC.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
// editVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
// editVC.providesPresentationContextTransitionStyle = YES;
// editVC.definesPresentationContext = YES;
// [self presentViewController:editVC animated:YES completion:nil];
//下面這個方法在9.0的模擬器上嘗試發現失敗,8.0以下沒試過,不過官方模擬器都沒有8.0以下的可以下載了,也沒有支持的必要。
// }else{
// editVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
// [self presentViewController:editVC animated:NO completion:nil];
// self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
// }
// [this presentViewController:editVC animated:YES completion:nil];
}];
}
#pragma mark -- KWMSelectSizeVCDelegate
......
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