Commit b980ca24 by lee

brand add search product

parent 6e4d3363
......@@ -12,6 +12,7 @@
- (void)kwm_clickBackBtn;
- (void)kwm_HitShopCartBtn;
- (void)kwm_hitSearchBtn;
@end
......
......@@ -68,6 +68,10 @@
}
}
- (IBAction)onClickSearchBtn:(id)sender {
[self.delegate kwm_hitSearchBtn];
}
- (IBAction)onClickBackBtn:(id)sender {
NSLog(@"点击了返回按钮");
if ([self.delegate respondsToSelector:@selector(kwm_clickBackBtn)]) {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -20,14 +23,17 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w07-X3-TZc">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="I5b-cU-UJp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LhU-hy-cgg">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CAEAMEL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eLp-Fc-DGP">
<rect key="frame" x="50" y="11" width="78" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="Bqy-qp-TtK"/>
<constraint firstAttribute="width" constant="90" id="vmB-ph-xU7"/>
......@@ -42,6 +48,7 @@
</variation>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jot-my-Skn">
<rect key="frame" x="321" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="Se9-VU-U3c"/>
<constraint firstAttribute="width" constant="44" id="dQW-nU-NqO"/>
......@@ -52,6 +59,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qzz-HS-1ka" userLabel="back">
<rect key="frame" x="0.0" y="7" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="2zo-GE-glc"/>
<constraint firstAttribute="height" constant="30" id="dsr-NJ-Brr"/>
......@@ -62,6 +70,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ffN-14-C4W">
<rect key="frame" x="340" y="17" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="JCv-Vl-bjz"/>
<constraint firstAttribute="height" constant="14" id="ni4-e6-xAG"/>
......@@ -70,6 +79,17 @@
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PaU-vd-maA">
<rect key="frame" x="269" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="4KS-bk-nto"/>
<constraint firstAttribute="width" constant="44" id="ulA-Nm-ETK"/>
</constraints>
<state key="normal" image="btn_ nav_search"/>
<connections>
<action selector="onClickSearchBtn:" destination="-1" eventType="touchUpInside" id="FQi-ND-qmV"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
......@@ -78,8 +98,11 @@
<constraint firstItem="eLp-Fc-DGP" firstAttribute="centerY" secondItem="LhU-hy-cgg" secondAttribute="centerY" id="CYF-jt-pNn"/>
<constraint firstItem="ffN-14-C4W" firstAttribute="bottom" secondItem="jot-my-Skn" secondAttribute="bottom" constant="-13" id="FCE-d3-9F6"/>
<constraint firstItem="Qzz-HS-1ka" firstAttribute="centerY" secondItem="LhU-hy-cgg" secondAttribute="centerY" id="VW7-ru-rft"/>
<constraint firstItem="jot-my-Skn" firstAttribute="leading" secondItem="PaU-vd-maA" secondAttribute="trailing" constant="8" id="d18-gM-JWM"/>
<constraint firstItem="ffN-14-C4W" firstAttribute="trailing" secondItem="jot-my-Skn" secondAttribute="trailing" constant="-11" id="ddE-oR-ylC"/>
<constraint firstAttribute="trailing" secondItem="jot-my-Skn" secondAttribute="trailing" constant="10" id="ewH-at-Gll"/>
<constraint firstItem="jot-my-Skn" firstAttribute="centerY" secondItem="PaU-vd-maA" secondAttribute="centerY" id="sX1-bj-cl2"/>
<constraint firstItem="jot-my-Skn" firstAttribute="centerY" secondItem="PaU-vd-maA" secondAttribute="centerY" id="x6e-HO-bFW"/>
<constraint firstItem="Qzz-HS-1ka" firstAttribute="leading" secondItem="LhU-hy-cgg" secondAttribute="leading" id="zaO-mI-Gl2"/>
</constraints>
</view>
......@@ -106,6 +129,7 @@
</view>
</objects>
<resources>
<image name="btn_ nav_search" width="22" height="22"/>
<image name="btn_ nav_shop cart" width="21" height="22"/>
<image name="btn_nav_back" width="10" height="20"/>
</resources>
......
......@@ -11,6 +11,7 @@
@protocol KWMCarCountViewDelegate <NSObject>
- (void)kwm_touchShopCartBtn;
- (void)kwm_touchSearchBtn;
@end
@interface KWMCarCountView : UIView
......@@ -21,6 +22,7 @@
@property (weak, nonatomic) id<KWMCarCountViewDelegate> delegate;
- (IBAction)onClickShopCartBtn:(id)sender;
- (IBAction)onClickSearchBtn:(id)sender;
@end
......@@ -63,4 +63,8 @@
[self.delegate kwm_touchShopCartBtn];
}
}
- (void)onClickSearchBtn:(id)sender {
[self.delegate kwm_touchSearchBtn];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -19,14 +22,17 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jaQ-9K-pwB">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="1db-NU-cyT"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k5I-0u-ww6">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oya-px-46r">
<rect key="frame" x="321" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="EuD-IV-fdo"/>
<constraint firstAttribute="height" constant="44" id="pd0-mz-6I3"/>
......@@ -37,6 +43,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JyV-gT-W6k">
<rect key="frame" x="340" y="17" width="14" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="6iD-hl-uNU"/>
<constraint firstAttribute="width" constant="14" id="WBS-Yd-LKE"/>
......@@ -46,15 +53,29 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="品牌" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rt2-0b-5Qg">
<rect key="frame" x="171.5" y="12.5" width="32" height="19"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XCu-Vw-UbS">
<rect key="frame" x="269" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="PPp-fS-VbO"/>
<constraint firstAttribute="height" constant="44" id="QxY-Op-FL8"/>
</constraints>
<state key="normal" image="btn_ nav_search"/>
<connections>
<action selector="onClickSearchBtn:" destination="-1" eventType="touchUpInside" id="NSH-6w-dmi"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="JyV-gT-W6k" firstAttribute="trailing" secondItem="oya-px-46r" secondAttribute="trailing" constant="-11" id="1ix-zq-Mor"/>
<constraint firstItem="oya-px-46r" firstAttribute="centerY" secondItem="XCu-Vw-UbS" secondAttribute="centerY" id="3Ys-1m-sUe"/>
<constraint firstAttribute="bottom" secondItem="oya-px-46r" secondAttribute="bottom" id="FAW-tW-q9a"/>
<constraint firstItem="oya-px-46r" firstAttribute="leading" secondItem="XCu-Vw-UbS" secondAttribute="trailing" constant="8" id="IsE-2T-b1e"/>
<constraint firstItem="Rt2-0b-5Qg" firstAttribute="centerY" secondItem="k5I-0u-ww6" secondAttribute="centerY" id="M7w-JU-b4j"/>
<constraint firstItem="Rt2-0b-5Qg" firstAttribute="centerX" secondItem="k5I-0u-ww6" secondAttribute="centerX" id="k5U-pP-UxB"/>
<constraint firstAttribute="height" constant="44" id="p0A-9X-4Pb"/>
......@@ -79,6 +100,7 @@
</view>
</objects>
<resources>
<image name="btn_ nav_search" width="22" height="22"/>
<image name="btn_ nav_shop cart" width="21" height="22"/>
</resources>
</document>
......@@ -41,7 +41,6 @@
- (IBAction)onClickSearchBtn:(id)sender;
- (IBAction)onClickACancelBtn:(id)sender;
- (IBAction)onClickBackBtn:(id)sender;
- (IBAction)tfValueChanged:(id)sender;
@end
......@@ -21,6 +21,7 @@
#import "KWMFilterVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
#import "KWMSearchFeedbackVC.h"
@interface KWMBrandCaramelVC ()<UITableViewDelegate,UITableViewDataSource,KWMBrandCaramelCellDelegate>
@property (nonatomic) KWMBarandSelectView *barandSelectView;
......@@ -199,6 +200,12 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[self.navigationController pushViewController:shopCartVC animated:YES];
}
- (void)kwm_hitSearchBtn {
KWMSearchFeedbackVC *vc = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
// vc.searchText = @"";
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark -- KWMFilterDelegate
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES;
......
......@@ -19,6 +19,7 @@
#import "KWMBrandsTypeModel.h"
#import "UIColor+SAMAdditions.h"
#import "KWMShoppingCart.h"
#import "KWMSearchFeedbackVC.h"
@interface KWMBrandVC ()<KWMCarCountViewDelegate>
......@@ -124,6 +125,12 @@ static NSString *cellId = @"KWMBrandCell";
[self.navigationController pushViewController:ShopCartVC animated:YES];
}
- (void)kwm_touchSearchBtn {
KWMSearchFeedbackVC *vc = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
// vc.searchText = @"";
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark -- UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
......
......@@ -37,6 +37,9 @@
[self.navigationController setNavigationBarHidden:YES];
self.vBackground.hidden = YES;
[self initHeardView];
if (!self.searchText) {
[self.vSearchFB.tfSearch becomeFirstResponder];
}
}
- (UITableView *)targetTableView{
......@@ -49,7 +52,7 @@
- (void)reLoadData{
[self getSearchProduct];
// [self getSearchProduct];
}
static NSString *idStr = @"KWMBrandCaramelCell";
- (void)viewDidLoad {
......@@ -64,8 +67,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickBackgroundView:)];
[self.vBackground addGestureRecognizer:tapGesture];
if (self.searchText) {
[self getSearchProduct];
}
}
- (void)onClickBackgroundView:(UITapGestureRecognizer *)tapGesture{
......
......@@ -84,6 +84,7 @@
BUYDiscount *discount = [self.client.modelManager discountWithCode:code];
self.checkout.discount = discount;
self.checkout.attributes = nil;
[self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
[self hideLoading];
if (error == nil && checkout) {
......@@ -101,8 +102,13 @@
if(self.delegate != nil){
[self.delegate kwm_addedDiscount:self.checkout];
}
[self showToast:@"添加优惠码失败"];
// 八成是因为checkout是web生成的所以如果discount如果传的有问题返回的是500如果没问题的话是正常的
if ([@"Internal Server Error" isEqualToString:error.userInfo[@"errors"]]) {
[self showToast:@"您输入的优惠码有误"];
}else {
[self showError:error];
}
// [self showToast:@"添加优惠码失败"];
NSLog(@"Error applying checkout: %@", error);
}
}];
......
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