private async void SetCustomerReturnGoodsSeftReject() { List <OrderItemDto> selectOrder = OrderItemList.Where(e => e.IsSelected).ToList(); if (SaleRma == null) { await MvvmUtility.ShowMessageAsync("请选择订单", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (selectOrder.Count == 0) { await MvvmUtility.ShowMessageAsync("请选择销售单明细", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } List <KeyValuePair <int, int> > list = selectOrder.Select( e => new KeyValuePair <int, int>(e.Id, e.NeedReturnCount)).ToList <KeyValuePair <int, int> >(); RmaPost.OrderNo = SaleRma.OrderNo; RmaPost.ReturnProducts = list; bool bFlag = AppEx.Container.GetInstance <ICustomerGoodsReturnService>().CustomerReturnGoodsSelfReject(RmaPost); await MvvmUtility.ShowMessageAsync(bFlag? "拒绝退货申请成功" : "拒绝退货申请失败", "提示", MessageBoxButton.OK, bFlag?MessageBoxImage.Information : MessageBoxImage.Error); if (bFlag) { ClearOrInitData(); RmaPost = new RMAPost(); ReturnGoodsSearch(); } }
//自助退货 拒绝退货申请 public bool CustomerReturnGoodsSelfReject(RMAPost rmaPost) { try {//接口不对 return(RestClient.Post("rma/CreateSaleRMA", rmaPost)); } catch (Exception ex) { return(false); } }
//自助退货 退货审核通过 public bool CustomerReturnGoodsSelfPass(RMAPost rmaPost) { try { return(RestClient.Post("rma/CreateSaleRmaAuto", rmaPost)); } catch (Exception ex) { return(false); } }
public CustomerReturnGoodsViewModel() { CommandCustomerReturnGoodsSave = new DelegateCommand(CustomerReturnGoodsSave); CommandReturnGoodsSearch = new AsyncQueryCommand(ReturnGoodsSearch, () => SaleRmaList, "订单"); CommandGetDown = new AsyncDelegateCommand(GetOrderDetailByOrderNo); CommandSetOrderRemark = new DelegateCommand(SetOrderRemark); ReturnGoodsGet = new ReturnGoodsGet(); ClearOrInitData(); InitCombo(); RmaPost = new RMAPost(); }
/*客服退货*/ private async void CustomerReturnGoodsSave() { List <OrderItemDto> selectOrder = OrderItemList.Where(e => e.IsSelected).ToList(); if (SaleRma == null) { await MvvmUtility.ShowMessageAsync("请选择订单", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (selectOrder.Count == 0) { await MvvmUtility.ShowMessageAsync("请选择销售单明细", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } //原因必填 if (string.Empty == RmaPost.Remark || RmaPost.Remark == null || RmaPost.Remark == "") { await MvvmUtility.ShowMessageAsync("退货备注不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } List <KeyValuePair <int, int> > list = selectOrder.Select( e => new KeyValuePair <int, int>(e.Id, e.NeedReturnCount)).ToList <KeyValuePair <int, int> >(); //退货数量大于0,且已退数量+退货数量<=销售数量 List <OrderItemDto> q = selectOrder.Where(t => (t.ReturnCount + t.NeedReturnCount > t.Quantity) || t.NeedReturnCount < 1).ToList(); if (q.Count > 0) { await MvvmUtility.ShowMessageAsync("选择的订单明细的退货数量必须大于零,且已退货数量加上退货数量要小于等于销售数量", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } RmaPost.OrderNo = SaleRma.OrderNo; RmaPost.ReturnProducts = list; bool bFlag = AppEx.Container.GetInstance <ICustomerGoodsReturnService>().CustomerReturnGoodsSave(RmaPost); await MvvmUtility.ShowMessageAsync(bFlag? "客服退货成功" : "客服退货失败", "提示", MessageBoxButton.OK, bFlag?MessageBoxImage.Information : MessageBoxImage.Error); if (bFlag) { ClearOrInitData(); RmaPost = new RMAPost(); ReturnGoodsSearch(); } }