Commit f88230c5 authored by Sandy's avatar Sandy

更改商品搜索接口

parent 1f749328
......@@ -128,6 +128,10 @@
194FB0E01CE452EE0089A3D5 /* MessageTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 194FB0DE1CE452EE0089A3D5 /* MessageTableViewCell.xib */; };
194FB0E31CE472C40089A3D5 /* NavigationbarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 194FB0E21CE472C40089A3D5 /* NavigationbarView.m */; };
194FB0E51CE472D20089A3D5 /* NavigationbarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 194FB0E41CE472D20089A3D5 /* NavigationbarView.xib */; };
1952C2ED1CED93D80017E4D6 /* OrderListHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1952C2EC1CED93D80017E4D6 /* OrderListHeaderView.m */; };
1952C2EF1CED93E90017E4D6 /* OrderListHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1952C2EE1CED93E90017E4D6 /* OrderListHeaderView.xib */; };
1952C2F21CED95230017E4D6 /* OrderListFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1952C2F11CED95230017E4D6 /* OrderListFooterView.m */; };
1952C2F41CED952B0017E4D6 /* OrderListFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1952C2F31CED952B0017E4D6 /* OrderListFooterView.xib */; };
19563C471CDAE60B00AFD0E0 /* MyBandCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19563C461CDAE60B00AFD0E0 /* MyBandCardViewController.m */; };
19563C4A1CDAEA3800AFD0E0 /* MyBandBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 19563C491CDAEA3800AFD0E0 /* MyBandBottomView.m */; };
19563C4C1CDAEA4500AFD0E0 /* MyBandBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 19563C4B1CDAEA4500AFD0E0 /* MyBandBottomView.xib */; };
......@@ -559,6 +563,12 @@
194FB0E11CE472C40089A3D5 /* NavigationbarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationbarView.h; sourceTree = "<group>"; };
194FB0E21CE472C40089A3D5 /* NavigationbarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavigationbarView.m; sourceTree = "<group>"; };
194FB0E41CE472D20089A3D5 /* NavigationbarView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NavigationbarView.xib; sourceTree = "<group>"; };
1952C2EB1CED93D80017E4D6 /* OrderListHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderListHeaderView.h; sourceTree = "<group>"; };
1952C2EC1CED93D80017E4D6 /* OrderListHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderListHeaderView.m; sourceTree = "<group>"; };
1952C2EE1CED93E90017E4D6 /* OrderListHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OrderListHeaderView.xib; sourceTree = "<group>"; };
1952C2F01CED95230017E4D6 /* OrderListFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderListFooterView.h; sourceTree = "<group>"; };
1952C2F11CED95230017E4D6 /* OrderListFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderListFooterView.m; sourceTree = "<group>"; };
1952C2F31CED952B0017E4D6 /* OrderListFooterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OrderListFooterView.xib; sourceTree = "<group>"; };
19563C451CDAE60B00AFD0E0 /* MyBandCardViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyBandCardViewController.h; sourceTree = "<group>"; };
19563C461CDAE60B00AFD0E0 /* MyBandCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyBandCardViewController.m; sourceTree = "<group>"; };
19563C481CDAEA3800AFD0E0 /* MyBandBottomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyBandBottomView.h; sourceTree = "<group>"; };
......@@ -1010,6 +1020,12 @@
19D906B81CC87F3B00CD42DC /* OrderExpressTableViewCell.h */,
19D906B91CC87F3B00CD42DC /* OrderExpressTableViewCell.m */,
19D906BA1CC87F3B00CD42DC /* OrderExpressTableViewCell.xib */,
1952C2EB1CED93D80017E4D6 /* OrderListHeaderView.h */,
1952C2EC1CED93D80017E4D6 /* OrderListHeaderView.m */,
1952C2EE1CED93E90017E4D6 /* OrderListHeaderView.xib */,
1952C2F01CED95230017E4D6 /* OrderListFooterView.h */,
1952C2F11CED95230017E4D6 /* OrderListFooterView.m */,
1952C2F31CED952B0017E4D6 /* OrderListFooterView.xib */,
1913833E1CAB9DD4005F6440 /* OrderCellView.h */,
1913833F1CAB9DD4005F6440 /* OrderCellView.m */,
1913833C1CAB9DC2005F6440 /* OrderCellView.xib */,
......@@ -2251,7 +2267,7 @@
TargetAttributes = {
1940D2E61C9A56730080678C = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 4WRSWKXL27;
DevelopmentTeam = W54V2VB863;
};
1940D2F91C9A56730080678C = {
CreatedOnToolsVersion = 7.2.1;
......@@ -2299,6 +2315,7 @@
194FB0E01CE452EE0089A3D5 /* MessageTableViewCell.xib in Resources */,
1900A3421CB6059000B2B7C4 /* introductionViewController.xib in Resources */,
199B4D6A1CABBEF400451E0E /* OrderDetailTopView.xib in Resources */,
1952C2F41CED952B0017E4D6 /* OrderListFooterView.xib in Resources */,
199BC7B81C9ADD5500E4E0B8 /* ToLoginViewController.xib in Resources */,
196944DE1CEC4E780036E574 /* NoBillHistoryView.xib in Resources */,
19DC6B3E1CC0E06C0064A9FD /* CustomerTableViewCell.xib in Resources */,
......@@ -2343,6 +2360,7 @@
19563CA21CDC2E0E00AFD0E0 /* BankTableViewCell.xib in Resources */,
192940201CC8DA5B00E377EE /* InvitePartnerViewController.xib in Resources */,
19563C9D1CDB345400AFD0E0 /* AddDetailInfoViewController.xib in Resources */,
1952C2EF1CED93E90017E4D6 /* OrderListHeaderView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -2502,6 +2520,7 @@
19DC6B191CC0B5690064A9FD /* MyTeamCollectionViewCell.m in Sources */,
19DCCB691C9A9EB30072C3BF /* IBTObject.m in Sources */,
192900811CD1AECB00D226E7 /* ShareInstance.m in Sources */,
1952C2ED1CED93D80017E4D6 /* OrderListHeaderView.m in Sources */,
19DCCBDD1C9AA0450072C3BF /* IBTFileManager.m in Sources */,
1921EF6D1CE5987B00B0BC4A /* HomeCollectionFooterReusableView.m in Sources */,
1929009A1CD2129B00D226E7 /* MyAcountViewController.m in Sources */,
......@@ -2616,6 +2635,7 @@
19632DB11CB39B190024A8A1 /* SelectPhotoView.m in Sources */,
19DCCB621C9A9EB30072C3BF /* IBTTableViewInfo.m in Sources */,
19ADD38E1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.m in Sources */,
1952C2F21CED95230017E4D6 /* OrderListFooterView.m in Sources */,
194FB0AC1CE2E95B0089A3D5 /* UserInfoBaseClass.m in Sources */,
194FB0BE1CE2F8400089A3D5 /* JavenBankCards.m in Sources */,
191383351CAB95F5005F6440 /* NoPaymentTableViewController.m in Sources */,
......
//
// OrderListFooterView.h
// ALand
//
// Created by Z on 16/5/19.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "JavenOrderModel.h"
@interface OrderListFooterView : UITableViewHeaderFooterView
- (void)setUpViewWithModel:(JavenOrderModel *)model;
@end
//
// OrderListFooterView.m
// ALand
//
// Created by Z on 16/5/19.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderListFooterView.h"
@interface OrderListFooterView ()
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@property (weak, nonatomic) IBOutlet UILabel *labelCommissions;
@end
@implementation OrderListFooterView
- (void)setUpViewWithModel:(JavenOrderModel *)model
{
self.labelTotal.text = [NSString stringWithFormat:@"¥%.2f", model.total];
self.labelCommissions.text = [NSString stringWithFormat:@"¥%.2f", model.commissions];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="OrderListFooterView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zjG-YU-5RC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="总计:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LFc-F6-JT0">
<rect key="frame" x="374" y="290" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50823958329999996" green="0.50823958329999996" blue="0.50823958329999996" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥837" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kDR-7B-Oxx">
<rect key="frame" x="421" y="290" width="48" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" 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="QaC-wG-Ylh">
<rect key="frame" x="495" y="290" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50823958329999996" green="0.50823958329999996" blue="0.50823958329999996" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥83.7" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u6I-iG-56m">
<rect key="frame" x="542" y="290" width="52" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.3921568627" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="97a-c1-hZ5"/>
<constraint firstItem="u6I-iG-56m" firstAttribute="centerY" secondItem="LFc-F6-JT0" secondAttribute="centerY" id="ABp-n7-EXt"/>
<constraint firstAttribute="trailing" secondItem="u6I-iG-56m" secondAttribute="trailing" constant="6" id="E2f-Ho-SZk"/>
<constraint firstItem="u6I-iG-56m" firstAttribute="leading" secondItem="QaC-wG-Ylh" secondAttribute="trailing" constant="8" id="HEb-O0-aVj"/>
<constraint firstItem="LFc-F6-JT0" firstAttribute="centerY" secondItem="zjG-YU-5RC" secondAttribute="centerY" id="eiE-pG-cG2"/>
<constraint firstItem="kDR-7B-Oxx" firstAttribute="centerY" secondItem="LFc-F6-JT0" secondAttribute="centerY" id="l2R-QV-mF4"/>
<constraint firstItem="QaC-wG-Ylh" firstAttribute="leading" secondItem="kDR-7B-Oxx" secondAttribute="trailing" constant="26" id="mMT-fH-Frn"/>
<constraint firstItem="kDR-7B-Oxx" firstAttribute="leading" secondItem="LFc-F6-JT0" secondAttribute="trailing" constant="8" id="mUj-9s-7Ly"/>
<constraint firstItem="QaC-wG-Ylh" firstAttribute="centerY" secondItem="LFc-F6-JT0" secondAttribute="centerY" id="xEg-Jf-5Pq"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="97a-c1-hZ5"/>
</mask>
</variation>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="zjG-YU-5RC" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="CRC-Im-KQW"/>
<constraint firstAttribute="trailing" secondItem="zjG-YU-5RC" secondAttribute="trailing" id="MIB-Fc-10d"/>
<constraint firstAttribute="bottom" secondItem="zjG-YU-5RC" secondAttribute="bottom" id="a8N-jy-7sp"/>
<constraint firstItem="zjG-YU-5RC" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="cgl-RT-iyZ"/>
</constraints>
<connections>
<outlet property="labelCommissions" destination="u6I-iG-56m" id="p8Z-HH-axB"/>
<outlet property="labelTotal" destination="kDR-7B-Oxx" id="G7b-eP-AWW"/>
</connections>
<point key="canvasLocation" x="409" y="326"/>
</view>
</objects>
</document>
//
// OrderListHeaderView.h
// ALand
//
// Created by Z on 16/5/19.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "JavenOrderModel.h"
@interface OrderListHeaderView : UITableViewHeaderFooterView
- (void)setUpViewWithModel:(JavenOrderModel *)model state:(NSString *)state;
@end
//
// OrderListHeaderView.m
// ALand
//
// Created by Z on 16/5/19.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderListHeaderView.h"
@interface OrderListHeaderView ()
@property (weak, nonatomic) IBOutlet UILabel *labelState;
@property (weak, nonatomic) IBOutlet UILabel *labelCosumer;
@property (weak, nonatomic) IBOutlet UILabel *labelTime;
@end
@implementation OrderListHeaderView
- (void)setUpViewWithModel:(JavenOrderModel *)model state:(NSString *)state
{
self.labelCosumer.text = model.consumer.code;
self.labelTime.text = [(JavenCreateInfo *)model.createInfo time];
self.labelState.text = state;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
This diff is collapsed.
......@@ -43,6 +43,7 @@
[self setUpSortView];
[self setUpCollectionView];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[self setUpData];
// Do any additional setup after loading the view.
}
......@@ -89,7 +90,6 @@
@"page" : @(self.page),
@"probePages" : @0},
@"fetchParts" : @[@"string"]};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:myDictionary success:^(NSURLSessionDataTask *task, id responseObject) {
......@@ -97,7 +97,7 @@
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
[weakSelf.arrItemDatas addObject:model];
}
[MBProgressHUD hideHUDForView:weakSelf.view];
[weakSelf.collectionView reloadData];
[weakSelf.collectionView.mj_header endRefreshing];
if ([responseObject[@"queryResult"] count] < kPageSize) {
......@@ -189,6 +189,7 @@
//改变排序条件之后重新请求数据
- (void)resetReloadData {
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[self.arrItemDatas removeAllObjects];
[self setUpData];
......@@ -222,7 +223,7 @@
}];
_collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.page += 1;
weakSelf.page += 1;
[weakSelf setUpData];
}];
......
......@@ -76,8 +76,10 @@
- (void)setUpData {
NSDictionary *myDictionary = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"goodsData name like",
NSDictionary *myDictionary = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"global name like",
@"parameters" : @[self.searchText]},
@{@"operation" : @"online only",
@"parameters" : @[[NSNull null]]},
@{@"operation" : @"domain equals",
@"parameters" : @[[UserInfo shareInstance].domain]},
],
......@@ -150,13 +152,13 @@
break;
case 3://佣金
{
self.field = @"brokerageRate";
self.field = @"commission";
self.direction = @"desc";
}
break;
case 4:
{
self.field = @"brokerageRate";
self.field = @"commission";
self.direction = @"asc";
}
break;
......
......@@ -36,6 +36,7 @@
[super viewDidLoad];
self.view.backgroundColor = kBacroundColor;
self.page = 0;
self.phoneNo = [NSNull null];
[self setUpDefaultConditions];
[self setUpSearchBar];
[self setUpSortView];
......@@ -48,7 +49,6 @@
self.field = @"commission";
self.direction = @"desc";
self.customerCreateDate = @"2011-04-09 00:00:00";
self.phoneNo = [NSNull null];
}
......@@ -113,6 +113,7 @@
@"page" : @(self.page),
@"probePages" : @0},
@"fetchParts" : @[@""]};
NSString *strJson = [params mj_JSONString];
return params;
}
......@@ -282,7 +283,7 @@
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
// self.sortView.userInteractionEnabled = YES;
self.phoneNo = [NSNull null];
self.searchBar.text = @"";
self.phoneNo = [NSNull null];
[self.searchBar endEditing:YES];
......@@ -292,7 +293,7 @@
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
[self.sortView hide];
// self.sortView.userInteractionEnabled = NO;
// self.sortView.userInteractionEnabled = NO;
self.searchBar.showsCancelButton = YES;
return YES;
}
......@@ -305,7 +306,7 @@
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
// self.sortView.userInteractionEnabled = YES;
// self.sortView.userInteractionEnabled = YES;
[self.results removeAllObjects];
[self setUpDefaultConditions];
[self setUpData];
......@@ -325,13 +326,13 @@
}
/*
#pragma mark - Navigation
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
}
*/
@end
......@@ -13,10 +13,15 @@
#import "JavenOrderModel.h"
#import "JavenGoodsDetails.h"
#import "MJRefresh.h"
#import "OrderDetailTableViewCell.h"
#import "OrderListHeaderView.h"
#import "OrderListFooterView.h"
#define kExpressCell @"OrderExpressTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
#define kPageSize 4
#define kHeaderID @"headerId"
#define kFooterID @"footerId"
@interface NoPaymentTableViewController ()
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, strong) NSMutableArray *arrDatas;
......@@ -26,8 +31,10 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderExpressTableViewCell" bundle:nil] forCellReuseIdentifier:kExpressCell];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderDetailTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderListHeaderView" bundle:nil] forHeaderFooterViewReuseIdentifier:kHeaderID];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderListFooterView" bundle:nil] forHeaderFooterViewReuseIdentifier:kFooterID];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
WS(weakSelf)
......@@ -115,16 +122,7 @@
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// if ([self.orderTag isEqualToString:@"待支付"]) {
// }else if([self.orderTag isEqualToString:@"待发货"]){
// }else if ([self.orderTag isEqualToString:@"已发货"]){
// return 170 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
// }else if ([self.orderTag isEqualToString:@"已完成"]){
// return 170 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
// }else if ([self.orderTag isEqualToString:@"已取消"]){
// }
return 115 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
return 110;
}
......@@ -136,31 +134,39 @@
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
return self.arrDatas.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.arrDatas.count;
return [[self.arrDatas[section] goodsDetails] count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 80;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
OrderListHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kHeaderID];
[header setUpViewWithModel:self.arrDatas[section] state:self.orderTag];
return header;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 40;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
OrderListFooterView *footer = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kFooterID];
[footer setUpViewWithModel:self.arrDatas[section]];
return footer;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// if ([self.orderTag isEqualToString:@"已发货"] || [self.orderTag isEqualToString:@"已完成"]) {
// OrderExpressTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kExpressCell forIndexPath:indexPath];
//
// [cell cellWithModel:self.arrDatas[indexPath.row]];
// [cell setState:_orderTag];
// cell.checkExpress.hidden = NO;
// return cell;
//
// }else{
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
OrderDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
[cell cellWithModel:self.arrDatas[indexPath.row]];
[cell setState:_orderTag];
[cell cellWithModel:[self.arrDatas[indexPath.section] goodsDetails][indexPath.row]];
return cell;
// }
}
......
......@@ -74,17 +74,14 @@
[self.atopView updateHeight];
self.atopView.frame = CGRectMake(0, -self.atopView.height, kWidth, self.atopView.height);
[self.bottomView updateHeight];
//self.bottomView.y = kHeight - self.bottomView.height;
self.bottomView.width = kWidth;
self.tableView.contentInset = UIEdgeInsetsMake(self.atopView.height, 0, self.bottomView.height - 250, 0);
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
......
......@@ -52,7 +52,7 @@
for (int i = 0; i < arrTitle.count; i++) {
NSLog(@"-----%ld", (long)i);
NoPaymentTableViewController *noPayMentVC = [[NoPaymentTableViewController alloc] init];
NoPaymentTableViewController *noPayMentVC = [[NoPaymentTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
noPayMentVC.orderTag = arrTitle[i];
[arrVC addObject:noPayMentVC];
}
......
......@@ -95,6 +95,8 @@
- (IBAction)loginACtion:(UIButton *)sender {
[self defaultLoginAction];
ToLoginViewController *toLoginVC = [[ToLoginViewController alloc] initWithNibName:@"ToLoginViewController" bundle:[NSBundle mainBundle]];
toLoginVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:toLoginVC animated:YES];
......
......@@ -29,7 +29,7 @@
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString *strBankCardID = [textField.text stringByReplacingCharactersInRange:range withString:string];//变化后的字符串
if ([strBankCardID bankCardluhmCheck]) {
if ([strBankCardID isBankCard]) {
self.btnNext.enabled = YES;
}else{
self.btnNext.enabled = NO;
......
......@@ -50,7 +50,7 @@
{
//check cardNo validate
NSString *strBankCardID = [textField.text stringByReplacingCharactersInRange:range withString:string];//变化后的字符串
if ([strBankCardID bankCardluhmCheck]) {
if ([strBankCardID isBankCard]) {
NSString *strBankNameAndType = [MyBankClass returnBankName:strBankCardID];
self.labelCardName.text = [strBankNameAndType componentsSeparatedByString:@"·"][0];
}else{
......
......@@ -45,7 +45,7 @@
/**
* 银行卡的有效性
*/
- (BOOL)bankCardluhmCheck;
- (BOOL)isBankCard;
/**
* IP地址有效性
......@@ -77,6 +77,7 @@
*/
- (BOOL)isValidTaxNo;
/**
@brief 是否符合最小长度、最长长度,是否包含中文,首字母是否可以为数字
@param minLenth 账号最小长度
......
......@@ -281,68 +281,48 @@
* 2,将奇位乘积的个十位全部相加,再加上所有偶数位上的数字
* 3,将加法和加上校验位能被 10 整除。
*/
- (BOOL)bankCardluhmCheck{
if (self.length != 19) {
return NO;
- (BOOL)isBankCard
{
int oddsum = 0; //奇数求和
int evensum = 0; //偶数求和
int allsum = 0;
int cardNoLength = (int)[self length];
int lastNum = [[self substringFromIndex:cardNoLength-1] intValue];
NSString *cardNo = [self substringToIndex:cardNoLength - 1];
for (int i = cardNoLength -1 ; i>=1;i--) {
NSString *tmpString = [cardNo substringWithRange:NSMakeRange(i-1, 1)];
int tmpVal = [tmpString intValue];
if (cardNoLength % 2 ==1 ) {
if((i % 2) == 0){
tmpVal *= 2;
if(tmpVal>=10)
tmpVal -= 9;
evensum += tmpVal;
}else{
NSString * lastNum = [[self substringFromIndex:(self.length-1)] copy];//取出最后一位
NSString * forwardNum = [[self substringToIndex:(self.length -1)] copy];//前15或18位
NSMutableArray * forwardArr = [[NSMutableArray alloc] initWithCapacity:0];
for (int i=0; i<forwardNum.length; i++) {
NSString * subStr = [forwardNum substringWithRange:NSMakeRange(i, 1)];
[forwardArr addObject:subStr];
oddsum += tmpVal;
}
NSMutableArray * forwardDescArr = [[NSMutableArray alloc] initWithCapacity:0];
for (int i = (int)(forwardArr.count-1); i> -1; i--) {//前15位或者前18位倒序存进数组
[forwardDescArr addObject:forwardArr[i]];
}
NSMutableArray * arrOddNum = [[NSMutableArray alloc] initWithCapacity:0];//奇数位*2的积 < 9
NSMutableArray * arrOddNum2 = [[NSMutableArray alloc] initWithCapacity:0];//奇数位*2的积 > 9
NSMutableArray * arrEvenNum = [[NSMutableArray alloc] initWithCapacity:0];//偶数位数组
for (int i=0; i< forwardDescArr.count; i++) {
NSInteger num = [forwardDescArr[i] intValue];
if (i%2) {//偶数位
[arrEvenNum addObject:[NSNumber numberWithInteger:num]];
}else{//奇数位
if (num * 2 < 9) {
[arrOddNum addObject:[NSNumber numberWithInteger:num * 2]];
}else{
NSInteger decadeNum = (num * 2) / 10;
NSInteger unitNum = (num * 2) % 10;
[arrOddNum2 addObject:[NSNumber numberWithInteger:unitNum]];
[arrOddNum2 addObject:[NSNumber numberWithInteger:decadeNum]];
if((i % 2) == 1){
tmpVal *= 2;
if(tmpVal>=10)
tmpVal -= 9;
evensum += tmpVal;
}else{
oddsum += tmpVal;
}
}
}
__block NSInteger sumOddNumTotal = 0;
[arrOddNum enumerateObjectsUsingBlock:^(NSNumber * obj, NSUInteger idx, BOOL *stop) {
sumOddNumTotal += [obj integerValue];
}];
__block NSInteger sumOddNum2Total = 0;
[arrOddNum2 enumerateObjectsUsingBlock:^(NSNumber * obj, NSUInteger idx, BOOL *stop) {
sumOddNum2Total += [obj integerValue];
}];
__block NSInteger sumEvenNumTotal =0 ;
[arrEvenNum enumerateObjectsUsingBlock:^(NSNumber * obj, NSUInteger idx, BOOL *stop) {
sumEvenNumTotal += [obj integerValue];
}];
NSInteger lastNumber = [lastNum integerValue];
allsum = oddsum + evensum;
allsum += lastNum;
if((allsum % 10) == 0)
return YES;
else
return NO;
}
NSInteger luhmTotal = lastNumber + sumEvenNumTotal + sumOddNum2Total + sumOddNumTotal;
return (luhmTotal%10 ==0)?YES:NO;
}
}
- (BOOL)isIPAddress{
NSString *regex = [NSString stringWithFormat:@"^(\\\\d{1,3})\\\\.(\\\\d{1,3})\\\\.(\\\\d{1,3})\\\\.(\\\\d{1,3})$"];
......@@ -367,5 +347,4 @@
}
@end
......@@ -58,6 +58,7 @@
#define kMoneyFromDouble(doubleData) [NSString stringWithFormat:@"¥%.2f", doubleData]
#define kMoneyFromIDNumber(doubleData) [NSString stringWithFormat:@"%.2f", [doubleData doubleValue]]
#define kIsResponseSuccess(responseObject) [responseObject[@"code"] isEqualToNumber:@0]
#define kWindow [UIApplication sharedApplication].keyWindow
......
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