From dc33aeaf319b079c922370d68f2e3fd4f607ee2c Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 21 Aug 2026 17:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=92=E6=94=B6=E9=80=80=E6=AC=BE=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BuyerCtrls/PDDBuyerOrderReadCtrl.xaml.cs | 131 ++++++++++++++---- .../Ctrls/OrderCtrls/OrderListCtrl.xaml.cs | 10 +- .../OrderCtrls/OrderListRowItemCtrl.xaml | 16 ++- .../OrderCtrls/OrderListRowItemCtrl.xaml.cs | 94 ++++++++++++- 29WxOrderWpf/MainWindow.xaml.cs | 2 +- .../Model/DBModel/oms_wei_order_item_info.cs | 8 +- 6 files changed, 229 insertions(+), 32 deletions(-) diff --git a/29WxOrderWpf/Ctrls/BuyerCtrls/PDDBuyerOrderReadCtrl.xaml.cs b/29WxOrderWpf/Ctrls/BuyerCtrls/PDDBuyerOrderReadCtrl.xaml.cs index 8f42a98..6c0e288 100644 --- a/29WxOrderWpf/Ctrls/BuyerCtrls/PDDBuyerOrderReadCtrl.xaml.cs +++ b/29WxOrderWpf/Ctrls/BuyerCtrls/PDDBuyerOrderReadCtrl.xaml.cs @@ -947,12 +947,14 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls currentReadBuyer = ""; //return; } - //{\"error_code\":50000,\"error_msg\":\"http error:504\"} - if (data.Contains("\"error_code\":40001") || data.Contains("\"error_code\":50000")) + //{\"error_code\":50000,\"error_msg\":\"http error:504\"} + //{"errorCode":72004,"errorMsg":"","error_code":72004,"error_msg":"","result":null} + if (data.Contains("\"error_code\":40001") || data.Contains("\"error_code\":50000") || data.Contains("\"error_code\":72004")) { - currentReadBuyer = ""; PddMobileLoginForm.CheckBuyerLogin(new List { buyer }, false); - return; + if (buyer.status == "掉线") + currentReadBuyer = ""; + return; } Dispatcher.Invoke(new Action(() => @@ -1185,24 +1187,31 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls // 如果中转仓表买手售后状态不等于买手售后单售后,更新仓库买手售后状态 else if (afterSale.TransitBuyerOrderRefundStatus != "买手退款成功" && afterSale.TransitBuyerOrderRefundStatus != afterSale.AfterSaleStatusStr) { - if (afterSale.AfterSaleStatusStr == "退款失败" && lstPddBuyerAfterSaleInfoLite.Any(a => a.orderSn == afterSale.orderSn && a.AfterSaleStatusStr != afterSale.AfterSaleStatusStr)) + if (afterSale.ShopOrderIdStr == "3738552208766960384") + { + + } + var afterSaleExistList = lstPddBuyerAfterSaleInfoLite.Where(a => a.orderSn == afterSale.orderSn).ToList(); + + if ((afterSale.AfterSaleStatusStr == "退款失败" || afterSale.AfterSaleStatusStr == "申请已撤销") && + afterSaleExistList.Any(a => a.AfterSaleStatusStr != "退款失败" && a.AfterSaleStatusStr != "申请已撤销")) { } - else - { - //if (!afterSale.AfterSaleStatusStr.Contains("关闭") && !afterSale.AfterSaleStatusStr.Contains("撤销") && !afterSale.AfterSaleStatusStr.Contains("失败")) - var orderTmp = new PddBuyerOrderLiteInfo() { ShopOrderIdStr = afterSale.ShopOrderIdStr, order_sn = afterSale.orderSn }; - var refundRst = SendTransitAfterSaleE57(orderTmp, afterSale.AfterSaleStatusStr); - if (refundRst.Contains("0") || refundRst.Contains("200")) - { - afterSale.afterSaleSendStatus = "买手退款信息更新成功"; - } - else - { - var msg = BaseRegex.GetStringXml(ref refundRst, "msg"); - afterSale.afterSaleSendStatus = "买手退款信息更新失败,服务端返回 " + msg; - } - } + else + { + //if (!afterSale.AfterSaleStatusStr.Contains("关闭") && !afterSale.AfterSaleStatusStr.Contains("撤销") && !afterSale.AfterSaleStatusStr.Contains("失败")) + var orderTmp = new PddBuyerOrderLiteInfo() { ShopOrderIdStr = afterSale.ShopOrderIdStr, order_sn = afterSale.orderSn }; + var refundRst = SendTransitAfterSaleE57(orderTmp, afterSale.AfterSaleStatusStr); + if (refundRst.Contains("0") || refundRst.Contains("200")) + { + afterSale.afterSaleSendStatus = "买手退款信息更新成功"; + } + else + { + var msg = BaseRegex.GetStringXml(ref refundRst, "msg"); + afterSale.afterSaleSendStatus = "买手退款信息更新失败,服务端返回 " + msg; + } + } } } } @@ -2236,7 +2245,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls } } - + /// + /// 未发货直接退款 + /// + /// + /// + /// public static string SimPddAfterSale(BuyerLoginInfo buyer, PddBuyerOrderLiteInfo order) { var rst = YkdBuyerOrder.GetInitAfterSale(buyer, order.order_sn); @@ -2267,7 +2281,52 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls return afterSaleRst; } - public static string SimPddAfterSaleWithReturnGoods(BuyerLoginInfo buyer, PddBuyerOrderLiteInfo order, order_pdd_buyer_after_sale pddBuyerAfterSale = null) + /// + /// 拒收后申请退款 + /// + /// + /// + /// + /// + public static string SimPddAfterSaleWithRejected(BuyerLoginInfo buyer, PddBuyerOrderLiteInfo order, order_pdd_buyer_after_sale pddBuyerAfterSale = null) + { + var rst = YkdBuyerOrder.GetInitAfterSale(buyer, order.order_sn); + // + var mobile = BaseRegex.GetStringJson(ref rst, "userReceivePhone"); + var applyAmount = BaseRegex.GetIntJson(ref rst, "applyAmount"); + var refundAmount = BaseRegex.GetIntJson(ref rst, "refundAmount"); + var newMaxApplyAmount = BaseRegex.GetIntJson(ref rst, "newMaxApplyAmount"); + var shippingStatus = BaseRegex.GetIntJson(ref rst, "shippingStatus"); + var afterSalesId = BaseRegex.GetIntJson(ref rst, "afterSalesId"); + if (shippingStatus == -1) + return "{\"success\":false,\"msg\":\"订单未付款,无法拒收退款\"}"; + if (shippingStatus == 0) + return "{\"success\":false,\"msg\":\"订单未发货,无法拒收退款\"}"; + + if (applyAmount == 0) applyAmount = order.order_amount.ParseToInt(); + if (refundAmount == 0) refundAmount = order.order_amount.ParseToInt(); + if (newMaxApplyAmount == 0) newMaxApplyAmount = order.order_amount.ParseToInt(); + if (string.IsNullOrEmpty(mobile)) + { + return "{\"success\":false,\"msg\":\"退货信息获取失败,请检查买手是否掉线\"}"; + } + if (pddBuyerAfterSale != null) + { + pddBuyerAfterSale.refundAmount = refundAmount; + } + Thread.Sleep(Randomx.GetId(1000, 2000)); + var afterSaleRst = YkdBuyerOrder.SetOrderAfterSaleWithRejected(buyer, mobile, order.order_sn, applyAmount, refundAmount, newMaxApplyAmount); + return afterSaleRst; + } + + /// + /// 申请拼多多买手退货退款 + /// + /// + /// + /// + /// + public static string SimPddAfterSaleWithReturnGoods(BuyerLoginInfo buyer, PddBuyerOrderLiteInfo order, order_pdd_buyer_after_sale pddBuyerAfterSale = null) { var rst = YkdBuyerOrder.GetInitAfterSale(buyer, order.order_sn); // @@ -2460,7 +2519,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls } - // 仅退款 + /// + /// 仅退款 + /// public static string SetOrderAfterSale(BuyerLoginInfo buyer, string user_phone, string order_sn, int apply_amount, int refund_amount, int new_refund_amount) { string url = "https://mobile.yangkeduo.com/proxy/api/after_sales/create?pdduid=" + buyer.buyer_id; @@ -2476,7 +2537,29 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls return rst; } - // 退货退款 + /// + /// 已收货仅退款(拒收退款) + /// + public static string SetOrderAfterSaleWithRejected(BuyerLoginInfo buyer, string user_phone, string order_sn, int apply_amount, int refund_amount, int new_refund_amount) + { + string url = "https://mobile.yangkeduo.com/proxy/api/after_sales/create?pdduid=" + buyer.buyer_id; + string body = @"{""order_sn"":""260819-346491491930090"",""coupon_return_control_type"":0,""after_sales_type"":1,""user_ship_status"":1,""user_phone"":""17567817029"",""images"":[],""return_coupon_amount"":0,""question_type"":197,""question_desc"":""已拒收快递"",""apply_amount"":623,""refund_amount"":623,""new_refund_amount"":623,""is_lite"":true}"; + body = @"{""order_sn"":""" + order_sn + @""",""coupon_return_control_type"":0,""after_sales_type"":1,""user_ship_status"":1,""user_phone"":""" + user_phone + + @""",""images"":[],""return_coupon_amount"":0,""question_type"":197,""question_desc"":""已拒收快递"",""apply_amount"":" + apply_amount + + @",""refund_amount"":" + refund_amount + @",""new_refund_amount"":" + new_refund_amount + @",""is_lite"":true}"; + + + + string referer = "https://mobile.yangkeduo.com/complaint.html?mode=64&after_sales_id=22198198961472&order_sn=260819-346491491930090&refer_page_name=complaints_new_detail&refer_page_id=82697_1787286043220_qillb14kr1&refer_page_sn=82697&after_sales_reason=197&after_sales_type=1&after_sales_code=1001&user_ship_status=1"; + referer = "https://mobile.yangkeduo.com/complaint.html?order_sn=" + order_sn + "&refer_page_name=order_detail&after_sales_reason=197&after_sales_type=1&after_sales_code=1001&user_ship_status=1"; + + var rst = HttpResponseYkdBLL.YangkeduoPostResponse(buyer, url, body, referer); + return rst; + } + + /// + /// 退货退款 + /// public static string SetOrderAfterSaleWithReturnGoods(BuyerLoginInfo buyer, string user_phone, string order_sn, int apply_amount, int refund_amount, int new_refund_amount) { string url = "https://mobile.yangkeduo.com/proxy/api/after_sales/create?pdduid=" + buyer.buyer_id; diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs index 089e25e..fcf9053 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs @@ -962,6 +962,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls var buyer = GlobalConfig.PDDBuyerLoginList.ToList().FirstOrDefault(b => b.buyer_nick == buyerNickName); if (buyer == null) continue; + if (buyer.status == "掉线") + { + BaseMsgWindow.ShowAnimateMessage("买手号 " + buyer.buyer_nick + " 掉线,跳过自动退货", "Msg", 5); + continue; + } var afterSalesId = orderItem.PddBuyerAfterSale?.afterSalesId; if (string.IsNullOrEmpty(afterSalesId)) continue; @@ -1703,7 +1708,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls } /// - /// 中转仓拦截退货包裹 + /// 中转仓拦截退货包裹申请买手退货退款并获取总店地址,暂时不使用此功能防止需交涉或者可拦截的订单被自动申请退货退款 /// /// public async Task DoReturnPackageBuyerRefendSlient() @@ -1787,7 +1792,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls } /// - /// 退货仓买手申请退货 + /// 退货仓买手申请退货退款获取总店地址 /// /// public async Task DoReturnOrderBuyerRefendSlient() @@ -2022,6 +2027,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls } } } + // 更新Pdd总店退货地址 if (isSimPddAfterSaleSuccess) { var addressRst = YkdBuyerOrder.GetAfterSaleAddress(buyer, pddOrderSn, pddBuyerAfterSale.afterSalesId.ParseToString()); diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml index efff70b..1879cd3 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml @@ -1507,7 +1507,7 @@ IsReadOnly="True" Text="" TextWrapping="Wrap" - WaterMark="中转仓拒收占位" /> + WaterMark="中转仓拒收" />