Commit d29beda4 authored by 勾芒's avatar 勾芒

caoyunxiao

parent 27d221f0
......@@ -22,4 +22,9 @@
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *productCollectionLayout;
/**
* 搜索code
*/
@property (nonatomic,copy) NSString *selectedCode;
@end
......@@ -87,6 +87,31 @@
[self getScreeningdatas];
}
#pragma mark -热门搜索
- (void)setSelectedCode:(NSString *)selectedCode
{
_selectedCode = selectedCode;
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
Newpage.page = 0;
conditon.page = Newpage;
conditon.categoryEquals = _selectedCode;
__weak typeof(self)weakSelf = self;
[self getGoodsListdatas:conditon returnResponse:^(GoodsResponse *response) {
if (response.goodsEntity.count == 0) {
[self ErrorMBProgressView:@"暂无数据"];
return ;
}
weakSelf.datasArray = response;
[weakSelf.productCollectionView reloadData];
}];
}
#pragma mark -获取商品列表数据
- (void)getGoodsListDatas
......@@ -194,7 +219,8 @@
#pragma mark -返回根视图
- (void)popTorootviewController:(NSNotification *)not
{
[self.navigationController popViewControllerAnimated:YES];
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex_opple:1] animated:NO];
}
......
......@@ -93,9 +93,6 @@
page.page = 0;
condition.page = page;
[self getSceneLibrarydatas:condition];
}
......
......@@ -74,40 +74,26 @@
//保存输入内容
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(searchInputString:) name:SEARCHSTRING object:nil];
//返回根视图
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(popTorootviewController:) name:POPROOTCONTROLLER object:nil];
}
#pragma mark -返回根视图
- (void)popTorootviewController:(NSNotification *)not
{
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -输入内容
- (void)searchInputString:(NSNotification *)not
{
[self.localSearchArray addObject:not.object];
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:productVC];
[self.navigationController pushViewController:nav animated:YES];
[self.navigationController pushViewController:productVC animated:YES];
}
#pragma mark -获取本地存储搜索历史
- (void)getlocalsaveDatas
{
NSString *homeDictionary = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *homepath = [homeDictionary stringByAppendingPathComponent:@"LOCALSAVE"];//添加储存的文件名
NSString *homepath = [homeDictionary stringByAppendingPathComponent:SEARCHHISTORY];//添加储存的文件名
self.localSearchArray = [NSKeyedUnarchiver unarchiveObjectWithFile:homepath];
[self.historyCollectionView reloadData];
}
......@@ -116,12 +102,31 @@
- (void)SaveSearchDatas
{
NSString *homeDictionary = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *homepath = [homeDictionary stringByAppendingPathComponent:@"LOCALSAVE"];//添加储存的文件名
NSString *homepath = [homeDictionary stringByAppendingPathComponent:SEARCHHISTORY];//添加储存的文件名
BOOL flag = [NSKeyedArchiver archiveRootObject:self.localSearchArray toFile:homepath];//归档一个字符串
if (flag) {
NSLog(@"归档成功");
}
}
#pragma mark -将要加载前获取本地搜索历史
- (void)viewWillAppear:(BOOL)animated
{
[self getlocalsaveDatas];
}
#pragma mark -视图消失后归档搜索历史
- (void)viewDidDisappear:(BOOL)animated
{
[self.view endEditing:YES];
[self SaveSearchDatas];
}
#pragma mark -获取热门搜索数据
- (void)getHotSearchdatas
{
......@@ -175,6 +180,19 @@
return self.localSearchArray.count;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if ([collectionView isEqual:self.hotCollectionView]) {
[self.localSearchArray addObject:[[self.response.list objectAtIndex_opple:indexPath.item] name]];
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = [[self.response.list objectAtIndex_opple:indexPath.item] fid];
[self.navigationController pushViewController:productVC animated:YES];
}
}
#pragma mark -释放
- (void)dealloc
......@@ -184,6 +202,21 @@
#pragma mark -清除搜索历史
- (IBAction)delecteSearchHistoryButtonClick:(UIButton *)sender {
NSString *homeDictionary = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *homepath = [homeDictionary stringByAppendingPathComponent:SEARCHHISTORY];//添加储存的文件名
NSFileManager *manager = [NSFileManager defaultManager];
[manager removeItemAtPath:homepath error:nil];
[self.localSearchArray removeAllObjects];
[self.historyCollectionView reloadData];
}
- (void)didReceiveMemoryWarning {
......
......@@ -344,6 +344,7 @@
page.page = 0;
order.datapage = page;
//收货地址
TOOrderEntity *orderReceiver = [[TOOrderEntity alloc]init];
NSArray *Adressarr = [self.datasArray objectAtIndex_opple:1];
......
......@@ -210,7 +210,6 @@
}
#pragma mark -二维码扫描
- (void)QrcodeButtonClick
{
......@@ -243,7 +242,7 @@
if (textField.text != nil) {
[textField resignFirstResponder];
self.selectedIndex = 4;
// self.selectedIndex = 4;
//搜索
[[NSNotificationCenter defaultCenter] postNotificationName:SEARCHSTRING object:textField.text];
......
......@@ -734,7 +734,7 @@
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="firstcell" rowHeight="84" id="XgA-9w-ut9" customClass="OrderInformationTableViewCell">
<rect key="frame" x="0.0" y="113.5" width="768" height="84"/>
<rect key="frame" x="0.0" y="49.5" width="768" height="84"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XgA-9w-ut9" id="BWi-jv-OOH">
<rect key="frame" x="0.0" y="0.0" width="768" height="83.5"/>
......@@ -811,7 +811,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="secondcell" rowHeight="135" id="rIO-yd-hh7" customClass="PersonInformationTableViewCell">
<rect key="frame" x="0.0" y="197.5" width="768" height="135"/>
<rect key="frame" x="0.0" y="133.5" width="768" height="135"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rIO-yd-hh7" id="mn8-g0-Zqo">
<rect key="frame" x="0.0" y="0.0" width="768" height="134.5"/>
......@@ -907,7 +907,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="thirdcell" rowHeight="90" id="PfN-24-v5t" customClass="GoodsInformationTableViewCell">
<rect key="frame" x="0.0" y="332.5" width="768" height="90"/>
<rect key="frame" x="0.0" y="268.5" width="768" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PfN-24-v5t" id="2Je-94-WVY">
<rect key="frame" x="0.0" y="0.0" width="768" height="89.5"/>
......@@ -967,7 +967,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="fourthcell" rowHeight="80" id="47T-H0-tG7" customClass="CommodityListTableViewCell">
<rect key="frame" x="0.0" y="422.5" width="768" height="80"/>
<rect key="frame" x="0.0" y="358.5" width="768" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="47T-H0-tG7" id="zXR-bC-Wdh">
<rect key="frame" x="0.0" y="0.0" width="768" height="79.5"/>
......@@ -1028,7 +1028,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="sixthcell" rowHeight="50" id="PNT-Fy-4Hi" customClass="AllpriceTableViewCell">
<rect key="frame" x="0.0" y="502.5" width="768" height="50"/>
<rect key="frame" x="0.0" y="438.5" width="768" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PNT-Fy-4Hi" id="PxE-0c-Zdt">
<rect key="frame" x="0.0" y="0.0" width="768" height="49.5"/>
......@@ -1188,7 +1188,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="productcell" id="J5m-0M-uqb" customClass="ProductCollectionViewCell">
<rect key="frame" x="0.0" y="64" width="300" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
......@@ -1261,7 +1261,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="productDetailscell" rowHeight="170" id="Sye-2R-IQf" customClass="ProductDetailsTableViewCell">
<rect key="frame" x="0.0" y="92" width="768" height="170"/>
<rect key="frame" x="0.0" y="28" width="768" height="170"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Sye-2R-IQf" id="CXs-SR-gHP">
<rect key="frame" x="0.0" y="0.0" width="768" height="169.5"/>
......@@ -1843,7 +1843,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="secondcell" rowHeight="140" id="LsY-i0-h5H" customClass="PersonInformationTableViewCell">
<rect key="frame" x="0.0" y="92" width="768" height="140"/>
<rect key="frame" x="0.0" y="28" width="768" height="140"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LsY-i0-h5H" id="dPG-p9-V2i">
<rect key="frame" x="0.0" y="0.0" width="768" height="139.5"/>
......@@ -1940,7 +1940,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="consigneecell" rowHeight="56" id="gfQ-UE-mXV" customClass="GenerateOrdersTableViewCell">
<rect key="frame" x="0.0" y="232" width="768" height="56"/>
<rect key="frame" x="0.0" y="168" width="768" height="56"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gfQ-UE-mXV" id="za6-HU-VEw">
<rect key="frame" x="0.0" y="0.0" width="768" height="55.5"/>
......@@ -2011,7 +2011,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Modifycell" rowHeight="56" id="Kk4-Fh-HhL" customClass="GenerateOrdersModifyTableViewCell">
<rect key="frame" x="0.0" y="288" width="768" height="56"/>
<rect key="frame" x="0.0" y="224" width="768" height="56"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Kk4-Fh-HhL" id="oRX-7p-HkY">
<rect key="frame" x="0.0" y="0.0" width="768" height="55.5"/>
......@@ -2042,7 +2042,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="fourthcell" rowHeight="80" id="G7o-xS-1mB" customClass="CommodityListTableViewCell">
<rect key="frame" x="0.0" y="344" width="768" height="80"/>
<rect key="frame" x="0.0" y="280" width="768" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="G7o-xS-1mB" id="l3e-TL-GCT">
<rect key="frame" x="0.0" y="0.0" width="768" height="79.5"/>
......@@ -2103,7 +2103,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="sixthcell" rowHeight="50" id="6K9-mc-7RW" customClass="AllpriceTableViewCell">
<rect key="frame" x="0.0" y="424" width="768" height="50"/>
<rect key="frame" x="0.0" y="360" width="768" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6K9-mc-7RW" id="Vc7-f6-wGb">
<rect key="frame" x="0.0" y="0.0" width="768" height="49.5"/>
......@@ -3049,7 +3049,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="secondcell" id="OVG-fE-V0o" customClass="HotCollectionViewCell">
<rect key="frame" x="0.0" y="64" width="100" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="100" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="100" height="44"/>
......@@ -3083,16 +3083,19 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="9SH-x3-JKz">
<rect key="frame" x="215" y="12" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<state key="normal" backgroundImage="Trash"/>
</button>
<view contentMode="scaleToFill" id="3Pe-8k-bNM">
<rect key="frame" x="0.0" y="55" width="260" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="9SH-x3-JKz">
<rect key="frame" x="226" y="18" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<state key="normal" backgroundImage="Trash"/>
<connections>
<action selector="delecteSearchHistoryButtonClick:" destination="O7j-UZ-n6W" eventType="touchUpInside" id="jdj-s7-emU"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
......@@ -3183,24 +3186,6 @@
</objects>
<point key="canvasLocation" x="822" y="10781"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="fM8-Mo-DKe">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="CNH-ve-5Ur" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="me5-6f-x6e">
<rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="O7j-UZ-n6W" kind="relationship" relationship="rootViewController" id="EDd-h0-Ffg"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ZWx-jL-qrI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="832" y="11891"/>
</scene>
</scenes>
<resources>
<image name="05产品库-详情_03" width="500" height="375"/>
......
......@@ -145,8 +145,10 @@
#define POPROOTCONTROLLER @"POPROOTCONTROLLER"
/**
* 储存本地的搜索历史文件名
*/
#define SEARCHHISTORY @"searchhistory"
#endif /* PrefixHeader_pch */
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