Commit 7ff09212 authored by 勾芒's avatar 勾芒

曹云霄

parent 45ca044b
......@@ -7,6 +7,8 @@
//
#import "BaseViewController.h"
#import "screeningButton.h"
@interface CustomerOrderViewController : BaseViewController
......@@ -23,9 +25,17 @@
*/
@property (weak, nonatomic) IBOutlet UITextField *searchCustomerOrder;
/**
* 订单状态排序背景
*/
@property (weak, nonatomic) IBOutlet UIView *orderStateBackView;
/**
* 订单状态排序
* 订单状态按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *orderStateButton;
@property (strong, nonatomic) screeningButton *StyleButton;
@end
......@@ -19,6 +19,7 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
[self uiConfigAction];
[self getGuideAllcustomerOrder];
}
......@@ -28,6 +29,61 @@
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);
[self.StyleButton setTitle:@"订单状态" forState:UIControlStateNormal];
[self.StyleButton addTarget:self action:@selector(screeningStyleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.StyleButton setImage:TCImage(@"down_arr") forState:UIControlStateNormal];
self.StyleButton.layer.masksToBounds = YES;
self.StyleButton.layer.cornerRadius = 10;
[self.orderStateBackView addSubview:self.StyleButton];
}
#pragma mark -获取导购下客户订单
- (void)getGuideAllcustomerOrder
{
OrderBill *allOrder = [[OrderBill alloc]init];
//分页
DataPage *page = [[DataPage alloc]init];
page = 0;
//订单
TOOrderEntity *order = [[TOOrderEntity alloc]init];
order.guideId = [Shoppersmanager manager].guideid;
allOrder.datapage = page;
allOrder.order = order;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/query"] WithRequestType:0 WithParameter:allOrder WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"%@",returnValue);
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
}];
}
#pragma mark -订单状态筛选
- (void)screeningStyleButtonClick:(UIButton *)button
{
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
......
......@@ -153,6 +153,7 @@
SettlementViewController *settlement = [[SettlementViewController alloc]init];
settlement.preferredContentSize = CGSizeMake(380, 500);
settlement.goodsArray = self.orderDetails.orderdetailList;
settlement.orderCode = _orderCode;
settlement.modalPresentationStyle = UIModalPresentationFormSheet;
UIPopoverPresentationController *pop = settlement.popoverPresentationController;
pop.sourceView = settlement.view;
......
......@@ -103,7 +103,10 @@
@property (weak, nonatomic) IBOutlet UIButton *sureButton;
/**
* 订单编号
*/
@property (nonatomic,copy) NSString *orderCode;
......
......@@ -83,7 +83,7 @@
- (IBAction)SureButtonClick:(UIButton *)sender {
[self SurePayRequest];
}
#pragma amrk -支付方式选择
......@@ -96,11 +96,17 @@
#pragma mark -是否开票
- (IBAction)isinvoiceButtonClick:(UIButton *)sender {
NSArray *arr = @[@"是",@"否"];
[self ShowPopoverViewController:CGSizeMake(50, 150) Withdatas:arr ShowButton:sender SelectedIndex:1 GetTitle:YES];
}
#pragma mark -发票类型
- (IBAction)invoiceTypeButtonClick:(UIButton *)sender {
NSArray *arr = @[@"个人发票",@"公司发票"];
[self ShowPopoverViewController:CGSizeMake(100, 150) Withdatas:arr ShowButton:sender SelectedIndex:2 GetTitle:YES];
}
......@@ -133,6 +139,7 @@
*/
- (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected
{
[self dismissViewControllerAnimated:YES completion:nil];
switch (Selected) {
case 0://支付方式
{
......@@ -155,6 +162,39 @@
}
}
#pragma mark -确认支付请求
- (void)SurePayRequest
{
NSString *string = [NSString stringWithFormat:@"%@%@%@/%@/%@/%@/%@",ServerAddress,@"/order/payOrder/",_orderCode,[self ReturnUrlString:self.payTypeButton.currentTitle],[self ReturnUrlString:self.ISinvoiceButton.currentTitle],[self ReturnUrlString:self.invoiceType.currentTitle],[self ReturnUrlString:self.invoiceHeader.text]];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:string WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",returnValue);
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
}];
}
#pragma mark -汉字转码
- (NSString *)ReturnUrlString:(NSString *)ChineseString
{
NSString* encodedString = [ChineseString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
return encodedString;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -54,8 +54,10 @@
Customermanager *customerModel = [Customermanager manager];
[[_datasArray firstObject] addObject:customerModel];
AddressModel *model = [[AddressModel alloc]init];
model.name = @"地址占位";
//地址占位
[[_datasArray objectAtIndex_opple:1] addObject:@"地址占位"];
[[_datasArray objectAtIndex_opple:1] addObject:model];
//加入商品信息
[_datasArray replaceObjectAtIndex:2 withObject:_settlementGoodsdatas];
......@@ -355,49 +357,69 @@
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:@"未选中地址"];
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;
orderGoods.goodsCover = model.goods.pictures;
orderGoods.goodsCode = model.goods.code;
orderGoods.goodsSpec = model.goods.spec;
orderGoods.goodsName = model.goods.name;
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;
[goodidArr addObject:orderGoods];
}
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) {
[self RemoveMBProgressHUDLoding];
}];
return;
}
else if (i == Adressarr.count -1)
{
[self ErrorMBProgressView:@"未选中地址"];
}
}
}
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;
[goodidArr addObject:orderGoods];
}
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) {
[self RemoveMBProgressHUDLoding];
}];
}
......
......@@ -77,8 +77,10 @@
#pragma mark - UI
- (void)uiConfigAction
{
self.view.backgroundColor = kTCColor(238, 238, 238);
self.shoppingTableview.dataSource = self;
self.shoppingTableview.delegate = self;
self.shoppingTableview.backgroundColor = [UIColor clearColor];
self.shoppingTableview.tableFooterView = [UIView new];
}
......@@ -166,11 +168,19 @@
}
#pragma mark -设置为当前客户回调
#pragma mark -选中商品回调
- (void)setSelectedButton:(NSInteger)index;
{
ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:index];
model.isSelected = !model.isSelected;
NSInteger goodsNumber = 0;
for (ShopcarModel *model in self.shopResponseArray) {
if (model.isSelected) {
goodsNumber ++;
}
}
[self.settlementButton setTitle:[NSString stringWithFormat:@"去结算(%ld)",goodsNumber] forState:UIControlStateNormal];
}
......@@ -230,18 +240,59 @@
#pragma mark -删除选中商品
- (IBAction)delecteSelectedGoods:(UIButton *)sender {
//需要删除的cell数组
[self CreateMBProgressHUDLoding];
DeleteCartRequest *delecteGoods = [[DeleteCartRequest alloc]init];
//code数组
NSMutableArray *codeArr = [NSMutableArray array];
//需要删除的cell数组indexpath
NSMutableArray *delecteArray = [NSMutableArray array];
//模型数组
NSMutableArray *delectemodel = [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];
[codeArr addObject:model.fid];
[delectemodel addObject:model];
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:i inSection:0];
[delecteArray addObject:indexpath];
}
}
[self.shoppingTableview deleteRowsAtIndexPaths:delecteArray withRowAnimation:UITableViewRowAnimationLeft];
//没有选中任何商品
if (codeArr.count == 0) {
[self RemoveMBProgressHUDLoding];
return;
}
delecteGoods.cartIds = codeArr;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/shopcart/delete"] WithRequestType:0 WithParameter:delecteGoods WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
//删除商品
for (ShopcarModel *model in delectemodel) {
[self.shopResponseArray removeObject:model];
}
[self.shoppingTableview deleteRowsAtIndexPaths:delecteArray withRowAnimation:UITableViewRowAnimationLeft];
[self SuccessMBProgressView:@"删除成功"];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
}
......
......@@ -29,6 +29,7 @@
self.popoverTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.contentSize.width, self.contentSize.height) style:UITableViewStylePlain];
self.popoverTableView.dataSource = self;
self.popoverTableView.delegate = self;
self.popoverTableView.showsVerticalScrollIndicator = NO;
self.popoverTableView.tableFooterView = [UIView new];
[self.view addSubview:self.popoverTableView];
self.popoverTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
......
......@@ -957,7 +957,7 @@ extern NSString * const SORTDIRECTION_DESC;
*/
@property (nonatomic, strong) TOGoodsEntity *goods;
/**
* ��法: 取得java.lang.String
* 法: 取得java.lang.String
*
*
*/
......@@ -1022,6 +1022,12 @@ extern NSString * const SORTDIRECTION_DESC;
*
*/
@property (nonatomic, copy) NSString *resellerId;
/**
* 方法: 取得java.lang.String
*
*
*/
@property (nonatomic, strong) NSNumber *costPrice;
@end /* interface TOShopcartEntity */
#endif
......
......@@ -340,6 +340,7 @@
@synthesize goodsNum;
@synthesize consumerId;
@synthesize resellerId;
@synthesize costPrice;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......
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