本地直发逻辑
This commit is contained in:
1 parent
ac0430f3f7
commit
f00cdee502
19 files changed
+1590
-520
No files matched your search
@@ -28,6 +28,7 @@ using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using TemuKJD.ToolForms;
|
||||
using Work;
|
||||
using Work._29Tools.BLL;
|
||||
@@ -106,7 +107,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
order.AddressStr = GetDecryptOrder(deRst);
|
||||
GetDecryptOrder(deRst, order);
|
||||
GlobalConfig.DicDecryptOrderAddress[order.order_id] = order;
|
||||
if (ShowErrorDialog)
|
||||
BaseMsgWindow.ShowAnimateMessage("查看地址成功但保存到服务端失败:" + errMsg, "Error", 5);
|
||||
}));
|
||||
@@ -118,7 +120,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
order.AddressStr = GetDecryptOrder(deRst);
|
||||
GetDecryptOrder(deRst, order);
|
||||
GlobalConfig.DicDecryptOrderAddress[order.order_id] = order;
|
||||
BaseMsgWindow.ShowAnimateMessage("查看地址成功");
|
||||
}));
|
||||
}
|
||||
@@ -149,7 +152,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
}
|
||||
}
|
||||
public string GetDecryptOrder(string sourceOrderAddressStr)
|
||||
public string GetDecryptOrder(string sourceOrderAddressStr, oms_wei_order_info order)
|
||||
{
|
||||
//黄颖飞(4559),18466134204-4559,广西壮族自治区柳州市柳南区福柳宏都8-1-701 (拨打请输入分机号4559)
|
||||
var userName = BaseRegex.GetStringJson(ref sourceOrderAddressStr, "userName"); // 黄颖飞
|
||||
@@ -164,8 +167,18 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
return sourceOrderAddressStr;
|
||||
}
|
||||
|
||||
order.user_name = userName + "(" + extension + ")";
|
||||
order.tel_number = virtualNumber;
|
||||
order.tel_number_ext_info = extension;
|
||||
order.province_name = provinceName;
|
||||
order.city_name = cityName;
|
||||
order.county_name = countyName;
|
||||
order.detail_info = detailInfo;
|
||||
|
||||
//return userName + "(" + extension + ")," + virtualNumber + "-" + extension + "," + provinceName + cityName + countyName + detailInfo + "(拨打请输入分机号" + extension + ")";
|
||||
return userName + "" + extension + "," + virtualNumber + "-" + extension + "," + provinceName + cityName + countyName + detailInfo + "拨打请输入分机号" + extension + "";
|
||||
order.AddressStr = userName + "(" + extension + ")" + "," + virtualNumber + "," + provinceName + cityName + countyName + detailInfo;
|
||||
return order.AddressStr;
|
||||
}
|
||||
|
||||
public static string decryptOrder(ShopLoginInfo shop, string orderId)
|
||||
@@ -308,9 +321,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
BaseMsgWindow.ShowError("请选择买手号");
|
||||
return;
|
||||
}
|
||||
if (/*orderItem.sku_cnt > 1 ||*/ orderItem.ItemOrder.orderItems.Count > 1)
|
||||
if (orderItem.ItemOrder.orderItems.Count > 1)
|
||||
{
|
||||
//BaseMsgWindow.ShowError("多子单或多件商品订单中转仓暂不支持");
|
||||
BaseMsgWindow.ShowError("多子单订单中转仓暂不支持");
|
||||
return;
|
||||
}
|
||||
@@ -356,28 +368,10 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
BaseMsgWindow.ShowAnimateMessage("该异常单不符合重拍条件", "Error", 5);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 如果是退款单,弹出退款窗口
|
||||
if (/*orderItem?.ItemRefund?.count > 0 &&*/ orderItem.refund_status > 1)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == orderItem.shop_id.ParseToString());
|
||||
if (shop != null)
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
shopLoginForm.openType = Work._29Tools.Forms.ShopForms.EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/aftersale/detail?orderid=" + orderItem.ItemRefund.after_sale_order_id;
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseMsgWindow.ShowError("订单有售后,请去店铺后台退款");
|
||||
}
|
||||
}));
|
||||
if (CheckIsRefund(orderItem))
|
||||
return;
|
||||
}
|
||||
|
||||
// 拍单前检测买手号是否在线
|
||||
if (GlobalConfig.CurrentPddBuyer.status == "在线")
|
||||
@@ -513,7 +507,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
|
||||
// 检测是否加入代发
|
||||
if (orderItem.Shop?.LoginStatus == "登录成功" && !isAbnormalOrder)
|
||||
if (orderItem.Shop?.LoginStatus == "登录成功" && orderItem.BuyGoodsBtnTxt == "云仓拍单" && !isAbnormalOrder)
|
||||
{
|
||||
var is29SupplierRst = WxOrderSupplierBLL.GetWxSupplierOrderList(orderItem.Shop, orderItem.order_id);
|
||||
if (!is29SupplierRst.Contains("\"code\":0"))
|
||||
@@ -869,14 +863,34 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
if (!noBuyer)
|
||||
{
|
||||
var pddAfterRst = PDDBuyerOrderReadCtrl.SimPddAfterSale(buyer, new PddBuyerOrderLiteInfo()
|
||||
PddBuyerOrderLiteInfo order = null;
|
||||
MainWindow.Instance.Dispatcher.Invoke(new Action(() => { }));
|
||||
order = PDDBuyerOrderReadCtrl.lstPddBuyerOrderInfoLite.FirstOrDefault(o => o.order_sn == orderItem.ItemTransitOrder.out_order_no);
|
||||
if (order == null)
|
||||
order = new PddBuyerOrderLiteInfo()
|
||||
{
|
||||
order_status_prompt = "待发货",
|
||||
order_amount = orderItem.ItemTransitOrder.out_amount,
|
||||
order_sn = orderItem.ItemTransitOrder.out_order_no
|
||||
});
|
||||
};
|
||||
PDDBuyerOrderReadCtrl.lstPddBuyerOrderInfoLite.Add(order);
|
||||
var pddAfterRst = PDDBuyerOrderReadCtrl.SimPddAfterSale(buyer, order);
|
||||
if (pddAfterRst.Contains("\"after_sales_status\":1") || pddAfterRst.Contains("该订单已全额退款") || pddAfterRst.Contains("订单未付款"))
|
||||
{
|
||||
// 保存退款成功状态
|
||||
order.order_status_prompt = pddAfterRst.Contains("订单未付款") ? "订单未付款" : "退款成功";
|
||||
// 中转仓订单买手号售后信息 存到服务端
|
||||
var refundRst = PDDBuyerOrderReadCtrl.SendTransitAfterSaleE57(order);
|
||||
if (refundRst.Contains("<code>0</code>") || refundRst.Contains("<code>200</code>"))
|
||||
{
|
||||
order.sendStatus = "退款成功 买手退款信息更新成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = BaseRegex.GetStringXml(ref refundRst, "msg");
|
||||
order.sendStatus = "退款成功 买手退款信息更新失败,服务端返回 " + msg;
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_buyer_order_list", PDDBuyerOrderReadCtrl.lstPddBuyerOrderInfoLite);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -994,5 +1008,147 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDirectBuyOrder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
directBuyOrder();
|
||||
}
|
||||
|
||||
void directBuyOrder()
|
||||
{
|
||||
var orderItem = this.DataContext as oms_wei_order_item_info;
|
||||
if (orderItem == null)
|
||||
{
|
||||
BaseMsgWindow.ShowError("订单信息为空");
|
||||
return;
|
||||
}
|
||||
if (GlobalConfig.CurrentPddBuyer == null)
|
||||
{
|
||||
BaseMsgWindow.ShowError("请选择买手号");
|
||||
return;
|
||||
}
|
||||
if (/*orderItem.sku_cnt > 1 ||*/ orderItem.ItemOrder.orderItems.Count > 1)
|
||||
{
|
||||
//BaseMsgWindow.ShowError("多子单或多件商品订单中转仓暂不支持");
|
||||
BaseMsgWindow.ShowError("多子单订单中转仓暂不支持");
|
||||
return;
|
||||
}
|
||||
|
||||
//if (!GetIsAbnormalOrderRebuy(orderItem) && GlobalConfig.lstOrder.Any(o => o.orderItems
|
||||
// .Any(oi => oi.ItemTransitOrder?.order_no == orderItem.order_id && oi.ItemTransitOrder?.order_sku_id == orderItem.sku_id)))
|
||||
//{
|
||||
// MainWindow.Instance.orderListCtrl.FilterOneOrder(orderItem.ItemOrder);
|
||||
// BaseMsgWindow.ShowError("已存在中转拍单信息,请核对后再拍单");
|
||||
// return;
|
||||
//}
|
||||
|
||||
btnBuyOrder.Cursor = Cursors.Wait;
|
||||
btnBuyOrder.IsEnabled = false;
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
Dispatcher.Invoke(new Action(() => { btnBuyOrder.IsEnabled = true; }));
|
||||
});
|
||||
Task.Run(() =>
|
||||
{
|
||||
// 拍单前查询订单是否退款
|
||||
var orderId = orderItem.order_id;
|
||||
var skuId = orderItem.sku_id;
|
||||
MainWindow.Instance.orderListCtrl.GetOrder(orderId);
|
||||
var newOrder = GlobalConfig.lstOrder.FirstOrDefault(or => or.order_id == orderId);
|
||||
if (newOrder.orderItems.Count == 1)
|
||||
orderItem = newOrder?.orderItems?.FirstOrDefault();
|
||||
else
|
||||
orderItem = newOrder?.orderItems?.FirstOrDefault(oi => oi.sku_id == skuId);
|
||||
if (orderItem == null)
|
||||
return;
|
||||
|
||||
if (!orderItem.ItemOrder.out_order_no.IsNullOrEmpty() && orderItem.ItemOrder.out_after_sale_status != "out_after_sale_status")
|
||||
{
|
||||
// 外采单已存在的,不可再拍单
|
||||
BaseMsgWindow.ShowAnimateMessage("该订单已有直发采购记录", "Error", 5);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果是退款单,弹出退款窗口
|
||||
if (CheckIsRefund(orderItem))
|
||||
return;
|
||||
|
||||
|
||||
// 检测买手号是否掉线
|
||||
if (GlobalConfig.CurrentPddBuyer.status == "在线")
|
||||
{
|
||||
PddMobileLoginForm.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer);
|
||||
}
|
||||
if (GlobalConfig.CurrentPddBuyer.status != "在线")
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("买手号掉线");
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
// 打开拍单窗口
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
|
||||
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance,
|
||||
orderItem, GlobalConfig.CurrentPddBuyer, orderItem.BuyMap);
|
||||
|
||||
buyOrderForm.TitleText = "买手直发拍单 - 当前买手 " + GlobalConfig.CurrentPddBuyer.buyer_nick;
|
||||
buyOrderForm.BuyType = "direct";
|
||||
|
||||
// 未关联拍单的跳到所有订单页面
|
||||
buyOrderForm.InitUrl = "https://mobile.yangkeduo.com/orders.html";
|
||||
//https://mobile.yangkeduo.com/order.html?order_sn=260729-663591339661688
|
||||
if (orderItem.ItemTransitOrderWithVoid != null)
|
||||
buyOrderForm.InitUrl = "https://mobile.yangkeduo.com/order.html?order_sn=" + orderItem.ItemTransitOrderWithVoid.out_order_no;
|
||||
|
||||
buyOrderForm.pnlBuy.Visible = false;
|
||||
|
||||
|
||||
// 已有拍单关联的跳的到订单确认界面
|
||||
if (orderItem.BuyMap != null)
|
||||
{
|
||||
buyOrderForm.ShowBuyMask = true;
|
||||
buyOrderForm.InitUrl = "https://mobile.yangkeduo.com/order_checkout.html?sku_id=" + orderItem.BuyMap.map_sku_id +
|
||||
"&group_id=1" + Randomx.GetNumber(11) + "&goods_id=" + orderItem.BuyMap.map_goods_id + "&goods_number=" + orderItem.sku_cnt +
|
||||
"&page_from=101";
|
||||
|
||||
buyOrderForm.pnlBuy.Visible = true;
|
||||
buyOrderForm.pnlMap.Visible = false;
|
||||
}
|
||||
buyOrderForm.ShowDialog();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
bool CheckIsRefund(oms_wei_order_item_info orderItem)
|
||||
{
|
||||
if (/*orderItem?.ItemRefund?.count > 0 &&*/ orderItem.refund_status > 1)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == orderItem.shop_id.ParseToString());
|
||||
if (shop != null)
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
shopLoginForm.openType = Work._29Tools.Forms.ShopForms.EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/aftersale/detail?orderid=" + orderItem.ItemRefund.after_sale_order_id;
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseMsgWindow.ShowError("订单有售后,请去店铺后台退款");
|
||||
}
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user