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

caoyunxiao

parent 490bc4e3
......@@ -11,10 +11,28 @@
@interface CustomerOrderViewController ()<UITableViewDataSource,UITableViewDelegate>
/**
* 数据源数组
*/
@property (nonatomic,strong) NSMutableArray *datasArray;
@end
@implementation CustomerOrderViewController
/**
* 初始化数据源数组
*/
- (NSMutableArray *)datasArray
{
if (_datasArray == nil) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
......@@ -28,7 +46,6 @@
{
self.customerOrderTableView.dataSource = self;
self.customerOrderTableView.delegate = self;
self.StyleButton = [screeningButton buttonWithType:UIButtonTypeCustom];
self.StyleButton.frame = CGRectMake(ScreenWidth-250, 20, 150, 30);
self.StyleButton.backgroundColor = kTCColor(131, 131, 131);
......@@ -47,18 +64,21 @@
OrderBill *allOrder = [[OrderBill alloc]init];
//分页
DataPage *page = [[DataPage alloc]init];
page = 0;
page.page = 0;
page.rows = 10;
//订单
TOOrderEntity *order = [[TOOrderEntity alloc]init];
order.guideId = [Shoppersmanager manager].guideid;
TOOrderEntity *Neworder = [[TOOrderEntity alloc]init];
Neworder.guideId = [Shoppersmanager manager].Shoppers.employee.fid;
allOrder.datapage = page;
allOrder.order = order;
allOrder.order = Neworder;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/query"] WithRequestType:0 WithParameter:allOrder WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"%@",returnValue);
OrderResponse *Allorder = [[OrderResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
}else
{
......@@ -86,6 +106,9 @@
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomerOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"customerordercell" forIndexPath:indexPath];
......
......@@ -14,8 +14,10 @@
#import "AllpriceTableViewCell.h"
#import "SettlementViewController.h"
#import "AdditionalTableViewCell.h"
#import <QuickLook/QuickLook.h>
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource>
/**
......@@ -341,32 +343,63 @@
#pragma mark -打印订单
- (void)AirprintButtonClick:(UIButton *)button
{
// [self callAirprintWithdata:nil];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/UrlOfprintPDF/",_orderCode] WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",returnValue);
[self DownloadPDF:^(id returnValue) {
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
[self callAirprintWithdata:returnValue SuccessBlock:^{
[self SuccessMBProgressView:@"打印成功"];
} ErrorBlock:^{
[self ErrorMBProgressView:@"打印失败"];
}];
}];
}
#pragma mark -预览订单
- (void)PreviewButtonClick:(UIButton *)button
#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) {
[[NetworkRequestClassManager Manager] DownloadPDFdatasWithURL:[NSString stringWithFormat:@"%@%@",PDFSERADDRESS,returnValue[@"data"]] WithReturnValueBlock:^(id returnValue) {
[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 @@
<rect key="frame" x="20" y="20" width="350" height="350"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<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"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
</imageView>
......@@ -25,7 +25,7 @@
<state key="normal" title="放大"/>
</button>
</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>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="tsa-PY-0mz">
<rect key="frame" x="383" y="59" width="80" height="269"/>
......@@ -187,6 +187,6 @@
</view>
</objects>
<resources>
<image name="05产品库-详情_03" width="500" height="375"/>
<image name="140046029-MX260-D112-03-星冠-5700K(4)" width="600" height="450"/>
</resources>
</document>
......@@ -96,11 +96,12 @@
self.headerView.nameLabe.text = self.entity.name;
self.headerView.brandName.text = self.entity.brandId;
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
{
......
......@@ -282,7 +282,7 @@
{
ProductCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"productcell" forIndexPath:indexPath];
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;
......
......@@ -379,17 +379,10 @@
orderGoods.goodsBrand = model.goods.brandId;
orderGoods.goodsNum = model.goods.number;
orderGoods.goodsPrice = model.goods.costPrice;
// orderGoods.goodsUnit = model.goods.unit;
// @synthesize goodsId;
// @synthesize goodsCode;
// @synthesize goodsName;
// @synthesize goodsCover;
// @synthesize goodsSpec;
// @synthesize goodsBrand;
// @synthesize goodsNum;
// @synthesize goodsPrice;
// @synthesize goodsTotalPrice;
orderGoods.remark = @" ";
//总价
NSInteger allprice = [model.goods.number integerValue]*[model.goods.costPrice integerValue];
orderGoods.goodsTotalPrice = [NSNumber numberWithInteger:allprice];
[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 @@
/**
* 调用打印机
*/
- (void)callAirprintWithdata:(NSData *)PDFdata;
- (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed;
......@@ -63,7 +63,10 @@
*/
- (void)SHOWPrompttext:(NSString *)Text;
/**
* 调用无线打印机......成功回调、失败回调
*/
- (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed;
......
......@@ -162,14 +162,13 @@
}
#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];
if (pic && [UIPrintInteractionController canPrintData: mypdfdata] ) {
pic.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细";
......@@ -178,16 +177,21 @@
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);
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (completed)
{
// 执行成功后的处理
success();
}
else if (!completed && error)
{
// 执行失败后的处理
failed();
}
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler];
} else {
[pic presentAnimated:YES completionHandler:completionHandler];
}
}
......@@ -198,11 +202,10 @@
#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"]];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.delegate = self;
......@@ -212,24 +215,27 @@
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细";
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printInfo.duplex = UIPrintInfoDuplexShortEdge;
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];
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (completed)
{
// 执行成功后的处理
success();
}
else if (!completed && error)
{
// 执行失败后的处理
failed();
}
};
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler];
}
}
......
......@@ -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;
/**
* 下载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 @@
#define SEARCHHISTORY @"searchhistory"
/**
* PDF地址
*/
#define PDFSERADDRESS @"http://139.196.195.30:8090/opple-web/"
/**
* 默认图
*/
#define REPLACEIMAGE [UIImage imageNamed:@"bg-img 副本"]
#endif /* PrefixHeader_pch */
......@@ -12,9 +12,6 @@
/**
* 导购个人信息Jastor对象
*/
......@@ -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