Commit 986fdbfb authored by 勾芒's avatar 勾芒

caoyunxiao

parent 157084af
//
// AdditionalTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AdditionalTableViewCell : UITableViewCell
@end
//
// AttachmentInformationTableViewCell.m
// AdditionalTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 16/5/4.
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "AttachmentInformationTableViewCell.h"
#import "AdditionalTableViewCell.h"
@implementation AttachmentInformationTableViewCell
@implementation AdditionalTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="259" id="KGk-i7-Jjw" customClass="AdditionalTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="768" height="75"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="768" height="74.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="是否开票:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="444-pT-XHf">
<rect key="frame" x="21" y="13" width="70" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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="曹云霄" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Gdg-fx-ziI">
<rect key="frame" x="95" y="13" width="150" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.7124683436" blue="0.054982668810000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发票抬头:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="MoA-e8-03W">
<rect key="frame" x="21" y="45" width="70" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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="曹云霄" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IhE-VI-oy0">
<rect key="frame" x="95" y="45" width="220" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.7124683436" blue="0.054982668810000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发票类型:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Zdn-MM-Xad">
<rect key="frame" x="370" y="13" width="70" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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="曹云霄" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="7ty-c7-Sgn">
<rect key="frame" x="432" y="13" width="170" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.7124683436" blue="0.054982668810000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="支付方式:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="S5V-nq-hin">
<rect key="frame" x="370" y="43" width="70" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<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="曹云霄" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="MPi-P0-LEg">
<rect key="frame" x="432" y="43" width="170" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.7124683436" blue="0.054982668810000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<point key="canvasLocation" x="420" y="242.5"/>
</tableViewCell>
</objects>
</document>
......@@ -28,4 +28,10 @@
*/
@property (nonatomic,strong) NSArray *goodsAllprice;
/**
* 商品数据源
*/
@property (nonatomic,strong) NSArray *goodsArray;
@end
......@@ -34,6 +34,32 @@
}
#pragma mark -数据源赋值
- (void)setGoodsArray:(NSArray *)goodsArray
{
_goodsArray = goodsArray;
NSInteger allNumber = 0;//总数量
NSInteger allPrice = 0;//总价格
for (TOOrderdetailEntity *model in _goodsArray) {
allNumber += [model.goodsPrice integerValue];
allPrice += [model.goodsNum integerValue];
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",allNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%ld",allPrice];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// AttachmentInformationTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/5/4.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AttachmentInformationTableViewCell : UITableViewCell
/**
* 是否开票
*/
@property (weak, nonatomic) IBOutlet UILabel *whetherInvoice;
/**
* 发票抬头
*/
@property (weak, nonatomic) IBOutlet UILabel *InvoiceHeader;
/**
* 发票类型
*/
@property (weak, nonatomic) IBOutlet UILabel *invoicetype;
@end
......@@ -219,7 +219,7 @@
#pragma mark -添加客户信息
#pragma mark -添加客户信息、或者退出当前客户
- (IBAction)addCustomerInformationORExit:(UIButton *)sender {
if ([sender.currentTitle isEqualToString:@"退出当前客户"]) {
......@@ -235,6 +235,7 @@
self.changePersonInformationButton.hidden = YES;
[Shoppersmanager manager].currentCustomer = NO;
[Customermanager manager].customerID = nil;
[self.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal];
//全部为为选中状态
for (InformationTableViewCell *cell in self.informationTableview.visibleCells) {
......@@ -248,12 +249,12 @@
[sender setTitle:@"添加客户信息" forState:UIControlStateNormal];
return;
}
[self addCustomerInformation];
[self addCustomerInformation:NO];
}
#pragma mark -添加客户信息请求
- (void)addCustomerInformation
#pragma mark -添加客户信息请求 -新增、或者修改
- (void)addCustomerInformation:(BOOL)isChange
{
[self.view endEditing:YES];
if (self.customerNameField.text.length == 0) {
......@@ -280,6 +281,10 @@
customerEntity.mobile = self.phoneNumberField.text;
customerEntity.address = self.customerAddress.text;
customerEntity.name = self.companyNameField.text;
//修改
if (isChange) {
customerEntity.fid = [Customermanager manager].customerID;
}
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/consumer/save"] WithRequestType:0 WithParameter:customerEntity WithReturnValueBlock:^(id returnValue) {
......@@ -287,15 +292,21 @@
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
//保存客户信息
//新增保存ID
if (!isChange) {
[Customermanager manager].customerID = returnValue[@"data"];
[self SuccessMBProgressView:@"新增成功"];
}else
{
[self SuccessMBProgressView:@"修改成功"];
[self.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal];
}
//保存客户信息
[Customermanager manager].customerName = customerEntity.name;
[Customermanager manager].customerPhoneNumber = customerEntity.mobile;
[Customermanager manager].companyAddress = customerEntity.address;
[Customermanager manager].cutomerAddress = customerEntity.address;
[Shoppersmanager manager].currentCustomer = YES;
[self SuccessMBProgressView:returnValue[@"新增成功"]];
[self.addpersonInformationButton setTitle:@"退出当前客户" forState:UIControlStateNormal];
self.changePersonInformationButton.hidden = NO;
self.customerNameField.enabled = NO;
......@@ -324,11 +335,22 @@
- (IBAction)changeCustomerInformation:(UIButton *)sender {
if ([sender.currentTitle isEqualToString:@"保存"]) {
[self.customerNameField resignFirstResponder];
[sender setTitle:@"更改客户信息" forState:UIControlStateNormal];
[self addCustomerInformation:YES];
}else
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.customerNameField becomeFirstResponder];
});
[sender setTitle:@"保存" forState:UIControlStateNormal];
}
self.customerNameField.enabled = YES;
self.customerAddress.enabled = YES;
self.phoneNumberField.enabled = YES;
self.companyNameField.enabled = YES;
[self.customerNameField becomeFirstResponder];
}
......
......@@ -43,6 +43,10 @@
@property (nonatomic,strong) ShopcarModel *model;
/**
* 订单详情商品数据源
*/
@property (nonatomic,strong) TOOrderdetailEntity *orderDetailslist;
@end
......@@ -32,6 +32,23 @@
#pragma mark -订单详情页赋值
- (void)setOrderDetailslist:(TOOrderdetailEntity *)orderDetailslist
{
_orderDetailslist = orderDetailslist;
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:_orderDetailslist.goodsBrand] placeholderImage:ReplaceImage];
self.goodsNumber.text = _orderDetailslist.goodsNum;
self.clinchPrice.text = [_orderDetailslist.goodsPrice stringValue];
self.totalPrice.text = [_orderDetailslist.goodsTotalPrice stringValue];
self.goodsName.text = _orderDetailslist.goodsSpec;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -39,7 +39,10 @@
/**
* 收货信息
*/
@property (nonatomic,strong) TOOrderEntity *model;
......
......@@ -15,6 +15,23 @@
// Initialization code
}
#pragma mark -赋值
- (void)setModel:(TOOrderEntity *)model
{
_model = model;
self.consigneeName.text = _model.receiverName;
self.consigneePhoneNumber.text = _model.receiverMobile;
self.detailsAddress.text = _model.receiverAddress;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// HotCollectionViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HotCollectionViewCell : UICollectionViewCell
/**
* 数据源
*/
@property (nonatomic,strong) TOHottagEntity *responseDatas;
/**
* title
*/
@property (nonatomic,strong) UILabel *titleLabe;
@end
//
// HotCollectionViewCell.m
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "HotCollectionViewCell.h"
@implementation HotCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self uiConfigAction];
}
return self;
}
#pragma mark -UI
- (void)uiConfigAction
{
self.titleLabe = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.titleLabe.textAlignment = NSTextAlignmentCenter;
self.titleLabe.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.titleLabe];
}
#pragma mark -赋值
- (void)setResponseDatas:(TOHottagEntity *)responseDatas
{
_responseDatas = responseDatas;
self.titleLabe.text = _responseDatas.name;
}
@end
......@@ -79,7 +79,8 @@
#pragma mark -登陆
- (IBAction)LoginButtonClick:(UIButton *)sender {
// [self SetTheRootViewController];
// return;
if (self.userName.text.length == 0) {
......@@ -130,8 +131,6 @@
[Shoppersmanager manager].passWordString = self.passWord.text;
[self SetTheRootViewController];
NSLog(@"成功");
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
......
......@@ -30,6 +30,9 @@
*/
@property (weak, nonatomic) IBOutlet UILabel *operatorName;
/**
* 订单数据
*/
@property (nonatomic,strong) OrderBill *model;
@end
......@@ -15,6 +15,32 @@
// Initialization code
}
#pragma mark -订单赋值
- (void)setModel:(OrderBill *)model
{
_model = model;
self.orderNumber.text = _model.order.orderNumber;
self.orderTime.text = [self dateAsString:_model.order.orderTime];
self.orderStatus.text = _model.order.orderState;
self.operatorName.text = _model.employee.userName;
}
#pragma mark -时间转换NSDate转NSString
- (NSString*)dateAsString:(NSDate*)date {
NSDateFormatter *formatter=[[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSString * timeString = [formatter stringFromDate:date];
return timeString;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -18,7 +18,22 @@
/**
* 订单详情
* 订单ID
*/
@property (nonatomic,copy) NSString *orderCode;
/**
* 是否显示附件信息
*/
@property (nonatomic,assign) BOOL isShowattachment;
/**
* 区头显示title
*/
@property (nonatomic,strong) NSArray *sectionTitle;
@end
......@@ -12,15 +12,27 @@
#import "GoodsInformationTableViewCell.h"
#import "CommodityListTableViewCell.h"
#import "AllpriceTableViewCell.h"
#import "AttachmentInformationTableViewCell.h"
#import "SettlementViewController.h"
#import "AdditionalTableViewCell.h"
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
/**
* 订单详情数据
*/
@property (nonatomic,strong) OrderBill *orderDetails;
@end
@implementation OrderdetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -35,21 +47,22 @@
{
self.orderDetailsTableview.dataSource = self;
self.orderDetailsTableview.delegate = self;
// self.orderDetailsTableview.tableFooterView = [UIView new];
[self CreateTableviewHeaderView];
[self CreateTableviewFooterView];
}
#pragma mark -获取订单详情
- (void)getOrderDetailsData
{
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/findOrder/",_orderCode] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",returnValue);
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
OrderBill *orderDetails = [[OrderBill alloc]initWithDictionary:returnValue[@"data"] error:nil];
NSLog(@"%@",orderDetails);
self.orderDetails = [[OrderBill alloc]initWithDictionary:returnValue[@"data"] error:nil];
[self.orderDetailsTableview reloadData];
}
else
{
......@@ -61,6 +74,7 @@
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
}
......@@ -102,6 +116,11 @@
lineView.backgroundColor = kTCColor(193, 193, 193);
[headerView addSubview:lineView];
//附加信息cell
[self.orderDetailsTableview registerNib:[UINib nibWithNibName:@"AdditionalTableViewCell" bundle:nil] forCellReuseIdentifier:@"fifthcell"];
self.orderDetailsTableview.tableHeaderView = headerView;
}
......@@ -130,8 +149,10 @@
#pragma mark -调出支付框
- (void)PayButtonClick
{
SettlementViewController *settlement = [[SettlementViewController alloc]init];
settlement.preferredContentSize = CGSizeMake(380, 500);
settlement.goodsArray = self.orderDetails.orderdetailList;
settlement.modalPresentationStyle = UIModalPresentationFormSheet;
UIPopoverPresentationController *pop = settlement.popoverPresentationController;
pop.sourceView = settlement.view;
......@@ -161,7 +182,7 @@
break;
case 3:
{
return 3;
return self.orderDetails.orderdetailList.count+1;
}
break;
case 4:
......@@ -183,44 +204,52 @@
case 0://订单信息
{
OrderInformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"firstcell" forIndexPath:indexPath];
cell.model = self.orderDetails;
return cell;
}
break;
case 1://客户信息
{
PersonInformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"secondcell" forIndexPath:indexPath];
cell.model = self.orderDetails.consumer;
return cell;
}
break;
case 2://收货信息
{
GoodsInformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"thirdcell" forIndexPath:indexPath];
cell.model = self.orderDetails.order;
return cell;
}
break;
case 3://商品清单
{
if (indexPath.row == 2) {
if (indexPath.row == self.orderDetails.orderdetailList.count) {
//商品总计
AllpriceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"sixthcell" forIndexPath:indexPath];
cell.goodsArray = self.orderDetails.orderdetailList;
return cell;
}else
{
//单个商品
CommodityListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"fourthcell" forIndexPath:indexPath];
cell.orderDetailslist = [self.orderDetails.orderdetailList objectAtIndex_opple:indexPath.row];
return cell;
}
}
break;
case 4://附件信息
{
AttachmentInformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"fifthcell" forIndexPath:indexPath];
//是否显示
if (_isShowattachment) {
AdditionalTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"fifthcell" forIndexPath:indexPath];
return cell;
}
}
break;
default:
break;
}
......@@ -237,18 +266,18 @@
break;
case 1:
{
return 160;
return 135;
}
break;
case 2:
{
return 110;
return 90;
}
break;
case 3:
{
//商品总计
if (indexPath.row == 2) {
if (indexPath.row == self.orderDetails.orderdetailList.count) {
return 50;
}
......@@ -261,6 +290,11 @@
break;
case 4:
{
//是否显示附件信息
if (!_isShowattachment) {
return 0;
}
return 75;
}
break;
......@@ -276,12 +310,9 @@
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 44)];
view.backgroundColor = kMainGrayColor;
//区头文字
UILabel *Titlelabe = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, ScreenWidth, 34)];
Titlelabe.backgroundColor = [UIColor whiteColor];
Titlelabe.text = @" 订单详情";
UILabel *Titlelabe = [[UILabel alloc]initWithFrame:CGRectMake(30, 0, 100, 44)];
Titlelabe.text = [self.sectionTitle objectAtIndex_opple:section];
Titlelabe.font = [UIFont systemFontOfSize:13];
[view addSubview:Titlelabe];
return view;
......@@ -298,7 +329,7 @@
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 5;
return self.sectionTitle.count;
}
......@@ -309,7 +340,19 @@
#pragma mark -打印订单
- (void)AirprintButtonClick:(UIButton *)button
{
[self callAirprintWithdata:nil];
// [self callAirprintWithdata:nil];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/UrlOfprintPDF/",_orderCode] WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",returnValue);
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
}];
}
......@@ -329,15 +372,16 @@
/*
#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 {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -52,6 +52,10 @@
@property (weak, nonatomic) IBOutlet UILabel *customerQQNumber;
/**
* 订单数据
*/
@property (nonatomic,strong) TOConsumerEntity *model;
......
......@@ -15,6 +15,20 @@
// Initialization code
}
#pragma mark -赋值
- (void)setModel:(TOConsumerEntity *)model
{
_model = model;
self.customerName.text = _model.name;
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:ReplaceImage];
self.customerNumbers.text = _model.mobile;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -69,13 +69,13 @@
}
//- (void)viewWillAppear:(BOOL)animated
//{
// if (self.productCollectionView != nil) {
//
// [self getGoodsListDatas];
// }
//}
- (void)viewWillAppear:(BOOL)animated
{
if (_screeningDatas != nil) {
[self getGoodsListDatas];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -116,7 +116,6 @@
- (void)getScreeningdatas
{
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/goods/getGoodsFilter"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......@@ -127,8 +126,6 @@
[self.screeningDatas addObject:goodsStyle.space];
[self.screeningDatas addObject:goodsStyle.material];
[self.screeningDatas addObject:goodsStyle.price];
// NSLog(@"%@",self.screeningDatas);
}
else
{
......@@ -144,101 +141,6 @@
}];
}
/*
{
code = 0;
data = {
categories = (
{
children = (
{
children = (
);
id = 0b44439e54997ce201549986e02c0003;
name = "\U5927\U706f";
},
{
children = (
);
id = 0b44439e54997ce201549987c8550004;
name = "\U5eca\U706f";
}
);
id = 0b44439e54997ce20154998630210002;
name = "\U73b0\U4ee3\U706f";
},
{
children = (
{
children = (
);
id = 0b44439e54997ce20154998a59450006;
name = "\U53a8\U623f\U706f";
}
);
id = 0b44439e54997ce201549989c8b10005;
name = "\U7167\U660e\U706f";
}
);
material = (
{
typecode = 001;
typename = "\U91d1";
},
{
typecode = 002;
typename = "\U94f6";
},
{
typecode = 003;
typename = "\U6728\U8d28";
}
);
price = (
{
typecode = 001;
typename = "500\U4ee5\U4e0b";
},
{
typecode = 002;
typename = "500\U52301000";
},
{
typecode = 003;
typename = "1000\U52302000";
}
);
space = (
{
typecode = 001;
typename = "15\U5e73\U7c73";
},
{
typecode = 002;
typename = "20\U5e73\U7c73";
},
{
typecode = 003;
typename = "35\U5e73\U7c73";
}
);
styles = (
{
typecode = 001;
typename = "\U4e2d\U56fd\U98ce";
},
{
typecode = 002;
typename = "\U82f1\U56fd\U98ce";
}
);
};
message = "\U64cd\U4f5c\U6210\U529f";
}
*/
#pragma mark -获取商品列表数据
- (void)getGoodsListdatas:(GoodsCondition *)conditon returnResponse:(void(^)(GoodsResponse *))finish
......@@ -283,9 +185,36 @@
self.productCollectionView.alwaysBounceVertical = YES;
[self CreatescreeningButton];
//搜索关键字
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(searchInputString:) name:@"SEARCHINPUTSTRING" object:nil];
}
#pragma mark -搜索关键字
- (void)searchInputString:(NSNotification *)not
{
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
Newpage.page = 0;
conditon.page = Newpage;
conditon.nameLike = not.object;
__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)CreatescreeningButton
......@@ -559,6 +488,16 @@
}
#pragma mark -释放
- (void)dealloc
{
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
//
// SearchCollectionViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SearchCollectionViewCell : UICollectionViewCell
/**
* 显示历史记录,或者热门搜索
*/
@property (weak, nonatomic) IBOutlet UILabel *searchLabe;
@end
//
// SearchCollectionViewCell.m
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "SearchCollectionViewCell.h"
@implementation SearchCollectionViewCell
@end
//
// SearchViewController.h
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface SearchViewController : BaseViewController
/**
* 历史记录collectionView
*/
@property (weak, nonatomic) IBOutlet UICollectionView *historyCollectionView;
/**
* 历史记录layout
*/
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *historyLayout;
/**
* 热门搜索collectionView
*/
@property (weak, nonatomic) IBOutlet UICollectionView *hotCollectionView;
/**
* 热门搜索layout
*/
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *hotCollectionviewLayout;
@end
//
// SearchViewController.m
// Lighting
//
// Created by 曹云霄 on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "SearchViewController.h"
#import "SearchCollectionViewCell.h"
#import "HotCollectionViewCell.h"
@interface SearchViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
/**
* 数据源
*/
@property (nonatomic,strong) HotTagResponse *response;
/**
* 本地搜索历史
*/
@property (nonatomic,strong) NSMutableArray *localSearchArray;
@end
@implementation SearchViewController
/**
* 本地搜索历史初始化
*/
- (NSMutableArray *)localSearchArray
{
if (_localSearchArray == nil) {
_localSearchArray = [NSMutableArray array];
}
return _localSearchArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self uiConfigAction];
[self getHotSearchdatas];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.hotCollectionviewLayout.itemSize = CGSizeMake(120, 44);
self.hotCollectionviewLayout.minimumLineSpacing = 10;
self.hotCollectionviewLayout.minimumInteritemSpacing = 10;
self.hotCollectionviewLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
self.historyLayout.itemSize = CGSizeMake(120, 44);
self.historyLayout.minimumLineSpacing = 10;
self.historyLayout.minimumInteritemSpacing = 10;
self.historyLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
self.historyCollectionView.delegate = self;
self.historyCollectionView.dataSource = self;
self.hotCollectionView.dataSource = self;
self.hotCollectionView.delegate = self;
self.hotCollectionView.backgroundColor = [UIColor redColor];
self.historyCollectionView.backgroundColor = [UIColor greenColor];
}
#pragma mark -获取本地存储搜索历史
- (void)getlocalsaveDatas
{
NSString *homeDictionary = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *homepath = [homeDictionary stringByAppendingPathComponent:@"LOCALSAVE"];//添加储存的文件名
self.localSearchArray = [NSKeyedUnarchiver unarchiveObjectWithFile:homepath];
}
#pragma mark -归档搜索历史
- (void)SaveSearchDatas
{
NSString *homeDictionary = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *homepath = [homeDictionary stringByAppendingPathComponent:@"LOCALSAVE"];//添加储存的文件名
BOOL flag = [NSKeyedArchiver archiveRootObject:self.localSearchArray toFile:homepath];//归档一个字符串
}
#pragma mark -获取热门搜索数据
- (void)getHotSearchdatas
{
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/hottag/getHotTag"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
self.response = [[HotTagResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
[self.hotCollectionView reloadData];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
if ([collectionView isEqual:self.historyCollectionView]) {
SearchCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"firstcell" forIndexPath:indexPath];
return cell;
}
if ([collectionView isEqual:self.hotCollectionView]) {
HotCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"secondcell" forIndexPath:indexPath];
cell.responseDatas = [self.response.list objectAtIndex_opple:indexPath.item];
return cell;
}
return nil;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
if ([collectionView isEqual:self.hotCollectionView]) {
return self.response.list.count;
}
return 20;
}
#pragma mark -释放
- (void)dealloc
{
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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 {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -14,8 +14,101 @@
/**
*
* 商品信息
*/
@property (nonatomic,strong) NSArray *goodsArray;
/**
* 商品总数量
*/
@property (weak, nonatomic) IBOutlet UITextField *goodsAllNumber;
/**
* 商品总数量背景View
*/
@property (weak, nonatomic) IBOutlet UIView *goodsAllNumberBackvie;
/**
* 商品总金额
*/
@property (weak, nonatomic) IBOutlet UITextField *goodsAllPrice;
/**
* 商品总金额背景View
*/
@property (weak, nonatomic) IBOutlet UIView *goodsAllpriceBackView;
/**
* 支付方式
*/
@property (weak, nonatomic) IBOutlet UIButton *payTypeButton;
/**
* 微信支付
*/
@property (weak, nonatomic) IBOutlet UIButton *WeixiPayButton;
/**
* 支付宝支付
*/
@property (weak, nonatomic) IBOutlet UIButton *payTreasureButton;
/**
* 显示支付二维码
*/
@property (weak, nonatomic) IBOutlet UIImageView *showPayQrCodeImageView;
/**
* 是否开票
*/
@property (weak, nonatomic) IBOutlet UIButton *ISinvoiceButton;
/**
* 发票类型
*/
@property (weak, nonatomic) IBOutlet UIButton *invoiceType;
/**
* 发票抬头
*/
@property (weak, nonatomic) IBOutlet UITextField *invoiceHeader;
/**
* 发票抬头背景
*/
@property (weak, nonatomic) IBOutlet UIView *invoiceBackView;
/**
* 取消
*/
@property (weak, nonatomic) IBOutlet UIButton *cancelButton;
/**
* 确认
*/
@property (weak, nonatomic) IBOutlet UIButton *sureButton;
@end
......@@ -8,7 +8,7 @@
#import "SettlementViewController.h"
@interface SettlementViewController ()
@interface SettlementViewController ()<ReturnTableviewcellIndexpathdelegate>
@end
......@@ -16,16 +16,145 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self uiConfigAction];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.goodsAllNumberBackvie.layer.masksToBounds = YES;
self.goodsAllNumberBackvie.layer.cornerRadius = kCornerRadius;
self.goodsAllpriceBackView.layer.masksToBounds = YES;
self.goodsAllpriceBackView.layer.cornerRadius = kCornerRadius;
self.payTypeButton.layer.masksToBounds = YES;
self.payTypeButton.layer.cornerRadius = kCornerRadius;
self.WeixiPayButton.layer.masksToBounds = YES;
self.WeixiPayButton.layer.cornerRadius = kCornerRadius;
self.payTreasureButton.layer.masksToBounds = YES;
self.payTreasureButton.layer.cornerRadius = kCornerRadius;
self.ISinvoiceButton.layer.masksToBounds = YES;
self.ISinvoiceButton.layer.cornerRadius = kCornerRadius;
self.invoiceType.layer.masksToBounds = YES;
self.invoiceType.layer.cornerRadius = kCornerRadius;
self.invoiceBackView.layer.masksToBounds = YES;
self.invoiceBackView.layer.cornerRadius = kCornerRadius;
}
#pragma mark -支付总金额,商品总数量
- (void)setGoodsArray:(NSArray *)goodsArray
{
_goodsArray = goodsArray;
NSInteger goodsAllNumber = 0;//总数量
NSInteger goodAllprice = 0;//总价格
for (TOOrderdetailEntity *model in _goodsArray) {
goodsAllNumber += [model.goodsNum integerValue];
goodAllprice += [model.goodsPrice integerValue];
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",goodsAllNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"%ld元",goodAllprice];
}
- (void)viewWillAppear:(BOOL)animated
{
self.view.superview.layer.cornerRadius = 0;
}
#pragma mark -取消支付
- (IBAction)CancelButtonClick:(UIButton *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark -确认支付
- (IBAction)SureButtonClick:(UIButton *)sender {
}
#pragma amrk -支付方式选择
- (IBAction)payTypeButtonClick:(UIButton *)sender {
NSArray *arr = @[@"现金",@"支票",@"转账"];
[self ShowPopoverViewController:CGSizeMake(100, 200) Withdatas:arr ShowButton:sender SelectedIndex:0 GetTitle:YES];
}
#pragma mark -是否开票
- (IBAction)isinvoiceButtonClick:(UIButton *)sender {
}
#pragma mark -发票类型
- (IBAction)invoiceTypeButtonClick:(UIButton *)sender {
}
#pragma mark -弹出popover视图控制器
- (void)ShowPopoverViewController:(CGSize)size Withdatas:(NSArray *)datasArray ShowButton:(UIButton *)button SelectedIndex:(NSInteger)index GetTitle:(BOOL )istitle
{
PopoverViewController *popover = [[PopoverViewController alloc]init];
popover.datasArray = datasArray;
popover.delegate = self;
popover.Selectedindex = index;
popover.isString = YES;
popover.contentSize = size;
popover.preferredContentSize = size;
popover.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *pop = popover.popoverPresentationController;
pop.permittedArrowDirections = UIPopoverArrowDirectionUp;
pop.sourceView = popover.view;
pop.barButtonItem = [[UIBarButtonItem alloc]initWithCustomView:button];
[self presentViewController:popover animated:YES completion:nil];
}
/**
* 选中筛选条件对象typecode
*
* @param index NSString
*/
- (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected
{
switch (Selected) {
case 0://支付方式
{
[self.payTypeButton setTitle:title forState:UIControlStateNormal];
}
break;
case 1://是否开票
{
[self.ISinvoiceButton setTitle:title forState:UIControlStateNormal];
}
break;
case 2://发票类型
{
[self.invoiceType setTitle:title forState:UIControlStateNormal];
}
break;
default:
break;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
This diff is collapsed.
......@@ -346,19 +346,33 @@
//收货地址
TOOrderEntity *orderReceiver = [[TOOrderEntity alloc]init];
orderReceiver.receiverName = @"caoyunxiao";
orderReceiver.receiverMobile = @"15121161964";
orderReceiver.receiverAddress = @"dasdsssssssssss";
NSArray *Adressarr = [self.datasArray objectAtIndex_opple:1];
for (int i=0; i<Adressarr.count; i++) {
if ([[Adressarr objectAtIndex_opple:i] isKindOfClass:[AddressModel class]]) {
AddressModel *model = [Adressarr objectAtIndex_opple:i];
if (model.isSelected) {
orderReceiver.receiverName = model.name;
orderReceiver.receiverMobile = model.miblephone;
orderReceiver.receiverAddress = model.address;
break;
}
if (i == Adressarr.count -1) {
[self ErrorMBProgressView:@"未选中地址"];
return;
}
}
}
order.order = orderReceiver;
orderReceiver.guideId = [[Shoppersmanager manager] Shoppers].employee.fid;
orderReceiver.consumerId = [[Customermanager manager] customerID];
//商品ID
NSArray *goodArray = [self.datasArray lastObject];
NSMutableArray *goodidArr = [NSMutableArray array];
for (int i=0; i<goodArray.count-1; i++) {
ShopcarModel *model = [goodArray objectAtIndex_opple:i];
TOOrderdetailEntity *orderGoods = [[TOOrderdetailEntity alloc]init];
orderGoods.goodsId = model.fid;
......@@ -367,25 +381,20 @@
order.orderdetailList = goodidArr;
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/save"] WithRequestType:0 WithParameter:order WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
OrderdetailsViewController *orderDetails = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"orderdetails"];
orderDetails.orderCode = returnValue[@"data"];
orderDetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品清单"];
orderDetails.isShowattachment = NO;
[self.navigationController pushViewController:orderDetails animated:YES];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
[self RemoveMBProgressHUDLoding];
}];
}
......@@ -399,7 +408,6 @@
}
#pragma mark -设置为当前地址回调
- (void)SetCustomerButtonClick:(NSInteger)index;
{
......
......@@ -85,7 +85,7 @@
self.returnCellblock(_cellindex);
}
sender.selected = YES;
sender.selected = !sender.selected;
}
......
......@@ -64,6 +64,8 @@
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.shopResponseArray removeAllObjects];
[self getShoppingCardata];
// 开启
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
......@@ -115,19 +117,15 @@
model.goodsId = objc.goodsId;
model.goodsNum = objc.goodsNum;
model.consumerId = objc.consumerId;
[self.shopResponseArray addObject:model];
}
[self.shoppingTableview reloadData];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
......@@ -136,7 +134,6 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ShoppingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Shopping" forIndexPath:indexPath];
......@@ -147,7 +144,6 @@
[cell setReturnCellblock:^(NSInteger index) {
[self setSelectedButton:index];
}];
return cell;
}
......@@ -170,33 +166,20 @@
}
#pragma mark -设置为当前客户回调
- (void)setSelectedButton:(NSInteger)index;
{
for (ShoppingTableViewCell *cell in self.shoppingTableview.visibleCells) {
cell.selectedButton.selected = NO;
}
for (ShopcarModel *model in self.shopResponseArray) {
model.isSelected = NO;
}
ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:index];
model.isSelected = YES;
model.isSelected = !model.isSelected;
}
#pragma mark -结算
- (IBAction)settlementButtonClick:(UIButton *)sender {
NSMutableArray *array = [NSMutableArray array];
for (ShopcarModel *model in self.shopResponseArray) {
if (model.isSelected) {
[array addObject:model];
}
}
......@@ -214,12 +197,52 @@
}
#pragma mark -全选
- (IBAction)allSelectedButtonClick:(id)sender {
- (IBAction)allSelectedButtonClick:(UIButton *)sender {
sender.selected = !sender.selected;
if (sender.selected) {
//全部选中
for (ShoppingTableViewCell *cell in self.shoppingTableview.visibleCells) {
cell.selectedButton.selected = YES;
}
for (ShopcarModel *model in self.shopResponseArray) {
model.isSelected = YES;
}
}else
{
//取消全部选中
for (ShoppingTableViewCell *cell in self.shoppingTableview.visibleCells) {
cell.selectedButton.selected = NO;
}
for (ShopcarModel *model in self.shopResponseArray) {
model.isSelected = NO;
}
}
}
#pragma mark -删除选中商品
- (IBAction)delecteSelectedGoods:(UIButton *)sender {
//需要删除的cell数组
NSMutableArray *delecteArray = [NSMutableArray array];
for (int i=0; i<self.shopResponseArray.count; i++) {
ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:i];
if (model.isSelected) {
[self.shopResponseArray removeObject:model];
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:i inSection:0];
[delecteArray addObject:indexpath];
}
}
[self.shoppingTableview deleteRowsAtIndexPaths:delecteArray withRowAnimation:UITableViewRowAnimationLeft];
}
......
......@@ -19,11 +19,13 @@
#import "CustomerOrderViewController.h"
#import "UserViewController.h"
#import "ChangePasswordViewController.h"
#import "SearchViewController.h"
@interface CustomTabbarController ()<TabbarButtonClickdelegate,ChangpasswordDelegate,CancelButtondelegate>
@interface CustomTabbarController ()<TabbarButtonClickdelegate,ChangpasswordDelegate,CancelButtondelegate,UITextFieldDelegate>
@property (nonatomic,strong) NSArray *identifierArray;
@property (nonatomic,strong) NSArray *controllerArray;
/**
* 保存按钮引用
......@@ -43,21 +45,13 @@
{
if (_identifierArray == nil) {
_identifierArray = [NSArray arrayWithObjects:@"shopping",@"Client",@"followheart",@"scenelibrary",@"productlibrary",@"customermanager",@"allcustomer",@"customerorder",@"about", nil];
_identifierArray = [NSArray arrayWithObjects:@"searchvc",@"shopping",@"Client",@"followheart",@"scenelibrary",@"productlibrary",@"customermanager",@"allcustomer",@"customerorder",@"about", nil];
}
return _identifierArray
;
return _identifierArray;
}
- (NSArray *)controllerArray
{
if (_controllerArray == nil) {
_controllerArray = [NSArray arrayWithObjects:@"ShoppingViewController",@"ClientViewController", nil];
}
return _controllerArray;
}
- (void)viewDidLoad {
......@@ -75,6 +69,7 @@
self.tabBar.frame = CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight);
Toolview *toolview = [[Toolview alloc]initWithFrame:CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight)];
toolview.delegate = self;
toolview.inputField.delegate = self;
[self.tabBar addSubview:toolview];
SHARED_APPDELEGATE.tabbar = self.tabBar;
}
......@@ -85,17 +80,19 @@
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
ShoppingViewController *shoppingVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:0]];
ClientViewController *clientVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:1]];
FollowHeartViewController *followVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:2]];
SceneLibraryViewController *sceneVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:3]];
ProductLibraryViewController *productVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:4]];
CustomerManagementViewController *customerVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:5]];
AllCustomerViewController *allcustomerVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:6]];
CustomerOrderViewController *customerOrderVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:7]];
AboutViewController *aboutVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:8]];
SearchViewController *searchVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:0]];
ShoppingViewController *shoppingVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:1]];
ClientViewController *clientVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:2]];
FollowHeartViewController *followVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:3]];
SceneLibraryViewController *sceneVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:4]];
ProductLibraryViewController *productVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:5]];
CustomerManagementViewController *customerVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:6]];
AllCustomerViewController *allcustomerVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:7]];
CustomerOrderViewController *customerOrderVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:8]];
AboutViewController *aboutVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:9]];
UINavigationController *searchNav = [[UINavigationController alloc]initWithRootViewController:searchVC];
UINavigationController *shoppingNav = [[UINavigationController alloc]initWithRootViewController:shoppingVC];
UINavigationController *clientNav = [[UINavigationController alloc]initWithRootViewController:clientVC];
UINavigationController *followNav = [[UINavigationController alloc]initWithRootViewController:followVC];
......@@ -106,7 +103,7 @@
UINavigationController *cutomerorderNav = [[UINavigationController alloc]initWithRootViewController:customerOrderVC];
UINavigationController *aboutNav = [[UINavigationController alloc]initWithRootViewController:aboutVC];
NSArray *vcArray = [NSArray arrayWithObjects:aboutNav,cutomerorderNav,allcustomerNav,customerNav,productNav,sceneNav,followNav,clientNav,shoppingNav, nil];
NSArray *vcArray = [NSArray arrayWithObjects:aboutNav,cutomerorderNav,allcustomerNav,customerNav,productNav,sceneNav,followNav,clientNav,shoppingNav,searchNav, nil];
self.viewControllers = vcArray;
self.selectedIndex = 7;
}
......@@ -218,12 +215,34 @@
- (void)QrcodeButtonClick
{
NSLog(@"二维码扫描");
}
#pragma mark -搜索框代理方法
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
self.selectedIndex = 9;
return YES;
}
#pragma mark -Search按钮
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
//搜索
if (textField.text != nil) {
[textField resignFirstResponder];
self.selectedIndex = 4;
[[NSNotificationCenter defaultCenter] postNotificationName:@"SEARCHINPUTSTRING" object:textField.text];
}
return YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@protocol TabbarButtonClickdelegate <NSObject>
@protocol TabbarButtonClickdelegate <NSObject,UITextFieldDelegate>
@required
......@@ -34,4 +34,10 @@
*/
@property (nonatomic,strong) UIView *underlineView;
/**
* 搜索框
*/
@property (nonatomic,strong) UITextField *inputField;
@end
......@@ -67,12 +67,12 @@
//输入框
UITextField *inputField = [[UITextField alloc]initWithFrame:CGRectMake(45, 0, 170, 35)];
inputField.borderStyle = UITextBorderStyleNone;
inputField.placeholder = @"请输入关键字";
inputField.font = [UIFont systemFontOfSize:12];
[backView addSubview:inputField];
self.inputField = [[UITextField alloc]initWithFrame:CGRectMake(45, 0, 170, 35)];
self.inputField.borderStyle = UITextBorderStyleNone;
self.inputField.placeholder = @"请输入关键字";
self.inputField.font = [UIFont systemFontOfSize:12];
self.inputField.returnKeyType = UIReturnKeySearch;
[backView addSubview:self.inputField];
//扫描二维码
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
......@@ -148,4 +148,10 @@
@end
This diff is collapsed.
......@@ -11,6 +11,7 @@
@interface BaseViewController ()<UIPrintInteractionControllerDelegate>
@property (nonatomic,strong) MBProgressHUD*TCHud;
@property (nonatomic,strong) UIWebView *webView;
@end
......@@ -31,10 +32,22 @@
return _TCHud;
}
- (UIWebView *)webView
{
if (_webView == nil) {
_webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
}
return _webView;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.automaticallyAdjustsScrollViewInsets = NO;
self.view.backgroundColor = [UIColor whiteColor];
}
- (void)didReceiveMemoryWarning {
......@@ -181,4 +194,59 @@
}
#pragma mark 调用airPrint无线打印机
- (void)callAirprintWithURL:(NSURL *)datasurl
{
// NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.delegate = self;
[self.webView loadRequest:[NSURLRequest requestWithURL:datasurl]];//网页
pic.printFormatter = [self.webView viewPrintFormatter];//布局打印视图绘制的内容。
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细";
printInfo.duplex = UIPrintInfoDuplexLongEdge;
pic.printInfo = printInfo;
pic.showsPageRange = YES;
// pic.printingItem = mypdfdata;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (!completed && error)
NSLog(@"FAILED! due to error in domain %@ with error code %ld",
error.domain, error.code);
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler];
} else {
[pic presentAnimated:YES completionHandler:completionHandler];
}
}
@end
......@@ -15,6 +15,8 @@
@protocol ReturnTableviewcellIndexpathdelegate <NSObject>
@optional
/**
* 选中筛选条件对象typecode
*
......@@ -63,5 +65,10 @@
@property (nonatomic,assign) NSInteger Selectedindex;
/**
* 是否传入数据源,结构为内嵌字符串
*/
@property (nonatomic,assign) BOOL isString;
@end
......@@ -54,7 +54,12 @@
cell.imageView.image = TCImage([self.datasArray objectAtIndex_opple:indexPath.row]);
return cell;
}
if (self.isString) {
cell.textLabel.text = [self.datasArray objectAtIndex_opple:indexPath.row];
}else
{
cell.textLabel.text = [[self.datasArray objectAtIndex_opple:indexPath.row] typename];
}
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.font = [UIFont systemFontOfSize:12];
return cell;
......@@ -75,7 +80,6 @@
if ([self.delegate respondsToSelector:@selector(returnWithIndexSelected:)]) {
[self.delegate returnWithIndexSelected:indexPath.row];
}
}else
......@@ -83,9 +87,17 @@
if ([self.delegate respondsToSelector:@selector(returnCellindexpathwithrow:WithcellTitle:Withselected:)]) {
//判断是为纯字符串选中
if (self.isString) {
[self.delegate returnCellindexpathwithrow:[self.datasArray objectAtIndex_opple:indexPath.row] WithcellTitle:[self.datasArray objectAtIndex_opple:indexPath.row] Withselected:_Selectedindex];
}else
{
[self.delegate returnCellindexpathwithrow:[[self.datasArray objectAtIndex_opple:indexPath.row] typecode] WithcellTitle:[[self.datasArray objectAtIndex_opple:indexPath.row] typename] Withselected:_Selectedindex];
}
}
}
}
......
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