Commit 853747a5 authored by 勾芒's avatar 勾芒

曹云霄

parent 62b1e46a
......@@ -265,17 +265,7 @@
#pragma mark -设置为当前客户、查询购物车数量
- (void)SetupUserShoppingCarNumberRequest
{
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/shopcart/get/",[Customermanager manager].customerID] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[[NSNotificationCenter defaultCenter]postNotificationName:REFRESHSHOPPINGCAR object:returnValue[@"data"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
}];
[self QueryShoppingCarNumber];
}
......
......@@ -55,6 +55,9 @@
self.orderDetailsTableview.dataSource = self;
self.orderDetailsTableview.delegate = self;
// [self CreateTableviewHeaderView];
//附加信息cell
[self.orderDetailsTableview registerNib:[UINib nibWithNibName:@"AdditionalTableViewCell" bundle:nil] forCellReuseIdentifier:@"fifthcell"];
[self CreateTableviewFooterView];
}
......@@ -123,11 +126,6 @@
lineView.backgroundColor = kTCColor(193, 193, 193);
[headerView addSubview:lineView];
//附加信息cell
[self.orderDetailsTableview registerNib:[UINib nibWithNibName:@"AdditionalTableViewCell" bundle:nil] forCellReuseIdentifier:@"fifthcell"];
self.orderDetailsTableview.tableHeaderView = headerView;
}
......@@ -273,6 +271,10 @@
return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.section) {
......
......@@ -41,6 +41,13 @@
@property (nonatomic,strong) NSArray *settlementGoodsdatas;
/**
* 清空已生成订单的商品 ,goodsCode表示选中商品购物车ID
*/
@property (nonatomic,copy) void(^DelecteSelectedGoods)(NSArray *goodsCode);
@end
......@@ -126,7 +126,7 @@
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:i inSection:1];
[addCellArray addObject:indexpath];
}
[self.generateOrderTableview insertRowsAtIndexPaths:addCellArray withRowAnimation:UITableViewRowAnimationLeft];
[self.generateOrderTableview insertRowsAtIndexPaths:addCellArray withRowAnimation:UITableViewRowAnimationBottom];
}
else
{
......@@ -329,15 +329,12 @@
- (IBAction)CreateOrderButtonClick:(UIButton *)sender {
OrderBill *order = [[OrderBill alloc]init];
//分页
DataPage *page = [[DataPage alloc]init];
page.page = 0;
order.datapage = page;
//收货地址
TOOrderEntity *orderReceiver = [[TOOrderEntity alloc]init];
NSArray *Adressarr = [self.datasArray objectAtIndex_opple:1];
......@@ -385,11 +382,21 @@
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/save"] WithRequestType:0 WithParameter:order WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
//商品购物车id
NSMutableArray *codeArrray = [NSMutableArray array];
for (ShopcarModel *model in _settlementGoodsdatas) {
[codeArrray addObject:model.fid?model.fid:@" "];
}
//调用删除购物车
if (self.DelecteSelectedGoods) {
self.DelecteSelectedGoods(codeArrray);
}
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"]];
......
......@@ -153,6 +153,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ShoppingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Shopping" forIndexPath:indexPath];
......@@ -228,6 +229,44 @@
[array addObject:ZhanweiModel];
GenerateOrdersViewController *generateOrder = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"generateorders"];
generateOrder.settlementGoodsdatas = array;
//清除已经生成订单的商品
[generateOrder setDelecteSelectedGoods:^(NSArray *goodsCode) {
DeleteCartRequest *delecteGoods = [[DeleteCartRequest alloc]init];
delecteGoods.cartIds = goodsCode;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/shopcart/delete"] WithRequestType:0 WithParameter:delecteGoods WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[self QueryShoppingCarNumber];
//商品cell
NSMutableArray *cellArray = [NSMutableArray array];
//删除商品
for (int i=0; i<self.shopResponseArray.count; i++) {
ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:i];
if ([goodsCode containsObject:model.fid]) {
[self.shopResponseArray removeObject:model];
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:i inSection:0];
[cellArray addObject:indexpath];
}
}
//删除cell
[self.shoppingTableview deleteRowsAtIndexPaths:cellArray withRowAnimation:UITableViewRowAnimationTop];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
}];
}];
[self.navigationController pushViewController:generateOrder animated:YES];
}
......@@ -311,6 +350,7 @@
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[self QueryShoppingCarNumber];
//删除商品
for (ShopcarModel *model in delectemodel) {
[self.shopResponseArray removeObject:model];
......@@ -335,6 +375,7 @@
}
#pragma mark -改变商品数量
- (void)ChangeGoodsNumber:(int)goodsNumber WithcostPrice:(NSInteger)costprice Withcellindex:(NSInteger)cellindex
{
......
......@@ -90,6 +90,9 @@
+ (id)ReturnOrderStateTitleWithStateCode:(NSInteger)ordercode withPoint:(CGPoint)point WithCode:(NSInteger)code;
/**
* 查询购物车数量
*/
- (void)QueryShoppingCarNumber;
@end
......@@ -286,17 +286,17 @@
{
const NSArray *imageArray = [NSArray arrayWithObjects:@"已撤销",@"已完成",@"已退货", nil];
switch (ordercode) {
case 004://退货
case 4://退货
{
return TCImage([imageArray objectAtIndex_opple:2]);
}
break;
case 005://作废
case 5://作废
{
return TCImage([imageArray objectAtIndex_opple:0]);
}
break;
case 006://完成
case 6://完成
{
return TCImage([imageArray objectAtIndex_opple:1]);
}
......@@ -374,6 +374,23 @@
return nil;
}
#pragma mark -查询购物车数量
- (void)QueryShoppingCarNumber
{
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/shopcart/get/",[Customermanager manager].customerID] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"更新购物车数量成功");
[[NSNotificationCenter defaultCenter]postNotificationName:REFRESHSHOPPINGCAR object:returnValue[@"data"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"更新购物车数量失败");
}];
}
......
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