Commit 798b5db8 authored by 勾芒's avatar 勾芒

caoyunxiao

parent 490bc4e3
...@@ -11,10 +11,28 @@ ...@@ -11,10 +11,28 @@
@interface CustomerOrderViewController ()<UITableViewDataSource,UITableViewDelegate> @interface CustomerOrderViewController ()<UITableViewDataSource,UITableViewDelegate>
/**
* 数据源数组
*/
@property (nonatomic,strong) NSMutableArray *datasArray;
@end @end
@implementation CustomerOrderViewController @implementation CustomerOrderViewController
/**
* 初始化数据源数组
*/
- (NSMutableArray *)datasArray
{
if (_datasArray == nil) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
...@@ -28,7 +46,6 @@ ...@@ -28,7 +46,6 @@
{ {
self.customerOrderTableView.dataSource = self; self.customerOrderTableView.dataSource = self;
self.customerOrderTableView.delegate = self; self.customerOrderTableView.delegate = self;
self.StyleButton = [screeningButton buttonWithType:UIButtonTypeCustom]; self.StyleButton = [screeningButton buttonWithType:UIButtonTypeCustom];
self.StyleButton.frame = CGRectMake(ScreenWidth-250, 20, 150, 30); self.StyleButton.frame = CGRectMake(ScreenWidth-250, 20, 150, 30);
self.StyleButton.backgroundColor = kTCColor(131, 131, 131); self.StyleButton.backgroundColor = kTCColor(131, 131, 131);
...@@ -47,18 +64,21 @@ ...@@ -47,18 +64,21 @@
OrderBill *allOrder = [[OrderBill alloc]init]; OrderBill *allOrder = [[OrderBill alloc]init];
//分页 //分页
DataPage *page = [[DataPage alloc]init]; DataPage *page = [[DataPage alloc]init];
page = 0; page.page = 0;
page.rows = 10;
//订单 //订单
TOOrderEntity *order = [[TOOrderEntity alloc]init]; TOOrderEntity *Neworder = [[TOOrderEntity alloc]init];
order.guideId = [Shoppersmanager manager].guideid; Neworder.guideId = [Shoppersmanager manager].Shoppers.employee.fid;
allOrder.datapage = page; allOrder.datapage = page;
allOrder.order = order; allOrder.order = Neworder;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/query"] WithRequestType:0 WithParameter:allOrder WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/query"] WithRequestType:0 WithParameter:allOrder WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"%@",returnValue); NSLog(@"%@",returnValue);
OrderResponse *Allorder = [[OrderResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
}else }else
{ {
...@@ -86,6 +106,9 @@ ...@@ -86,6 +106,9 @@
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
CustomerOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"customerordercell" forIndexPath:indexPath]; CustomerOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"customerordercell" forIndexPath:indexPath];
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
#import "AllpriceTableViewCell.h" #import "AllpriceTableViewCell.h"
#import "SettlementViewController.h" #import "SettlementViewController.h"
#import "AdditionalTableViewCell.h" #import "AdditionalTableViewCell.h"
#import <QuickLook/QuickLook.h>
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource>
/** /**
...@@ -341,32 +343,63 @@ ...@@ -341,32 +343,63 @@
#pragma mark -打印订单 #pragma mark -打印订单
- (void)AirprintButtonClick:(UIButton *)button - (void)AirprintButtonClick:(UIButton *)button
{ {
[self DownloadPDF:^(id returnValue) {
// [self callAirprintWithdata:nil]; [self callAirprintWithdata:returnValue SuccessBlock:^{
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/UrlOfprintPDF/",_orderCode] WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) { [self SuccessMBProgressView:@"打印成功"];
} ErrorBlock:^{
NSLog(@"%@",returnValue); [self ErrorMBProgressView:@"打印失败"];
}];
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
}]; }];
} }
#pragma mark -下载PDF
- (void)DownloadPDF:(void(^)(id returnValue))success
{
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/UrlOfprintPDF/",@"A0716051715560001"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
#pragma mark -预览订单 [[NetworkRequestClassManager Manager] DownloadPDFdatasWithURL:[NSString stringWithFormat:@"%@%@",PDFSERADDRESS,returnValue[@"data"]] WithReturnValueBlock:^(id returnValue) {
- (void)PreviewButtonClick:(UIButton *)button
{
} [self RemoveMBProgressHUDLoding];
success(returnValue);
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
}
//
//#pragma mark -预览订单
//- (void)PreviewButtonClick:(UIButton *)button
//{
// //初始化QLPreviewController对象
// QLPreviewController *previewController = [[QLPreviewController alloc] init];
// previewController.dataSource = self;
// [self.navigationController pushViewController:previewController animated:YES];
//}
//
//
////再实现QLPreviewControllerDataSource的两个方法即可显示
////显示文件数量
//- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller
//{
// return 1;
//}
////文件路径URL
//- (id <QLPreviewItem>)previewController: (QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
//{
//
//}
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<rect key="frame" x="20" y="20" width="350" height="350"/> <rect key="frame" x="20" y="20" width="350" height="350"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="05产品库-详情_03" id="tLl-kB-n3W"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="140046029-MX260-D112-03-星冠-5700K(4)" id="tLl-kB-n3W">
<rect key="frame" x="0.0" y="0.0" width="350" height="350"/> <rect key="frame" x="0.0" y="0.0" width="350" height="350"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
</imageView> </imageView>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<state key="normal" title="放大"/> <state key="normal" title="放大"/>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" red="0.40784313729999999" green="0.40784313729999999" blue="0.40784313729999999" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.9882352941176471" green="0.97254901960784312" blue="0.93725490196078431" alpha="1" colorSpace="calibratedRGB"/>
</view> </view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="tsa-PY-0mz"> <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="tsa-PY-0mz">
<rect key="frame" x="383" y="59" width="80" height="269"/> <rect key="frame" x="383" y="59" width="80" height="269"/>
...@@ -187,6 +187,6 @@ ...@@ -187,6 +187,6 @@
</view> </view>
</objects> </objects>
<resources> <resources>
<image name="05产品库-详情_03" width="500" height="375"/> <image name="140046029-MX260-D112-03-星冠-5700K(4)" width="600" height="450"/>
</resources> </resources>
</document> </document>
...@@ -96,11 +96,12 @@ ...@@ -96,11 +96,12 @@
self.headerView.nameLabe.text = self.entity.name; self.headerView.nameLabe.text = self.entity.name;
self.headerView.brandName.text = self.entity.brandId; self.headerView.brandName.text = self.entity.brandId;
self.headerView.dorpPriceLabe.text = [self.entity.tagPrice stringValue]; self.headerView.dorpPriceLabe.text = [self.entity.tagPrice stringValue];
[self.headerView.goodsImageview sd_setImageWithURL:[NSURL URLWithString:self.entity.pictures] placeholderImage:ReplaceImage]; [self.headerView.goodsImageview sd_setImageWithURL:[NSURL URLWithString:self.entity.pictures] placeholderImage:TCImage(@"140046029-MX260-D112-03-星冠-5700K(4)")];
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
......
...@@ -282,7 +282,7 @@ ...@@ -282,7 +282,7 @@
{ {
ProductCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"productcell" forIndexPath:indexPath]; ProductCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"productcell" forIndexPath:indexPath];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",ServerAddress,[[self.datasArray.goodsEntity objectAtIndex_opple:indexPath.row] pictures]]]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",ServerAddress,[[self.datasArray.goodsEntity objectAtIndex_opple:indexPath.row] pictures]]];
[cell.productImageView sd_setImageWithURL:url placeholderImage:nil]; [cell.productImageView sd_setImageWithURL:url placeholderImage:REPLACEIMAGE];
return cell; return cell;
......
...@@ -379,17 +379,10 @@ ...@@ -379,17 +379,10 @@
orderGoods.goodsBrand = model.goods.brandId; orderGoods.goodsBrand = model.goods.brandId;
orderGoods.goodsNum = model.goods.number; orderGoods.goodsNum = model.goods.number;
orderGoods.goodsPrice = model.goods.costPrice; orderGoods.goodsPrice = model.goods.costPrice;
// orderGoods.goodsUnit = model.goods.unit; orderGoods.remark = @" ";
//总价
// @synthesize goodsId; NSInteger allprice = [model.goods.number integerValue]*[model.goods.costPrice integerValue];
// @synthesize goodsCode; orderGoods.goodsTotalPrice = [NSNumber numberWithInteger:allprice];
// @synthesize goodsName;
// @synthesize goodsCover;
// @synthesize goodsSpec;
// @synthesize goodsBrand;
// @synthesize goodsNum;
// @synthesize goodsPrice;
// @synthesize goodsTotalPrice;
[goodidArr addObject:orderGoods]; [goodidArr addObject:orderGoods];
} }
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "140046029-MX260-D112-03-星冠-5700K(2).png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "140046029-MX260-D112-03-星冠-5700K(4).png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "bg-img 副本.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* 调用打印机 * 调用打印机
*/ */
- (void)callAirprintWithdata:(NSData *)PDFdata; - (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed;
...@@ -63,7 +63,10 @@ ...@@ -63,7 +63,10 @@
*/ */
- (void)SHOWPrompttext:(NSString *)Text; - (void)SHOWPrompttext:(NSString *)Text;
/**
* 调用无线打印机......成功回调、失败回调
*/
- (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed;
......
...@@ -162,14 +162,13 @@ ...@@ -162,14 +162,13 @@
} }
#pragma mark 调用airPrint无线打印机 #pragma mark 调用airPrint无线打印机
- (void)callAirprintWithdata:(NSData *)PDFdata - (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed
{ {
NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]];
NSData *mypdfdata = [NSData dataWithContentsOfFile:PDFpath];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
if (pic && [UIPrintInteractionController canPrintData: mypdfdata] ) { if (pic && [UIPrintInteractionController canPrintData: mypdfdata] ) {
pic.delegate = self; pic.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo]; UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细"; printInfo.jobName = @"订单明细";
...@@ -178,16 +177,21 @@ ...@@ -178,16 +177,21 @@
pic.showsPageRange = YES; pic.showsPageRange = YES;
pic.printingItem = mypdfdata; pic.printingItem = mypdfdata;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { if (completed)
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %ld", // 执行成功后的处理
error.domain, error.code); success();
}
else if (!completed && error)
{
// 执行失败后的处理
failed();
}
}; };
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler]; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
} else {
[pic presentAnimated:YES completionHandler:completionHandler]; [pic presentAnimated:YES completionHandler:completionHandler];
} }
} }
...@@ -198,11 +202,10 @@ ...@@ -198,11 +202,10 @@
#pragma mark 调用airPrint无线打印机 #pragma mark 调用airPrint无线打印机
- (void)callAirprintWithURL:(NSURL *)datasurl - (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void (^)())success ErrorBlock:(void (^)())failed
{ {
// NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]]; // NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.delegate = self; pic.delegate = self;
...@@ -212,22 +215,25 @@ ...@@ -212,22 +215,25 @@
UIPrintInfo *printInfo = [UIPrintInfo printInfo]; UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细"; printInfo.jobName = @"订单明细";
printInfo.duplex = UIPrintInfoDuplexLongEdge; printInfo.duplex = UIPrintInfoDuplexShortEdge;
pic.printInfo = printInfo; pic.printInfo = printInfo;
pic.showsPageRange = YES; pic.showsPageRange = YES;
// pic.printingItem = mypdfdata;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { if (completed)
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %ld", // 执行成功后的处理
error.domain, error.code); success();
}
else if (!completed && error)
{
// 执行失败后的处理
failed();
}
}; };
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler]; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
} else {
[pic presentAnimated:YES completionHandler:completionHandler]; [pic presentAnimated:YES completionHandler:completionHandler];
} }
} }
......
...@@ -75,9 +75,18 @@ typedef enum { ...@@ -75,9 +75,18 @@ typedef enum {
/**
* 下载PDF
*
* @param requestURLString 网址
* @param successBlock 成功回调
* @param errorCodeBlock 错误编码回到
* @param failureBlock 失败回调
*/
- (void)DownloadPDFdatasWithURL:(NSString *) requestURLString
WithReturnValueBlock:(ReturnValueBlock) successBlock
WithErrorCodeBlock:(ErrorCodeBlock) errorCodeBlock
WithFailureBlock:(FailureBlock) failureBlock;
......
...@@ -159,12 +159,65 @@ static NetworkRequestClassManager *manager = nil; ...@@ -159,12 +159,65 @@ static NetworkRequestClassManager *manager = nil;
/**
* 下载PDF
*
* @param requestURLString 网址
* @param successBlock 成功回调
* @param errorCodeBlock 错误编码回到
* @param failureBlock 失败回调
*/
- (void)DownloadPDFdatasWithURL:(NSString *) requestURLString
WithReturnValueBlock:(ReturnValueBlock) successBlock
WithErrorCodeBlock:(ErrorCodeBlock) errorCodeBlock
WithFailureBlock:(FailureBlock) failureBlock
{
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.requestSerializer.timeoutInterval = 10.0f;
[manager.requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField: @"Content-Type"];
//网络检测
if (SHARED_APPDELEGATE.Networkstatus == false) {
errorCodeBlock(BROKEN);
return;
}
//构造URL对象
NSURL *url = [NSURL URLWithString:requestURLString];
//构造request对象
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
//使用系统类创建downLoad Task对象
NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
NSLog(@"%@", downloadProgress);//下载进度
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
//返回下载到哪里(返回值是一个路径)
//拼接存放路径
NSURL *pathURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
return [pathURL URLByAppendingPathComponent:[response suggestedFilename]];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
//下载完成走这个block
if (!error)
{
successBlock(filePath);
//如果请求没有错误(请求成功), 则打印地址
// NSLog(@"%@", filePath);
}else
{
failureBlock(error);
}
}];
//开始请求
[task resume];
}
......
...@@ -151,4 +151,33 @@ ...@@ -151,4 +151,33 @@
#define SEARCHHISTORY @"searchhistory" #define SEARCHHISTORY @"searchhistory"
/**
* PDF地址
*/
#define PDFSERADDRESS @"http://139.196.195.30:8090/opple-web/"
/**
* 默认图
*/
#define REPLACEIMAGE [UIImage imageNamed:@"bg-img 副本"]
#endif /* PrefixHeader_pch */ #endif /* PrefixHeader_pch */
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
/** /**
* 导购个人信息Jastor对象 * 导购个人信息Jastor对象
*/ */
...@@ -47,10 +44,7 @@ ...@@ -47,10 +44,7 @@
/**
* 导购ID
*/
@property (nonatomic,copy) NSString *guideid;
......
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