1优化拍单逻辑 2优化部分文件位置命名等
This commit is contained in:
1 parent
34c51c6fcd
commit
1e27c0b1e1
65 files changed
+2594
-268
No files matched your search
@@ -40,7 +40,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\KJD Cef138\Bin\</OutputPath>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -49,7 +49,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\KJD Cef138\Bin\</OutputPath>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -99,14 +99,15 @@
|
||||
<DependentUpon>BaseMsgWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseWindows\BaseWindow.cs" />
|
||||
<Compile Include="CefHelper\WPFCEFBrowser.cs" />
|
||||
<Compile Include="Converters\ImageUrlToBitmapImageConverter.cs" />
|
||||
<Compile Include="Converters\HasValueToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\StatusToColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\TextToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\VisibleToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\ValueMinus24Converter.cs" />
|
||||
<Compile Include="Ctrls\BuyerCtrls\PDDBuyerOrderListCtrl.xaml.cs">
|
||||
<DependentUpon>PDDBuyerOrderListCtrl.xaml</DependentUpon>
|
||||
<Compile Include="Ctrls\BuyerCtrls\PDDBuyerOrderReadCtrl.xaml.cs">
|
||||
<DependentUpon>PDDBuyerOrderReadCtrl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Ctrls\BuyerCtrls\PDDBuyerSelectCtrl.xaml.cs">
|
||||
<DependentUpon>PDDBuyerSelectCtrl.xaml</DependentUpon>
|
||||
@@ -145,7 +146,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Ctrls\BuyerCtrls\PDDBuyerOrderListCtrl.xaml">
|
||||
<Page Include="Ctrls\BuyerCtrls\PDDBuyerOrderReadCtrl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -325,10 +326,13 @@
|
||||
<Resource Include="Resources\err_pic.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\loading_blue.gif" />
|
||||
<Resource Include="Resources\loading.gif" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="CefHelper\" />
|
||||
<Resource Include="Resources\buyer_order.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\loading.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
@@ -0,0 +1,573 @@
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using CefSharp.Wpf;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using NaiBa.Util.Helper;
|
||||
using NaiBa.Util.Model;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Work._29Tools.CefTools;
|
||||
|
||||
namespace _29WxOrderWpf.CefHelper
|
||||
{
|
||||
public class WPFCEFBrowser
|
||||
{
|
||||
public static bool IsKeepGlobalCookie = true; // true 的时候,cookie 会保存在硬盘上,cookie 是持久化的
|
||||
public static string CefGlobalCachePath = Path.Combine(FileHelper.GetApplicationDir(), "cef_temp");
|
||||
public static string CefMemoryCachePath = Path.Combine(CefGlobalCachePath, "memory");
|
||||
|
||||
public static void Init(string userAgent = "")
|
||||
{
|
||||
// 必须在主线程进行初始化
|
||||
|
||||
if (NaiBaGlobalConfig.IsDevelopment)
|
||||
{
|
||||
FileHelper.DeleteFolder(CefGlobalCachePath);
|
||||
}
|
||||
FileHelper.CreateDirectory(CefGlobalCachePath);
|
||||
|
||||
CefSharpSettings.WcfEnabled = false;
|
||||
CefSettings settings = new CefSettings
|
||||
{
|
||||
IgnoreCertificateErrors = false,
|
||||
Locale = "zh-CN",
|
||||
PersistSessionCookies = true,
|
||||
//PersistUserPreferences = true, //cef138
|
||||
LogFile = Path.Combine(CefGlobalCachePath, "debug.log"),
|
||||
LogSeverity = NaiBaGlobalConfig.IsDevelopment ? LogSeverity.Verbose : LogSeverity.Error,
|
||||
CachePath = IsKeepGlobalCookie ? CefGlobalCachePath : string.Empty,
|
||||
RootCachePath = IsKeepGlobalCookie ? CefGlobalCachePath : string.Empty
|
||||
};
|
||||
|
||||
settings.UserAgent = string.IsNullOrEmpty(userAgent) ? NaiBaGlobalConfig.UserAgent : userAgent;
|
||||
|
||||
settings.CefCommandLineArgs.Add("disable-gpu", "1");
|
||||
settings.CefCommandLineArgs.Add("--ignore-ssl-errors");
|
||||
settings.CefCommandLineArgs.Add("--disable-web-security");
|
||||
settings.CefCommandLineArgs.Add("--allow-file-access-from-files"); // 允许通过 file:/// 协议访问 Worker
|
||||
System.Net.IWebProxy webProxy = NaiBaGlobalConfig.GetDevelopProxy();
|
||||
if (webProxy != null)
|
||||
{
|
||||
if (NaiBaGlobalConfig.IsDevelopment)
|
||||
{
|
||||
bool isSetFiddlerProxy = false; // 由于店铺可能绑定了代理,浏览器不设置 Fiddler 代理
|
||||
if (isSetFiddlerProxy)
|
||||
{
|
||||
string address = ReflectionHelper.GetObjectPropertyValue(webProxy, "Address").ParseToString();
|
||||
if (!address.IsNullOrEmpty())
|
||||
{
|
||||
address = address.Trim('/');
|
||||
// Don't set any proxy during initialize,becuase once setting,it couldn't be changed at runtime
|
||||
settings.CefCommandLineArgs.Add("--proxy-server", address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var rst = Cef.Initialize(settings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭所有Cef进程
|
||||
/// </summary>
|
||||
public static void ShutDown()
|
||||
{
|
||||
Cef.Shutdown();
|
||||
}
|
||||
|
||||
public static ChromiumWebBrowser CreateChromiumWebBrowser(string url, bool isGlobal = true, bool isPopupNewWindow = true)
|
||||
{
|
||||
ChromiumWebBrowser cefBrowser = new ChromiumWebBrowser(url);
|
||||
if (!isGlobal)
|
||||
{
|
||||
cefBrowser.RequestContext = new RequestContext(GetRequestContextIsolateSettings());
|
||||
}
|
||||
cefBrowser.BrowserSettings = new BrowserSettings
|
||||
{
|
||||
Javascript = CefState.Enabled,
|
||||
JavascriptAccessClipboard = CefState.Enabled,
|
||||
JavascriptCloseWindows = CefState.Enabled,
|
||||
JavascriptDomPaste = CefState.Enabled,
|
||||
LocalStorage = CefState.Enabled,
|
||||
|
||||
|
||||
//Plugins = CefState.Disabled, //cef138
|
||||
//FileAccessFromFileUrls = CefState.Enabled, //cef138
|
||||
//UniversalAccessFromFileUrls = CefState.Enabled //cef138
|
||||
};
|
||||
cefBrowser.KeyboardHandler = new KeyboardHandler();
|
||||
cefBrowser.MenuHandler = new LocalMenuHandler();
|
||||
cefBrowser.LifeSpanHandler = new LocalLifeSpanHandler(isPopupNewWindow ? PopWindowType.NewWindow : PopWindowType.SelfWindow);
|
||||
return cefBrowser;
|
||||
}
|
||||
|
||||
public static RequestContextSettings GetRequestContextIsolateSettings()
|
||||
{
|
||||
RequestContextSettings requestContextSettings = new RequestContextSettings()
|
||||
{
|
||||
PersistSessionCookies = true,
|
||||
CookieableSchemesExcludeDefaults = false,
|
||||
};
|
||||
//requestContextSettings.PersistSessionCookies = false;
|
||||
//requestContextSettings.PersistUserPreferences = false; // cef138
|
||||
return requestContextSettings;
|
||||
}
|
||||
|
||||
public static void CheckCefPlatform()
|
||||
{
|
||||
string executingFolder = FileHelper.GetApplicationDir();
|
||||
//If libcef.dll doesn't exist in our executing folder then we'll copy the files
|
||||
//For this method the user must have write permissions to the executing folder.
|
||||
if (!File.Exists(Path.Combine(executingFolder, "libcef.dll")))
|
||||
{
|
||||
var libPath = Path.Combine(executingFolder, Environment.Is64BitProcess ? "x64" : "x86");
|
||||
|
||||
if (Directory.Exists(libPath))
|
||||
{
|
||||
FileHelper.MoveFolder(libPath, executingFolder);
|
||||
}
|
||||
|
||||
string dir = executingFolder + "x86";
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
Directory.Delete(dir, recursive: true);
|
||||
}
|
||||
dir = executingFolder + "x64";
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
Directory.Delete(dir, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<bool> SetProxyAsync(ChromiumWebBrowser cefWebBrowser, string proxyUrl)
|
||||
{
|
||||
bool isUseProxy = false;
|
||||
await Cef.UIThreadTaskFactory.StartNew(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var rc = cefWebBrowser.GetBrowser().GetHost().RequestContext;
|
||||
var dict = new Dictionary<string, object>();
|
||||
if (string.IsNullOrEmpty(proxyUrl))
|
||||
{
|
||||
dict.Add("mode", "system");
|
||||
}
|
||||
else
|
||||
{
|
||||
var objProxy = HttpHelper.ResoveProxyServer(proxyUrl);
|
||||
if (objProxy.Tag == 1)
|
||||
{
|
||||
BaseProxyServer baseProxyServer = objProxy.Data;
|
||||
if (!baseProxyServer.Username.IsNullOrEmpty() && !baseProxyServer.Password.IsNullOrEmpty())
|
||||
{
|
||||
LocalRequestHandler customRequestHandler = cefWebBrowser.RequestHandler as LocalRequestHandler;
|
||||
if (customRequestHandler != null)
|
||||
{
|
||||
customRequestHandler.UserName = baseProxyServer.Username;
|
||||
customRequestHandler.Password = baseProxyServer.Password;
|
||||
}
|
||||
}
|
||||
proxyUrl = string.Format("http://{0}:{1}", baseProxyServer.ServerIP, baseProxyServer.ServerPort);
|
||||
}
|
||||
dict.Add("mode", "fixed_servers"); // fixed_servers,pac_script,auto_detect,system,direct
|
||||
dict.Add("server", proxyUrl);
|
||||
}
|
||||
string error;
|
||||
|
||||
bool success = rc.SetPreference("proxy", dict, out error);
|
||||
if (success)
|
||||
{
|
||||
isUseProxy = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
});
|
||||
return isUseProxy;
|
||||
}
|
||||
|
||||
public static string ParseCookieListToString(List<Cookie> cookieList)
|
||||
{
|
||||
string cookies = string.Empty;
|
||||
foreach (Cookie cookie in cookieList)
|
||||
{
|
||||
cookies += string.Format("{0}={1};", cookie.Name, cookie.Value);
|
||||
}
|
||||
return cookies;
|
||||
}
|
||||
|
||||
public static List<Cookie> GetCookieList(string domains = "", ICookieManager cookieManager = null)
|
||||
{
|
||||
if (cookieManager == null)
|
||||
{
|
||||
cookieManager = Cef.GetGlobalCookieManager();
|
||||
}
|
||||
LocalCookieVisitor visitor = new LocalCookieVisitor();
|
||||
if (cookieManager.VisitAllCookies(visitor))
|
||||
{
|
||||
visitor.WaitForAllCookie();
|
||||
}
|
||||
if (string.IsNullOrEmpty(domains))
|
||||
{
|
||||
return visitor.CookieList;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Cookie> list = new List<Cookie>();
|
||||
foreach (string domain in domains.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
list.AddRange(visitor.CookieList.Where(p => p.Domain != null && p.Domain.Contains(domain.Trim())).ToList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetCookie(string domains = "", ICookieManager cookieManager = null)
|
||||
{
|
||||
List<Cookie> cookieList = GetCookieList(domains, cookieManager);
|
||||
string cookies = ParseCookieListToString(cookieList);
|
||||
return cookies;
|
||||
}
|
||||
|
||||
public static async Task SetCookieAsync(string domain, string cookies, ICookieManager cookieManager = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (string cookie in cookies.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
int i = cookie.IndexOf('=');
|
||||
if (i > 0)
|
||||
{
|
||||
string name = cookie.Substring(0, i).ToString().Trim();
|
||||
string value = cookie.Substring(i + 1).ToString().Trim();
|
||||
if (name.ToLower() == "expires" || name.ToLower() == "path" || name.ToLower() == "domain")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Cookie newCookie = new Cookie
|
||||
{
|
||||
Domain = domain,
|
||||
Name = name,
|
||||
Value = value,
|
||||
Path = "/"
|
||||
};
|
||||
if (cookieManager == null)
|
||||
{
|
||||
bool result = await Cef.GetGlobalCookieManager().SetCookieAsync("http://" + domain, newCookie);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool result = await cookieManager.SetCookieAsync("http://" + domain, newCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static async Task SetCookieAsync(string cookieList, ICookieManager cookieManager = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cookieList))
|
||||
{
|
||||
List<Cookie> list = JsonConvert.DeserializeObject<List<Cookie>>(cookieList);
|
||||
foreach (Cookie cookie in list)
|
||||
{
|
||||
cookie.Secure = false;
|
||||
if (cookieManager == null)
|
||||
{
|
||||
bool result = await Cef.GetGlobalCookieManager().SetCookieAsync("http://" + cookie.Domain.Trim('.'), cookie);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool result = await cookieManager.SetCookieAsync("http://" + cookie.Domain.Trim('.'), cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task DeleteCookieAsync(ICookieManager cookieManager, string domain = "", string name = "")
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (!string.IsNullOrEmpty(domain))
|
||||
{
|
||||
url = "http://" + domain;
|
||||
}
|
||||
if (cookieManager == null)
|
||||
{
|
||||
int result = await Cef.GetGlobalCookieManager().DeleteCookiesAsync(url, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
int result = await cookieManager.DeleteCookiesAsync(url, name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteCookie(ICookieManager cookieManager, string domain = "", string name = "")
|
||||
{
|
||||
string url = string.Empty;
|
||||
if (!string.IsNullOrEmpty(domain))
|
||||
{
|
||||
url = "http://" + domain;
|
||||
}
|
||||
if (cookieManager == null)
|
||||
{
|
||||
bool result = Cef.GetGlobalCookieManager().DeleteCookies(url, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool result = cookieManager.DeleteCookies(url, name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExecJavascript(ChromiumWebBrowser cefWebBrowser, string js)
|
||||
{
|
||||
// cef138
|
||||
//List<long> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
//foreach (long identifier in frameIdentifierList)
|
||||
List<string> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
foreach (string identifier in frameIdentifierList)
|
||||
{
|
||||
//IFrame frame = cefWebBrowser.GetBrowser().GetFrame(identifier);
|
||||
IFrame frame = cefWebBrowser.GetBrowser().GetFrameByIdentifier(identifier);
|
||||
if (frame.IsMain)
|
||||
{
|
||||
frame.ExecuteJavaScriptAsync(js);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExecJavascript(ChromiumWebBrowser cefWebBrowser, string expectUrl, string js, Func<string, string, bool> checkUrl)
|
||||
{
|
||||
// cef138
|
||||
//List<long> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
//foreach (long identifier in frameIdentifierList)
|
||||
List<string> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
foreach (string identifier in frameIdentifierList)
|
||||
{
|
||||
//IFrame frame = cefWebBrowser.GetBrowser().GetFrame(identifier);
|
||||
IFrame frame = cefWebBrowser.GetBrowser().GetFrameByIdentifier(identifier);
|
||||
if (checkUrl(frame.Url, expectUrl))
|
||||
{
|
||||
frame.ExecuteJavaScriptAsync(js);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExecJavascriptEqualsUrl(ChromiumWebBrowser cefWebBrowser, string url, string js)
|
||||
{
|
||||
ExecJavascript(cefWebBrowser, url, js, (frameUrl, expectUrl) =>
|
||||
{
|
||||
if (frameUrl.Equals(expectUrl))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void ExecJavascriptStartsWithUrl(ChromiumWebBrowser cefWebBrowser, string url, string js)
|
||||
{
|
||||
ExecJavascript(cefWebBrowser, url, js, (frameUrl, expectUrl) =>
|
||||
{
|
||||
if (frameUrl.StartsWith(expectUrl))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void ExecJavascriptContainsUrl(ChromiumWebBrowser cefWebBrowser, string url, string js)
|
||||
{
|
||||
ExecJavascript(cefWebBrowser, url, js, (frameUrl, expectUrl) =>
|
||||
{
|
||||
if (frameUrl.Contains(expectUrl))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static JavascriptResponse EvaluateScript(ChromiumWebBrowser cefWebBrowser, string js)
|
||||
{
|
||||
JavascriptResponse javascriptResponse = null;
|
||||
Task task = Task.Run(async () =>
|
||||
{
|
||||
javascriptResponse = await cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(js);
|
||||
return javascriptResponse;
|
||||
});
|
||||
task.Wait();
|
||||
return javascriptResponse;
|
||||
}
|
||||
|
||||
public static async Task<JavascriptResponse> EvaluateScriptAsync(ChromiumWebBrowser cefWebBrowser, string js)
|
||||
{
|
||||
JavascriptResponse javascriptResponse = await cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(js);
|
||||
return javascriptResponse;
|
||||
}
|
||||
|
||||
public static async Task<JavascriptResponse> EvaluateScriptAsync(ChromiumWebBrowser cefWebBrowser, string url, string js, Func<string, string, bool> checkUrl)
|
||||
{
|
||||
// cef138
|
||||
JavascriptResponse javascriptResponse = new JavascriptResponse();
|
||||
//List<long> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
//foreach (long identifier in frameIdentifierList)
|
||||
List<string> frameIdentifierList = cefWebBrowser.GetBrowser().GetFrameIdentifiers();
|
||||
foreach (string identifier in frameIdentifierList)
|
||||
{
|
||||
//IFrame frame = cefWebBrowser.GetBrowser().GetFrame(identifier);
|
||||
IFrame frame = cefWebBrowser.GetBrowser().GetFrameByIdentifier(identifier);
|
||||
if (checkUrl(frame.Url, url))
|
||||
{
|
||||
javascriptResponse = await frame.EvaluateScriptAsync(js);
|
||||
}
|
||||
}
|
||||
return javascriptResponse;
|
||||
}
|
||||
|
||||
public static string GetElementLocation(ChromiumWebBrowser cefWebBrowser, string elementIdOrClass)
|
||||
{
|
||||
string js = @"function getElementLocation() {
|
||||
var element = document.getElementById('{0}');
|
||||
if (element == null || element == undefined) {
|
||||
var elements = document.getElementsByClassName('{0}');
|
||||
if(elements){
|
||||
element = elements[0];
|
||||
}
|
||||
}
|
||||
if (element == null || element == undefined)
|
||||
{
|
||||
return '0,0,0,0';
|
||||
}
|
||||
return element.getBoundingClientRect().left.toString() + ',' + element.getBoundingClientRect().top.toString() + ',' + (element.width?element.width.toString():element.getBoundingClientRect().width) + ',' + (element.height?element.height.toString():element.getBoundingClientRect().height);
|
||||
}
|
||||
getElementLocation();
|
||||
";
|
||||
string formatJs = js.Replace("{0}", elementIdOrClass);
|
||||
Task<JavascriptResponse> task = cefWebBrowser.EvaluateScriptAsync(formatJs);
|
||||
task.Wait(2000);
|
||||
string location = task.Result.Result.ParseToString();
|
||||
return location;
|
||||
}
|
||||
|
||||
public static LocationPoint GetElementLocationPoint(ChromiumWebBrowser cefWebBrowser, string elementIdOrClass)
|
||||
{
|
||||
LocationPoint locationPoint = new LocationPoint();
|
||||
string location = GetElementLocation(cefWebBrowser, elementIdOrClass);
|
||||
if (location.Contains(","))
|
||||
{
|
||||
string[] xy = location.Split(',');
|
||||
locationPoint.Left = xy[0].DecimalPointParseToInt();
|
||||
locationPoint.Top = xy[1].DecimalPointParseToInt();
|
||||
locationPoint.Width = xy[2].DecimalPointParseToInt();
|
||||
locationPoint.Height = xy[3].DecimalPointParseToInt();
|
||||
}
|
||||
return locationPoint;
|
||||
}
|
||||
|
||||
public static void SimulateMouseLeftClick(IBrowserHost host, int x, int y)
|
||||
{
|
||||
Random random = new Random(Guid.NewGuid().GetHashCode());
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
||||
Thread.Sleep(75 + random.Next(50));
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None); // 松开鼠标左键
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模拟鼠标滑动
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
/// <param name="fromX">左边缘Left</param>
|
||||
/// <param name="fromY">左边缘Top</param>
|
||||
/// <param name="toX">右边缘Left</param>
|
||||
/// <param name="toY">右边缘Top</param>
|
||||
/// <param name="slideWidth">滑块的宽度</param>
|
||||
/// <param name="slideHeight">滑块的高度</param>
|
||||
public static void SimulateMouseMove(IBrowserHost host, int fromX, int fromY, int toX, int toY, int slideWidth = 0, int slideHeight = 0)
|
||||
{
|
||||
Thread.Sleep(RandomHelper.GetRandom(0, 50));
|
||||
int randomX = 0;
|
||||
int randomY = 0;
|
||||
if (slideWidth == 0)
|
||||
{
|
||||
randomX = -2 + RandomHelper.GetRandom(0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
randomX = RandomHelper.GetRandom(0, slideWidth);
|
||||
}
|
||||
if (slideHeight == 0)
|
||||
{
|
||||
randomY = -2 + RandomHelper.GetRandom(0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
randomY = RandomHelper.GetRandom(0, slideHeight);
|
||||
}
|
||||
int x = fromX + randomX;
|
||||
int y = fromY + randomY;
|
||||
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
||||
Thread.Sleep(200 + RandomHelper.GetRandom(0, 200));
|
||||
|
||||
int times = 0;
|
||||
while (x < toX - 4) // 后半部分
|
||||
{
|
||||
times++;
|
||||
x += 4 + RandomHelper.GetRandom(0, 4);
|
||||
y = y - 1 + RandomHelper.GetRandom(0, 3);
|
||||
Thread.Sleep(6 + times / 6 + RandomHelper.GetRandom(0, 4));
|
||||
host.SendMouseMoveEvent(x, y, false, CefEventFlags.LeftMouseButton); // 移动鼠标
|
||||
}
|
||||
|
||||
x = toX - 1 + RandomHelper.GetRandom(0, 3);
|
||||
Thread.Sleep(100 + RandomHelper.GetRandom(0, 100));
|
||||
host.SendMouseMoveEvent(x, y, false, CefEventFlags.LeftMouseButton); // 移动鼠标
|
||||
|
||||
Thread.Sleep(400 + RandomHelper.GetRandom(0, 600));
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None); // 抬起鼠标左键
|
||||
}
|
||||
|
||||
public static void SimulateInputChar(IBrowserHost host, int key)
|
||||
{
|
||||
Random random = new Random();
|
||||
host.SendKeyEvent(new KeyEvent() { WindowsKeyCode = key, Type = KeyEventType.KeyDown });
|
||||
Thread.Sleep(10 + random.Next(10));
|
||||
|
||||
host.SendKeyEvent(new KeyEvent() { WindowsKeyCode = key, Type = KeyEventType.Char });
|
||||
Thread.Sleep(50 + random.Next(40));
|
||||
|
||||
host.SendKeyEvent(new KeyEvent() { WindowsKeyCode = key, Type = KeyEventType.KeyUp });
|
||||
Thread.Sleep(50 + random.Next(40));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<UserControl x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PDDBuyerOrderListCtrl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
/// <summary>
|
||||
/// PDDBuyerOrderListCtrl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PDDBuyerOrderListCtrl : UserControl
|
||||
{
|
||||
public PDDBuyerOrderListCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<UserControl x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PDDBuyerOrderReadCtrl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
|
||||
mc:Ignorable="d" Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="450" d:DesignWidth="1000">
|
||||
<Grid Background="White">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Content="自动读买手单" x:Name="chkAutoReadBuyerOrder" BorderBrush="{StaticResource mainColorBrush}" FontSize="12" HorizontalAlignment="Left"
|
||||
Margin="6,0" VerticalAlignment="Center" Checked="chkAutoReadBuyerOrder_CheckedChanged" Unchecked="chkAutoReadBuyerOrder_CheckedChanged" IsChecked="True"/>
|
||||
|
||||
<TextBox x:Name="txtUrlAddress" Grid.Column="2" Margin="8,0,20,0" BorderBrush="{StaticResource pageColorBrush}" BorderThickness="1" Height="28"
|
||||
VerticalContentAlignment="Center" Style="{StaticResource BaseRoundCornerTextBoxStyle}"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" Background="LightGray" x:Name="GridCef">
|
||||
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" VerticalAlignment="Bottom" Visibility="Visible">
|
||||
<DataGrid Height="300" RowHeight="50" AutoGenerateColumns = "False" HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
|
||||
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}" CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="30">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="0.5*" Header="" Binding="{Binding order_id}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1*" Header="买手名称" Binding="{Binding order_id}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1.5*" Header="拍单订单号"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="0.8*" Header="拍单时间"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1.8*" Header="商品信息"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="0.8*" Header="金额"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1*" Header="订单状态"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1*" Header="物流名称"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1*" Header="物流单号"></DataGridTextColumn>
|
||||
<DataGridTextColumn Width="1*" Header="订单信息"></DataGridTextColumn>
|
||||
<DataGridTemplateColumn Width="0.6*" Header="手动发送" x:Name="colSendBuyerOrder" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Grid.Column="1" Grid.Row="2" x:Name="btnSendBuyerOrder" Background="Transparent" HorizontalAlignment="Center" Foreground="#409eff" BorderBrush="Transparent"
|
||||
Margin="4,0,0,0" Content="发送" Click="btnSendBuyerOrder_Click"></Button>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,133 @@
|
||||
using _29WxOrderWpf.CefHelper;
|
||||
using AllBase;
|
||||
using AllBase.Model;
|
||||
using AllBase.Model.Result;
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using CefSharp.Wpf;
|
||||
using NaiBa.Util;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Work._29Tools.CefTools;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
/// <summary>
|
||||
/// PDDBuyerOrderReadCtrl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PDDBuyerOrderReadCtrl : UserControl
|
||||
{
|
||||
ChromiumWebBrowser cefWebBrowser = null;
|
||||
public bool AutoReadBuyerOrder = true;
|
||||
ConcurrentList<PddBuyerOrderLiteInfo> lstPddBuyerOrderInfoLite { get; set; } = new ConcurrentList<PddBuyerOrderLiteInfo>();
|
||||
|
||||
public PDDBuyerOrderReadCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
InitCef();
|
||||
}
|
||||
|
||||
public void InitCef()
|
||||
{
|
||||
//CefSharp.Wpf.ChromiumWebBrowser cefWebBrowser = new CefSharp.Wpf.ChromiumWebBrowser();
|
||||
//cefWebBrowser.Address = "https://www.baidu.com";
|
||||
cefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser("https://www.baidu.com", false);
|
||||
Grid.SetRow(cefWebBrowser, 0);
|
||||
this.GridCef.Children.Add(cefWebBrowser);
|
||||
|
||||
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
|
||||
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
|
||||
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
|
||||
cefWebBrowser.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
|
||||
var lifeSapnHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
|
||||
cefWebBrowser.LifeSpanHandler = lifeSapnHandler;
|
||||
cefWebBrowser.KeyboardHandler = new KeyboardHandler();
|
||||
cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
|
||||
cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
|
||||
cefWebBrowser.LoadError += CefWebBrowser_LoadError;
|
||||
|
||||
|
||||
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
//Thread.Sleep(2000);
|
||||
//Dispatcher.Invoke(new Action(() => {
|
||||
// browser.Visibility = Visibility.Hidden;
|
||||
//}));
|
||||
//Thread.Sleep(1000);
|
||||
//Dispatcher.Invoke(new Action(() => {
|
||||
|
||||
// browser.Address = "https://www.sina.com.cn";
|
||||
|
||||
|
||||
// //}));
|
||||
// //Thread.Sleep(3000);
|
||||
// //var jsStr = @"window.scrollTo(0, document.body.scrollHeight);";
|
||||
// //var client = browser.GetDevToolsClient();
|
||||
// //if (client != null)
|
||||
// //{
|
||||
// // var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
// // //result.Wait(5000);
|
||||
// // //string resultStr = result.Result.Result.Value.ParseToString();
|
||||
// // ////if (resultStr.ParseToInt() > 0)
|
||||
// // //{
|
||||
// // // CEFBrowser.DeleteCookie(browser.GetCookieManager(null));
|
||||
// // // //return;
|
||||
// // //}
|
||||
// //}
|
||||
// //Dispatcher.Invoke(new Action(() => {
|
||||
// //}));
|
||||
// //Thread.Sleep(3000);
|
||||
// //Dispatcher.Invoke(new Action(() => {
|
||||
// // browser.Visibility = Visibility.Visible;
|
||||
// //}));
|
||||
//});
|
||||
}
|
||||
|
||||
private void CefWebBrowser_LoadError(object sender, LoadErrorEventArgs e)
|
||||
{
|
||||
}
|
||||
private void CefWebBrowser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
|
||||
{
|
||||
}
|
||||
private void CefWebBrowser_AddressChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
|
||||
{
|
||||
}
|
||||
|
||||
private void chkAutoReadBuyerOrder_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AutoReadBuyerOrder = chkAutoReadBuyerOrder.IsChecked == true;
|
||||
}
|
||||
|
||||
private void btnSendBuyerOrder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Margin="4,0,0,0" Width="24" Height="24" Source="{StaticResource imgBuyerOrder}" MouseLeftButtonUp="Image_MouseLeftButtonUp" Cursor="Hand"></Image>
|
||||
<ComboBox Grid.Column="1" x:Name="cmbPddBuyer" Margin="8,0,0,0" VerticalContentAlignment="Center" Style="{StaticResource RoundedComboBox}" Height="24"
|
||||
MouseLeftButtonUp="cmbPddBuyer_MouseLeftButtonUp" SelectionChanged="cmbPddBuyer_SelectionChanged" SelectedIndex="0">
|
||||
<ComboBox.ItemTemplate>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Local;
|
||||
using AllBase.Model.Result;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -154,5 +155,15 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
// GetPddBuyer();
|
||||
//});
|
||||
}
|
||||
|
||||
private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (MainWindow.Instance.pddBuyerOrderReadCtrl.Visibility != Visibility.Visible)
|
||||
MainWindow.Instance.pddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
|
||||
if (Panel.GetZIndex(MainWindow.Instance.pddBuyerOrderReadCtrl) < 1)
|
||||
Panel.SetZIndex(MainWindow.Instance.pddBuyerOrderReadCtrl, 1);
|
||||
else
|
||||
Panel.SetZIndex(MainWindow.Instance.pddBuyerOrderReadCtrl, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,21 +63,25 @@
|
||||
|
||||
<Button Grid.Column="8" x:Name="btnFilter" Style="{StaticResource BasePageButtonStyle}" Margin="4,0,0,0" Content="过滤" Width="48" Height="24" Click="btnFilter_Click"/>
|
||||
<Button Grid.Column="9" x:Name="btnSearch" Style="{StaticResource BasePageButtonStyle}" Margin="4,0,4,0" Content="读单" Width="48" Height="24" Click="btnSearch_Click"/>
|
||||
<Image x:Name="imgLoading" Grid.Column="10" Source="{StaticResource loading_pic}" Width="20" Height="20" Margin="0,15,0,15">
|
||||
<!--<Image.Triggers>
|
||||
<EventTrigger RoutedEvent="Image.Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="myElement"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
||||
To="360"
|
||||
Duration="0:0:5"
|
||||
RepeatBehavior="Forever"/>
|
||||
<Image x:Name="imgLoading" Grid.Column="10" Source="{StaticResource imgLoadingPic}" Width="20" Height="20" Margin="0,15,0,15">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform Angle="45" CenterX="10" CenterY="10"/>
|
||||
</Image.RenderTransform>
|
||||
<Image.Triggers>
|
||||
<EventTrigger RoutedEvent="Image.Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="imgLoading"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
||||
From="0"
|
||||
To="360"
|
||||
Duration="0:0:3"
|
||||
RepeatBehavior="Forever">
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Image.Triggers>-->
|
||||
</Image.Triggers>
|
||||
</Image>
|
||||
</Grid>
|
||||
|
||||
@@ -140,7 +144,8 @@
|
||||
</DataGrid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ListBox BorderThickness="0" ItemsSource="{Binding lstFilterOrder}" Grid.Row="3" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="0,0,0,4">
|
||||
<ListBox BorderThickness="0" ItemsSource="{Binding lstFilterOrder}" Grid.Row="3" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="0,0,0,4"
|
||||
ScrollViewer.CanContentScroll="True" VirtualizingPanel.ScrollUnit="Pixel">
|
||||
<!--使用自定义属性模板去除ListBox高亮显示框-->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
|
||||
@@ -4,7 +4,7 @@ using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Local;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
@@ -224,6 +224,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
order.order_items.Add(item);
|
||||
|
||||
item.buy_map = byuMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
|
||||
if (item.buy_map == null)
|
||||
item.buy_map = byuMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
|
||||
|
||||
item.item_transit_orders.AddRange(transitOrderList.Where(t => t.order_no == item.order_id && t.order_sku_id == item.sku_id));
|
||||
}
|
||||
@@ -275,7 +277,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
imgLoading.Visibility = Visibility.Collapsed;
|
||||
imgLoading.Visibility = Visibility.Hidden;
|
||||
btnSearch.IsEnabled = true;
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using AllBase.Model.Local;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -42,7 +43,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
//if (gridChildOrder.Children.Count > 0)
|
||||
// return;
|
||||
|
||||
var order = this.DataContext as AllBase.Model.oms_wei_order_info;
|
||||
var order = this.DataContext as oms_wei_order_info;
|
||||
if (order == null)
|
||||
return;
|
||||
|
||||
@@ -69,14 +70,14 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
private void btnSeeAddressDetail_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var order = this.DataContext as AllBase.Model.oms_wei_order_info;
|
||||
var order = this.DataContext as oms_wei_order_info;
|
||||
if (order == null)
|
||||
return;
|
||||
}
|
||||
|
||||
private void btnGetRefundAddress_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var order = this.DataContext as AllBase.Model.oms_wei_order_info;
|
||||
var order = this.DataContext as oms_wei_order_info;
|
||||
if (order == null)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</Border>
|
||||
|
||||
|
||||
<Image Margin="8,8,0,8" Grid.Column="4" Width="24" Height="24" Source="{StaticResource OrderWeishopIcon}"></Image>
|
||||
<Image Margin="8,8,0,8" Grid.Column="4" Width="24" Height="24" Source="{StaticResource imgOrderWeishopIcon}"></Image>
|
||||
<uc:UcWaterMarkTextBox WaterMark="店铺名称" x:Name="txtShopName" Grid.Column="5" Margin="4,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="{Binding shop_name}" BorderThickness="0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--<Image Grid.RowSpan="20" Grid.Column="0" Height="80" Width="80" Margin="0,0,8,0" Source="{DynamicResource err_pic}"></Image>-->
|
||||
<!--<Image Grid.RowSpan="20" Grid.Column="0" Height="80" Width="80" Margin="0,0,8,0" Source="{DynamicResource imgErrPic}"></Image>-->
|
||||
<uc:UcWaterMarkTextBox WaterMark="商品名称" x:Name="txtGoodsName" Text="{Binding title}" Grid.Column="1" Grid.Row="1" Margin="0,2,4,2"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap" FontWeight="Bold"/>
|
||||
|
||||
@@ -198,20 +198,27 @@
|
||||
<!--<TextBox Text="发货:" Grid.Column="1" Grid.Row="1" Margin="0,2,0,2" VerticalAlignment="Top" Background="Transparent" IsReadOnly="True" BorderThickness="0"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="发货" Text="" Grid.Column="1" Grid.Row="1" Margin="0,2,4,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>-->
|
||||
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="2">
|
||||
<TextBlock Text="外部单号:" IsHitTestVisible="False" Foreground="LightGray" VerticalAlignment="Center"
|
||||
Visibility="{Binding ElementName=txtOutOrderNumStr,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>
|
||||
<uc:UcWaterMarkTextBox WaterMark="外部单号:" Text="{Binding item_transit_order.OutOrderNumStr}" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
x:Name="txtOutOrderNumStr" Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
</WrapPanel>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3">
|
||||
<TextBox Text="外采:" Grid.Column="1" Grid.Row="1" Margin="0,2,0,2" VerticalAlignment="Top" Background="Transparent" IsReadOnly="True" BorderThickness="0"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="外采" Text="{Binding item_order.out_express_company}" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="外采" Text="-" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
<uc:UcWaterMarkTextBox WaterMark="-" Text="-" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="外采" Text="{Binding item_order.out_express_no}" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2,4,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
</WrapPanel>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3">
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="4">
|
||||
<TextBox Text="退货:" Grid.Column="1" Grid.Row="1" Margin="0,2,0,2" VerticalAlignment="Top" Background="Transparent" IsReadOnly="True" BorderThickness="0"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="退货" Text="{Binding item_refund.return_delivery_name}" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="退货" Text="-" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
<uc:UcWaterMarkTextBox WaterMark="-" Text="-" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
<uc:UcWaterMarkTextBox WaterMark="退货" Text="{Binding item_refund.return_waybill_id}" Grid.Column="1" Grid.Row="1" Padding="0" Margin="-2,2,4,2" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model;
|
||||
using AllBase.Model.Local;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -32,14 +33,14 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
private void btnSeeAddressDetail_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var order = this.DataContext as AllBase.Model.oms_wei_order_item_info;
|
||||
var order = this.DataContext as oms_wei_order_item_info;
|
||||
if (order == null)
|
||||
return;
|
||||
}
|
||||
|
||||
private void btnGetRefundAddress_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var order = this.DataContext as AllBase.Model.oms_wei_order_item_info;
|
||||
var order = this.DataContext as oms_wei_order_item_info;
|
||||
if (order == null)
|
||||
return;
|
||||
}
|
||||
@@ -56,7 +57,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
private void btnBuyOrder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var orderItem = this.DataContext as AllBase.Model.oms_wei_order_item_info;
|
||||
var orderItem = this.DataContext as oms_wei_order_item_info;
|
||||
if (orderItem == null)
|
||||
{
|
||||
BaseMsgWindow.ShowError(MainWindow.Instance, "订单信息为空");
|
||||
@@ -76,9 +77,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
|
||||
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, orderItem, GlobalConfig.CurrentPddBuyer, orderItem.buy_map);
|
||||
|
||||
//所有订单页面
|
||||
buyOrderForm.InitUrl = "https://mobile.yangkeduo.com/orders.html?type=0&comment_tab=1&combine_orders=1&" +
|
||||
"main_orders=1&refer_page_name=personal&refer_page_id=10001_1782219035613_a9ulipk4k3&refer_page_sn=10001";
|
||||
buyOrderForm.InitUrl = "https://mobile.yangkeduo.com/orders.html"; //"?type=0&comment_tab=1&combine_orders=1&main_orders=1&refer_page_name=personal&refer_page_id=10001_1782219035613_a9ulipk4k3&refer_page_sn=10001";
|
||||
//已有拍单关联的跳的到订单确认界面
|
||||
if (orderItem.buy_map != null)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
|
||||
<DataGrid Grid.Row="1" Opacity="1" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
|
||||
AutoGenerateColumns = "False" HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
|
||||
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}" CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using _29WxOrderWpf.Utils;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Local;
|
||||
using AllBase.Model.Result;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<orderctrls:OrderListCtrl x:Name="orderListCtrl" Grid.Column="1" Visibility="Collapsed"></orderctrls:OrderListCtrl>
|
||||
|
||||
<buyerctrls:PDDBuyerSelectCtrl Width="240" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="8"/>
|
||||
<buyerctrls:PDDBuyerOrderReadCtrl x:Name="pddBuyerOrderReadCtrl" Grid.Column="1" Visibility="Collapsed" Panel.ZIndex="-1" Width="800" HorizontalAlignment="Right" Margin="0,40,0,0"></buyerctrls:PDDBuyerOrderReadCtrl>
|
||||
<buyerctrls:PDDBuyerSelectCtrl x:Name="pddBuyerSelectCtrl" Visibility="Collapsed" Width="280" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="8"/>
|
||||
<Grid x:Name="gridUser" Visibility="Hidden" Grid.ColumnSpan="2" Background="#7F000000">
|
||||
<Border CornerRadius="4" Width="500" Height="600" Background="White">
|
||||
<shopctrls:ShopListCtrl x:Name="shopListCtrl" Visibility="{Binding ElementName=gridUser,Mode=TwoWay,Path=Visibility}" Margin="2"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.Ctrls.BuyerCtrls;
|
||||
using _29WxOrderWpf.Ctrls.OrderCtrls;
|
||||
using AllBase;
|
||||
using AllBase.DouYinModel.Result;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model;
|
||||
using AllBase.Model.Local;
|
||||
using AllBase.Model.Result;
|
||||
using CefSharp;
|
||||
using NaiBa.Util;
|
||||
@@ -68,6 +70,8 @@ namespace _29WxOrderWpf
|
||||
{
|
||||
//shopListCtrl.Visibility = Visibility.Visible;
|
||||
orderListCtrl.Visibility = Visibility.Visible;
|
||||
pddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
|
||||
pddBuyerSelectCtrl.Visibility = Visibility.Visible;
|
||||
Task.Run(() =>
|
||||
{
|
||||
GetServerShop();
|
||||
@@ -77,46 +81,6 @@ namespace _29WxOrderWpf
|
||||
GetPddBuyer();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//CefSharp.Wpf.ChromiumWebBrowser browser = new CefSharp.Wpf.ChromiumWebBrowser();
|
||||
//browser.Address = "https://www.baidu.com";
|
||||
//Grid.SetRow(browser, 1);
|
||||
//this.mainGrid.Children.Add(browser);
|
||||
//Task. Run(() => {
|
||||
|
||||
// Thread.Sleep(2000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// browser.Visibility = Visibility.Hidden;
|
||||
// }));
|
||||
// Thread.Sleep(1000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
|
||||
// browser.Address = "https://www.sina.com.cn";
|
||||
|
||||
|
||||
// }));
|
||||
// Thread.Sleep(3000);
|
||||
// var jsStr = @"window.scrollTo(0, document.body.scrollHeight);";
|
||||
// var client = browser.GetDevToolsClient();
|
||||
// if (client != null)
|
||||
// {
|
||||
// var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
// //result.Wait(5000);
|
||||
// //string resultStr = result.Result.Result.Value.ParseToString();
|
||||
// ////if (resultStr.ParseToInt() > 0)
|
||||
// //{
|
||||
// // CEFBrowser.DeleteCookie(browser.GetCookieManager(null));
|
||||
// // //return;
|
||||
// //}
|
||||
// }
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// }));
|
||||
// Thread.Sleep(3000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// browser.Visibility = Visibility.Visible;
|
||||
// }));
|
||||
//});
|
||||
}
|
||||
|
||||
#region 反抓包功能
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -13,7 +13,8 @@
|
||||
<BitmapImage x:Key="imgBaseMsgErr" UriSource="/Resources/BaseMsgErr.png"/>
|
||||
<BitmapImage x:Key="imgBaseMsgInfo" UriSource="/Resources/BaseMsgInfo.png"/>
|
||||
<BitmapImage x:Key="imgBaseMsgQue" UriSource="/Resources/BaseMsgQue.png"/>
|
||||
<BitmapImage x:Key="OrderWeishopIcon" UriSource="/Resources/order_weishop_icon.png" />
|
||||
<BitmapImage x:Key="err_pic" UriSource="/Resources/err_pic.png" />
|
||||
<BitmapImage x:Key="loading_pic" UriSource="/Resources/loading_blue.gif" />
|
||||
<BitmapImage x:Key="imgOrderWeishopIcon" UriSource="/Resources/order_weishop_icon.png" />
|
||||
<BitmapImage x:Key="imgErrPic" UriSource="/Resources/err_pic.png" />
|
||||
<BitmapImage x:Key="imgLoadingPic" UriSource="/Resources/loading.png" />
|
||||
<BitmapImage x:Key="imgBuyerOrder" UriSource="/Resources/buyer_order.png" />
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user