1中转仓订单退货功能 2中转仓订单运费根据oem或管理员设定调整 3其他一些问题修复

This commit is contained in:
wule committed 2026-07-18 18:31:29 +08:00
1 parent d6f81f9ef4
commit 2e20cbdf68
24 files changed
+834 -292

No files matched your search

+117 -29
View File
@@ -23,6 +23,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -40,6 +41,7 @@ namespace TemuKJD.ToolForms
{
public bool IsAutoBuy { get; set; } = true;
public bool IsFormLoad { get; set; } = false;
public bool ShowBuyMask { get; set; } = false;
public int CloseAfterSecond { get; set; }
public string InitUrl = "";
@@ -98,6 +100,27 @@ namespace TemuKJD.ToolForms
});
}
if (this.ShowBuyMask == true)
{
Task.Run(() =>
{
for (int i = 3; i > 0; i--)
{
Invoke(new Action(() =>
{
this.pnlMask.Visible = true;
this.pnlMask.Text = "自动拍单倒计时\r\n" + i;
}));
Thread.Sleep(1000);
}
Invoke(new Action(() =>
{
this.pnlMask.Visible = false;
}));
});
}
if (buyMap != null)
{
@@ -173,6 +196,7 @@ namespace TemuKJD.ToolForms
cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
cefWebBrowser.LoadError += CefWebBrowser_LoadError;
cefWebBrowser.Dock = DockStyle.Fill;
cefWebBrowser.SendToBack();
//js绑定C#对象
//PDDShopBrowserObject shopObj = new PDDShopBrowserObject();
@@ -283,7 +307,11 @@ namespace TemuKJD.ToolForms
//static int GetAntiContentsTimes = 40;
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
Task.Run(() => { DoResourceLoadComplete(url, postData, responseData); });
}
public void DoResourceLoadComplete(string url, string postData, string responseData)
{
if (url.StartsWith("https://mobile.yangkeduo.com/order_checkout.html") && responseData.Contains("该商品已下架"))
{
IsSoldOut = true;
@@ -348,12 +376,12 @@ namespace TemuKJD.ToolForms
this.cmbTransitWarehouse.Text = "";
// 自动填写拍单信息界面
this.txtBuyGoodsId.Text = goodsId.ParseToString();
this.txtBuySkuId.Text = skuId.ParseToString();
this.txtBuyGoodsName.Text = goodsName;
this.txtBuySkuName.Text = spec;
this.txtBuyCnt.Text = buyCnt.ParseToString();
this.txtBuyPrice.Text = (buyPrice * 0.01m).ParseToString();
if (!goodsId.IsNullOrZero()) this.txtBuyGoodsId.Text = goodsId.ParseToString();
if (!skuId.IsNullOrZero()) this.txtBuySkuId.Text = skuId.ParseToString();
if (!goodsName.IsNullOrEmpty()) this.txtBuyGoodsName.Text = goodsName;
if (!spec.IsNullOrEmpty()) this.txtBuySkuName.Text = spec;
if (!buyCnt.IsNullOrZero()) this.txtBuyCnt.Text = buyCnt.ParseToString();
if (!buyPrice.IsNullOrZero()) this.txtBuyPrice.Text = (buyPrice * 0.01m).ParseToString();
}));
});
}
@@ -392,12 +420,12 @@ namespace TemuKJD.ToolForms
var buyPrice = BaseRegex.GetIntJson(ref data, "pay_price");
Invoke(new Action(() =>
{
this.txtBuyGoodsId.Text = goodsId.ParseToString();
this.txtBuySkuId.Text = skuId.ParseToString();
this.txtBuyGoodsName.Text = goodsName;
this.txtBuySkuName.Text = spec;
this.txtBuyCnt.Text = buyCnt.ParseToString();
this.txtBuyPrice.Text = (buyPrice * 0.01m).ParseToString();
if (!goodsId.IsNullOrZero()) this.txtBuyGoodsId.Text = goodsId.ParseToString();
if (!skuId.IsNullOrZero()) this.txtBuySkuId.Text = skuId.ParseToString();
if (!goodsName.IsNullOrEmpty()) this.txtBuyGoodsName.Text = goodsName;
if (!spec.IsNullOrEmpty()) this.txtBuySkuName.Text = spec;
if (!buyCnt.IsNullOrZero()) this.txtBuyCnt.Text = buyCnt.ParseToString();
if (!buyPrice.IsNullOrZero()) this.txtBuyPrice.Text = (buyPrice * 0.01m).ParseToString();
}));
Invoke(new Action(() =>
@@ -406,12 +434,12 @@ namespace TemuKJD.ToolForms
var transit = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransDetailAddress == txtBuyTransitWarehouse.Text.Trim());
if (transit != null && IsChangeAddress == false && HasChangeAddress == false)
{
if(!IsSoldOut)
if (!IsSoldOut)
{
Task.Run(() =>
{
IsChangeAddress = true;
Thread.Sleep(1000);
Thread.Sleep(100);
var sourceCodeRst = GetSourceCode(transit);
if (sourceCodeRst.Contains("失败"))
{
@@ -445,14 +473,16 @@ namespace TemuKJD.ToolForms
}
// 订单提交接口
//https://mobile.yangkeduo.com/proxy/api/order/prepay?pdduid=8161628055192
if (url.StartsWith("https://mobile.yangkeduo.com/proxy/api/order/prepay?pdduid="))
{
var data = postData;
Task.Run(() =>
{
var data = postData;
Invoke(new Action(() =>
Invoke(new Action(() =>
{
txtBuyOrderId.Text = BaseRegex.GetStringJson(ref data, "order_sn");
//txtBuyOrderId.Text = BaseRegex.GetStringJson(ref data, "order_sn");
txtBuyOrderId.Text = BaseRegex.GetStringJsonByRegs(ref data, "", "order_sn", "orderSn");
}));
});
}
@@ -508,9 +538,19 @@ namespace TemuKJD.ToolForms
/// <returns></returns>
public string ChangeAddress(TransitWarehouseParam transit)
{
Thread.Sleep(1000);
Thread.Sleep(200);
var host = cefWebBrowser.GetBrowser().GetHost();
var client = cefWebBrowser.GetDevToolsClient();
for (int i = 0; i < 20; i++)
{
Thread.Sleep(50);
if (host == null || client == null)
{
host = cefWebBrowser.GetBrowser().GetHost();
client = cefWebBrowser.GetDevToolsClient();
continue;
}
}
if (host == null || client == null)
{
return "页面未加载";
@@ -521,53 +561,99 @@ namespace TemuKJD.ToolForms
//for (i=0; i< elements.length;i++){
// var element = elements[i];
// if (element.outerHTML.indexOf('当前收货地址为') >= 0) {
element.click();
element.click();
return 'success';
// break;
// }
//}
})();";
var ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
Thread.Sleep(Randomx.GetId(1500, 2500));
for (int i = 0; i < 20; i++)
{
if (ts1.Result.Result.Value is string rstStr)
{
if (rstStr == "success")
break;
}
Thread.Sleep (100);
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
}
//Thread.Sleep(Randomx.GetId(1500, 2500));
Thread.Sleep(Randomx.GetId(300, 500));
jsStr1 = @"(function() { var elements = document.getElementsByTagName('span');
for (i=0; i< elements.length;i++){
var element = elements[i];
if (element.innerHTML.indexOf('修改') == 0) {
element.click();
break;
return 'success';
}
}
})();";
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
Thread.Sleep(Randomx.GetId(1500, 2500));
for (int i = 0; i < 20; i++)
{
if (ts1.Result.Result.Value is string rstStr)
{
if (rstStr == "success")
break;
}
Thread.Sleep(100);
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
}
//Thread.Sleep(Randomx.GetId(1500, 2500));
Thread.Sleep(Randomx.GetId(300, 500));
jsStr1 = @"(function() { var elements = document.getElementsByTagName('span');
for (i=0; i< elements.length;i++){
var element = elements[i];
if (element.innerHTML.indexOf('保存') == 0) {
element.click();
break;
return 'success';
}
}
})();";
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
Thread.Sleep(Randomx.GetId(1500, 2500));
for (int i = 0; i < 20; i++)
{
if (ts1.Result.Result.Value is string rstStr)
{
if (rstStr == "success")
break;
}
Thread.Sleep(100);
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
}
//Thread.Sleep(Randomx.GetId(1500, 2500));
Thread.Sleep(Randomx.GetId(300, 500));
jsStr1 = @"(function() { var elements = document.getElementsByTagName('div');
for (i = elements.length - 1; i >= 0; i--){
var element = elements[i];
if (element.innerHTML.indexOf('" + txtBuyTransitWarehouse.Text.Trim() + @"') >= 0) {
element.click();
break;
return 'success';
}
}
})();";
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
Thread.Sleep(Randomx.GetId(1500, 2500));
for (int i = 0; i < 20; i++)
{
if (ts1.Result.Result.Value is string rstStr)
{
if (rstStr == "success")
break;
}
Thread.Sleep(100);
ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
ts1.Wait(5000);
}
//Thread.Sleep(Randomx.GetId(1500, 2500));
Thread.Sleep(Randomx.GetId(300, 500));
return "";
}
@@ -808,6 +894,7 @@ namespace TemuKJD.ToolForms
{
body["userName"] = BaseClass.UserName; // 软件端用户名
body["purchaserNote"] = BaseClass.UserName + "-" + BaseClass.NickName; // 购买软件账户备注
body["postage"] = (BaseClass.PostagePerOrder * 100).ParseToInt() + "";
}
var url = "https://po.e57.cn/prod-api/api/oms-api/externalProcurement/saveOrUpdate";
var dataStr = JsonHelper.SerializeObject(body);
@@ -855,6 +942,7 @@ namespace TemuKJD.ToolForms
out_order_no = txtBuyOrderId.Text.Trim(),
purchaser_note = body["purchaserNote"].ParseToString(),
});
orderItem.SetTransitOrder();
// 利润计算重置为最小值,控件Resource更新时将计算利润
orderItem.ProfitCount = decimal.MinValue;
var order = orderItem.ItemOrder;
+54 -8
View File
@@ -31,6 +31,7 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PddMobileBuyOrderForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.pnlMask = new DevComponents.DotNetBar.PanelEx();
this.btnJumpOrderList = new DevComponents.DotNetBar.PanelEx();
this.txtBuySkuName = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label();
@@ -94,11 +95,13 @@
this.btnReMap = new DevComponents.DotNetBar.PanelEx();
this.label25 = new System.Windows.Forms.Label();
this.txtBuyTransitWarehouse = new System.Windows.Forms.TextBox();
this.label29 = new System.Windows.Forms.Label();
this.pnlMap = new System.Windows.Forms.Panel();
this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
@@ -127,6 +130,10 @@
this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.pnlMask);
this.splitContainer1.Panel1MinSize = 0;
//
// splitContainer1.Panel2
@@ -139,6 +146,31 @@
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
// pnlMask
//
this.pnlMask.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlMask.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlMask.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlMask.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlMask.Font = new System.Drawing.Font("微软雅黑", 50F);
this.pnlMask.Location = new System.Drawing.Point(0, 0);
this.pnlMask.Name = "pnlMask";
this.pnlMask.Size = new System.Drawing.Size(864, 700);
this.pnlMask.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlMask.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(235)))), ((int)(((byte)(255)))));
this.pnlMask.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(235)))), ((int)(((byte)(255)))));
this.pnlMask.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.pnlMask.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pnlMask.Style.ForeColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pnlMask.Style.GradientAngle = 90;
this.pnlMask.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.pnlMask.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(83)))), ((int)(((byte)(147)))));
this.pnlMask.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(83)))), ((int)(((byte)(147)))));
this.pnlMask.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.pnlMask.TabIndex = 881;
this.pnlMask.Text = "自动拍单倒计时\r\n8";
this.pnlMask.Visible = false;
//
// btnJumpOrderList
//
this.btnJumpOrderList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -367,9 +399,9 @@
this.btnManualUpdateTransitWarehouse.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnManualUpdateTransitWarehouse.DisabledBackColor = System.Drawing.Color.Empty;
this.btnManualUpdateTransitWarehouse.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnManualUpdateTransitWarehouse.Location = new System.Drawing.Point(348, 175);
this.btnManualUpdateTransitWarehouse.Location = new System.Drawing.Point(368, 175);
this.btnManualUpdateTransitWarehouse.Name = "btnManualUpdateTransitWarehouse";
this.btnManualUpdateTransitWarehouse.Size = new System.Drawing.Size(114, 23);
this.btnManualUpdateTransitWarehouse.Size = new System.Drawing.Size(94, 23);
this.btnManualUpdateTransitWarehouse.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnManualUpdateTransitWarehouse.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.btnManualUpdateTransitWarehouse.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
@@ -523,9 +555,9 @@
this.btnManualUpdateBuyOrder.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnManualUpdateBuyOrder.DisabledBackColor = System.Drawing.Color.Empty;
this.btnManualUpdateBuyOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnManualUpdateBuyOrder.Location = new System.Drawing.Point(348, 198);
this.btnManualUpdateBuyOrder.Location = new System.Drawing.Point(368, 198);
this.btnManualUpdateBuyOrder.Name = "btnManualUpdateBuyOrder";
this.btnManualUpdateBuyOrder.Size = new System.Drawing.Size(114, 23);
this.btnManualUpdateBuyOrder.Size = new System.Drawing.Size(94, 23);
this.btnManualUpdateBuyOrder.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnManualUpdateBuyOrder.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.btnManualUpdateBuyOrder.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
@@ -568,9 +600,9 @@
this.btnManualUpdateSendProvince.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnManualUpdateSendProvince.DisabledBackColor = System.Drawing.Color.Empty;
this.btnManualUpdateSendProvince.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnManualUpdateSendProvince.Location = new System.Drawing.Point(348, 115);
this.btnManualUpdateSendProvince.Location = new System.Drawing.Point(368, 115);
this.btnManualUpdateSendProvince.Name = "btnManualUpdateSendProvince";
this.btnManualUpdateSendProvince.Size = new System.Drawing.Size(114, 23);
this.btnManualUpdateSendProvince.Size = new System.Drawing.Size(94, 23);
this.btnManualUpdateSendProvince.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnManualUpdateSendProvince.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.btnManualUpdateSendProvince.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
@@ -662,7 +694,7 @@
this.txtSendProvince.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSendProvince.Location = new System.Drawing.Point(74, 115);
this.txtSendProvince.Name = "txtSendProvince";
this.txtSendProvince.Size = new System.Drawing.Size(268, 23);
this.txtSendProvince.Size = new System.Drawing.Size(288, 23);
this.txtSendProvince.TabIndex = 467;
//
// splitContainer2
@@ -811,6 +843,7 @@
this.pnlBuy.Controls.Add(this.txtBuyGoodsName);
this.pnlBuy.Controls.Add(this.txtBuyPrice);
this.pnlBuy.Controls.Add(this.label24);
this.pnlBuy.Controls.Add(this.label29);
this.pnlBuy.Location = new System.Drawing.Point(12, 291);
this.pnlBuy.Name = "pnlBuy";
this.pnlBuy.Size = new System.Drawing.Size(468, 226);
@@ -844,7 +877,7 @@
this.btnReMap.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReMap.Location = new System.Drawing.Point(9, 198);
this.btnReMap.Name = "btnReMap";
this.btnReMap.Size = new System.Drawing.Size(114, 23);
this.btnReMap.Size = new System.Drawing.Size(94, 23);
this.btnReMap.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnReMap.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(235)))), ((int)(((byte)(255)))));
this.btnReMap.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(235)))), ((int)(((byte)(255)))));
@@ -879,6 +912,16 @@
this.txtBuyTransitWarehouse.Size = new System.Drawing.Size(388, 23);
this.txtBuyTransitWarehouse.TabIndex = 870;
//
// label29
//
this.label29.AutoSize = true;
this.label29.ForeColor = System.Drawing.Color.SandyBrown;
this.label29.Location = new System.Drawing.Point(121, 201);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(248, 17);
this.label29.TabIndex = 892;
this.label29.Text = "如自动识别失败,请填写后点击手动确认拍单";
//
// pnlMap
//
this.pnlMap.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
@@ -943,6 +986,7 @@
this.Load += new System.EventHandler(this.PddBuyOrderForm_Load);
this.Controls.SetChildIndex(this.splitContainer2, 0);
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
@@ -1031,5 +1075,7 @@
private Work.UserComponents.UcCheckBox chkUseAppBalance;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.TextBox txtSourceCode;
private System.Windows.Forms.Label label29;
public DevComponents.DotNetBar.PanelEx pnlMask;
}
}