Compare commits

..
33 Commits
Author SHA1 Message Date
wule 9cca38beff 版本号更新 2026-10-16 10:12:04 +08:00
wule 75aae91b66 优化拍单 修复异常拍单和状态不准确订单无法拦截退回问题 2026-10-16 10:11:22 +08:00
wule e71ef72475 修复拍单问题 2026-10-15 17:57:11 +08:00
wule a89adafe61 新版本号 2026-10-15 17:42:06 +08:00
wule 9626bc8d8c Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-15 17:37:01 +08:00
wule e7d22984df 淘宝拍单优化 2026-10-15 17:36:34 +08:00
chfei 912837a84b Merge branch 'main' of github.com:jtt-fan/29WxOrder 2026-10-15 13:33:35 +08:00
chfei a81ba26de8 优化发票助手 2026-10-15 13:33:08 +08:00
wule ea14ad3af4 优化淘宝拍单界面显示 2026-10-15 11:26:43 +08:00
wule e0dead1b6d Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-15 11:14:29 +08:00
wule 18a4373918 优化拍单 2026-10-15 11:14:14 +08:00
wule 4873b6cdd5 新版本 2026-10-14 21:13:33 +08:00
wule 79ad130fde Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-14 21:13:05 +08:00
wule a27f6cb33c 优化拍单界面 2026-10-14 21:12:52 +08:00
wule 89299d3e3a 新版本号 2026-10-14 19:56:28 +08:00
wule 84a484a568 淘宝买手售后状态读取 2026-10-14 19:47:27 +08:00
wule 0f850b8840 新版本 2026-10-14 10:32:36 +08:00
wule 4a4d9d7dfb 优化淘宝读买手单逻辑 2026-10-14 08:22:28 +08:00
wule 0244865ace Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-13 18:32:29 +08:00
wule c4363d0ac9 新版本317 2026-10-13 18:26:08 +08:00
wule ade92facab Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-13 18:24:17 +08:00
wule 41fa98dc2d 支持淘宝拍单 2026-10-13 18:24:06 +08:00
chfei 6b36de2494 统计订单详情增加备注提示,
备注可以输入空
2026-10-13 16:58:42 +08:00
wule 4e122fce6e 新版本 2026-10-12 18:51:33 +08:00
wule 5fb42e4d34 Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-12 18:48:54 +08:00
wule 60b1088e55 外采淘宝 2026-10-12 18:48:42 +08:00
chfei 064bd1f142 修复开票 过程中出现的错误提示 2026-10-12 18:44:30 +08:00
chfei dd512a0dcb 更新 Dialog弹出框模式 2026-10-12 18:43:32 +08:00
wule_5900x 74e59b4892 淘宝物流读取cef逻辑优化 2026-10-11 21:53:48 +08:00
chfei a01e938055 Merge branch 'main' of github.com:jtt-fan/29WxOrder 2026-10-10 20:04:47 +08:00
chfei 66d4d67374 修复订单详情 复制缺少备注 2026-10-10 20:04:14 +08:00
wule 28c112794d Merge branch 'main' of github.com:KJD2025/29WxOrder 2026-10-10 19:00:23 +08:00
wule b84ccc4670 1淘宝拍单 2中转仓订单优化 2026-10-10 18:59:37 +08:00
56 changed files with 8373 additions and 415 deletions

No files matched your search

+5
View File
@@ -66,13 +66,18 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\**\*" /> <Resource Include="Resources\**\*" />
<None Remove="Ctrls\PDDInvoice\Resources\invoice.js" /> <None Remove="Ctrls\PDDInvoice\Resources\invoice.js" />
<None Remove="Ctrls\PDDInvoice\Resources\order.js" />
<Resource Include="29wx.ico" /> <Resource Include="29wx.ico" />
<Resource Include="29_common_icon.ico" /> <Resource Include="29_common_icon.ico" />
<Resource Include="Ctrls\OrderCtrls\Resources\tbAutoAddress.js" /> <Resource Include="Ctrls\OrderCtrls\Resources\tbAutoAddress.js" />
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" /> <Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
<Resource Include="Ctrls\PDDInvoice\Resources\order.js" />
<Resource Include="gear.ico" /> <Resource Include="gear.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Ctrls\BuyerCtrls\PddBuyOrderCtrl.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\ChangePickNoView.xaml.cs"> <Compile Update="Views\ChangePickNoView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
+5 -2
View File
@@ -1,4 +1,5 @@
using System; using Prism.Services.Dialogs;
using System;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Remoting.Contexts; using System.Runtime.Remoting.Contexts;
@@ -14,7 +15,7 @@ namespace _29WxOrderWpf.Common
/// <summary> /// <summary>
/// DialogWindow.xaml 的交互逻辑 /// DialogWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class DialogWindow : Window public partial class DialogWindow : Window, IDialogWindow
{ {
private readonly Style dialogWindowStyle; private readonly Style dialogWindowStyle;
private bool isConstructorSuccessful = false; private bool isConstructorSuccessful = false;
@@ -101,6 +102,8 @@ namespace _29WxOrderWpf.Common
private const int GWL_STYLE = -16; private const int GWL_STYLE = -16;
private const int WS_MINIMIZEBOX = 0x00020000; private const int WS_MINIMIZEBOX = 0x00020000;
public IDialogResult Result { get; set; }
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex); private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
@@ -0,0 +1,41 @@
namespace Prism.Services.Dialogs
{
/// <summary>
/// The result of the dialog.
/// </summary>
public enum ButtonResult
{
/// <summary>
/// Abort.
/// </summary>
Abort = 3,
/// <summary>
/// Cancel.
/// </summary>
Cancel = 2,
/// <summary>
/// Ignore.
/// </summary>
Ignore = 5,
/// <summary>
/// No.
/// </summary>
No = 7,
/// <summary>
/// No result returned.
/// </summary>
None = 0,
/// <summary>
/// OK.
/// </summary>
OK = 1,
/// <summary>
/// Retry.
/// </summary>
Retry = 4,
/// <summary>
/// Yes.
/// </summary>
Yes = 6
}
}
+82
View File
@@ -0,0 +1,82 @@
#if HAS_UWP
using Windows.UI.Xaml;
#elif HAS_WINUI
using Microsoft.UI.Xaml;
#else
using System.Windows;
#endif
namespace Prism.Services.Dialogs
{
/// <summary>
/// This class contains <see cref="IDialogWindow"/> attached properties.
/// </summary>
public class Dialog
{
/// <summary>
/// Identifies the WindowStyle attached property.
/// </summary>
/// <remarks>
/// This attached property is used to specify the style of a <see cref="IDialogWindow"/>.
/// </remarks>
public static readonly DependencyProperty WindowStyleProperty =
DependencyProperty.RegisterAttached("WindowStyle", typeof(Style), typeof(Dialog), new PropertyMetadata(null));
/// <summary>
/// Gets the value for the <see cref="WindowStyleProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <returns>The <see cref="WindowStyleProperty"/> attached to the <paramref name="obj"/> element.</returns>
public static Style GetWindowStyle(DependencyObject obj)
{
return (Style)obj.GetValue(WindowStyleProperty);
}
/// <summary>
/// Sets the <see cref="WindowStyleProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <param name="value">The Style to attach.</param>
public static void SetWindowStyle(DependencyObject obj, Style value)
{
obj.SetValue(WindowStyleProperty, value);
}
#if !HAS_UWP && !HAS_WINUI
/// <summary>
/// Identifies the WindowStartupLocation attached property.
/// </summary>
/// <remarks>
/// This attached property is used to specify the startup location of a <see cref="IDialogWindow"/>.
/// </remarks>
public static readonly DependencyProperty WindowStartupLocationProperty =
DependencyProperty.RegisterAttached("WindowStartupLocation", typeof(WindowStartupLocation), typeof(Dialog), new UIPropertyMetadata(OnWindowStartupLocationChanged));
/// <summary>
/// Gets the value for the <see cref="WindowStartupLocationProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <returns>The <see cref="WindowStartupLocationProperty"/> attached to the <paramref name="obj"/> element.</returns>
public static WindowStartupLocation GetWindowStartupLocation(DependencyObject obj)
{
return (WindowStartupLocation)obj.GetValue(WindowStartupLocationProperty);
}
/// <summary>
/// Sets the <see cref="WindowStartupLocationProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <param name="value">The WindowStartupLocation to attach.</param>
public static void SetWindowStartupLocation(DependencyObject obj, WindowStartupLocation value)
{
obj.SetValue(WindowStartupLocationProperty, value);
}
private static void OnWindowStartupLocationChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
if (sender is Window window)
window.WindowStartupLocation = (WindowStartupLocation)e.NewValue;
}
#endif
}
}
@@ -0,0 +1,24 @@
using Prism.Common;
namespace Prism.Services.Dialogs
{
/// <summary>
/// Represents Dialog parameters.
/// </summary>
/// <remarks>
/// This class can be used to to pass object parameters during the showing and closing of Dialogs.
/// </remarks>
public class DialogParameters : ParametersBase, IDialogParameters
{
/// <summary>
/// Initializes a new instance of the <see cref="DialogParameters"/> class.
/// </summary>
public DialogParameters() : base() { }
/// <summary>
/// Constructs a list of parameters.
/// </summary>
/// <param name="query">Query string to be parsed.</param>
public DialogParameters(string query) : base(query) { }
}
}
@@ -0,0 +1,44 @@
namespace Prism.Services.Dialogs
{
/// <summary>
/// An <see cref="IDialogResult"/> that contains <see cref="IDialogParameters"/> from the dialog
/// and the <see cref="ButtonResult"/> of the dialog.
/// </summary>
public class DialogResult : IDialogResult
{
/// <summary>
/// The parameters from the dialog.
/// </summary>
public IDialogParameters Parameters { get; private set; } = new DialogParameters();
/// <summary>
/// The result of the dialog.
/// </summary>
public ButtonResult Result { get; private set; } = ButtonResult.None;
/// <summary>
/// Initializes a new instance of the <see cref="DialogResult"/> class.
/// </summary>
public DialogResult() { }
/// <summary>
/// Initializes a new instance of the <see cref="DialogResult"/> class.
/// </summary>
/// <param name="result">The result of the dialog.</param>
public DialogResult(ButtonResult result)
{
Result = result;
}
/// <summary>
/// Initializes a new instance of the <see cref="DialogResult"/> class.
/// </summary>
/// <param name="result">The result of the dialog.</param>
/// <param name="parameters">The parameters from the dialog.</param>
public DialogResult(ButtonResult result, IDialogParameters parameters)
{
Result = result;
Parameters = parameters;
}
}
}
@@ -0,0 +1,170 @@
using _29WxOrderWpf.Common;
using Prism.Common;
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
namespace Prism.Services.Dialogs
{
/// <summary>
/// 静态弹窗服务:不依赖容器,直接传入 View 实例弹出。
/// ViewModel 需实现 IDialogAware。
/// </summary>
public static class DialogService
{
// ========== 对外接口 ==========
/// <summary>非模态弹出</summary>
public static void Show(FrameworkElement view,
IDialogParameters parameters = null,
Action<IDialogResult> callback = null,
IDialogWindow window = null)
{
ShowInternal(view, parameters, callback, false, window);
}
/// <summary>模态弹出</summary>
public static void ShowDialog(FrameworkElement view,
IDialogParameters parameters = null,
Action<IDialogResult> callback = null,
IDialogWindow window = null)
{
ShowInternal(view, parameters, callback, true, window);
}
// ========== 内部实现 ==========
private static void ShowInternal(FrameworkElement view,
IDialogParameters parameters,
Action<IDialogResult> callback,
bool isModal,
IDialogWindow window)
{
if (view == null) throw new ArgumentNullException(nameof(view));
if (parameters == null) parameters = new DialogParameters();
// 1. 创建(或使用传入的)DialogWindow
var dialogWindow = window ?? new DialogWindow();
// 2. 绑定事件(关闭、回调等)
ConfigureDialogWindowEvents(dialogWindow, callback);
// 3. 配置内容(View + ViewModel)
ConfigureDialogWindowContent(view, dialogWindow, parameters);
// 4. 弹出
ShowDialogWindow(dialogWindow, isModal);
}
private static void ShowDialogWindow(IDialogWindow dialogWindow, bool isModal)
{
if (isModal)
dialogWindow.ShowDialog();
else
dialogWindow.Show();
}
/// <summary>
/// 把 View 挂到 DialogWindow 上,并触发 OnDialogOpened。
/// </summary>
private static void ConfigureDialogWindowContent(FrameworkElement dialogContent,
IDialogWindow window,
IDialogParameters parameters)
{
// 不再自动绑 ViewModel,DataContext 由 View 自己负责
if (!(dialogContent.DataContext is IDialogAware viewModel))
throw new NullReferenceException("A dialog's ViewModel must implement the IDialogAware interface");
ConfigureDialogWindowProperties(window, dialogContent, viewModel);
// 直接触发 OnDialogOpened(替代 MvvmHelpers.ViewAndViewModelAction)
viewModel.OnDialogOpened(parameters);
}
/// <summary>
/// 绑定 DialogWindow 的生命周期事件。
/// </summary>
private static void ConfigureDialogWindowEvents(IDialogWindow dialogWindow, Action<IDialogResult> callback)
{
Action<IDialogResult> requestCloseHandler = null;
requestCloseHandler = (o) =>
{
dialogWindow.Result = o;
dialogWindow.Close();
};
RoutedEventHandler loadedHandler = null;
loadedHandler = (o, e) =>
{
dialogWindow.Loaded -= loadedHandler;
GetDialogViewModel(dialogWindow).RequestClose += requestCloseHandler;
};
dialogWindow.Loaded += loadedHandler;
CancelEventHandler closingHandler = null;
closingHandler = (o, e) =>
{
if (!GetDialogViewModel(dialogWindow).CanCloseDialog())
e.Cancel = true;
};
dialogWindow.Closing += closingHandler;
EventHandler closedHandler = null;
closedHandler = (o, e) =>
{
dialogWindow.Closed -= closedHandler;
dialogWindow.Closing -= closingHandler;
GetDialogViewModel(dialogWindow).RequestClose -= requestCloseHandler;
GetDialogViewModel(dialogWindow).OnDialogClosed();
if (dialogWindow.Result == null)
dialogWindow.Result = new DialogResult();
callback?.Invoke(dialogWindow.Result);
dialogWindow.DataContext = null;
dialogWindow.Content = null;
};
dialogWindow.Closed += closedHandler;
}
/// <summary>
/// 设置 DialogWindow 的 Style / Content / DataContext / Owner。
/// </summary>
private static void ConfigureDialogWindowProperties(IDialogWindow window,
FrameworkElement dialogContent,
IDialogAware viewModel)
{
var windowStyle = Dialog.GetWindowStyle(dialogContent);
if (windowStyle != null)
window.Style = windowStyle;
window.Content = dialogContent;
window.DataContext = viewModel; // 宿主窗口和对话框共享同一个 DataContext
if (window.Owner == null)
window.Owner = Application.Current?.Windows
.OfType<Window>()
.FirstOrDefault(x => x.IsActive);
}
/// <summary>
/// 从 window.Content 或 window.DataContext 里拿 IDialogAware。
/// 替代 Prism 的 dialogWindow.GetDialogViewModel() 扩展方法。
/// </summary>
private static IDialogAware GetDialogViewModel(IDialogWindow window)
{
if (window.Content is FrameworkElement fe)
{
if (fe is IDialogAware aware) return aware;
if (fe.DataContext is IDialogAware vm) return vm;
}
if (window.DataContext is IDialogAware wvm) return wvm;
throw new NullReferenceException("A dialog's ViewModel must implement the IDialogAware interface");
}
}
}
@@ -0,0 +1,37 @@
using System;
namespace Prism.Services.Dialogs
{
/// <summary>
/// Interface that provides dialog functions and events to ViewModels.
/// </summary>
public interface IDialogAware
{
/// <summary>
/// Determines if the dialog can be closed.
/// </summary>
/// <returns>If <c>true</c> the dialog can be closed. If <c>false</c> the dialog will not close.</returns>
bool CanCloseDialog();
/// <summary>
/// Called when the dialog is closed.
/// </summary>
void OnDialogClosed();
/// <summary>
/// Called when the dialog is opened.
/// </summary>
/// <param name="parameters">The parameters passed to the dialog.</param>
void OnDialogOpened(IDialogParameters parameters);
/// <summary>
/// The title of the dialog that will show in the window title bar.
/// </summary>
string Title { get; }
/// <summary>
/// Instructs the <see cref="IDialogWindow"/> to close the dialog.
/// </summary>
event Action<IDialogResult> RequestClose;
}
}
@@ -0,0 +1,63 @@
using System.Collections.Generic;
namespace Prism.Services.Dialogs
{
/// <summary>
/// Represents Dialog parameters.
/// </summary>
/// <remarks>
/// A class that implements this interface can be used to pass
/// object parameters during the showing and closing of Dialogs.
/// </remarks>
public interface IDialogParameters
{
/// <summary>
/// Adds the key and value to the collection.
/// </summary>
/// <param name="key">The key to reference this parameter value in the collection.</param>
/// <param name="value">The parameter value to store.</param>
void Add(string key, object value);
/// <summary>
/// Checks the collection for the presence of a key.
/// </summary>
/// <param name="key">The key to check.</param>
/// <returns><c>true</c> if key exists; <c>false</c> otherwise.</returns>
bool ContainsKey(string key);
/// <summary>
/// The number of parameters in the collection.
/// </summary>
int Count { get; }
/// <summary>
/// The keys in the collection.
/// </summary>
IEnumerable<string> Keys { get; }
/// <summary>
/// Gets the parameter value referenced by a key.
/// </summary>
/// <typeparam name="T">The type of object to be returned.</typeparam>
/// <param name="key">The key of the parameter value to be returned.</param>
/// <returns>The matching parameter of type <typeparamref name="T"/>.</returns>
T GetValue<T>(string key);
/// <summary>
/// Gets all parameter values referenced by a key.
/// </summary>
/// <typeparam name="T">The type of object to be returned.</typeparam>
/// <param name="key">The key of the parameter values to be returned.</param>
///<returns>All matching parameter values of type <typeparamref name="T"/>.</returns>
IEnumerable<T> GetValues<T>(string key);
/// <summary>
/// Gets the parameter value if the referenced key exists.
/// </summary>
/// <typeparam name="T">The type of object to be returned.</typeparam>
/// <param name="key">The key of the parameter value to be returned.</param>
/// <param name="value">The matching parameter of type <typeparamref name="T"/> if the key exists.</param>
/// <returns><c>true</c> if the parameter exists; <c>false</c> otherwise.</returns>
bool TryGetValue<T>(string key, out T value);
}
}
@@ -0,0 +1,19 @@
namespace Prism.Services.Dialogs
{
/// <summary>
/// Contains <see cref="IDialogParameters"/> from the dialog
/// and the <see cref="ButtonResult"/> of the dialog.
/// </summary>
public interface IDialogResult
{
/// <summary>
/// The parameters from the dialog.
/// </summary>
IDialogParameters Parameters { get; }
/// <summary>
/// The result of the dialog.
/// </summary>
ButtonResult Result { get; }
}
}
@@ -0,0 +1,71 @@
using System;
using System.ComponentModel;
using System.Windows;
namespace Prism.Services.Dialogs
{
/// <summary>
/// Interface for a dialog hosting window.
/// </summary>
public interface IDialogWindow
{
/// <summary>
/// Dialog content.
/// </summary>
object Content { get; set; }
/// <summary>
/// Close the window.
/// </summary>
void Close();
/// <summary>
/// The window's owner.
/// </summary>
Window Owner { get; set; }
/// <summary>
/// Show a non-modal dialog.
/// </summary>
void Show();
/// <summary>
/// Show a modal dialog.
/// </summary>
/// <returns></returns>
bool? ShowDialog();
/// <summary>
/// The data context of the window.
/// </summary>
/// <remarks>
/// The data context must implement <see cref="IDialogAware"/>.
/// </remarks>
object DataContext { get; set; }
/// <summary>
/// Called when the window is loaded.
/// </summary>
event RoutedEventHandler Loaded;
/// <summary>
/// Called when the window is closed.
/// </summary>
event EventHandler Closed;
/// <summary>
/// Called when the window is closing.
/// </summary>
event CancelEventHandler Closing;
/// <summary>
/// The result of the dialog.
/// </summary>
IDialogResult Result { get; set; }
/// <summary>
/// The window style.
/// </summary>
Style Style { get; set; }
}
}
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Prism.Common
{
/// <summary>
/// Defines a contract for specifying values associated with a unique key.
/// </summary>
public interface IParameters : IEnumerable<KeyValuePair<string, object>>
{
/// <summary>
/// Adds the specified key and value to the parameter collection.
/// </summary>
/// <param name="key">The key of the parameter to add.</param>
/// <param name="value">The value of the parameter to add.</param>
void Add(string key, object value);
/// <summary>
/// Determines whether the <see cref="IParameters"/> contains the specified <paramref name="key"/>.
/// </summary>
/// <param name="key">The key to search the parameters for existence.</param>
/// <returns>true if the <see cref="IParameters"/> contains a parameter with the specified key; otherwise, false.</returns>
bool ContainsKey(string key);
/// <summary>
/// Gets the number of parameters contained in the <see cref="IParameters"/>.
/// </summary>
int Count { get; }
/// <summary>
/// Gets a collection containing the keys in the <see cref="IParameters"/>.
/// </summary>
IEnumerable<string> Keys { get; }
/// <summary>
/// Gets the parameter associated with the specified <paramref name="key"/>.
/// </summary>
/// <typeparam name="T">The type of the parameter to get.</typeparam>
/// <param name="key">The key of the parameter to find.</param>
/// <returns>A matching value of <typeparamref name="T"/> if it exists.</returns>
T GetValue<T>(string key);
/// <summary>
/// Gets the parameter associated with the specified <paramref name="key"/>.
/// </summary>
/// <typeparam name="T">The type of the parameter to get.</typeparam>
/// <param name="key">The key of the parameter to find.</param>
/// <returns>An <see cref="IEnumerable{T}"/> of all the values referenced by key.</returns>
IEnumerable<T> GetValues<T>(string key);
/// <summary>
/// Gets the parameter associated with the specified <paramref name="key"/>.
/// </summary>
/// <typeparam name="T">The type of the parameter to get.</typeparam>
/// <param name="key">The key of the parameter to get.</param>
/// <param name="value">
/// When this method returns, contains the parameter associated with the specified key,
/// if the key is found; otherwise, the default value for the type of the value parameter.
/// </param>
/// <returns>true if the <see cref="IParameters"/> contains a parameter with the specified key; otherwise, false.</returns>
bool TryGetValue<T>(string key, out T value);
/// <summary>
/// Gets the parameter associated with the specified key (legacy).
/// </summary>
/// <param name="key">The key of the parameter to get.</param>
/// <returns>A matching value if it exists.</returns>
object this[string key] { get; }
}
}
@@ -0,0 +1,198 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace Prism.Common
{
/// <summary>
/// This is a generic parameters base class used for Dialog Parameters and Navigation Parameters.
/// </summary>
public abstract class ParametersBase : IParameters, IEnumerable<KeyValuePair<string, object>>
{
private readonly List<KeyValuePair<string, object>> _entries = new List<KeyValuePair<string, object>>();
/// <summary>
/// Default constructor.
/// </summary>
protected ParametersBase()
{
}
/// <summary>
/// Constructs a list of parameters.
/// </summary>
/// <param name="query">Query string to be parsed.</param>
protected ParametersBase(string query)
{
if (!string.IsNullOrWhiteSpace(query))
{
int num = query.Length;
for (int i = ((query.Length > 0) && (query[0] == '?')) ? 1 : 0; i < num; i++)
{
int startIndex = i;
int num4 = -1;
while (i < num)
{
char ch = query[i];
if (ch == '=')
{
if (num4 < 0)
{
num4 = i;
}
}
else if (ch == '&')
{
break;
}
i++;
}
string key = null;
string value;
if (num4 >= 0)
{
key = query.Substring(startIndex, num4 - startIndex);
value = query.Substring(num4 + 1, (i - num4) - 1);
}
else
{
value = query.Substring(startIndex, i - startIndex);
}
if (key != null)
Add(Uri.UnescapeDataString(key), Uri.UnescapeDataString(value));
}
}
}
/// <summary>
/// Searches Parameter collection and returns value if Collection contains key.
/// Otherwise returns null.
/// </summary>
/// <param name="key">The key for the value to be returned.</param>
/// <returns>The value of the parameter referenced by the key; otherwise <c>null</c>.</returns>
public object this[string key]
{
get
{
foreach (var entry in _entries)
{
if (string.Compare(entry.Key, key, StringComparison.Ordinal) == 0)
{
return entry.Value;
}
}
return null;
}
}
/// <summary>
/// The count, or number, of parameters in collection.
/// </summary>
public int Count => _entries.Count;
/// <summary>
/// Returns an IEnumerable of the Keys in the collection.
/// </summary>
public IEnumerable<string> Keys =>
_entries.Select(x => x.Key);
/// <summary>
/// Adds the key and value to the parameters collection.
/// </summary>
/// <param name="key">The key to reference this value in the parameters collection.</param>
/// <param name="value">The value of the parameter to store.</param>
public void Add(string key, object value) =>
_entries.Add(new KeyValuePair<string, object>(key, value));
/// <summary>
/// Checks collection for presence of key.
/// </summary>
/// <param name="key">The key to check in the collection.</param>
/// <returns><c>true</c> if key exists; else returns <c>false</c>.</returns>
public bool ContainsKey(string key) =>
_entries.ContainsKey(key);
/// <summary>
/// Gets an enumerator for the KeyValuePairs in parameter collection.
/// </summary>
/// <returns>Enumerator.</returns>
public IEnumerator<KeyValuePair<string, object>> GetEnumerator() =>
_entries.GetEnumerator();
/// <summary>
/// Returns the value of the member referenced by key.
/// </summary>
/// <typeparam name="T">The type of object to be returned.</typeparam>
/// <param name="key">The key for the value to be returned.</param>
/// <returns>Returns a matching parameter of <typeparamref name="T"/> if one exists in the Collection.</returns>
public T GetValue<T>(string key) =>
_entries.GetValue<T>(key);
/// <summary>
/// Returns an IEnumerable of all parameters.
/// </summary>
/// <typeparam name="T">The type for the values to be returned.</typeparam>
/// <param name="key">The key for the values to be returned.</param>
///<returns>Returns a IEnumerable of all the instances of type <typeparamref name="T"/>.</returns>
public IEnumerable<T> GetValues<T>(string key) =>
_entries.GetValues<T>(key);
/// <summary>
/// Checks to see if the parameter collection contains the value.
/// </summary>
/// <typeparam name="T">The type for the values to be returned.</typeparam>
/// <param name="key">The key for the value to be returned.</param>
/// <param name="value">Value of the returned parameter if it exists.</param>
public bool TryGetValue<T>(string key, out T value) =>
_entries.TryGetValue(key, out value);
IEnumerator IEnumerable.GetEnumerator() =>
GetEnumerator();
/// <summary>
/// Converts parameter collection to a parameter string.
/// </summary>
/// <returns>A string representation of the parameters.</returns>
public override string ToString()
{
var queryBuilder = new StringBuilder();
if (_entries.Count > 0)
{
queryBuilder.Append('?');
var first = true;
foreach (var kvp in _entries)
{
if (!first)
{
queryBuilder.Append('&');
}
else
{
first = false;
}
queryBuilder.Append(Uri.EscapeDataString(kvp.Key));
queryBuilder.Append('=');
queryBuilder.Append(Uri.EscapeDataString(kvp.Value != null ? kvp.Value.ToString() : ""));
}
}
return queryBuilder.ToString();
}
/// <summary>
/// Adds a collection of parameters to the local parameter list.
/// </summary>
/// <param name="parameters">An IEnumerable of KeyValuePairs to add to the current parameter list.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public void FromParameters(IEnumerable<KeyValuePair<string, object>> parameters) =>
_entries.AddRange(parameters);
}
}
@@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Prism.Common
{
/// <summary>
/// Extension methods for Navigation or Dialog parameters
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ParametersExtensions
{
/// <summary>
/// Searches <paramref name="parameters"/> for <paramref name="key"/>
/// </summary>
/// <typeparam name="T">The type of the parameter to return</typeparam>
/// <param name="parameters">A collection of parameters to search</param>
/// <param name="key">The key of the parameter to find</param>
/// <returns>A matching value of <typeparamref name="T"/> if it exists</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static T GetValue<T>(this IEnumerable<KeyValuePair<string, object>> parameters, string key) =>
(T)GetValue(parameters, key, typeof(T));
/// <summary>
/// Searches <paramref name="parameters"/> for value referenced by <paramref name="key"/>
/// </summary>
/// <param name="parameters">A collection of parameters to search</param>
/// <param name="key">The key of the parameter to find</param>
/// <param name="type">The type of the parameter to return</param>
/// <returns>A matching value of <paramref name="type"/> if it exists</returns>
/// <exception cref="InvalidCastException">Unable to convert the value of Type</exception>
[EditorBrowsable(EditorBrowsableState.Never)]
public static object GetValue(this IEnumerable<KeyValuePair<string, object>> parameters, string key, Type type)
{
foreach (var kvp in parameters)
{
if (string.Compare(kvp.Key, key, StringComparison.Ordinal) == 0)
{
if (TryGetValueInternal(kvp, type, out var value))
return value;
throw new InvalidCastException($"Unable to convert the value of Type '{kvp.Value.GetType().FullName}' to '{type.FullName}' for the key '{key}' ");
}
}
return GetDefault(type);
}
/// <summary>
/// Searches <paramref name="parameters"/> for value referenced by <paramref name="key"/>
/// </summary>
/// <typeparam name="T">The type of the parameter to return</typeparam>
/// <param name="parameters">A collection of parameters to search</param>
/// <param name="key">The key of the parameter to find</param>
/// <param name="value">The value of parameter to return</param>
/// <returns>Success if value is found; otherwise returns <c>false</c></returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool TryGetValue<T>(this IEnumerable<KeyValuePair<string, object>> parameters, string key, out T value)
{
var type = typeof(T);
foreach (var kvp in parameters)
{
if (string.Compare(kvp.Key, key, StringComparison.Ordinal) == 0)
{
var success = TryGetValueInternal(kvp, typeof(T), out object valueAsObject);
value = (T)valueAsObject;
return success;
}
}
value = default;
return false;
}
/// <summary>
/// Searches <paramref name="parameters"/> for value referenced by <paramref name="key"/>
/// </summary>
/// <typeparam name="T">The type of the parameter to return</typeparam>
/// <param name="parameters">A collection of parameters to search</param>
/// <param name="key">The key of the parameter to find</param>
/// <returns>An IEnumerable{T} of all the values referenced by key</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<T> GetValues<T>(this IEnumerable<KeyValuePair<string, object>> parameters, string key)
{
List<T> values = new List<T>();
var type = typeof(T);
foreach (var kvp in parameters)
{
if (string.Compare(kvp.Key, key, StringComparison.Ordinal) == 0)
{
TryGetValueInternal(kvp, type, out var value);
values.Add((T)value);
}
}
return values.AsEnumerable();
}
private static bool TryGetValueInternal(KeyValuePair<string, object> kvp, Type type, out object value)
{
value = GetDefault(type);
var success = false;
if (kvp.Value == null)
{
success = true;
}
else if (kvp.Value.GetType() == type)
{
success = true;
value = kvp.Value;
}
else if (type.IsAssignableFrom(kvp.Value.GetType()))
{
success = true;
value = kvp.Value;
}
else if (type.IsEnum)
{
var valueAsString = kvp.Value.ToString();
if (Enum.IsDefined(type, valueAsString))
{
success = true;
value = Enum.Parse(type, valueAsString);
}
else if (int.TryParse(valueAsString, out var numericValue))
{
success = true;
value = Enum.ToObject(type, numericValue);
}
}
if (!success && type.GetInterface("System.IConvertible") != null)
{
success = true;
value = Convert.ChangeType(kvp.Value, type);
}
return success;
}
/// <summary>
/// Checks to see if key exists in parameter collection
/// </summary>
/// <param name="parameters">IEnumerable to search</param>
/// <param name="key">The key to search the <paramref name="parameters"/> for existence</param>
/// <returns><c>true</c> if key exists; <c>false</c> otherwise</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool ContainsKey(this IEnumerable<KeyValuePair<string, object>> parameters, string key) =>
parameters.Any(x => string.Compare(x.Key, key, StringComparison.Ordinal) == 0);
private static object GetDefault(Type type)
{
if (type.IsValueType)
{
return Activator.CreateInstance(type);
}
return null;
}
}
}
@@ -58,7 +58,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}" BorderBrush="{StaticResource mainColorBrush}"
Checked="chkAutoReadBuyerOrder_CheckedChanged" Checked="chkAutoReadBuyerOrder_CheckedChanged"
Content="自动读买手单" Content="自动读多多买手单"
FontSize="12" FontSize="12"
IsChecked="true" IsChecked="true"
Unchecked="chkAutoReadBuyerOrder_CheckedChanged" /> Unchecked="chkAutoReadBuyerOrder_CheckedChanged" />
@@ -389,9 +389,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
}); });
} }
// 读订单 // 读订单
if (/*(cefAddress.Contains("orders.html")) &&*/ if (/*(cefAddress.Contains("orders.html")) &&*/ url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v")) //https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v4?pdduid=6766109923730
{ {
Task.Run(() => Task.Run(() =>
{ {
@@ -2802,12 +2803,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private void btnHideAll_Click(object sender, RoutedEventArgs e) private void btnHideAll_Click(object sender, RoutedEventArgs e)
{ {
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible) if (MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility != Visibility.Visible)
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible; MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1) if (Panel.GetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl) < 1)
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1); Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, 1);
else else
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1); Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, -1);
} }
private void CheckBox_Click(object sender, RoutedEventArgs e) private void CheckBox_Click(object sender, RoutedEventArgs e)
@@ -34,6 +34,17 @@
Orientation="Vertical" Orientation="Vertical"
VerticalSpacing="2"> VerticalSpacing="2">
<WrapPanel x:Name="wpPddBuyer"> <WrapPanel x:Name="wpPddBuyer">
<CheckBox
x:Name="chkPddBuyerLogin"
Margin="2,2,2,2"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkBuyerLogin_Click"
FontSize="12"
IsChecked="True" />
<ComboBox <ComboBox
x:Name="cmbPddBuyer" x:Name="cmbPddBuyer"
Grid.Column="1" Grid.Column="1"
@@ -108,7 +119,18 @@
<WrapPanel <WrapPanel
x:Name="wpTaobaoBuyer" x:Name="wpTaobaoBuyer"
d:Visibility="Visible" d:Visibility="Visible"
Visibility="Collapsed"> Visibility="Visible">
<CheckBox
x:Name="chkTbBuyerLogin"
Margin="2,2,2,2"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkBuyerLogin_Click"
FontSize="12"
IsChecked="False" />
<ComboBox <ComboBox
x:Name="cmbTaobaoBuyer" x:Name="cmbTaobaoBuyer"
Grid.Column="1" Grid.Column="1"
@@ -189,7 +211,8 @@
c:DebugVisibility.Enable="True" c:DebugVisibility.Enable="True"
d:Visibility="Visible" d:Visibility="Visible"
Click="btnSwitch_Click" Click="btnSwitch_Click"
Style="{StaticResource BasePageButtonStyle}"> Style="{StaticResource BasePageButtonStyle}"
Visibility="Collapsed">
<TextBlock <TextBlock
Grid.Column="2" Grid.Column="2"
Margin="0,0,0,1" Margin="0,0,0,1"
@@ -149,20 +149,38 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
} }
int buyZIndex = 2;
private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
if (wpPddBuyer.Visibility == Visibility.Visible) if (/*wpPddBuyer.Visibility == Visibility.Visible*/ chkPddBuyerLogin.IsChecked == true)
{ {
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible) if (MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility != Visibility.Visible)
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible; MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1) if (Panel.GetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl) < 1)
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1); Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, 1);
else else
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1); Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, -1);
Panel.SetZIndex(MainWindow.Instance.pddBuyerOrderReadCtrl, buyZIndex++);
MainWindow.Instance.pddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
MainWindow.Instance.tbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
}
else if (/*wpTaobaoBuyer.Visibility == Visibility.Visible*/ chkTbBuyerLogin.IsChecked == true)
{
if (MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility != Visibility.Visible)
MainWindow.Instance.gridTbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
if (Panel.GetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl) < 1)
Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, 1);
else
Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, -1);
Panel.SetZIndex(MainWindow.Instance.tbBuyerOrderReadCtrl, buyZIndex++);
MainWindow.Instance.pddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
MainWindow.Instance.tbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
} }
else else
{ {
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1); Panel.SetZIndex(MainWindow.Instance.gridTbBuyerOrderReadCtrl, -1);
} }
} }
@@ -305,5 +323,41 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
} }
} }
private void chkBuyerLogin_Click(object sender, RoutedEventArgs e)
{
if (sender == chkPddBuyerLogin)
{
chkPddBuyerLogin.IsChecked = true;
chkTbBuyerLogin.IsChecked = false;
GlobalConfig.CurrentBuyPlatform = "pdd";
foreach (var order in GlobalConfig.lstOrder)
{
//OrderListCtrl.InitOrderObservableProp(order);
foreach (var orderItem in order.orderItems)
{
orderItem.UpdateOrderItemBuyButton();
orderItem.SetAbnormalAndDirectBtnVisibility();
}
}
}
else
{
chkPddBuyerLogin.IsChecked = false;
chkTbBuyerLogin.IsChecked = true;
GlobalConfig.CurrentBuyPlatform = "tb";
foreach (var order in GlobalConfig.lstOrder)
{
//OrderListCtrl.InitOrderObservableProp(order);
foreach (var orderItem in order.orderItems)
{
orderItem.UpdateOrderItemBuyButton();
orderItem.SetAbnormalAndDirectBtnVisibility();
}
}
}
}
} }
} }
@@ -0,0 +1,598 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PddBuyOrderCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uc="clr-namespace:_29WxOrderWpf.UserControls"
xmlns:wpf="WPFCommon"
x:Name="pddBuyOrderCtrl"
Width="1360"
Height="768"
MinWidth="800"
MinHeight="600"
d:Height="800"
Loaded="pddBuyOrderCtrl_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<Style BasedOn="{StaticResource TitleContentBaseStyle}" TargetType="wpf:TitleContent">
<Setter Property="Placement" Value="Left" />
<Setter Property="TitleVerticalAlignment" Value="Center" />
<Setter Property="LeftTitlePadding" Value="0,0,0,0" />
</Style>
<Style TargetType="wpf:SpacingStackPanel">
<Setter Property="Margin" Value="3,0" />
</Style>
</UserControl.Resources>
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 地址栏 -->
<Border
Grid.Row="0"
Background="White"
BorderBrush="#E0E0E0"
BorderThickness="0,0,0,1">
<TextBox
x:Name="txtAddress"
Margin="3,2"
VerticalContentAlignment="Center"
BorderBrush="#D0D0D0"
BorderThickness="1"
KeyDown="txtAddress_KeyDown"
Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" />
</Border>
<!-- 主区域:浏览器 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True">
<TextBlock
Margin="0,-140,0,0"
Padding="30,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
d:Text="ErrorMsg"
Background="#C0FFFFFF"
FontSize="20"
Foreground="Red"
IsHitTestVisible="False"
Text="{Binding ErrorMsg}"
TextWrapping="Wrap"
Visibility="{Binding ErrorMsg, Converter={StaticResource HasTextVisibility}}" />
<TextBlock
Margin="0,0,0,0"
Padding="30,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
d:Text="TransitErrorMsg"
Background="#C0FFFFFF"
FontSize="20"
Foreground="Red"
IsHitTestVisible="False"
Text="{Binding TransitErrorMsg}"
TextWrapping="Wrap"
Visibility="{Binding TransitErrorMsg, Converter={StaticResource HasTextVisibility}}" />
</Grid>
<GridSplitter
Grid.Column="1"
Width="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#d0d0d0"
ResizeBehavior="PreviousAndNext"
ShowsPreview="True" />
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<wpf:SpacingStackPanel
Grid.Row="0"
Margin="4"
Orientation="Vertical"
VerticalSpacing="4">
<Grid>
<Image
x:Name="imgOrderItem"
Grid.Row="1"
Grid.Column="0"
Width="100"
Height="100"
Margin="0,4,8,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Panel.ZIndex="1"
Cursor="Hand"
MouseDown="imgOrderItem_MouseDown"
Source="{Binding Img}" />
<wpf:SpacingStackPanel
Width="250"
Margin="4"
HorizontalAlignment="Right"
Orientation="Vertical"
VerticalSpacing="4">
<CheckBox
x:Name="chkDirectOrder"
Margin="0,0,0,8"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Content="保存地址时替换为云仓地址"
FontSize="12" />
<wpf:TitleContent
Title="店铺名称:"
HorizontalAlignment="Right"
VerticalAlignment="Top"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtShopName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="订单编号:"
HorizontalAlignment="Right"
VerticalAlignment="Top"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtOrderIdVal}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
<TextBlock FontSize="14" FontWeight="Bold">店铺商品信息:</TextBlock>
<wpf:TitleContent
x:Name="tcShopGoodsName"
Title="店铺标题:"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtShopGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺规格:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopSpecName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSpecNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopSkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSkuIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台商品编码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSpuCode"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSpuCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台SKU编码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSkuCode"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSkuCodeVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:TitleContent
Title="数量:"
Grid.Column="0"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopOrderItemCnt"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="  总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
<TextBox
x:Name="txtShopOrderItemPrice"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemPriceVal}" />
</wpf:TitleContent>
</Grid>
<wpf:SpacingStackPanel
Grid.Row="0"
Margin="0"
Orientation="Vertical"
VerticalSpacing="4"
Visibility="{Binding BuyInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
买手拍单信息:
</TextBlock>
<wpf:TitleContent
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuIdVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:TitleContent
Title="拍单数量:"
Grid.Column="0"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyCnt"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
<TextBox
x:Name="txtBuyPrice"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyPriceVal}" />
</wpf:TitleContent>
</Grid>
<wpf:TitleContent
Title="拍单订单号:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyOrderIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="溯源码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSourceCode"
Height="20"
Background="#DDDDDD"
BorderBrush="#999999"
IsEnabled="False"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSourceCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
x:Name="tcBuyAddress"
Title="中转地址:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyTransitWarehouse"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyTransitWarehouseVal}" />
</wpf:TitleContent>
<Grid>
<Button
x:Name="btnReMap"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding ReMapCommand}"
Content="重新关联商品"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}" />
<Button
x:Name="btnCopyCurrentFullAddress"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="85,0,0,0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding CopyCurrentFullAddressCommand}"
Content="复制完整中转地址"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding CurrentFullTransitAddress, Converter={StaticResource HasTextVisibility}}" />
<Button
x:Name="btnManualUpdateBuyOrder"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
Command="{Binding ManualUpdateBuyOrderCommand}"
Content="手动确认拍单"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</Grid>
</wpf:SpacingStackPanel>
</wpf:SpacingStackPanel>
<wpf:SpacingStackPanel
Grid.Row="2"
Margin="4"
Orientation="Vertical"
VerticalSpacing="4"
Visibility="{Binding MapInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
关联商品信息:
</TextBlock>
<wpf:TitleContent
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapSkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapSkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="关联商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="关联SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapSkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapSkuIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="发货地:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="txtSendProvince"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSendProvinceVal}" />
<Button
x:Name="btnManualUpdateSendProvince"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="3,0,0,0"
Padding="4,0"
HorizontalAlignment="Right"
d:Opacity="0.5"
Content="手动更新发货地"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</Grid>
</wpf:TitleContent>
<wpf:TitleContent
Title="中转仓:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<ComboBox
x:Name="cmbTransitWarehouse"
Height="22"
SelectedIndex="0"
SelectedValue="{Binding cmbTransitWarehouseVal}"
SelectionChanged="cmbTransitWarehouse_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<!--<ComboBoxItem Content="仓库地址" />-->
</ComboBox>
</wpf:TitleContent>
<wpf:TitleContent
Title=""
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Button
x:Name="btnManualUpdateTransitWarehouse"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
Command="{Binding UpdateTransitWarehouseCommand}"
Content="确认商品关联"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,95 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
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>
/// PddBuyOrderCtrl.xaml 的交互逻辑
/// </summary>
public partial class PddBuyOrderCtrl : UserControl
{
/// <summary>视图模型</summary>
public PddBuyOrderViewModel ViewModel { get; }
public PddBuyOrderCtrl(BuyerLoginInfo buyerInfo, oms_wei_order_item_info orderItemInfo)
{
InitializeComponent();
foreach (var warehouse in TransitWarehouseData.TransitWarehouseList)
{
this.cmbTransitWarehouse.Items.Add(warehouse.TransName + " " + warehouse.TransFullAddress);
}
ViewModel = new PddBuyOrderViewModel(buyerInfo, orderItemInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private async void pddBuyOrderCtrl_Loaded(object sender, RoutedEventArgs e)
{
//btnManualUpdateSendProvince.Visibility = Visibility.Collapsed;
if (this.ViewModel.BuyType == "direct")
{
this.tcBuyAddress.Title = "拍单地址:";
}
await ViewModel.Start();
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{
Grid.SetRow(browser, 0);
Grid.SetColumn(browser, 0);
BrowserHost.Children.Add(browser);
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
private void cmbTransitWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void imgOrderItem_MouseDown(object sender, MouseButtonEventArgs e)
{
if (imgOrderItem.Width == 100)
{
imgOrderItem.Width = 500;
imgOrderItem.Height = 500;
}
else
{
imgOrderItem.Width = 100;
imgOrderItem.Height = 100;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -12,6 +12,7 @@
Height="768" Height="768"
MinWidth="800" MinWidth="800"
MinHeight="600" MinHeight="600"
d:Height="800"
Loaded="taobaoBuyOrderCtrl_Loaded" Loaded="taobaoBuyOrderCtrl_Loaded"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>
@@ -64,11 +65,12 @@
Background="White" Background="White"
ClipToBounds="True"> ClipToBounds="True">
<TextBlock <TextBlock
Margin="0,-140,0,0"
Padding="30,20" Padding="30,20"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Panel.ZIndex="99" Panel.ZIndex="99"
d:Text="TextBlock" d:Text="ErrorMsg"
Background="#C0FFFFFF" Background="#C0FFFFFF"
FontSize="20" FontSize="20"
Foreground="Red" Foreground="Red"
@@ -76,6 +78,20 @@
Text="{Binding ErrorMsg}" Text="{Binding ErrorMsg}"
TextWrapping="Wrap" TextWrapping="Wrap"
Visibility="{Binding ErrorMsg, Converter={StaticResource HasTextVisibility}}" /> Visibility="{Binding ErrorMsg, Converter={StaticResource HasTextVisibility}}" />
<TextBlock
Margin="0,0,0,0"
Padding="30,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
d:Text="TransitErrorMsg"
Background="#C0FFFFFF"
FontSize="20"
Foreground="Red"
IsHitTestVisible="False"
Text="{Binding TransitErrorMsg}"
TextWrapping="Wrap"
Visibility="{Binding TransitErrorMsg, Converter={StaticResource HasTextVisibility}}" />
</Grid> </Grid>
<GridSplitter <GridSplitter
Grid.Column="1" Grid.Column="1"
@@ -98,6 +114,18 @@
Orientation="Vertical" Orientation="Vertical"
VerticalSpacing="4"> VerticalSpacing="4">
<Image
x:Name="imgOrderItem"
Grid.Row="1"
Grid.Column="0"
Width="100"
Height="100"
Margin="0,2,8,2"
VerticalAlignment="Top"
Cursor="Hand"
MouseDown="imgOrderItem_MouseDown"
Source="{Binding Img}" />
<TextBlock FontSize="14" FontWeight="Bold">店铺商品信息:</TextBlock> <TextBlock FontSize="14" FontWeight="Bold">店铺商品信息:</TextBlock>
<wpf:TitleContent <wpf:TitleContent
x:Name="tcShopGoodsName" x:Name="tcShopGoodsName"
@@ -337,6 +365,7 @@
</wpf:TitleContent> </wpf:TitleContent>
<wpf:TitleContent <wpf:TitleContent
x:Name="tcBuyAddress"
Title="中转地址:" Title="中转地址:"
TitleHorizontalAlignment="Right" TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}"> TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
@@ -361,6 +390,19 @@
Content="重新关联商品" Content="重新关联商品"
FontSize="12" FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}" /> Style="{StaticResource BasePageButtonLightStyle}" />
<Button
x:Name="btnCopyCurrentFullAddress"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="85,0,0,0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding CopyCurrentFullAddressCommand}"
Content="复制完整中转地址"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding CurrentFullTransitAddress, Converter={StaticResource HasTextVisibility}}" />
<Button <Button
x:Name="btnManualUpdateBuyOrder" x:Name="btnManualUpdateBuyOrder"
Grid.Column="1" Grid.Column="1"
@@ -374,6 +416,18 @@
FontSize="12" FontSize="12"
Style="{StaticResource BasePageButtonStyle}" /> Style="{StaticResource BasePageButtonStyle}" />
</Grid> </Grid>
<TextBlock
Width="auto"
Padding="0,3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
Background="#C0FFFFFF"
FontSize="16"
Foreground="#EE0000"
IsHitTestVisible="False"
Text=" 淘宝网页跳转速度较慢,请耐心等待"
TextWrapping="Wrap" />
</wpf:SpacingStackPanel> </wpf:SpacingStackPanel>
</wpf:SpacingStackPanel> </wpf:SpacingStackPanel>
@@ -443,10 +497,13 @@
TitleHorizontalAlignment="Right" TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}"> TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Grid> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBox <TextBox
x:Name="txtSendProvince" x:Name="txtSendProvince"
Height="20" Height="20"
Margin="0,0,96,0"
BorderBrush="{StaticResource pageColorBrush}" BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1" BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" Style="{StaticResource BaseRoundCornerTextBoxStyle}"
@@ -456,9 +513,10 @@
Grid.Column="1" Grid.Column="1"
Height="20" Height="20"
MinWidth="48" MinWidth="48"
Margin="0" Margin="3,0,0,0"
Padding="4,0" Padding="4,0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
d:Opacity="0.5"
Content="手动更新发货地" Content="手动更新发货地"
FontSize="12" FontSize="12"
Style="{StaticResource BasePageButtonStyle}" /> Style="{StaticResource BasePageButtonStyle}" />
@@ -44,8 +44,25 @@ public partial class TaobaoBuyOrderCtrl : UserControl
private async void taobaoBuyOrderCtrl_Loaded(object sender, RoutedEventArgs e) private async void taobaoBuyOrderCtrl_Loaded(object sender, RoutedEventArgs e)
{ {
btnManualUpdateSendProvince.Visibility = Visibility.Collapsed;
if (this.ViewModel.BuyType == "direct")
{
this.tcBuyAddress.Title = "拍单地址:";
}
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
{
parentWindow.Closed += ParentWindow_Closed;
}
await ViewModel.Start(); await ViewModel.Start();
} }
private void ParentWindow_Closed(object sender, EventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser) private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{ {
Grid.SetRow(browser, 0); Grid.SetRow(browser, 0);
@@ -72,4 +89,18 @@ public partial class TaobaoBuyOrderCtrl : UserControl
{ {
} }
private void imgOrderItem_MouseDown(object sender, MouseButtonEventArgs e)
{
if (imgOrderItem.Width == 100)
{
imgOrderItem.Width = 300;
imgOrderItem.Height = 300;
}
else
{
imgOrderItem.Width = 100;
imgOrderItem.Height = 100;
}
}
} }
@@ -9,6 +9,7 @@ using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses; using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result; using AllBase.Model.Result;
using CefSharp; using CefSharp;
using CefSharp.DevTools.IO;
using CefSharp.Handler; using CefSharp.Handler;
using CefSharp.Wpf; using CefSharp.Wpf;
using NaiBa.Util.Extension; using NaiBa.Util.Extension;
@@ -16,6 +17,8 @@ using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Asn1.Ocsp; using Org.BouncyCastle.Asn1.Ocsp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Security.Policy; using System.Security.Policy;
@@ -24,6 +27,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Imaging;
using TemuKJD.ToolForms; using TemuKJD.ToolForms;
using Work; using Work;
using Work._29Tools.BLL; using Work._29Tools.BLL;
@@ -32,6 +36,7 @@ using Work.BaseForms;
using WxOrder.Framework.Commons; using WxOrder.Framework.Commons;
using WxOrder.Framework.Helpers; using WxOrder.Framework.Helpers;
using static AllBase.DouYinModel.Result.DouOrderListInfo; using static AllBase.DouYinModel.Result.DouOrderListInfo;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using static WPFCommon.Interop.InteropValues; using static WPFCommon.Interop.InteropValues;
@@ -66,6 +71,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
string mapSkuIdTmp = null; string mapSkuIdTmp = null;
string sendProvince = null; string sendProvince = null;
pddFrontGoods3Lite pddFrontGoodsLite = null; pddFrontGoods3Lite pddFrontGoodsLite = null;
/// <summary>
/// 自动读取拍单状态时,网页资源更新,可能会刷新多次,防止重复调用,记录状态只允许调用一次
/// </summary>
private bool HasAutoUpdateBuyStatus = false;
/// <summary> /// <summary>
/// 直发direct 中转transit /// 直发direct 中转transit
@@ -100,6 +109,16 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
get { return this.GetValue(x => x.ErrorMsg); } get { return this.GetValue(x => x.ErrorMsg); }
set { this.SetValue(x => x.ErrorMsg, value); } set { this.SetValue(x => x.ErrorMsg, value); }
} }
public string TransitErrorMsg
{
get { return this.GetValue(x => x.TransitErrorMsg); }
set { this.SetValue(x => x.TransitErrorMsg, value); }
}
public string CurrentFullTransitAddress
{
get { return this.GetValue(x => x.CurrentFullTransitAddress); }
set { this.SetValue(x => x.CurrentFullTransitAddress, value); }
}
public Visibility BuyInfoVisivility public Visibility BuyInfoVisivility
{ {
get { return this.GetValue(x => x.BuyInfoVisivility); } get { return this.GetValue(x => x.BuyInfoVisivility); }
@@ -132,6 +151,16 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
set { this.SetValue(x => x.Address, value); } set { this.SetValue(x => x.Address, value); }
} }
public string txtShopNameVal
{
get { return this.GetValue(x => x.txtShopNameVal); }
set { this.SetValue(x => x.txtShopNameVal, value); }
}
public string txtOrderIdVal
{
get { return this.GetValue(x => x.txtOrderIdVal); }
set { this.SetValue(x => x.txtOrderIdVal, value); }
}
public string txtShopGoodsNameVal public string txtShopGoodsNameVal
{ {
get { return this.GetValue(x => x.txtShopGoodsNameVal); } get { return this.GetValue(x => x.txtShopGoodsNameVal); }
@@ -264,6 +293,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
set { this.SetValue(x => x.cmbTransitWarehouseVal, value); } set { this.SetValue(x => x.cmbTransitWarehouseVal, value); }
} }
public BitmapImage Img
{
get { return this.GetValue(x => x.Img); }
set { this.SetValue(x => x.Img, value); }
}
#endregion #endregion
#region 命令 #region 命令
@@ -276,6 +311,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
/// <summary> 重新关联 </summary> /// <summary> 重新关联 </summary>
public ICommand ReMapCommand { get; } public ICommand ReMapCommand { get; }
public ICommand CopyCurrentFullAddressCommand { get; }
/// <summary> 确认拍单 /// </summary> /// <summary> 确认拍单 /// </summary>
public ICommand ManualUpdateBuyOrderCommand { get; } public ICommand ManualUpdateBuyOrderCommand { get; }
/// <summary> 确认商品关联 </summary> /// <summary> 确认商品关联 </summary>
@@ -298,9 +334,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
CopyUserNameCommand = new DelegateCommand(CopyUserName); CopyUserNameCommand = new DelegateCommand(CopyUserName);
CopyPasswordCommand = new DelegateCommand(CopyPassword); CopyPasswordCommand = new DelegateCommand(CopyPassword);
ReMapCommand = new DelegateCommand(ReMap); ReMapCommand = new DelegateCommand(ReMap);
CopyCurrentFullAddressCommand = new DelegateCommand(CopyCurrentFullAddress);
ManualUpdateBuyOrderCommand = new DelegateCommand(ManualUpdateBuyOrder); ManualUpdateBuyOrderCommand = new DelegateCommand(ManualUpdateBuyOrder);
UpdateTransitWarehouseCommand = new DelegateCommand(UpdateTransitWarehouse); UpdateTransitWarehouseCommand = new DelegateCommand(UpdateTransitWarehouse);
this.txtShopNameVal = orderItem.Shop.ShopAccount;
this.txtOrderIdVal = orderItem.order_id;
this.txtShopSkuIdVal = orderItem.sku_id; this.txtShopSkuIdVal = orderItem.sku_id;
this.txtShopGoodsIdVal = orderItem.product_id; this.txtShopGoodsIdVal = orderItem.product_id;
this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id; this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id;
@@ -322,6 +361,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
BuyInfoVisivility = Visibility.Collapsed; BuyInfoVisivility = Visibility.Collapsed;
MapInfoVisivility = Visibility.Visible; MapInfoVisivility = Visibility.Visible;
} }
Task.Run(() =>
{
Img = AllBase.ImageBuild.LoadBitmipImageFromUrl(orderItem.thumb_img);
});
} }
/// <summary> /// <summary>
@@ -398,6 +442,20 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
public void Stop() public void Stop()
{ {
_isWindowLoaded = false; _isWindowLoaded = false;
// 1. 解除 JS 绑定
CefWebBrowser?.JavascriptObjectRepository?.UnRegisterAll();
CefWebBrowser?.CloseDevTools();
// 2. 优雅关闭浏览器
CefWebBrowser?.GetBrowser()?.CloseBrowser(false);
// 3. 清理残留子进程(按路径判断,避免误杀)
TaobaoLoginViewModel.CleanupBrowserSubprocesses();
// 4. 释放控件
CefWebBrowser?.Dispose();
CefWebBrowser = null;
} }
/// <summary> /// <summary>
@@ -442,21 +500,20 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
cookieLst = new List<Cookie>(); cookieLst = new List<Cookie>();
} }
} }
catch catch (Exception ex)
{ {
} }
// cef138必须init后方可设置或删除cookie // cef138必须init后方可设置或删除cookie
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid) while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
await Task.Delay(20); await Task.Delay(50);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null)); await WPFCEFBrowser.DeleteCookieAsync(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager //cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null)); //await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
foreach (var cook in cookieLst) foreach (var cook in cookieLst)
{ {
await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null)); await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
//t.Wait(5000);
} }
//根据登录的具体店铺设置local storage //根据登录的具体店铺设置local storage
@@ -535,23 +592,38 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
// 打开窗口即进入商品页面一定是拍单,则下一步点击立即购买,随后进入地址修改页面(不能一开始就进入,会掉cookie) // 打开窗口即进入商品页面一定是拍单,则下一步点击立即购买,随后进入地址修改页面(不能一开始就进入,会掉cookie)
if (Address.StartsWith("https://item.taobao.com/item.htm?id=")) if (Address.StartsWith("https://item.taobao.com/item.htm?id=") || Address.StartsWith("https://detail.tmall.com/item.htm?id="))
{ {
if (this.BuyType == "transit")
TransitErrorMsg = "中转仓地址尚未匹配,请等待匹配成功后方可付款!";
try try
{ {
if (transitWarehouse != null && !txtSourceCodeVal.IsNullOrEmpty())
{
var name = TransitWaybillHelper.LastName[Randomx.GetId(TransitWaybillHelper.LastName.Count)] + (Randomx.GetId(2) == 1 ? "先生" : "女士");
var mobile = TransitWaybillHelper.MobileHead[Randomx.GetId(TransitWaybillHelper.MobileHead.Count)] + Randomx.GetNumber(8);
var addressSubValue = Randomx.GetId(1, 35) + Randomx.GetId(1, 9).ToString().PadLeft(2, '0') + "室" + txtSourceCodeVal;
var detail = transitWarehouse.TransDetail + addressSubValue;
var address = name + mobile + transitWarehouse.TransFullAddress + addressSubValue;
CurrentFullTransitAddress = address;
}
// 点击 立即购买/领券购买 // 点击 立即购买/领券购买
Thread.Sleep(Randomx.GetId(500, 1000));
await AutoClickBuyButton(); await AutoClickBuyButton();
// 点击 管理地址(必出验证,暂时url直接跳转) // 点击 管理地址(必出验证,暂时url直接跳转)
//await AutoClickManageAddressButton(); //await AutoClickManageAddressButton();
// 自动修改地址 进入地址页面 // 自动修改地址 进入地址页面
//Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
CefWebBrowser.Load("https://i.taobao.com/my_itaobao/receiver-address-pc"); CefWebBrowser.Load("https://i.taobao.com/my_itaobao/receiver-address-pc");
await AutoChangeAddress(); await AutoChangeAddress();
} }
catch (Exception ex) catch (Exception ex)
{ {
if (!ex.Message.ParseToString().Contains("无法访问已释放的对象"))
BaseMsgWindow.ShowError(ex.Message); BaseMsgWindow.ShowError(ex.Message);
} }
} }
@@ -562,11 +634,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private async Task AutoClickBuyButton() private async Task AutoClickBuyButton()
{ {
for (int i = 0; i < 10 && !Address.StartsWith("https://item.taobao.com/item.htm?id="); i++) for (int i = 0; i < 20 && !Address.StartsWith("https://item.taobao.com/item.htm?id=") && !Address.StartsWith("https://detail.tmall.com/item.htm?id="); i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
} }
if (!Address.StartsWith("https://item.taobao.com/item.htm?id=")) if (!Address.StartsWith("https://item.taobao.com/item.htm?id=") && !Address.StartsWith("https://detail.tmall.com/item.htm?id="))
throw new Exception("当前不在商品界面!"); throw new Exception("当前不在商品界面!");
var client = CefWebBrowser.GetDevToolsClient(); var client = CefWebBrowser.GetDevToolsClient();
@@ -644,12 +716,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
sb.Append(" return 'failed';\r\n"); sb.Append(" return 'failed';\r\n");
sb.Append("})();"); sb.Append("})();");
var jsStr = sb.ToString(); var jsStr = sb.ToString();
for (int i = 0; i < 20 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml"); i++) for (int i = 0; i < 30 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"); i++)
{ {
var r = await client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true); var r = await client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
Thread.Sleep(500); Thread.Sleep(500);
} }
if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml")) if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"))
throw new Exception("购买按钮不存在或点击失败!"); throw new Exception("购买按钮不存在或点击失败!");
//滑块完成验证 //滑块完成验证
@@ -677,7 +749,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
break; break;
} }
if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml")) if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"))
throw new Exception("立即购买点击失败!"); throw new Exception("立即购买点击失败!");
Thread.Sleep(500); Thread.Sleep(500);
@@ -699,11 +771,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private async Task AutoClickManageAddressButton() private async Task AutoClickManageAddressButton()
{ {
for (int i = 0; i < 10 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml"); i++) for (int i = 0; i < 10 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"); i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
} }
if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml")) if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"))
throw new Exception("当前不在结算界面!"); throw new Exception("当前不在结算界面!");
var client = CefWebBrowser.GetDevToolsClient(); var client = CefWebBrowser.GetDevToolsClient();
@@ -735,7 +807,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (jsRst != "success") if (jsRst != "success")
throw new Exception("管理地址按钮不存在!"); throw new Exception("管理地址按钮不存在!");
for (int i = 0; i < 10 && !Address.StartsWith("https://i.taobao.com/my_itaobao/receiver-address-pc"); i++) for (int i = 0; i < 25 && !Address.StartsWith("https://i.taobao.com/my_itaobao/receiver-address-pc"); i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
} }
@@ -805,7 +877,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
await client.Runtime.EvaluateAsync(changeReactInputValueStr, null, true, null, null, true, null, true); await client.Runtime.EvaluateAsync(changeReactInputValueStr, null, true, null, null, true, null, true);
string name = null, mobile = null, detail = null, address = null; string name = null, mobile = null, detail = null, address = null;
if (BuyType == "transit") if (BuyType == "transit") // 中转仓地址
{ {
if (transitWarehouse == null) if (transitWarehouse == null)
throw new Exception("中转仓不存在!"); throw new Exception("中转仓不存在!");
@@ -816,12 +888,19 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var addressSubValue = Randomx.GetId(1, 35) + Randomx.GetId(1, 9).ToString().PadLeft(2, '0') + "室" + txtSourceCodeVal; var addressSubValue = Randomx.GetId(1, 35) + Randomx.GetId(1, 9).ToString().PadLeft(2, '0') + "室" + txtSourceCodeVal;
detail = transitWarehouse.TransDetail + addressSubValue; detail = transitWarehouse.TransDetail + addressSubValue;
address = name + mobile + transitWarehouse.TransFullAddress + addressSubValue; address = name + mobile + transitWarehouse.TransFullAddress + addressSubValue;
}
else // todo 直发 CurrentFullTransitAddress = address;
{
}
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address)) if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address))
throw new Exception("地址获取失败!"); throw new Exception("地址获取失败!");
}
else // 直发
{
if (txtBuyTransitWarehouseVal.ParseToString().Contains("****"))
throw new Exception("地址中含有特殊字符,请手动匹配!");
address = txtBuyTransitWarehouseVal;
}
jsRst = "failed"; jsRst = "failed";
sb = new StringBuilder(); sb = new StringBuilder();
@@ -893,7 +972,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
throw new Exception("识别地址按钮不存在!"); throw new Exception("识别地址按钮不存在!");
//Thread.Sleep(5000); //Thread.Sleep(5000);
// 3.5 比较旧详细地址,详细地址文字有变化才继续操作 // 3.5 比较旧详细地址,详细地址文字有变化才继续操作(为防止直拍万一地址一致,仅校验中转仓)
if (this.BuyType == "transit")
{
jsRst = "failed"; jsRst = "failed";
sb = new StringBuilder(); sb = new StringBuilder();
sb.Append("(function() {\r\n"); sb.Append("(function() {\r\n");
@@ -915,6 +996,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
if (jsRst == "failed" || string.IsNullOrEmpty(jsRst) || jsRst == oldDetailAddressTxt) if (jsRst == "failed" || string.IsNullOrEmpty(jsRst) || jsRst == oldDetailAddressTxt)
throw new Exception("比较旧地址信息失败!"); throw new Exception("比较旧地址信息失败!");
}
// 4.核对详细地址 // 4.核对详细地址
jsRst = "failed"; jsRst = "failed";
@@ -1023,11 +1105,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 7.确定已回到结算页面 // 7.确定已回到结算页面
await client.Runtime.EvaluateAsync("history.go(-1);", null, true, null, null, true, null, true); await client.Runtime.EvaluateAsync("history.go(-1);", null, true, null, null, true, null, true);
for (int i = 0; i < 10 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml"); i++) for (int i = 0; i < 10 && !Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"); i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
} }
if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml")) if (!Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") && !Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm"))
throw new Exception("当前不在结算界面!"); throw new Exception("当前不在结算界面!");
// 8.确定结算页面地址是最新中转仓地址 // 8.确定结算页面地址是最新中转仓地址
@@ -1051,7 +1133,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
Thread.Sleep(500); Thread.Sleep(500);
} }
if (jsRst != "success") if (jsRst != "success")
throw new Exception("中转仓地址错误,请重试后再拍单付款!"); throw new Exception("付款前核对地址错误,请确认地址正确再拍单付款!");
} }
@@ -1072,7 +1154,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
// https://item.taobao.com/item.htm?id=756295486950&skuId=5216824841290 // https://item.taobao.com/item.htm?id=756295486950&skuId=5216824841290
if (currentUrl.Contains("item.taobao.com/item.htm?") && currentUrl.Contains("id") && currentUrl.Contains("skuId")) if ((currentUrl.Contains("item.taobao.com/item.htm?") || currentUrl.Contains("detail.tmall.com/item.htm?")) && currentUrl.Contains("id") && currentUrl.Contains("skuId"))
{ {
if (IsMappingGoods && buymapSkuInfo?.map_skus != null) if (IsMappingGoods && buymapSkuInfo?.map_skus != null)
{ {
@@ -1093,6 +1175,54 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
SetBuyMapValues(); SetBuyMapValues();
} }
} }
// 放到资源更新时候调用,防止触发两次
// "https://web.m.taobao.com/app/tbpc-trade/tbpc-pay-success/home"
if (currentUrl.Contains("app/tbpc-trade/tbpc-pay-success/home") && currentUrl.Contains("?biz_order_id=" + this.txtBuyOrderIdVal))
{
// 拍单后更新状态
if (!HasAutoUpdateBuyStatus)
{
HasAutoUpdateBuyStatus = true;
this.ManualUpdateBuyOrder();
}
}
if (this.BuyType == "transit" && (Address.StartsWith("https://buy.taobao.com/auction/buy_now.jhtml") || Address.StartsWith("https://buy.tmall.com/order/confirm_order.htm")))
{
Task.Run(() =>
{
// 确定结算页面地址是最新中转仓地址
var client = CefWebBrowser.GetDevToolsClient();
try
{
var jsRst = "failed";
var sb = new StringBuilder();
sb.Append("(function() {\r\n");
sb.Append(" var uiElements = document.getElementsByTagName('div');\r\n");
sb.Append(" for (i = 0; i < uiElements.length; i++) {\r\n");
sb.Append(" var uiElement = uiElements[i];\r\n");
sb.Append(" if (uiElement.innerHTML.indexOf('" + txtSourceCodeVal + "') >= 0) {\r\n");
sb.Append(" return 'success';\r\n");
sb.Append(" }\r\n");
sb.Append(" }\r\n");
sb.Append(" return 'failed';\r\n");
sb.Append("})();");
var jsStr = sb.ToString();
for (int i = 0; i < 20 && jsRst != "success"; i++)
{
var t = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
jsRst = t.Result.Result.Value.ParseToString();
Thread.Sleep(500);
}
if (jsRst == "success")
TransitErrorMsg = "";
}
catch (Exception ex)
{
}
});
}
} }
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e) private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
@@ -1123,7 +1253,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
catch (Exception ex) catch (Exception ex)
{ {
} }
}); });
} }
@@ -1136,6 +1265,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
return; return;
} }
await Task.Run(() => { });
// 1.关联或者购买商品 // 1.关联或者购买商品
//https://detail.tmall.com/item.htm?id=655638393036&sku_properties=1627207%3A42499150508 //https://detail.tmall.com/item.htm?id=655638393036&sku_properties=1627207%3A42499150508
//{"appData":null,"loaderData":{"home":{"data":{"res":{"seller":{"sellerNick":"匹克世冠专卖店","shopName":"匹克世冠专卖店","evaluates":[{"score":"4.8 ","level":"1","levelText":"高","title":"宝贝描述","type":"desc"},{"score":"4.8 ","level":"1","levelText":"高","title":"卖家服务","type":"serv"},{"score":"4.8 ","level":"1","levelText":"高","title":"物流服务","type":"post"}],"startsIcon":"https://img.alicdn.com/imgextra/i4/O1CN018GrFIW1Zx7vwjt3Jg_!!6000000003260-2-tps-91-14.png","pcShopUrl":"//shop67269976.taobao.com","creditLevelIcon":"//gw.alicdn.com/imgextra/i1/O1CN01VD9Iap25oweneR31D_!!6000000007574-2-tps-120-60.png","sellerType":"B","encryptUid":"RAzN8HWKpmWFSf9AkzVpz3nhAYRZrPS63pSiDPMWyvui5ixfJBs"},"item":{"images":["https://img.alicdn.com/imgextra/i4/717513321/O1CN01cvzkE61aP4Tjeupfh_!!4611686018427380329-0-item_pic.jpg","https://img.alicdn.com/imgextra/i3/717513321/O1CN01W9mF4N1aP4OAc3Mtt_!!4611686018427380329-0-item_pic.jpg","https://img.alicdn.com/imgextra/i1/717513321/O1CN01a72PTr1aP4S55SiRs_!!4611686018427380329-0-item_pic.jpg"],"title":"匹克态极拖鞋男情侣款夏季外穿潮鞋篮球运动防滑太极沙滩凉拖鞋女","itemId":"655638393036","useWirelessDesc":"true","qrCode":"https://h5.m.taobao.com/awp/core/detail.htm?id=655638393036","spuId":"2122802472","titleIcon":"//img.alicdn.com/tfs/TB1SMG7nnvI8KJjSspjXXcgjXXa-78-36.png?getAvatar=avatar"},"feature":{"pcResistDetail":"true","tmwOverseasScene":"false","pcIdentityRisk":"true"},"plusViewVO":{"askAnswerVO":{"ext":{"skeletonImg":"https://img.alicdn.com/imgextra/i2/O1CN01MLPxBr1flZy969k5W_!!6000000004047-2-tps-1376-1216.png"},"hit":"true"},"addCartActionVO":{"ext":{"type":"dialogWithRecommond_2","frequency":"day:1;repeat:1"},"hit":"true"},"guessLikeVO":{"hit":"true"},"wangwangFlowSplitVO":{"hit":"true"},"rankVO":{"hit":"true"},"tabPlaceholderVO":{"hit":"true"},"imageSearchVO":{"ext":{"textList":["商品已经下架啦~要不要瞧瞧别的~","该区域暂不支持购买","此商品不支持在当前地区销售","商品已经卖光啦~","当前商品仅限店铺会员购买","商品已经卖光啦,非常抱歉","店铺正在打烊中,当前商品不可下单","商品已经卖光啦~","当前库存已售完","该商品有卖家设置的购买门槛,须达门槛才可购买噢~","此商品暂时不能购买"]},"spm":"aliabtest1115297_1138353","hit":"true"},"reportEntranceVO":{"spm":"aliabtest1097211_1051854","hit":"true"},"headAtmosphereBeltVO":{"valid":"false","hit":"true"},"commentListVO":{"ext":{"countShow":"\"false\""},"hit":"true"},"pcFrontSkuQuantityLimitVO":{"hit":"true"},"buyParamVO":{"ext":{"autoApplCoupSource":"pcDetailOrder","needAutoApplCoup":"true"},"hit":"true"}},"skuCore":{"skuItem":{"renderSku":"true","itemStatus":0,"unitBuy":1},"sku2info":{"0":{"moreQuantity":"true","quantity":200,"logisticsTime":"平均9小时发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceDesc":"起","priceMoney":"15700"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967823":{"moreQuantity":"false","quantity":12,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5769423993152":{"moreQuantity":"false","quantity":19,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967808":{"moreQuantity":"false","quantity":46,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967810":{"moreQuantity":"false","quantity":95,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5132110197053":{"moreQuantity":"false","quantity":18,"logisticsTime":"平均9小时发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"169","priceMoney":"16900"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmLine truncated //{"appData":null,"loaderData":{"home":{"data":{"res":{"seller":{"sellerNick":"匹克世冠专卖店","shopName":"匹克世冠专卖店","evaluates":[{"score":"4.8 ","level":"1","levelText":"高","title":"宝贝描述","type":"desc"},{"score":"4.8 ","level":"1","levelText":"高","title":"卖家服务","type":"serv"},{"score":"4.8 ","level":"1","levelText":"高","title":"物流服务","type":"post"}],"startsIcon":"https://img.alicdn.com/imgextra/i4/O1CN018GrFIW1Zx7vwjt3Jg_!!6000000003260-2-tps-91-14.png","pcShopUrl":"//shop67269976.taobao.com","creditLevelIcon":"//gw.alicdn.com/imgextra/i1/O1CN01VD9Iap25oweneR31D_!!6000000007574-2-tps-120-60.png","sellerType":"B","encryptUid":"RAzN8HWKpmWFSf9AkzVpz3nhAYRZrPS63pSiDPMWyvui5ixfJBs"},"item":{"images":["https://img.alicdn.com/imgextra/i4/717513321/O1CN01cvzkE61aP4Tjeupfh_!!4611686018427380329-0-item_pic.jpg","https://img.alicdn.com/imgextra/i3/717513321/O1CN01W9mF4N1aP4OAc3Mtt_!!4611686018427380329-0-item_pic.jpg","https://img.alicdn.com/imgextra/i1/717513321/O1CN01a72PTr1aP4S55SiRs_!!4611686018427380329-0-item_pic.jpg"],"title":"匹克态极拖鞋男情侣款夏季外穿潮鞋篮球运动防滑太极沙滩凉拖鞋女","itemId":"655638393036","useWirelessDesc":"true","qrCode":"https://h5.m.taobao.com/awp/core/detail.htm?id=655638393036","spuId":"2122802472","titleIcon":"//img.alicdn.com/tfs/TB1SMG7nnvI8KJjSspjXXcgjXXa-78-36.png?getAvatar=avatar"},"feature":{"pcResistDetail":"true","tmwOverseasScene":"false","pcIdentityRisk":"true"},"plusViewVO":{"askAnswerVO":{"ext":{"skeletonImg":"https://img.alicdn.com/imgextra/i2/O1CN01MLPxBr1flZy969k5W_!!6000000004047-2-tps-1376-1216.png"},"hit":"true"},"addCartActionVO":{"ext":{"type":"dialogWithRecommond_2","frequency":"day:1;repeat:1"},"hit":"true"},"guessLikeVO":{"hit":"true"},"wangwangFlowSplitVO":{"hit":"true"},"rankVO":{"hit":"true"},"tabPlaceholderVO":{"hit":"true"},"imageSearchVO":{"ext":{"textList":["商品已经下架啦~要不要瞧瞧别的~","该区域暂不支持购买","此商品不支持在当前地区销售","商品已经卖光啦~","当前商品仅限店铺会员购买","商品已经卖光啦,非常抱歉","店铺正在打烊中,当前商品不可下单","商品已经卖光啦~","当前库存已售完","该商品有卖家设置的购买门槛,须达门槛才可购买噢~","此商品暂时不能购买"]},"spm":"aliabtest1115297_1138353","hit":"true"},"reportEntranceVO":{"spm":"aliabtest1097211_1051854","hit":"true"},"headAtmosphereBeltVO":{"valid":"false","hit":"true"},"commentListVO":{"ext":{"countShow":"\"false\""},"hit":"true"},"pcFrontSkuQuantityLimitVO":{"hit":"true"},"buyParamVO":{"ext":{"autoApplCoupSource":"pcDetailOrder","needAutoApplCoup":"true"},"hit":"true"}},"skuCore":{"skuItem":{"renderSku":"true","itemStatus":0,"unitBuy":1},"sku2info":{"0":{"moreQuantity":"true","quantity":200,"logisticsTime":"平均9小时发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceDesc":"起","priceMoney":"15700"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967823":{"moreQuantity":"false","quantity":12,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5769423993152":{"moreQuantity":"false","quantity":19,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967808":{"moreQuantity":"false","quantity":46,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5359436967810":{"moreQuantity":"false","quantity":95,"logisticsTime":"48小时内发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"157","priceMoney":"15700"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmdD1Plv0m1WF"}},"5132110197053":{"moreQuantity":"false","quantity":18,"logisticsTime":"平均9小时发货","price":{"priceTitle":"优惠前","priceColorNew":"#FFFFFF","priceText":"169","priceMoney":"16900"},"cartParam":{"addCartCheck":"true"},"quantityDisplayValue":1,"quantityText":"有货","buyExParams":{"mi_id":"0000m5cdA3X8kO8PXBJ3r8ji8d6gjumNVDVBkp9kKySsEPW3KKjUvUifmLine truncated
@@ -1175,7 +1306,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
continue; continue;
var tbSku2 = dicTaoBaoSku2[key]; var tbSku2 = dicTaoBaoSku2[key];
if (tbSku2.quantity < 1 || tbSku2.quantityText != "有货") if (tbSku2.quantity < 1 || !tbSku2.quantityText.Contains("有货") )
continue; continue;
var taobaoSku = taobaoSkusLst.FirstOrDefault(s => s.skuId == key); var taobaoSku = taobaoSkusLst.FirstOrDefault(s => s.skuId == key);
@@ -1265,12 +1396,17 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var quantity = BaseRegex.GetStringJson(ref dataTmp, "quantity"); var quantity = BaseRegex.GetStringJson(ref dataTmp, "quantity");
this.txtBuyCntVal = quantity; this.txtBuyCntVal = quantity;
} }
// 3.获取订单Id // 3.获取订单Id
if (url.StartsWith("https://h5api.m.taobao.com/h5/mtop.trade.order.create")) if (url.StartsWith("https://h5api.m.taobao.com/h5/mtop.trade.order.create") || url.StartsWith("https://h5api.m.tmall.com/h5/mtop.trade.order.create"))
{ {
//{"api":"mtop.trade.order.create","data":{"alipayOrderId":"2026100823001114311406600349","alipayWapCashierUrl":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0","backUrl":"https://web.m.taobao.com/app/tbpc-trade/tbpc-pay-success/home?biz_order_ids=5127312711003132114","bizOrderId":"5127312711003132114","buyerNumId":2210214614749,"cashierParam":{"sdkExtParams":{}},"clientPayScenario":0,"feature":{"pcRedirectLocation":"orderSuccess.vm","targetURL":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0"},"nextUrl":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0","partSuccess":false,"resultType":0,"secrityPay":true,"signStr":"service=\"mobile.securitypay.pay\"&_input_charset=\"utf-8\"&app_name=\"tb\"&appenv=\"appid=taobao^system=tbwang^version=1.0.0#pc\"&partner=\"PARTNER_TAOBAO_ORDER\"&biz_type=\"trade\"&trade_no=\"2026100823001114311406600349\"&sign_date=\"2026-10-08 16:08:39\"&extern_token=\"1e48bb37ed4474e59b7d10b39491a123\"&monitorType=\"0-buy2.create-doCreatingOrderBiz-0000\"&sign=\"_ov_g_x_y1i_p_q_x6_mgtxgr_h_f_l5_lq_gyr_s_q_g2_sz_k_t1_i%2F2_d3wo_v%2B_t52_n_h_dr_p_e_a%3D%3D\"&sign_type=\"DSA\"","simplePay":true,"useSimplePayForH5":false,"withholdingParams":"{}"},"ret":["SUCCESS::调用成功"],"traceId":"2147844817914469194905047e0ea8","v":"6.0"} //{"api":"mtop.trade.order.create","data":{"alipayOrderId":"2026100823001114311406600349","alipayWapCashierUrl":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0","backUrl":"https://web.m.taobao.com/app/tbpc-trade/tbpc-pay-success/home?biz_order_ids=5127312711003132114","bizOrderId":"5127312711003132114","buyerNumId":2210214614749,"cashierParam":{"sdkExtParams":{}},"clientPayScenario":0,"feature":{"pcRedirectLocation":"orderSuccess.vm","targetURL":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0"},"nextUrl":"https://tbapi.alipay.com/trade/trade_payment.htm?sign_account_no=20884520920143130156&sign_date=1791446919&sign_signature=hme_x_lhum6j77_y_b8m4ge%2F7_q_cbu8_rw_a_r_uru_zz_du0%2F_c_l_u_rkc7sodv_zfh_q%3D%3D&sign_from=3000&trade_no=2026100823001114311406600349&already_check=0","partSuccess":false,"resultType":0,"secrityPay":true,"signStr":"service=\"mobile.securitypay.pay\"&_input_charset=\"utf-8\"&app_name=\"tb\"&appenv=\"appid=taobao^system=tbwang^version=1.0.0#pc\"&partner=\"PARTNER_TAOBAO_ORDER\"&biz_type=\"trade\"&trade_no=\"2026100823001114311406600349\"&sign_date=\"2026-10-08 16:08:39\"&extern_token=\"1e48bb37ed4474e59b7d10b39491a123\"&monitorType=\"0-buy2.create-doCreatingOrderBiz-0000\"&sign=\"_ov_g_x_y1i_p_q_x6_mgtxgr_h_f_l5_lq_gyr_s_q_g2_sz_k_t1_i%2F2_d3wo_v%2B_t52_n_h_dr_p_e_a%3D%3D\"&sign_type=\"DSA\"","simplePay":true,"useSimplePayForH5":false,"withholdingParams":"{}"},"ret":["SUCCESS::调用成功"],"traceId":"2147844817914469194905047e0ea8","v":"6.0"}
txtBuyOrderIdVal = BaseRegex.GetStringJson(ref responseData, "bizOrderId"); txtBuyOrderIdVal = BaseRegex.GetStringJson(ref responseData, "bizOrderId");
} }
if (responseData.Contains("\"bizOrderId\":"))
{
txtBuyOrderIdVal = BaseRegex.GetStringJson(ref responseData, "bizOrderId");
}
//if (url.StartsWith("https://h5api.m.taobao.com/h5/mtop.trade.order.adjust/6.0")) //if (url.StartsWith("https://h5api.m.taobao.com/h5/mtop.trade.order.adjust/6.0"))
//{ //"https://h5api.m.taobao.com/h5/mtop.trade.order.create" //{ //"https://h5api.m.taobao.com/h5/mtop.trade.order.create"
@@ -1284,10 +1420,15 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// //{"api":"mtop.user.getUserSimple","v":"1.0","ret":["SUCCESS::调用成功"],"data":{"nick":"jtt_fan","userNumId":440631048,"displayNick":"jtt_fan"}} // //{"api":"mtop.user.getUserSimple","v":"1.0","ret":["SUCCESS::调用成功"],"data":{"nick":"jtt_fan","userNumId":440631048,"displayNick":"jtt_fan"}}
//} //}
if (url.StartsWith("https://web.m.taobao.com/app/tbpc-trade/tbpc-pay-success/home") && url.Contains("?biz_order_id=" + this.txtBuyOrderIdVal)) //if (currentUrl.Contains("app/tbpc-trade/tbpc-pay-success/home") && currentUrl.Contains("?biz_order_id=" + this.txtBuyOrderIdVal))
{ //{
this.ManualUpdateBuyOrder(); // // 拍单后更新状态
} // if (!HasAutoUpdateBuyStatus)
// {
// HasAutoUpdateBuyStatus = true;
// this.ManualUpdateBuyOrder();
// }
//}
} }
private void SetBuyMapValues() private void SetBuyMapValues()
@@ -1517,7 +1658,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
} }
} }
} }
catch catch (Exception ex)
{ {
} }
} }
@@ -1554,7 +1695,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
GlobalConfig.BuyMapList.RemoveAll(b => buyMapList.Any(map => b.spu_code == map.spu_code && b.sku_code == map.sku_code)); GlobalConfig.BuyMapList.RemoveAll(b => buyMapList.Any(map => b.spu_code == map.spu_code && b.sku_code == map.sku_code));
GlobalConfig.BuyMapList.AddRange(buyMapList); GlobalConfig.BuyMapList.AddRange(buyMapList);
} }
catch catch (Exception ex)
{ {
} }
var tbBuyMap = buyMapList.FirstOrDefault(b => b.spu_code == upSpuCode && b.sku_code == upSkuCode && b.platform == "tb"); var tbBuyMap = buyMapList.FirstOrDefault(b => b.spu_code == upSpuCode && b.sku_code == upSkuCode && b.platform == "tb");
@@ -1635,11 +1776,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
Enabled = false; Enabled = false;
if (BuyType == "transit")
{
#region 正常中转拍单
if (AbnormalTransitWarehouseOrderInfo == null)
{
var addMdyUrl = BaseClass.Build29WxObjString("order/wx_add_mdy_tb_buyer_order"); var addMdyUrl = BaseClass.Build29WxObjString("order/wx_add_mdy_tb_buyer_order");
var addMdyData = UserLogin.GetSignaturex(); var addMdyData = UserLogin.GetSignaturex();
//data3 += "&after_sales_status=" + ""; //data3 += "&after_sales_status=" + "";
@@ -1655,7 +1792,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
addMdyData += "&TransitCreateTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 先设置当前时间,后面有了仓库建仓时间再修改时间 addMdyData += "&TransitCreateTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 先设置当前时间,后面有了仓库建仓时间再修改时间
addMdyData += "&wx_order_id=" + orderItem.order_id; addMdyData += "&wx_order_id=" + orderItem.order_id;
addMdyData += "&wx_sku_id=" + orderItem.sku_id; addMdyData += "&wx_sku_id=" + orderItem.sku_id;
addMdyData += "&wx_send_type=" + 0; addMdyData += "&wx_send_type=" + (BuyType == "direct" ? 1 : 0);
var html3 = GetHtml.PostUtf8(addMdyUrl, addMdyData); var html3 = GetHtml.PostUtf8(addMdyUrl, addMdyData);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200")) if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
html3 = GetHtml.PostUtf8(addMdyUrl, addMdyData); html3 = GetHtml.PostUtf8(addMdyUrl, addMdyData);
@@ -1665,6 +1802,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
return; return;
} }
if (BuyType == "transit")
{
#region 正常中转拍单
if (AbnormalTransitWarehouseOrderInfo == null)
{
JObject body = new JObject(); JObject body = new JObject();
body["orderNo"] = orderItem.order_id; // 微信订单号 body["orderNo"] = orderItem.order_id; // 微信订单号
body["orderSkuId"] = orderItem.sku_id; // 微信商品skuId body["orderSkuId"] = orderItem.sku_id; // 微信商品skuId
@@ -1706,7 +1848,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
code = xmlDoc["AjaxResult"]["code"].InnerText; code = xmlDoc["AjaxResult"]["code"].InnerText;
msg = xmlDoc["AjaxResult"]["msg"].InnerText; msg = xmlDoc["AjaxResult"]["msg"].InnerText;
} }
catch catch (Exception ex)
{ {
msg = exportRst.ParseToString(); msg = exportRst.ParseToString();
} }
@@ -1792,6 +1934,112 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
BaseMsgWindow.ShowInfo("拍单信息保存成功"); BaseMsgWindow.ShowInfo("拍单信息保存成功");
} }
if (BuyType == "direct")
{
#region 直发拍单
var url = BaseClass.Build29WxObjString("order/wx_get_order_item_ext_info");
var data = UserLogin.GetSignaturex();
data += "&wx_order_id_in=" + orderItem.order_id;
data += "&wx_sku_id_in=" + orderItem.sku_id;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
this.ErrorMsg = "直发拍单信息保存失败(01) " + BaseRegex.GetStringJson(ref html, "msg");
return;
}
var existOrderExtList = JsonHelper.DeserializeJsonToList<order_item_ext>(JsonHelper.JObjectParse(html)["data"].ParseToString());
order_item_ext orderExt = new order_item_ext()
{
order_id = orderItem.order_id,
sku_id = orderItem.sku_id,
out_order_id = "tb_" + txtBuyOrderIdVal.Trim(),
shop_app_id = orderItem.Shop.ShopId,
shop_name = orderItem.Shop.ShopAccount,
buy_type = "直发",
};
var url1 = BaseClass.Build29WxObjString("order/wx_add_order_item_ext_info");
if (existOrderExtList.Any(eoe => eoe.order_id == orderExt.order_id && eoe.sku_id == orderExt.sku_id))
url1 = BaseClass.Build29WxObjString("order/wx_mdy_order_item_ext_info");
var data1 = UserLogin.GetSignaturex();
data1 += "&wx_order_id=" + orderExt.order_id;
data1 += "&wx_sku_id=" + orderExt.sku_id;
data1 += "&out_order_id=" + orderExt.out_order_id;
data1 += "&shop_app_id=" + orderExt.shop_app_id;
data1 += "&shop_name=" + orderExt.shop_name;
data1 += "&buy_type=" + orderExt.buy_type;
var html1 = GetHtml.PostUtf8(url1, data1);
if (string.IsNullOrEmpty(html1) || !html1.Contains("\"code\":200"))
{
this.ErrorMsg = "直发拍单信息保存失败(02) " + BaseRegex.GetStringJson(ref html1, "msg");
return;
}
// 拍单后覆盖原售后状态(如果有)
var url2 = BaseClass.Build29WxObjString("order/wx_update_erp_out_after_sale_status");
var data2 = UserLogin.GetSignaturex();
data2 += "&order_id=" + orderItem.order_id;
data2 += "&out_after_sale_status=NULL";
var html2 = GetHtml.PostUtf8(url2, data2);
if (string.IsNullOrEmpty(html2) || !html2.Contains("\"code\":200"))
html2 = GetHtml.PostUtf8(url2, data2);
if (string.IsNullOrEmpty(html2) || !html2.Contains("\"code\":200"))
{
this.ErrorMsg = "直发拍单信息保存失败(03) " + BaseRegex.GetStringJson(ref html2, "msg");
return;
}
JObject obj = new JObject();
obj["platform"] = "WEISHOP";
obj["outAmount"] = (txtBuyPriceVal.ParseToDecimal() * 100).ParseToInt() + "";
obj["outAccount"] = buyer.buyer_name;
obj["orderId"] = orderItem.order_id;
obj["outOrderNo"] = "tb_" + txtBuyOrderIdVal.ParseToString().Trim();
//if (!order.outExpressCompanyCode.IsNullOrEmpty() && !order.tracking_number.IsNullOrEmpty())
//{
// obj["outExpressCompany"] = order.outExpressCompanyCode;
// obj["outExpressNo"] = order.tracking_number;
//}
var dataStr = JsonHelper.SerializeObject(obj);
url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/bind/v2";
//成功 "<ResultVo><code>0</code><msg>SUCCESS</msg><data/><totalRecords/></ResultVo>"
//<AjaxResult><msg>更新微信外采订单状态成功</msg><code>1</code></AjaxResult>
//失败 已存在 <ResultVo><code>1505</code><msg>调用微信接口更新物流信息失败: 非法参数, 同运单号拦截 rid: 69d8ab9c-22baa3b1-67de0d95</msg><data/><totalRecords/></ResultVo>
var exportRst = HttpResponseWXBLL.e57PostResponse(url, dataStr, "");
var code = BaseRegex.GetStringXml(ref exportRst, "code");
var msg = BaseRegex.GetStringXml(ref exportRst, "msg");
if (code == "0" || code == "1")
{
// 利润计算重置为最小值,控件Resource更新时将计算利润
orderItem.ProfitCount = decimal.MinValue;
var order = orderItem?.ItemOrder;
if (order != null)
{
orderItem.OrderItemExt = orderExt;
order.out_account = buyer.buyer_id;
order.out_express_company = "OTHER";
order.out_order_no = "tb_" + txtBuyOrderIdVal.ParseToString().Trim();
orderItem.SetOrderItemTextProperty();
order.SetOrderTextProperty();
MainWindow.Instance.orderListCtrl.FilterOneOrder(order, true);
}
if (!IsAutoBuy)
BaseMsgForm.ShowInfo("拍单信息保存成功");
}
else
{
//order.sendStatus = "发送失败 " + (string.IsNullOrEmpty(msg) ? data : msg);
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("other_buyer_order_list", lstOtherBuyerOrderInfoLite);
this.ErrorMsg = "直发拍单保存失败,服务端返回 " + msg;
return;
}
#endregion
}
this.IsBuySuccess = true; this.IsBuySuccess = true;
if (_isWindowLoaded) if (_isWindowLoaded)
{ {
@@ -1809,6 +2057,23 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
this.MapInfoVisivility = Visibility.Visible; this.MapInfoVisivility = Visibility.Visible;
this.transitWarehouse = null; this.transitWarehouse = null;
this.IsMappingGoods = true; this.IsMappingGoods = true;
this.mapSkuIdTmp = null;
}
public void CopyCurrentFullAddress()
{
for (int i = 0; i < 10; i++)
{
try
{
Clipboard.SetDataObject(CurrentFullTransitAddress);
BaseMsgWindow.ShowInfo("复制成功");
break;
}
catch (Exception ex)
{
}
}
} }
} }
@@ -0,0 +1,735 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.TbBuyerOrderReadCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="tbBuyerOrderReadCtrl"
d:DesignHeight="450"
d:DesignWidth="1000"
Loaded="UserControl_Loaded"
mc:Ignorable="d">
<Border
Background="White"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1,1,0,1"
CornerRadius="5,0,0,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button
x:Name="btnHideAll"
Grid.Row="1"
Width="25"
Height="60"
Margin="-20,0,0,20"
HorizontalAlignment="left"
Click="btnHideAll_Click"
Style="{StaticResource BasePageButtonStyle}">
<TextBlock Margin="0,0,5,0">
关<LineBreak />
闭</TextBlock>
</Button>
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
Width="16"
Height="16"
Margin="12,0,4,0"
Cursor="Hand"
MouseLeftButtonUp="btnHideAll_Click"
Source="{StaticResource imgCloseGray}"
Visibility="Collapsed" />
<WrapPanel Grid.Column="1" VerticalAlignment="Center">
<CheckBox
x:Name="chkAutoReadBuyerOrder"
Margin="6,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Checked="chkAutoReadBuyerOrder_CheckedChanged"
Content="自动读淘宝买手单"
FontSize="12"
IsChecked="true"
Unchecked="chkAutoReadBuyerOrder_CheckedChanged" />
<CheckBox
x:Name="chkHideNoWxIdOrder"
Margin="6,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Checked="chkHideNoWxIdOrder_CheckedChanged"
Content="隐藏无微信订单的买手单"
FontSize="12"
IsChecked="True"
Unchecked="chkHideNoWxIdOrder_CheckedChanged" />
<CheckBox
x:Name="chkAutoAfterSale"
Margin="6,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Checked="chkAutoAfterSale_Checked"
Content="未发货订单自动售后"
FontSize="12"
IsChecked="True"
Unchecked="chkAutoAfterSale_Checked"
Visibility="Visible" />
<Button
x:Name="btnSearch"
Grid.Column="8"
Width="118"
Height="24"
Margin="4,0,0,0"
Click="btnSearch_Click"
Content="刷新订单"
Style="{StaticResource BasePageButtonStyle}" />
<Button
x:Name="btnNextBuyer"
Grid.Column="8"
Height="24"
Margin="4,0,0,0"
Padding="4,0"
Click="btnNextBuyer_Click"
Content="下一个买手"
Style="{StaticResource BasePageButtonStyle}" />
</WrapPanel>
<TextBox
x:Name="txtFilter"
Grid.Column="2"
Height="28"
Margin="28,0,8,0"
VerticalContentAlignment="Center"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
TextChanged="txtFilter_TextChanged" />
<Button
x:Name="btnFilter"
Grid.Column="3"
Width="50"
Height="24"
Margin="4,0,8,0"
Click="btnFilter_Click"
Content="过滤"
Style="{StaticResource BasePageButtonStyle}" />
</Grid>
<Grid
x:Name="GridCef"
Grid.Row="1"
Background="LightGray" />
<Grid
Grid.Row="1"
Margin="2,2,0,334"
HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Border
x:Name="borderTbBuyer"
Width="138"
Background="White"
CornerRadius="0,4,4,0">
<Grid>
<ListBox x:Name="lbTbBuyer">
<!-- 使用自定义属性模板去除ListBox高亮显示框 -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--<local:ShopListRowCtrl></local:ShopListRowCtrl>-->
<Border
MinHeight="50"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
BorderBrush="{StaticResource ListRowBorderColorBrush}"
BorderThickness="0,0,0,1"
CornerRadius="0">
<Border.Style>
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid x:Name="gridListItem">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="colCheck" Width="25*" />
<ColumnDefinition x:Name="colBuyerName" Width="100*" />
</Grid.ColumnDefinitions>
<CheckBox
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Click="CheckBox_Click"
IsChecked="{Binding IsSelect, Mode=TwoWay}" />
<TextBox
x:Name="txtBuyerNick"
Grid.Column="1"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Hand"
IsReadOnly="True"
Loaded="txtBuyerNick_Loaded"
Text="{Binding buyer_nick}"
TextWrapping="Wrap" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
<Border
Grid.Column="1"
Height="60"
Margin="-2,0,0,0"
VerticalAlignment="Center"
Panel.ZIndex="-1"
Background="{StaticResource pageColorBrush}"
CornerRadius="0,5,5,0"
Cursor="Hand">
<Button
x:Name="btnHideBuyer"
Grid.Column="1"
Width="20"
Height="60"
Margin="0,0,0,0"
Padding="0,0,0,0"
VerticalContentAlignment="Center"
Click="btnHideBuyer_Click"
Content="◀"
Style="{StaticResource BasePageButtonStyle}" />
</Border>
</Grid>
<Grid
Grid.Row="1"
Margin="0"
VerticalAlignment="Bottom"
Background="Transparent"
Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Button
x:Name="btnHide"
Width="60"
Height="25"
Margin="0,0,0,-10"
Padding="0,2,0,0"
VerticalContentAlignment="top"
Click="btnHide_Click"
Content="▼"
Style="{StaticResource BasePageButtonStyle}" />
<Grid
x:Name="gridTable"
Grid.Row="1"
Height="330"
Margin="2"
VerticalAlignment="Bottom"
Background="White"
Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label
x:Name="lblMsg"
Margin="180,0,0,0"
VerticalAlignment="Center"
Panel.ZIndex="1"
Content="正在操作:" />
<TabControl
x:Name="tabOrderType"
Grid.Row="1"
Margin="0,-32,0,1"
VerticalAlignment="Stretch">
<TabControl.Resources>
<Style TargetType="{x:Type TabControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border
Grid.Row="1"
MinHeight="4"
Background="#f8f8f9"
BorderBrush="#e0e0e0"
BorderThickness="1,1,1,0"
CornerRadius="0,4,0,0">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" />
</Border>
<Border
Margin="0,0,0,0"
HorizontalAlignment="Left"
Background="#e8e8e9"
BorderBrush="#e1e1e1"
BorderThickness="1,1,1,0"
CornerRadius="4,4,0,0">
<TabPanel
x:Name="HeaderPanel"
Background="Transparent"
IsItemsHost="True" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TabItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border
Name="Border"
Margin="-1,-2,-1,0"
BorderThickness="1,1,1,0"
CornerRadius="4,4,0,0">
<ContentPresenter
x:Name="ContentSite"
Margin="10,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="#f8f8f9" />
<Setter TargetName="Border" Property="BorderBrush" Value="#e0e0e0" />
<Setter TargetName="Border" Property="Margin" Value="-1,-3,-1,-1" />
<Setter Property="Foreground" Value="{StaticResource pageColorBrush}" />
<Setter Property="Panel.ZIndex" Value="100" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#999999" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem Header="买手订单">
<DataGrid
x:Name="dgBuyerOrder"
Grid.Row="1"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
ColumnHeaderHeight="30"
HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
LoadingRow="dgBuyerOrder_LoadingRow"
RowHeaderWidth="0"
RowHeight="50"
SelectionChanged="dgBuyerOrder_SelectionChanged"
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}">
<DataGrid.Columns>
<DataGridTextColumn
Width="40"
Binding="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}"
CanUserSort="False"
Header="序列"
IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.6*"
Binding="{Binding WxSendTypeStr}"
Header="是否直发">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.5*"
Binding="{Binding order_sn}"
Header="拍单订单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.5*"
Binding="{Binding ShopOrderIdStr}"
Header="店铺订单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding buyerName}"
Header="买手名称">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.8*"
Binding="{Binding OrderTimeStr}"
Header="拍单时间">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.8*"
Binding="{Binding ProdInfoStr}"
Header="商品信息">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.8*"
Binding="{Binding AmoutValue}"
Header="金额">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding order_status_prompt}"
Header="订单状态">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding outExpressCompanyCode}"
Header="物流名称">
<!-- outExpressCompanyName -->
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding tracking_number}"
Header="物流单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding sendStatus}"
Header="订单信息">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn
x:Name="colSendBuyerOrder"
Width="0.6*"
Header="手动发送">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Button
x:Name="btnSendBuyerOrder"
Grid.Row="2"
Grid.Column="1"
Margin="4,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
Click="btnSendBuyerOrder_Click"
Content="发送"
Foreground="{StaticResource PageLinkBrush}"
Visibility="{Binding TransitWarehouseIdStr, Converter={StaticResource HasTextVisibility}}" />
<Button
x:Name="btnSendDirectBuyerOrder"
Grid.Row="2"
Grid.Column="1"
Margin="4,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
Click="btnSendBuyerOrder_Click"
Content="发送"
Foreground="{StaticResource PageLinkBrush}"
Visibility="{Binding WxSendTypeStr, Converter={StaticResource HasTextVisibility}}" />
<!-- 直发单直发标注不为空 -->
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Header="买手售后">
<DataGrid
x:Name="dgBuyerAfterSale"
Grid.Row="1"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
ColumnHeaderHeight="30"
HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
LoadingRow="dgBuyerOrder_LoadingRow"
RowHeaderWidth="0"
RowHeight="50"
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}">
<DataGrid.Columns>
<DataGridTextColumn
Width="40"
Binding="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}"
CanUserSort="False"
Header="序列"
IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.6*"
Binding="{Binding WxSendTypeStr}"
Header="是否直发">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.5*"
Binding="{Binding afterSalesId}"
Header="售后单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.5*"
Binding="{Binding orderSn}"
Header="拍单订单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.5*"
Binding="{Binding ShopOrderIdStr}"
Header="店铺订单号">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding buyerName}"
Header="买手名称">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.8*"
Binding="{Binding orderDate}"
Header="拍单日期">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1.8*"
Binding="{Binding ProdInfoStr}"
Header="商品信息">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.8*"
Binding="{Binding OrderAmountValue}"
Header="订单金额">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="0.8*"
Binding="{Binding RefundAmountValue}"
Header="售后金额">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding AfterSaleStatusStr}"
Header="售后状态">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn
Width="1*"
Binding="{Binding sendStatus}"
Header="订单信息">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<!--<DataGridTemplateColumn Width="0.6*" Header="手动发送" x:Name="colSendBuyerOrderAfterSale" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Grid.Column="1" Grid.Row="2" x:Name="btnSendBuyerOrder" VerticalAlignment="Center" Background="Transparent" HorizontalAlignment="Center"
Foreground="{StaticResource PageLinkBrush}" BorderBrush="Transparent" Margin="4,0,0,0" Content="发送" Click="btnSendBuyerOrder_Click"
Visibility="{Binding TransitWarehouseIdStr, Converter={StaticResource HasTextVisibility}}"></Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</Grid>
</Grid>
</Grid>
</Border>
</UserControl>
File diff suppressed because it is too large. Load diff
@@ -7,6 +7,7 @@ using _29WxOrderWpf.Services;
using AllBase.Helper; using AllBase.Helper;
using AllBase.Model.DBModel; using AllBase.Model.DBModel;
using NaiBa.Util.Extension; using NaiBa.Util.Extension;
using Prism.Services.Dialogs;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -308,11 +309,8 @@ public partial class OrderListCtrl
private void ShowPDDInvoiceDialog() private void ShowPDDInvoiceDialog()
{ {
new DialogWindow var view = new PDDInvoiceView();
{ DialogService.Show(view);
Title = "发票助手",
Content = new PDDInvoiceView()
}.Show();
} }
#endregion #endregion
} }
@@ -306,9 +306,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 读取暂时记录的买手订单,后面想办法放到中转订单库里去 // 读取暂时记录的买手订单,后面想办法放到中转订单库里去
var pddBuyerOrders = GetPddBuyerOrders(order_ids); var pddBuyerOrders = GetPddBuyerOrders(order_ids);
// 读取暂时记录的淘宝买手订单(格式与拼多多的一致,存在不同的表中),后面想办法放到中转订单库里去
pddBuyerOrders.AddRange(GetTbBuyerOrders(order_ids));
// 读取暂时记录的买手售后单,后面想办法放到中转订单库里去 // 读取暂时记录的买手售后单,后面想办法放到中转订单库里去
var pddBuyerAfterSales = GetPddBuyerAfterSales(order_ids); var pddBuyerAfterSales = GetPddBuyerAfterSales(order_ids);
// 读取暂时记录的淘宝买手售后单(格式与拼多多的一致,存在不同的表中),后面想办法放到中转订单库里去
pddBuyerAfterSales.AddRange(GetTbBuyerAfterSales(order_ids));
// 同步单 // 同步单
var buyerIds = string.Join(",", pddBuyerOrders.Select(o => o.order_sn)); var buyerIds = string.Join(",", pddBuyerOrders.Select(o => o.order_sn));
@@ -736,6 +740,34 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return new List<order_pdd_buyer_order>(); return new List<order_pdd_buyer_order>();
} }
public static List<order_pdd_buyer_order> GetTbBuyerOrders(string order_ids)
{
if (string.IsNullOrEmpty(order_ids))
return new List<order_pdd_buyer_order>();
var url4 = BaseClass.Build29WxObjString("order/wx_get_tb_buyer_order_list");
var data4 = UserLogin.GetSignaturex();
data4 += "&wx_order_id_in=" + order_ids;
var html4 = GetHtml.PostUtf8(url4, data4);
if (string.IsNullOrEmpty(html4) || !html4.Contains("\"code\":200"))
html4 = GetHtml.PostUtf8(url4, data4);
if (string.IsNullOrEmpty(html4) || !html4.Contains("\"code\":200"))
{
BaseMsgWindow.ShowAnimateMessage("订单读取失败(买手) " + BaseRegex.GetStringJson(ref html4, "msg"), "Error", 5);
}
List<order_pdd_buyer_order> pddBuyerOrders = new List<order_pdd_buyer_order>();
try
{
pddBuyerOrders = JsonHelper.DeserializeJsonToList<order_pdd_buyer_order>(JObject.Parse(html4)["data"].ParseToString())
.OrderByDescending(p => p.TransitCreateTime).ToList();
return pddBuyerOrders;
}
catch
{
}
return new List<order_pdd_buyer_order>();
}
public static List<order_pdd_buyer_after_sale> GetPddBuyerAfterSales(string order_ids) public static List<order_pdd_buyer_after_sale> GetPddBuyerAfterSales(string order_ids)
{ {
var url6 = BaseClass.Build29WxObjString("order/wx_get_buyer_after_sale_list"); var url6 = BaseClass.Build29WxObjString("order/wx_get_buyer_after_sale_list");
@@ -764,6 +796,34 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return new List<order_pdd_buyer_after_sale>(); return new List<order_pdd_buyer_after_sale>();
} }
public static List<order_pdd_buyer_after_sale> GetTbBuyerAfterSales(string order_ids)
{
var url6 = BaseClass.Build29WxObjString("order/wx_get_tb_buyer_after_sale_list");
var data6 = UserLogin.GetSignaturex();
data6 += "&wx_order_id_in=" + order_ids;
List<order_pdd_buyer_after_sale> pddBuyerAfterSales = new List<order_pdd_buyer_after_sale>();
if (!string.IsNullOrEmpty(order_ids))
{
var html6 = GetHtml.PostUtf8(url6, data6);
if (string.IsNullOrEmpty(html6) || !html6.Contains("\"code\":200"))
html6 = GetHtml.PostUtf8(url6, data6);
if (string.IsNullOrEmpty(html6) || !html6.Contains("\"code\":200"))
{
BaseMsgWindow.ShowAnimateMessage("订单读取失败(买手售后) " + BaseRegex.GetStringJson(ref html6, "msg"), "Error", 6);
return new List<order_pdd_buyer_after_sale>();
}
try
{
pddBuyerAfterSales = JsonHelper.DeserializeJsonToList<order_pdd_buyer_after_sale>(JObject.Parse(html6)["data"].ParseToString()).OrderByDescending(p => p.TransitCreateTime).ToList();
return pddBuyerAfterSales;
}
catch
{
}
}
return new List<order_pdd_buyer_after_sale>();
}
public static List<yh_sync_logistics> GetSyncLogistics(string buyer_order_ids, int? not_upload_pickup_status = null) public static List<yh_sync_logistics> GetSyncLogistics(string buyer_order_ids, int? not_upload_pickup_status = null)
{ {
var url6 = BaseClass.Build29WxObjString("order/wx_get_sync_waybill"); var url6 = BaseClass.Build29WxObjString("order/wx_get_sync_waybill");
@@ -1188,15 +1248,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
if (orderItem.order_id == "3739105285145538816") if (orderItem.order_id == "3739105285145538816")
{ {
} }
if (order.OrderBuyType == "直发" || order.OrderBuyType == "云改直") if (order.OrderBuyType == "直发" || order.OrderBuyType == "云改直")
{ {
if (order.out_after_sale_status.ParseToString().Contains("待用户发货") && !(orderItem.DistribReturnOrderInfo?.real_logistics_express_code).IsNullOrEmpty()) if (order.out_after_sale_status.ParseToString().Contains("待用户发货") && !(orderItem.DistribReturnOrderInfo?.real_logistics_express_code).IsNullOrEmpty())
{ {
string orderSn = order.out_order_no; string orderSn = order.out_order_no;
if (orderSn.IsNullOrEmpty()) if (orderSn.IsNullOrEmpty() || orderSn.StartsWith("tb_")) // 无外采或淘宝外采直接退出
continue; continue;
string buyerNickName = order.out_account; string buyerNickName = order.out_account;
if (buyerNickName.IsNullOrEmpty()) if (buyerNickName.IsNullOrEmpty())
@@ -2447,16 +2505,25 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
if (tmpOrderItem.order_id == "3739296914665288192") if (tmpOrderItem.order_id == "3739296914665288192")
{ {
} }
Dispatcher.Invoke(new Action(() => { BottomMsg = "正在处理买手退货,总计:" + tmpOrderItems.Count + ",已处理:" + index++; })); Dispatcher.Invoke(new Action(() => { BottomMsg = "正在处理买手退货,总计:" + tmpOrderItems.Count + ",已处理:" + index++; }));
var pddOrderSn = ""; var outOrderSn = "";
if (tmpOrderItem.ItemOrder?.OrderBuyType == "云仓") if (tmpOrderItem.ItemOrder?.OrderBuyType == "云仓")
pddOrderSn = tmpOrderItem.ItemTransitOrderWithVoid?.out_order_no; outOrderSn = tmpOrderItem.ItemTransitOrderWithVoid?.out_order_no;
else if (tmpOrderItem.ItemOrder?.OrderBuyType == "直发" || tmpOrderItem.ItemOrder?.OrderBuyType == "云改直") else if (tmpOrderItem.ItemOrder?.OrderBuyType == "直发" || tmpOrderItem.ItemOrder?.OrderBuyType == "云改直")
pddOrderSn = tmpOrderItem.ItemOrder?.out_order_no; outOrderSn = tmpOrderItem.ItemOrder?.out_order_no;
if (outOrderSn.StartsWith("tb_"))
{
// todo 淘宝退货暂时不处理
}
else
{
#region 拼多多外采退货
var pddOrderSn = outOrderSn;
BuyerLoginInfo buyer = null; BuyerLoginInfo buyer = null;
if (tmpOrderItem.ItemOrder?.OrderBuyType == "云仓") if (tmpOrderItem.ItemOrder?.OrderBuyType == "云仓")
@@ -2663,6 +2730,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
} }
MainWindow.Instance.orderListCtrl.GetOrder(tmpOrderItem.order_id); MainWindow.Instance.orderListCtrl.GetOrder(tmpOrderItem.order_id);
Dispatcher.Invoke(new Action(() => { BottomMsg = "正在处理买手退货,总计:" + tmpOrderItems.Count + ",已处理:" + index; })); Dispatcher.Invoke(new Action(() => { BottomMsg = "正在处理买手退货,总计:" + tmpOrderItems.Count + ",已处理:" + index; }));
#endregion
}
} }
Dispatcher.Invoke(new Action(() => { BottomMsg = "买手退货处理完成,总计:" + tmpOrderItems.Count + ",已处理:" + index; })); Dispatcher.Invoke(new Action(() => { BottomMsg = "买手退货处理完成,总计:" + tmpOrderItems.Count + ",已处理:" + index; }));
@@ -2993,6 +3062,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
break; break;
} }
IsAutoBuy = false; IsAutoBuy = false;
BaseMsgWindow.ShowInfo("自动拍单结束!");
} }
private void btnAutoBuyIntroduction_Click(object sender, RoutedEventArgs e) private void btnAutoBuyIntroduction_Click(object sender, RoutedEventArgs e)
@@ -3060,6 +3130,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public static bool GetNeedBuyerAfterSale(string buyerAfterSaleStatus) public static bool GetNeedBuyerAfterSale(string buyerAfterSaleStatus)
{ {
if (buyerAfterSaleStatus == null)
return false;
if (buyerAfterSaleStatus.Contains("待用户发货") || GetNeedBuyerNewAfterSale(buyerAfterSaleStatus)) if (buyerAfterSaleStatus.Contains("待用户发货") || GetNeedBuyerNewAfterSale(buyerAfterSaleStatus))
return true; return true;
return false; return false;
@@ -3067,6 +3140,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public static bool GetNeedBuyerNewAfterSale(string buyerAfterSaleStatus) public static bool GetNeedBuyerNewAfterSale(string buyerAfterSaleStatus)
{ {
if (buyerAfterSaleStatus == null)
return false;
if (buyerAfterSaleStatus.Contains("需手动申请售后") || buyerAfterSaleStatus.Contains("已申请售后 退款失败") || buyerAfterSaleStatus.Contains("已取消申请") || string.IsNullOrEmpty(buyerAfterSaleStatus)) if (buyerAfterSaleStatus.Contains("需手动申请售后") || buyerAfterSaleStatus.Contains("已申请售后 退款失败") || buyerAfterSaleStatus.Contains("已取消申请") || string.IsNullOrEmpty(buyerAfterSaleStatus))
return true; return true;
return false; return false;
@@ -867,6 +867,7 @@
Margin="-2,2,4,2" Margin="-2,2,4,2"
Padding="0" Padding="0"
VerticalAlignment="Top" VerticalAlignment="Top"
d:Text="BBB采购废柴"
Background="Transparent" Background="Transparent"
BorderThickness="0" BorderThickness="0"
Cursor="Hand" Cursor="Hand"
@@ -911,6 +912,7 @@
Margin="-2,2" Margin="-2,2"
Padding="0" Padding="0"
VerticalAlignment="Top" VerticalAlignment="Top"
d:Text="261009-123456…"
Background="Transparent" Background="Transparent"
BorderThickness="0" BorderThickness="0"
Cursor="Hand" Cursor="Hand"
@@ -518,14 +518,21 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
if (GlobalConfig.CurrentBuyPlatform == "pdd") if (GlobalConfig.CurrentBuyPlatform == "pdd")
PddBuyOrder(orderItem, isAbnormalOrder, isAutoBuy); PddBuyOrder(orderItem, isAbnormalOrder, isAutoBuy);
//PddBuyOrderWpf(orderItem, isAbnormalOrder, isAutoBuy);
else if (GlobalConfig.CurrentBuyPlatform == "tb") else if (GlobalConfig.CurrentBuyPlatform == "tb")
TbBuyOrder(orderItem, isAbnormalOrder, isAutoBuy); TbBuyOrderWpf(orderItem, isAbnormalOrder, isAutoBuy);
})); }));
}); });
} }
public static void TbBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy) public static void TbBuyOrderWpf(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{ {
if (GlobalConfig.CurrentTaobaoBuyer == null)
{
BaseMsgWindow.ShowError("未选择买手!");
return;
}
TaobaoBuyOrderCtrl taobaoBuyView = new TaobaoBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem); TaobaoBuyOrderCtrl taobaoBuyView = new TaobaoBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
//https://item.taobao.com/item.htm?id=756295486950&skuId=5216824841295 //https://item.taobao.com/item.htm?id=756295486950&skuId=5216824841295
if (orderItem.TbBuyMap != null) if (orderItem.TbBuyMap != null)
@@ -542,7 +549,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
taobaoBuyView.ViewModel.AbnormalTransitWarehouseOrderInfo = orderItem.ItemTransitOrder; taobaoBuyView.ViewModel.AbnormalTransitWarehouseOrderInfo = orderItem.ItemTransitOrder;
new DialogWindow() new DialogWindow()
{ {
Title = "淘宝买手登录", Title = "买手拍单 - 当前买手 " + GlobalConfig.CurrentTaobaoBuyer.buyer_nick,
Content = taobaoBuyView, Content = taobaoBuyView,
//Height = System.Windows.Forms.SystemInformation.WorkingArea.Height - 80, //Height = System.Windows.Forms.SystemInformation.WorkingArea.Height - 80,
//Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 80, //Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 80,
@@ -572,6 +579,61 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
} }
} }
public static void PddBuyOrderWpf(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{
if (GlobalConfig.CurrentPddBuyer == null)
{
BaseMsgWindow.ShowError("未选择买手!");
return;
}
PddBuyOrderCtrl pddBuyView = new PddBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
if (orderItem.PddBuyMap != null)
{
pddBuyView.ViewModel.InitUrl = "https://mobile.yangkeduo.com/order_checkout.html?sku_id=" + orderItem.PddBuyMap.map_sku_id +
"&group_id=1" + Randomx.GetNumber(11) + "&goods_id=" + orderItem.PddBuyMap.map_goods_id + "&goods_number=" + orderItem.sku_cnt +
"&page_from=101";
pddBuyView.ViewModel.IsAutoBuy = isAutoBuy;
}
else
{
pddBuyView.ViewModel.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";
pddBuyView.ViewModel.IsMappingGoods = true;
}
if (isAbnormalOrder)
pddBuyView.ViewModel.AbnormalTransitWarehouseOrderInfo = orderItem.ItemTransitOrder;
new DialogWindow()
{
Title = "买手拍单 - 当前买手 " + GlobalConfig.CurrentPddBuyer.buyer_nick,
Content = pddBuyView,
//Height = System.Windows.Forms.SystemInformation.WorkingArea.Height - 80,
//Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 80,
Width = SystemParameters.PrimaryScreenWidth < 1920 ? SystemParameters.PrimaryScreenWidth : SystemParameters.PrimaryScreenWidth * 90 / 100,
Height = SystemParameters.PrimaryScreenHeight * 90 / 100,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
}.ShowDialog();
// 记录窗口内传出的是否继续自动拍单属性
OrderListCtrl.IsAutoBuy = pddBuyView.ViewModel.IsAutoBuy;
// 如果购买成功,修改供应商信息
if (pddBuyView.ViewModel.IsBuySuccess)
{
Task.Run(async () =>
{
if (orderItem.BuyGoodsBtnTxt == "云仓拍单" && !isAbnormalOrder) // 异常拍单不改变订单供应商
{
try
{
await SetSendOrderSupplier(orderItem, "wxfc630d60a1af6c6f", "29供货商");
}
catch (Exception ex)
{
BaseMsgWindow.ShowError(ex.Message);
}
}
});
}
}
public static void PddBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy) public static void PddBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{ {
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance, orderItem, GlobalConfig.CurrentPddBuyer, orderItem.PddBuyMap); PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance, orderItem, GlobalConfig.CurrentPddBuyer, orderItem.PddBuyMap);
@@ -881,12 +943,51 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
private void txtDirectOrderNumStr_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void txtDirectOrderNumStr_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
var orderItem = this.DataContext as oms_wei_order_item_info;
if (orderItem == null)
{
BaseMsgWindow.ShowError("订单信息为空");
return;
}
var buyerAccount = txtTransitOrderBuyerStr.Tag.ParseToString();
var buyerName = txtDirectBuyer.Text.Split(':').LastOrDefault(); var buyerName = txtDirectBuyer.Text.Split(':').LastOrDefault();
var outOrderId = txtDirectBuyerOrderNo.Text.Split(':').LastOrDefault(); var outOrderId = txtDirectBuyerOrderNo.Text.Split(':').LastOrDefault();
if (string.IsNullOrEmpty(buyerName) || string.IsNullOrEmpty(outOrderId)) if (string.IsNullOrEmpty(buyerName) || string.IsNullOrEmpty(outOrderId))
{ {
return; return;
} }
if (outOrderId.StartsWith("tb_")) // 淘宝买手及订单
{
var buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(p => p.buyer_id == buyerAccount || p.buyer_name == buyerName);
if (buyer == null)
{
BaseMsgWindow.ShowError("该订单买手号未在当前账户登录");
return;
}
var url = "";
if (sender == txtTransitOrderBuyerStr)
url = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?";
else
url = "https://trade.tmall.com/detail/orderDetail.htm?bizOrderId=" + outOrderId.Replace("tb_", "");
TaobaoBuyOrderCtrl taobaoBuyView = new TaobaoBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
taobaoBuyView.ViewModel.InitUrl = url;
taobaoBuyView.ViewModel.BuyType = "direct";
new DialogWindow()
{
Title = "订单查看 - 当前买手 " + buyer.buyer_nick,
Content = taobaoBuyView,
Width = SystemParameters.PrimaryScreenWidth < 1920 ? SystemParameters.PrimaryScreenWidth : SystemParameters.PrimaryScreenWidth * 90 / 100,
Height = SystemParameters.PrimaryScreenHeight * 90 / 100,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
}.ShowDialog();
}
else
{
var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(p => p.buyer_name == buyerName); var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(p => p.buyer_name == buyerName);
if (buyer == null) if (buyer == null)
{ {
@@ -905,12 +1006,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
"&refer_page_id=10032_" + BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now) + "_" + Randomx.GetWordNumber(10) + "&refer_page_sn=10032"; "&refer_page_id=10032_" + BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now) + "_" + Randomx.GetWordNumber(10) + "&refer_page_sn=10032";
} }
var orderItem = this.DataContext as oms_wei_order_item_info;
if (orderItem == null)
{
BaseMsgWindow.ShowError("订单信息为空");
return;
}
// 拍单的时候检测一下买手号 // 拍单的时候检测一下买手号
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
@@ -939,6 +1034,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
} }
buyOrderForm.ShowDialog(); buyOrderForm.ShowDialog();
} }
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
@@ -1120,8 +1216,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
string url2 = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/discardOrder"; string url2 = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/discardOrder";
var data2 = new JObject(); var data2 = new JObject();
data2["orderNo"] = orderItem.order_id; data2["orderNo"] = orderItem.order_id;
data2["outOrderNo"] = orderItem.ItemTransitOrder.out_order_no; //data2["outOrderNo"] = orderItem.ItemTransitOrder.out_order_no;
//data2["outOrderNo"] = orderItem.ItemTransitOrder.order_code; data2["outOrderNo"] = orderItem.ItemTransitOrder.order_code;
var dataStr2 = JsonHelper.SerializeObject(data2); var dataStr2 = JsonHelper.SerializeObject(data2);
var discardRst = HttpResponseWXBLL.e57PostResponse(url2, dataStr2, ""); var discardRst = HttpResponseWXBLL.e57PostResponse(url2, dataStr2, "");
if (discardRst.Contains("<code>0</code>") || discardRst.Contains("<code>200</code>")) if (discardRst.Contains("<code>0</code>") || discardRst.Contains("<code>200</code>"))
@@ -1196,6 +1292,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
orderItem.ItemTransitOrders = OrderListCtrl.GetTransitWarehouseList(orderItem.order_id); orderItem.ItemTransitOrders = OrderListCtrl.GetTransitWarehouseList(orderItem.order_id);
orderItem.PddBuyerOrders = OrderListCtrl.GetPddBuyerOrders(orderItem.order_id).Where(o => o.wx_send_type == 0).ToList(); orderItem.PddBuyerOrders = OrderListCtrl.GetPddBuyerOrders(orderItem.order_id).Where(o => o.wx_send_type == 0).ToList();
orderItem.PddBuyerOrders.AddRange(OrderListCtrl.GetTbBuyerOrders(orderItem.order_id).Where(o => o.wx_send_type == 0).ToList());
OrderListCtrl.InitOrderItemObservableProp(orderItem); OrderListCtrl.InitOrderItemObservableProp(orderItem);
//if (orderItem.ItemTransitOrder?.warehouse_status == 3) //if (orderItem.ItemTransitOrder?.warehouse_status == 3)
@@ -1398,11 +1495,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
} }
btnBuyOrder.Cursor = Cursors.Wait; btnBuyOrder.Cursor = Cursors.Wait;
btnBuyOrder.IsEnabled = false; btnDirectBuyOrder.IsEnabled = false;
Task.Run(() => Task.Run(() =>
{ {
Thread.Sleep(2000); Thread.Sleep(2000);
Dispatcher.Invoke(new Action(() => { btnBuyOrder.IsEnabled = true; })); Dispatcher.Invoke(new Action(() => { btnDirectBuyOrder.IsEnabled = true; }));
}); });
Task.Run(async() => Task.Run(async() =>
{ {
@@ -1471,6 +1568,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
//} //}
// 检测买手号是否掉线 // 检测买手号是否掉线
if (GlobalConfig.CurrentBuyPlatform == "pdd")
{
if (GlobalConfig.CurrentPddBuyer.status == "在线") if (GlobalConfig.CurrentPddBuyer.status == "在线")
{ {
PddMobileLoginViewModel.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer); PddMobileLoginViewModel.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer);
@@ -1484,13 +1583,19 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
})); }));
return; return;
} }
}
// 打开拍单窗口 // 打开拍单窗口
Dispatcher.Invoke(new Action(async () => Dispatcher.Invoke(new Action(async () =>
{ {
var BuyPlatform = "pdd";
bool IsBuySuccess = false;
btnBuyOrder.Cursor = Cursors.Hand; btnBuyOrder.Cursor = Cursors.Hand;
// 拼多多买手
if (GlobalConfig.CurrentBuyPlatform == "pdd")
{
BuyPlatform = "pdd";
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance, PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance,
orderItem, GlobalConfig.CurrentPddBuyer, orderItem.PddBuyMap); orderItem, GlobalConfig.CurrentPddBuyer, orderItem.PddBuyMap);
@@ -1505,7 +1610,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
buyOrderForm.pnlBuy.Visible = false; buyOrderForm.pnlBuy.Visible = false;
// 已有拍单关联的跳的到订单确认界面 // 已有拍单关联的跳的到订单确认界面
if (orderItem.PddBuyMap != null) if (orderItem.PddBuyMap != null)
{ {
@@ -1518,10 +1622,37 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
buyOrderForm.pnlMap.Visible = false; buyOrderForm.pnlMap.Visible = false;
} }
buyOrderForm.ShowDialog(); buyOrderForm.ShowDialog();
IsBuySuccess = buyOrderForm.IsBuySuccess;
if (buyOrderForm.IsBuySuccess) }
else if (GlobalConfig.CurrentBuyPlatform == "tb")
{ {
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill == true) BuyPlatform = "tb";
TaobaoBuyOrderCtrl taobaoBuyView = new TaobaoBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
if (orderItem.TbBuyMap != null)
{
taobaoBuyView.ViewModel.InitUrl = "https://i.taobao.com/my_itaobao/receiver-address-pc";
taobaoBuyView.ViewModel.InitUrl = "https://item.taobao.com/item.htm?id=" + orderItem.TbBuyMap.map_goods_id + "&skuId=" + orderItem.TbBuyMap.map_sku_id;
}
else
{
taobaoBuyView.ViewModel.InitUrl = "https://s.taobao.com/search?";
taobaoBuyView.ViewModel.IsMappingGoods = true;
}
taobaoBuyView.ViewModel.BuyType = "direct";
new DialogWindow()
{
Title = "买手拍单 - 当前买手 " + GlobalConfig.CurrentTaobaoBuyer.buyer_nick,
Content = taobaoBuyView,
Width = SystemParameters.PrimaryScreenWidth < 1920 ? SystemParameters.PrimaryScreenWidth : SystemParameters.PrimaryScreenWidth * 90 / 100,
Height = SystemParameters.PrimaryScreenHeight * 90 / 100,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
}.ShowDialog();
IsBuySuccess = taobaoBuyView.ViewModel.IsBuySuccess;
}
if (IsBuySuccess)
{
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill == true && BuyPlatform == "pdd")
{ {
// 设置同步物流单代发 // 设置同步物流单代发
//var rst = new WxApiBLL().GetShopSupplier(orderItem.Shop); //var rst = new WxApiBLL().GetShopSupplier(orderItem.Shop);
@@ -1537,7 +1668,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
try try
{ {
// 查询直拍单是否绑定了同步单代发(放到同步单发货前处理) // 查询拼多都直拍单是否绑定了同步单代发(放到同步单发货前处理)
await SetSendOrderSupplier(orderItem, "wx7809625286c28f2f", "百川日用"); await SetSendOrderSupplier(orderItem, "wx7809625286c28f2f", "百川日用");
} }
catch (Exception ex) catch (Exception ex)
@@ -1551,7 +1682,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 查询订单是否在代发货中,如果代发需要取消代发 // 查询订单是否在代发货中,如果代发需要取消代发
try try
{ {
// 查询直拍单是否绑定了同步单代发(放到同步单发货前处理) // 查询淘宝直拍单是否绑定了同步单代发(放到同步单发货前处理)
await SetSendOrderSupplier(orderItem, "", ""); await SetSendOrderSupplier(orderItem, "", "");
} }
catch (Exception ex) catch (Exception ex)
@@ -1986,6 +2117,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
//var orderSn = btnSendSync.Tag.ParseToString(); //var orderSn = btnSendSync.Tag.ParseToString();
var directOrder = orderItem.DirectPddBuyerOrder; var directOrder = orderItem.DirectPddBuyerOrder;
if (directOrder.order_sn.StartsWith("tb_"))
{
BaseMsgWindow.ShowInfo("淘宝买手单暂不支持同步单");
return;
}
PddBuyerOrderLiteInfo orderLiteInfo = new PddBuyerOrderLiteInfo() PddBuyerOrderLiteInfo orderLiteInfo = new PddBuyerOrderLiteInfo()
{ {
ShopOrderIdStr = orderItem.order_id, ShopOrderIdStr = orderItem.order_id,
@@ -1994,6 +2132,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
outExpressCompanyMsg = directOrder.outExpressCompanyCode, outExpressCompanyMsg = directOrder.outExpressCompanyCode,
tracking_number = directOrder.tracking_number, tracking_number = directOrder.tracking_number,
}; };
// 同步单发货
MainWindow.Instance.pddBuyerOrderReadCtrl.SendAsyncWaybillOrder(orderLiteInfo, true); MainWindow.Instance.pddBuyerOrderReadCtrl.SendAsyncWaybillOrder(orderLiteInfo, true);
} }
} }
@@ -1,5 +1,7 @@
using _29WxOrderWpf.Commands; using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels; using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
using Prism.Services.Dialogs;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -22,19 +24,26 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice;
/// <summary> /// <summary>
/// PDDInvoiceDialog.xaml 的交互逻辑 /// PDDInvoiceDialog.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class PDDInvoiceDialog : UserControl public partial class PDDInvoiceDialog : UserControl, IDialogAware
{ {
public PDDInvoiceDialog() public PDDInvoiceDialog(InvoiceConfig config)
{ {
InitializeComponent(); InitializeComponent();
DataContext = this; DataContext = this;
Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig<InvoiceConfig>(ConfigPath); Config = new InvoiceConfig();
Config.Assign(config);
} }
public string Title { get; set; }
public event Action<IDialogResult> RequestClose;
private void PDDInvoiceDialog_Loaded(object sender, RoutedEventArgs e) private void PDDInvoiceDialog_Loaded(object sender, RoutedEventArgs e)
{ {
} }
public void OnDialogOpened(IDialogParameters parameters)
{
Title = "设置";
}
private void ViewModel_RequestClose() private void ViewModel_RequestClose()
{ {
@@ -44,21 +53,35 @@ public partial class PDDInvoiceDialog : UserControl
} }
private const string ConfigPath = "./invoice.config";
public InvoiceConfig Config { get; } public InvoiceConfig Config { get; }
public ICommand ConfirmCommand => new DelegateCommand(Confirm); public ICommand ConfirmCommand => new DelegateCommand(Confirm);
private void Confirm() private void Confirm()
{ {
NaiBa.Util.Helper.ConfigHelper.SaveConfig(ConfigPath, Config); RequestClose?.Invoke(new DialogResult(ButtonResult.OK, new DialogParameters
ViewModel_RequestClose(); {
{ "config",Config}
}));
} }
public ICommand CancelCommand => new DelegateCommand(Cancel); public ICommand CancelCommand => new DelegateCommand(Cancel);
private void Cancel() private void Cancel()
{ {
ViewModel_RequestClose(); RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
} }
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
} }
@@ -10,7 +10,7 @@
xmlns:vm="clr-namespace:_29WxOrderWpf.Ctrls.PDDInvoice.ViewModels" xmlns:vm="clr-namespace:_29WxOrderWpf.Ctrls.PDDInvoice.ViewModels"
xmlns:wpf="clr-namespace:WPFCommon.Controls;assembly=WPFCommon" xmlns:wpf="clr-namespace:WPFCommon.Controls;assembly=WPFCommon"
comm:DialogWindowProperty.ResizeMode="CanResizeWithGrip" comm:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comm:DialogWindowProperty.ShowMinButton="False" comm:DialogWindowProperty.ShowMinButton="True"
common:DialogWindowProperty.Height="720" common:DialogWindowProperty.Height="720"
common:DialogWindowProperty.Width="1260" common:DialogWindowProperty.Width="1260"
d:DataContext="{d:DesignInstance Type=vm:PDDInvoiceViewModel, d:DataContext="{d:DesignInstance Type=vm:PDDInvoiceViewModel,
@@ -1,4 +1,5 @@
using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels; using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
using CefSharp.DevTools.Overlay;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -65,9 +66,6 @@ public partial class PDDInvoiceView : UserControl
{ {
_scrollStopTimer.Stop(); _scrollStopTimer.Stop();
System.Diagnostics.Debug.WriteLine("滚动停止了");
// 用 Background 优先级设置,避免和当前这一帧的滚动惯性/渲染争抢, // 用 Background 优先级设置,避免和当前这一帧的滚动惯性/渲染争抢,
// 让 UI 线程先把滚动动画收尾,再去处理这一波图片加载触发 // 让 UI 线程先把滚动动画收尾,再去处理这一波图片加载触发
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
@@ -100,4 +98,5 @@ public partial class PDDInvoiceView : UserControl
.ContainerFromItem(vm.SelectedOrder) as FrameworkElement; .ContainerFromItem(vm.SelectedOrder) as FrameworkElement;
container?.BringIntoView(); container?.BringIntoView();
} }
} }
@@ -1,134 +1,302 @@
// 填写信息 /*!
* invoice_hook.js · v1.0.0
* 发票申请 Hook
* - 使用 window.InvoiceApply 统一暴露接口
* - 支持重复注入,不重复自动执行
* - CEF 可通过 window.InvoiceApply.__installed 判断脚本是否已注入
* - 执行结果保存在 window.__invoiceApplyResult
*/
; (function (global) {
'use strict';
// 已注入时不重复创建对象或重复自动执行
if (global.InvoiceApply && global.InvoiceApply.__installed) {
return;
}
var VERSION = '1.0.0';
var state = {
installed: false,
running: false,
result: null,
error: null,
lastRunAt: null
};
function sleep(ms) {
return new Promise(function (resolve) {
global.setTimeout(resolve, ms);
});
}
// 支持 XPath 或 CSS 选择器
function findElement(selector, isXPath) {
if (isXPath === undefined) isXPath = true;
try {
if (isXPath) {
return global.document.evaluate(
selector,
global.document,
null,
global.XPathResult.FIRST_ORDERED_NODE_TYPE,
null
).singleNodeValue;
}
return global.document.querySelector(selector);
} catch (e) {
return null;
}
}
function changeReactInputValue(inputDom, newText) { function changeReactInputValue(inputDom, newText) {
let lastValue = inputDom.value; if (!inputDom) return false;
var lastValue = inputDom.value;
var valueSetter = null;
// 优先使用原生 input/textarea value setter,便于 React 感知值变化
try {
var proto = inputDom.tagName === 'TEXTAREA'
? global.HTMLTextAreaElement.prototype
: global.HTMLInputElement.prototype;
valueSetter = Object.getOwnPropertyDescriptor(proto, 'value');
} catch (e) {
// ignore
}
try {
if (valueSetter && valueSetter.set) {
valueSetter.set.call(inputDom, newText);
} else {
inputDom.value = newText; inputDom.value = newText;
let event = new Event('input', { bubbles: true }); }
event.simulated = true; } catch (e) {
let tracker = inputDom._valueTracker; inputDom.value = newText;
}
try {
var tracker = inputDom._valueTracker;
if (tracker) { if (tracker) {
tracker.setValue(lastValue); tracker.setValue(lastValue);
} }
} catch (e) {
// ignore
}
var event;
try {
event = new global.Event('input', { bubbles: true });
} catch (e) {
event = global.document.createEvent('Event');
event.initEvent('input', true, false);
}
event.simulated = true;
inputDom.dispatchEvent(event); inputDom.dispatchEvent(event);
return true;
} }
// 异步 sleep async function fillInvoiceAndApply(data) {
function sleep(ms) { data = data || {};
return new Promise(resolve => setTimeout(resolve, ms));
}
// 查找元素(支持选择器或XPath) var title = data.title === undefined
function findElement(selector, isXPath = true) { ? '某某科技有限公司'
if (isXPath) { : data.title;
return document.evaluate(
selector,
document,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null
).singleNodeValue;
} else {
return document.querySelector(selector);
}
}
// 完整流程 var taxNumber = data.taxNumber === undefined
async function fillInvoiceAndApply(data = {}) { ? '91110000123456789X'
const { : data.taxNumber;
title = '某某科技有限公司',
taxNumber = '91110000123456789X'
} = data;
console.log('📝 开始填充发票信息...'); console.log('[InvoiceApply] 开始填充发票信息...');
// 1. 点击“企业”按钮
var invoiceType = findElement('//*[contains(text(), "企业")]');
// 1. 点击"企业"按钮
const invoiceType = findElement('//*[contains(text(), "企业")]');
if (!invoiceType) { if (!invoiceType) {
console.warn('⚠️ 找不到"企业"按钮'); console.warn('[InvoiceApply] 找不到“企业”按钮');
return false; return false;
} }
invoiceType.click(); invoiceType.click();
console.log('✅ 已点击"企业"按钮');
console.log('[InvoiceApply] 已点击“企业”按钮');
await sleep(500); await sleep(500);
// 2. 查找并填充发票抬头 // 2. 填充发票抬头
const invoiceTitle = findElement('//label[contains(text(), "发票抬头")]/following-sibling::textarea[1]') || var invoiceTitle =
findElement('//label[contains(text(), "发票抬头")]/following-sibling::textarea[1]') ||
findElement('//*[contains(text(), "发票抬头")]/following-sibling::textarea[1]'); findElement('//*[contains(text(), "发票抬头")]/following-sibling::textarea[1]');
if (invoiceTitle) { if (invoiceTitle) {
changeReactInputValue(invoiceTitle, title); changeReactInputValue(invoiceTitle, title);
console.log('✅ 发票抬头已填充'); console.log('[InvoiceApply] 发票抬头已填充');
} else { } else {
console.warn('⚠️ 未找到发票抬头控件'); console.warn('[InvoiceApply] 未找到发票抬头控件');
} }
// 3. 查找并填充税号 // 3. 填充税号
const taxNumberInput = findElement('//label[contains(text(), "税号")]/following-sibling::input[1]') || var taxNumberInput =
findElement('//label[contains(text(), "税号")]/following-sibling::input[1]') ||
findElement('//*[contains(text(), "税号")]/following-sibling::input[1]'); findElement('//*[contains(text(), "税号")]/following-sibling::input[1]');
if (taxNumberInput) { if (taxNumberInput) {
changeReactInputValue(taxNumberInput, taxNumber); changeReactInputValue(taxNumberInput, taxNumber);
console.log('✅ 税号已填充'); console.log('[InvoiceApply] 税号已填充');
} else { } else {
console.warn('⚠️ 未找到税号控件'); console.warn('[InvoiceApply] 未找到税号控件');
} }
await sleep(300); await sleep(300);
// 4. 查找并点击"申请发票"按钮 // 4. 点击“申请发票”
const applyBtn = findElement('//*[contains(text(), "申请发票")]'); var applyBtn = findElement('//*[contains(text(), "申请发票")]');
if (!applyBtn) { if (!applyBtn) {
console.error('❌ 未找到"申请发票"按钮'); console.error('[InvoiceApply] 未找到“申请发票”按钮');
return false; return false;
} }
applyBtn.scrollIntoView({ behavior: 'smooth', block: 'center' }); if (applyBtn.scrollIntoView) {
applyBtn.scrollIntoView({
behavior: 'smooth',
block: 'center'
});
}
await sleep(300); await sleep(300);
applyBtn.click(); applyBtn.click();
console.log('✅ 已点击"申请发票"按钮');
// 5. 等待弹窗/状态出现 console.log('[InvoiceApply] 已点击“申请发票”按钮');
// 5. 等待弹窗或状态出现
await sleep(300); await sleep(300);
// 6. 判断状态 // 6. 判断申请状态
// 检查是否有"已经申请过"的提示 var alreadyApplied = findElement(
const alreadyApplied = findElement('//*[contains(text(), "您已经提交过发票申请了")]') '//*[contains(text(), "您已经提交过发票申请了")]'
);
if (alreadyApplied) { if (alreadyApplied) {
console.log('✅ 已经申请过,无需重复操作'); console.log('[InvoiceApply] 已经申请过,无需重复操作');
return true; return true;
} }
const successElement = findElement('//*[text()="确认发票信息无误后再提交"]');
if (successElement == null) { var successElement = findElement(
'//*[text()="确认发票信息无误后再提交"]'
);
if (!successElement) {
console.warn('[InvoiceApply] 未检测到确认发票信息的提示');
return false; return false;
} }
// 检查是否有"确认开具"按钮或提示
const confirmBtn = findElement('//*[text()= "确认"]'); var confirmBtn = findElement('//*[text()="确认"]');
if (confirmBtn) { if (confirmBtn) {
console.log('✅ 找到"确认"按钮,准备点击...'); console.log('[InvoiceApply] 找到“确认”按钮');
await sleep(200); await sleep(200);
confirmBtn.click(); confirmBtn.click();
console.log('✅ 已点击"确认"按钮'); console.log(
'[InvoiceApply] 已识别确认步骤,未自动提交最终确认'
);
return true; return true;
} }
// 如果都没有找到 console.warn(
console.warn('⚠️ 未找到"已经申请过"或"确认"按钮,请手动检查'); '[InvoiceApply] 未找到“已经申请过”提示或“确认”按钮'
);
return false; return false;
} }
// ========== 调用 ========== function run(data) {
(async function () { if (state.running) {
try { return Promise.reject(
const result = await fillInvoiceAndApply({ new Error('发票申请脚本正在执行,请勿重复调用')
);
}
state.running = true;
state.result = null;
state.error = null;
state.lastRunAt = Date.now();
global.__invoiceApplyResult = null;
return fillInvoiceAndApply(data)
.then(function (result) {
state.result = !!result;
global.__invoiceApplyResult = state.result;
return state.result;
})
.catch(function (ex) {
state.error = String((ex && ex.message) || ex);
state.result = false;
global.__invoiceApplyResult = false;
console.error('[InvoiceApply] 执行异常:', ex);
return false;
})
.then(
function (result) {
state.running = false;
return result;
},
function (ex) {
state.running = false;
throw ex;
}
);
}
var api = {
version: VERSION,
run: run,
findElement: findElement,
changeReactInputValue: changeReactInputValue,
get state() {
return state;
},
get __installed() {
return state.installed;
}
};
function install() {
if (state.installed) {
return api;
}
state.installed = true;
console.log('[InvoiceApply] v' + VERSION + ' 已注入');
// 保留原 invoice.js 的行为:脚本注入后自动执行一次
run({
title: '{公司}', title: '{公司}',
taxNumber: '{税号}' taxNumber: '{税号}'
}); });
console.log('执行结果:', result);
// 批量开票时,C# 端轮询该变量获取执行结果 return api;
window.__invoiceApplyResult = result;
} catch (ex) {
console.error('执行异常:', ex);
window.__invoiceApplyResult = false;
} }
})();
api.install = install;
global.InvoiceApply = api;
install();
})(typeof window !== 'undefined' ? window : this);
@@ -0,0 +1 @@
var _0xodc = 'jsjiami.com.v7'; var _0x20193a = _0x210f; function _0x1a46() { var _0x56c665 = (function () { return [_0xodc, 'PqljsTeUjiCarWmi.UwcyfobCmr.yuvW7tCtuXBl==', 'WRBdTGpdT0u', 'WO0CW47dHa', 'W43cUXVdLSon', 'W4BcS03cQ8ks', 'ygFdL8kNdCojrq', 'zSkCD8kItW', 'WPjwW6pcNqJcQa', 'zoINMUwmGU++Gq', 'W69xWPxcMJ0', 'qhFdQ0T1', 'WR/cKLPWWQC', 'WOJcOmo4W4zBxa', 'fCkxzSkWsa', 'WRaMW6xdUJ4', 'i8klgWhdQq', 'tCkAcwZcLa', 'BSk/WPKUFSooWORcU8kw', 'W7pcSmkQFKi', '5QMh5OMR5RMw5yUA5Roa5P2V6kwl5y2P5lMB5l2w6k2O5RoF77Yi6AcC6zYG5y6y6ioh5BEy57Ut5Rov5P6/5PU+5Asm77Yp5OUB5yQd6kgy5lUa5zY75RMi5yQL5AY75zUc5yAd7765', 'WPtcR8oKW5a', 'W64hW5xdSCot', 'qSkfWPS8C8oLWOdcL8krW5ufyG', 'eSoDW6exdHpdMq', 'W58MWQCya1y', 'CSk7C8kDxa', 'AZvVWQu', 'mrfYtf8', 'fmo8W7O0cq', 'hCkyWQ3dQCo9', 'W7FcIXFdKmoF', 'W6XTrmkHgcFcVWyZW53cLSoGWR4eW6y2kSkLgr5pyqhcV0m2WPtdS8kNkr8LW4edwmkWrL/dR3X3W5ZdINnzybPwbmoueW', 'vt5rWRye', 'f8kBcaddUG', 'k8kEWPJdU8o4WQrToSow', 'WQFcIfhdUCk1', 'WQFcGhrd', 'WRldJSonp8k+', 'tgZcO8oIW59G', 'W44CpCoDq8obvG', 'W5ZcMmkVAgG', 'W6ZcTCocWP0pW5u/W7qx', 'W43cKbaj', 'W4T6WPNcGYu', 'vCoPjCoFW7JcK1lMIP3PLje', 'vmoroSouW6y', 'W4tcI0BcPSkjW78', 'W5TqWP/cHG', 'W5xcMSovWRO0', 'WRJcM3XcWPK', 'W5z5WPdcGqe', 'nSk7DmkFDW', 'W5ZcIsJdVmoC', 'W6H+WRBcJHu', 'W7upW5VdVSoD', 'fCoeW6aBaGm', 'WPtdVSoiiCkbW4rk', 'cSkTgWZdPmk3WQ4YWP8', 'W5hcVmoAWOi1', 'h8knxCkhBq', 'hmogmCoHWOpcNSkT5OI+6zEO', 'WQJcOeJdTCkk', 'WPKPAb0k', 'W47cGbCZzu5eWQPXeCoQWOVdQSo7nCkL', 'amole8oVWOJcL8ofW4dcMctcL8om', 'W5mSpCoSzq', 'WQ5sa8k8W6m', 'FCoqn8oY', 'W5TEfNBdKq', 'cdLgvNa', 'kYGxoCkf', 'eSonW7Wx', 'WO3cGCoAW7bB', 'WRajW4FdMIu', 'nhqnW4BdHW', 'pw/dJ8kBW5/cQG', 'WQjtbmkcxmoiW6tdRSo9', 'BSkdC0/cHa5c', 'vSoOmmoVW4K', 'nmkChWhdN8kBWRm1WOZdQCkLWOC', 'WPT+W7ZcTby', 'gxGwW6FdHG', 'W7ddVt/cUfRdK3S5W6q', 'W4ZcGdxdUCoa', 'FhFdHmkwpG', 'W6VcTCobWPKHW5SVW6G', 'W6GAWQ4Tjq', 'WRGLCCkl', 'ww/dQK5dW7FcGmoChColyq', 'W4C5W4NdOmosqWrRWRq', 'rgtdQmkWjq', 'W7GbuSkSsSoM', 'w8kwWQ8suW', 'l8ktWPddOmoD', 'CSkKwfJcPa', 'f0RcPCo7lG', 'WRX8W4xcKtO', 'W7C7WO/dM8oU', 'W4ipWOxdQ8oh', 'W6JcMYFdLSoS', 'nSkgtCktFW', 'W4FcHcddVSonW7mR', 'WPZdUSkMA8kMW6GHWOBcOW', 'W59uWOFcQZJdOSofWRldGHaqutOMlUwNJoI2Na', 'W6CRWQGqpG', 'pJDXC0rXW4RdLmoti3q', 'W5tcGmovWQWu', 'C8ksoLxcUa', 'W5/cGflcPG', 'rCkRsCkIz8oR', 'pfmMW6ldHWa', 'FCkeumkPzG', 'kmk0WRFdHmoH', 'WQ18W4RcSGO', 'W6SsW5BdTa', 'WQmMW7ddPHS', 'WPTvW6VcNX/cTmkdW6FcVCkIWOP0umkzW50', 'W5VcJfhcQW', 'thJcOCo0W4HN', 'gCoBdSoU', 'WR95r8keWRhcMCk6W41+W5SDAay', 'WR0buI8O', 'nLNcOSo8lLRdHH3dQa', 'f8kCWP3dN8od', 'WQtcIxvdWPNdSG', 'idnZCNnNW4/dRSoengvQW6O', 'W7mmWOZdU8og', 'W4ZcM8ohWR8V', 'DSkAgKZcUcuDWQi', 'BSoJn8oBW6G', 'smklWQmmDW', 'W5dcIGeiBfOFWRzJc8ofWOxdRSo7jCk4WQePDMu', 'W7lcH8oeWQmx', 'qxJdV1Tf', 'WPpdVaBdMLK', 'imomeSoMWP0', 'WQdcGCouW41Z', 'WOxcIg/dJmk1', 'cCoAW6aDaai', 'WRZdJSkHsSk4', 'WR85E8kxoq', 'b0xdSCkVW4q', 'WRONvcik', 'WQpcJMb/WOVdQctcHSoWpCoCW5uhhW', 'WRldUCkUB8kB', 'WRyKuSkpoq', 'W4qGEmketmoQW4/dSSoc', 'W4FdTSo7W5tdQa', 'W6pdGSobxWhdTSoP', 'WRfYv8kUWRVcSSk5', 'WQBdTcJdMMe', 'C8kvduG', 'W5FcUSkQW4Knvmk3W6/dJW', 'WR3dHrxdKfC', 'rNlcSCoJW5TDWPRdKJi', 'W4JcKuVcR8kF', 'A8kdyeRcGb5DmmkFW5C+emki', 'DCkFi1JcMG', 'BmowkCoU', 'vWvKbSo1WO01WORdMwarwmkSWPNdLL/cICoEja', 'W77dQdNcR1JdJNO4', 'WOGpxGGOW5FdQq', 'smoIbmolW7RcHqzjESkVWOTqW7m', 'sCoKb8orW7pcMJPJyCkSWOzw', 'xSo+sCkaWPpcI2RcNSogct5LDCkIfG', 'WRuBESkjeG', 'WPRdHd7dP3O', 'DMZdKmk8aCoyqCokW55T', 'F0pdN3ns', 'W5ZcHdpdRmobW6i9', 'v8oqdCokW4K', 'WQ3cIMDtWPq', 'WR3cRwbaWR3cGCkU', 'W5VcQYeyBW', 'W5efDmk4Dq', 'W6xdU8ohW7VdK8kJW5lcTCk8vw8KmMC', 'WPqfrSkWjq', 'bSktWQldUmoF', 'W6eMv8kXCW', 'vmkqA3VcJa', 'me7cUSoUleZdGbhdVSk6W6JcQa', 'W41Ti0BdJa', 'ESoqimoYWObGWQu', 'wCkMv8kIASoJ', 'vKNcRmo9W7i', 'WOnYnCkPW5PG', 'nmoDcCkyW4hcVZBcJCkCegG', 'p8oUbCoSWRW', 'W60oW7xdLSos', 'W4PPWP/cHG4', 'W5uoWOhdJmoS', 'y0ZdVLja', 'BmkAoKZcTIq', 'aqKxemkr', 'WOaqxJ8o', 'WP7cSxbYWRi', 'WQP1W57cSX4', 'WOTJiCkeW6C', 'W6tdNSodta', 'e8krqCkhC8kmEG', 'WPz+rSk+WRC', 'fuRcNCoyjG', 'FCoCi8oJWQ16WRxdIa', 'WQOszY4K', 'W57dNs/cUM8', 'tgZdIK5dW5/cH8oZcmorvSkUcey6', 'WOBdTCoopSk3W4raB8oWpSkvW7u', 'WOGlvWK', 'aHLZFM8', '77YA77Yo5yo55Q6Z576F6AoF', 'oCkiDeFcKva', 'W7BdJSo/tai', 'WQVdGCkpuCkGW7u1WRhcTCoFWPGMWQH8W4FLTi7LIQJMJzq', 'WOPPW5FcQt4', 'W4DqihBdPqq', 'B8oxoCo+WRb2WR7dN8kDvmoKWOK', 'WQNcLmoBW7nC', 'gCoNcSkjW4NcGWRcLSkyb2K', 'mL3cV8o8lG', 'W78AWOVdKmoSW58', 'W6KYa8oLW7m', 'W7CqW5ZdTSoeyG9HWQW', 'W5RcUCohWRGu', 'WQxcJN5v', 'W67dGrhcH3O', 'W7mqWOtdHSoNW58NW4mwpstdGW', 'W47cHCkrWO7cMq', 'vCogaCo8W5e', 'W4rAo2ddRW/cGq', 'BCkreLNcNICTW6pcR0a', 'gSkwhIldPq', 'BmkUwKxcTW', 'W6hdPCoWBsK', 'W4VdT8o3BsddUSoJyCoXW7i', 'W5/cRG42BW', 'W6JcNaOksG', 'W7CrtSk5w8oGW57dLmoinSkO', 'W5byWOdcNJNdPmov', 'lN/cISohdW', 'lmkxWPZdQmoX', 'rCkNtSk/AmoI', 'WRRcM2n1WQ0', 'WPxdMYZdTMq', 'W6hdSCogW5tdIq', 'yhBdHmkLeCoz', 'z3VdLCk0', 'psrMyMrN', 'WRlcM0tdSW', 'DdTVWQmK', 'gmkXxSk+rq', 'WQTOxmk5WQy', 'mMVcOCodlq', 'W4NcQCoGWRuU', 'WQydW6ZdNW0', 'xSoAoSofWP0', 'W4OZWO8toq', 'CCkjyKVcIWXegG', 'peCKW7tdKaCeAK/cVcO', 'W6Wpgmooua', 'xSksWO0VAmo1', 'z3ddJmk2a8opuG', 'EsXLWQWy', 'imoOi8kPW60', 'tmkLine truncated
@@ -16,6 +16,7 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using Work._29Tools.CefTools; using Work._29Tools.CefTools;
using Work.BaseForms;
using WxOrder.Framework.Helpers; using WxOrder.Framework.Helpers;
namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels; namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
@@ -26,19 +27,11 @@ public partial class PDDInvoiceViewModel
/// 订单列表浏览器 /// 订单列表浏览器
/// </summary> /// </summary>
public ChromiumWebBrowser Browser { get; private set; } public ChromiumWebBrowser Browser { get; private set; }
/// <summary> private IFrame frame;
/// 内容浏览器
/// 订单详情
/// 发票详情
/// 申请发票
/// </summary>
public ChromiumWebBrowser BrowserDetail { get; private set; }
partial void InitBrowser() partial void InitBrowser()
{ {
BrowserZIndex = -1; BrowserZIndex = -1;
BrowserDetailZIndex = -1;
Browser = WPFCEFBrowser.CreateChromiumWebBrowser("about:blank", false); Browser = WPFCEFBrowser.CreateChromiumWebBrowser("about:blank", false);
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler(); LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
@@ -49,13 +42,7 @@ public partial class PDDInvoiceViewModel
Browser.KeyboardHandler = new KeyboardHandler(); Browser.KeyboardHandler = new KeyboardHandler();
Browser.LoadingStateChanged += Browser_LoadingStateChanged; Browser.LoadingStateChanged += Browser_LoadingStateChanged;
BrowserDetail = WPFCEFBrowser.CreateChromiumWebBrowser("about:blank", false);
LocalResourceRequestHandler detailResourceRequestHandler = new LocalResourceRequestHandler();
detailResourceRequestHandler.ResourceLoadCompleteEvent += DetailRequestHandler_ResourceLoadComplete;
BrowserDetail.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
BrowserDetail.LifeSpanHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
BrowserDetail.KeyboardHandler = new KeyboardHandler();
BrowserDetail.LoadingStateChanged += BrowserDetail_LoadingStateChanged;
} }
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
@@ -65,75 +52,31 @@ public partial class PDDInvoiceViewModel
var b = (ChromiumWebBrowser)sender; var b = (ChromiumWebBrowser)sender;
b.Dispatcher.InvokeAsync(async () => b.Dispatcher.InvokeAsync(async () =>
{ {
if (b.Address != null && b.Address.StartsWith("https://mobile.yangkeduo.com/orders.html"))
if (b.Address != null && b.Address.StartsWith("https://mobile.yangkeduo.com/orders.html"))//加载完成 加载 js
{
frame = b.GetMainFrame();
string content = ResourceHelper.GetResourceText("/Ctrls/PDDInvoice/Resources/order.js", "29WxFindOrder");
if (string.IsNullOrEmpty(content)) return;
Install(frame, content);
if (await IsInstalledAsync(frame))
{ {
StartAutoScroll(); StartAutoScroll();
} //await b.EvaluateScriptAsync(frame, content);
});
}
}
private void BrowserDetail_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
{
if (e.IsLoading == false)
{
var b = (ChromiumWebBrowser)sender;
b.Dispatcher.InvokeAsync(async () =>
{
if (b.Address != null && b.Address.StartsWith("https://mobile.yangkeduo.com/transac_return_compensation.html"))
{
string html = await b.GetBrowser().GetSourceAsync();
if (html.Contains("window.rawData"))
{
await ExecuteInvoiceApplyScriptAsync(b);
} }
else else
{ {
// 页面异常(未渲染出发票表单)时直接判定失败,避免批量开票长时间等待 BaseMsgForm.ShowError("订单读取失败");
_currentInvoiceTcs?.TrySetResult(false);
} }
} }
}); });
} }
} }
/// <summary>
/// 注入发票填写脚本并执行。
/// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的
/// <c>window.__invoiceApplyResult</c>,完成后通过 <see cref="_currentInvoiceTcs"/> 回传结果。
/// </summary>
private async Task ExecuteInvoiceApplyScriptAsync(ChromiumWebBrowser b)
{
string content = ResourceHelper.GetResourceText("/Ctrls/PDDInvoice/Resources/invoice.js", "29WxFindOrder");
content = content.Replace("{公司}", Config.Title);
content = content.Replace("{税号}", Config.TaxNo);
if (string.IsNullOrEmpty(content)) return;
await b.EvaluateScriptAsync(content);
if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行为
// 批量模式:等待异步脚本执行完成
// 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果
var tcs = _currentInvoiceTcs;
for (int i = 0; i < 120; i++)
{
await Task.Delay(500);
try
{
var res = await b.EvaluateScriptAsync("window.__invoiceApplyResult");
if (res.Success && res.Result != null)
{
tcs.TrySetResult(Convert.ToBoolean(res.Result));
return;
}
}
catch
{
}
}
tcs.TrySetResult(false);
}
public ICommand CloseInvoiceDetailCommand => new DelegateCommand(HidenOrderBrowserDetail); public ICommand CloseInvoiceDetailCommand => new DelegateCommand(HidenOrderBrowserDetail);
@@ -142,11 +85,6 @@ public partial class PDDInvoiceViewModel
get => GetValue<int>(); get => GetValue<int>();
set => SetValue(value); set => SetValue(value);
} }
public int BrowserDetailZIndex
{
get => GetValue<int>();
set => SetValue(value);
}
/// <summary> /// <summary>
/// 显示主浏览器 /// 显示主浏览器
/// </summary> /// </summary>
@@ -155,22 +93,12 @@ public partial class PDDInvoiceViewModel
BrowserZIndex = 10; BrowserZIndex = 10;
BrowserDetailZIndex = -1; BrowserDetailZIndex = -1;
} }
/// <summary>
/// 显示子浏览器
/// </summary>
public void ShowOrderBrowserDetail()
{
BrowserZIndex = -1;
BrowserDetailZIndex = 10;
}
public void HidenOrderBrowser() public void HidenOrderBrowser()
{ {
BrowserZIndex = -1; BrowserZIndex = -1;
} }
public void HidenOrderBrowserDetail()
{
BrowserDetailZIndex = -1;
}
public bool IsReadOrder public bool IsReadOrder
{ {
get => GetValue<bool>(); get => GetValue<bool>();
@@ -178,31 +106,28 @@ public partial class PDDInvoiceViewModel
} }
private int top = 0; private int top = 0;
private DateTime lastGetOrderDataTime = DateTime.Now; private DateTime lastGetOrderDataTime = DateTime.Now;
private string lastOrderSN = "0";
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{ {
if (url.StartsWith("https://mobile.yangkeduo.com/orders.html"))
{
//if (isAutoScroll == false)
//{
// StartAutoScroll();
//}
StartAutoScroll();
}
if (url.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v")) if (url.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
{ {
lastGetOrderDataTime = DateTime.Now; lastGetOrderDataTime = DateTime.Now;
parserData(responseData); parserData(responseData, out lastOrderSN);
Debug.WriteLine($"LastOrder:{lastOrderSN}");
//File.WriteAllText(@$"E:\{Guid.NewGuid().ToString()}.txt", responseData); //File.WriteAllText(@$"E:\{Guid.NewGuid().ToString()}.txt", responseData);
} }
} }
public void StartAutoScroll() public void StartAutoScroll()
{ {
if (frame == null)
{
StopAutoScroll(); return;
}
if (IsReadOrder) return; if (IsReadOrder) return;
IsReadOrder = true; IsReadOrder = true;
_ = autoScroll(_cancellationTokenSource.Token); //_ = autoScroll(_cancellationTokenSource.Token);
_ = autoLoadOrderData(_cancellationTokenSource.Token);
} }
// 停止滚动 // 停止滚动
@@ -210,39 +135,82 @@ public partial class PDDInvoiceViewModel
{ {
IsReadOrder = false; IsReadOrder = false;
_cancellationTokenSource?.Cancel(); _cancellationTokenSource?.Cancel();
}
private async Task autoScroll(CancellationToken token)
Application.Current?.Dispatcher.BeginInvoke(new Action(() =>
{ {
BottomMsg = $"订单读取结束";
}));
CompleteProgress();
}
private async Task autoLoadOrderData(CancellationToken token)
{
string templastOrderSN = "";
while (IsReadOrder && !token.IsCancellationRequested) while (IsReadOrder && !token.IsCancellationRequested)
{ {
if ((DateTime.Now - lastGetOrderDataTime).Seconds > 30) StopAutoScroll(); if (lastOrderSN == templastOrderSN)
top += Randomx.GetId(450, 600);
var jsStr = @"window.scroll({
top: " + top + @",
left: 0,
behavior: 'smooth' // 可选,使滚动平滑
});";
var client = Browser.GetDevToolsClient();
if (client != null)
{ {
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true); await Task.Delay(500);
result.Wait(5000); continue;
} }
await Task.Delay(Randomx.GetId(100, 300));
string jsStr = $"PDDOrders.trigger({{offset:'MO-01-{lastOrderSN}',type:0,size:10,mode:'store'}})";
templastOrderSN = lastOrderSN;
await frame.EvaluateScriptAsync(jsStr);
await Task.Delay(Randomx.GetId(1000, 3000));
//Thread.Sleep(); //Thread.Sleep();
} }
} }
private void DetailRequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) /// <summary>文档创建时注入(每个 document 注入一次即可,脚本本身幂等)</summary>
public void Install(IFrame frame, string hookJs)
{ {
if (url.StartsWith("https://mobile.yangkeduo.com/transac_return_compensation.html")) if (frame == null || string.IsNullOrEmpty(hookJs)) return;
{ frame.ExecuteJavaScriptAsync(hookJs);
}
} }
/// <summary>脚本是否已就绪(注入后自检用;异步,不会卡 UI 线程)</summary>
public async Task<bool> IsInstalledAsync(IFrame frame, int timeoutMs = 3000)
{
var deadline = DateTime.Now.AddMilliseconds(timeoutMs);
while (DateTime.Now < deadline)
{
var r = await frame.EvaluateScriptAsync("!!(window.PDDOrders && window.PDDOrders.__installed)")
.ConfigureAwait(false);
if (r != null && r.Success && r.Result is bool && (bool)r.Result) return true;
await Task.Delay(100).ConfigureAwait(false);
}
return false;
}
//private async Task autoScroll(CancellationToken token)
//{
// while (IsReadOrder && !token.IsCancellationRequested)
// {
// if ((DateTime.Now - lastGetOrderDataTime).Seconds > 30) StopAutoScroll();
// top += Randomx.GetId(450, 600);
// var jsStr = @"window.scroll({
// top: " + top + @",
// left: 0,
// behavior: 'smooth' // 可选,使滚动平滑
// });";
// var client = Browser.GetDevToolsClient();
// if (client != null)
// {
// var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
// result.Wait(5000);
// }
// await Task.Delay(Randomx.GetId(100, 300));
// //Thread.Sleep();
// }
//}
} }
@@ -0,0 +1,159 @@
using _29WxOrderWpf.CefHelper;
using CefSharp;
using CefSharp.Handler;
using CefSharp.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Controls;
using Work._29Tools.CefTools;
using Work.BaseForms;
using WxOrder.Framework.Helpers;
namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
public partial class PDDInvoiceViewModel
{
/// <summary>
/// 内容浏览器
/// 订单详情
/// 发票详情
/// 申请发票
/// </summary>
public ChromiumWebBrowser BrowserDetail { get; private set; }
partial void InitBrowserDetail()
{
BrowserDetailZIndex = -1;
BrowserDetail = WPFCEFBrowser.CreateChromiumWebBrowser("about:blank", false);
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
LocalResourceRequestHandler detailResourceRequestHandler = new LocalResourceRequestHandler();
detailResourceRequestHandler.ResourceLoadCompleteEvent += DetailRequestHandler_ResourceLoadComplete;
BrowserDetail.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
BrowserDetail.LifeSpanHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
BrowserDetail.KeyboardHandler = new KeyboardHandler();
BrowserDetail.LoadingStateChanged += BrowserDetail_LoadingStateChanged;
}
public int BrowserDetailZIndex
{
get => GetValue<int>();
set => SetValue(value);
}
/// <summary>
/// 显示子浏览器
/// </summary>
public void ShowOrderBrowserDetail()
{
BrowserZIndex = -1;
BrowserDetailZIndex = 10;
}
public void HidenOrderBrowserDetail()
{
BrowserDetailZIndex = -1;
}
private void BrowserDetail_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
{
if (e.IsLoading == false)
{
var b = (ChromiumWebBrowser)sender;
b.Dispatcher.InvokeAsync(async () =>
{
if (b.Address != null && b.Address.StartsWith("https://mobile.yangkeduo.com/transac_return_compensation.html"))
{
string orderSN = Regex.Match(b.Address, "order_sn=(?<sn>\\d+-\\d+)").Groups["sn"].Value;
string html = await b.GetBrowser().GetSourceAsync();
if (html.Contains("window.rawData"))
{
await ExecuteInvoiceApplyScriptAsync(b, orderSN);
}
else
{
// 页面异常(未渲染出发票表单)时直接判定失败,避免批量开票长时间等待
_currentInvoiceTcs?.TrySetResult(false);
}
}
});
}
}
/// <summary>
/// 注入发票填写脚本并执行。
/// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的
/// <c>window.__invoiceApplyResult</c>,完成后通过 <see cref="_currentInvoiceTcs"/> 回传结果。
/// </summary>
private async Task ExecuteInvoiceApplyScriptAsync(ChromiumWebBrowser b, string orderSn)
{
string content = ResourceHelper.GetResourceText("/Ctrls/PDDInvoice/Resources/invoice.js", "29WxFindOrder");
content = content.Replace("{公司}", Config.Title);
content = content.Replace("{税号}", Config.TaxNo);
if (string.IsNullOrEmpty(content)) return;
await b.EvaluateScriptAsync(content);
if (_currentInvoiceTcs == null)
{
var temp = Orders?.FirstOrDefault(a => a.order_sn == orderSn);
if (temp != null) temp.IsInvoiced = true;
return; // 单张申请模式:保持原有行为
}
// 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果
var tcs = _currentInvoiceTcs;
// 检查是否注入成功
if (await IsInstalledDetailAsync(b) == false)
{
IsBatchInvoicing = false;
BaseMsgForm.ShowError("JS错误,开票失败");
tcs.TrySetResult(false);
return;
}
for (int i = 0; i < 120; i++)
{
await Task.Delay(500);
try
{
var res = await b.EvaluateScriptAsync("window.__invoiceApplyResult");
if (res.Success && res.Result != null)
{
tcs.TrySetResult(Convert.ToBoolean(res.Result));
return;
}
}
catch
{
}
}
tcs.TrySetResult(false);
}
public async Task<bool> IsInstalledDetailAsync(ChromiumWebBrowser frame, int timeoutMs = 3000)
{
var deadline = DateTime.Now.AddMilliseconds(timeoutMs);
while (DateTime.Now < deadline)
{
var r = await frame.EvaluateScriptAsync("!!(window.InvoiceApply && window.InvoiceApply.__installed)")
.ConfigureAwait(false);
if (r != null && r.Success && r.Result is bool && (bool)r.Result) return true;
await Task.Delay(100).ConfigureAwait(false);
}
return false;
}
private void DetailRequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
if (url.StartsWith("https://mobile.yangkeduo.com/transac_return_compensation.html"))
{
}
}
}
@@ -15,6 +15,7 @@ using MAX.Core.Helpers;
using NaiBa.Util.Extension; using NaiBa.Util.Extension;
using Newtonsoft.Json; using Newtonsoft.Json;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using Prism.Services.Dialogs;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@@ -44,7 +45,7 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
/// <summary> /// <summary>
/// 拼多多发票助手 视图模型 /// 拼多多发票助手 视图模型
/// </summary> /// </summary>
public partial class PDDInvoiceViewModel : BindableBaseEx public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDisposable
{ {
private const string ConfigPath = "./invoice.config"; private const string ConfigPath = "./invoice.config";
private List<OrderInvoiceInfo> OrderInvoiceInfoList = new(); private List<OrderInvoiceInfo> OrderInvoiceInfoList = new();
@@ -75,7 +76,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
//Orders = new ObservableCollection<PDDInvoiceOrderModel>(_allOrders); //Orders = new ObservableCollection<PDDInvoiceOrderModel>(_allOrders);
InitBrowser(); InitBrowser(); InitBrowserDetail();
if (Config == null) Config = new InvoiceConfig(); if (Config == null) Config = new InvoiceConfig();
EndTime = DateTime.Now; EndTime = DateTime.Now;
@@ -105,7 +106,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
return true; return true;
} }
partial void InitBrowser(); partial void InitBrowser();
partial void InitBrowserDetail();
/// <summary> 列表增删时订阅/退订订单勾选状态,用于刷新表头全选状态 </summary> /// <summary> 列表增删时订阅/退订订单勾选状态,用于刷新表头全选状态 </summary>
private void Orders_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) private void Orders_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{ {
@@ -475,16 +476,22 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
private void ShowSettingDialog() private void ShowSettingDialog()
{ {
var view = new PDDInvoiceDialog(); var view = new PDDInvoiceDialog(Config);
new DialogWindow DialogService.ShowDialog(view, null, result =>
{ {
Title = "设置", if (result.Result == ButtonResult.OK)
Content = view, {
}.ShowDialog(); Config.Assign(view.Config);
Config = view.Config; NaiBa.Util.Helper.ConfigHelper.SaveConfig(ConfigPath, Config);
}
});
} }
public event EventHandler<int> BatchInvoiceChanged; public event EventHandler<int> BatchInvoiceChanged;
public event Action<IDialogResult> RequestClose;
/// <summary> /// <summary>
/// 后台批量开票:逐单加载开票页并自动填写提交,底部进度条实时更新,成功后更新列表状态 /// 后台批量开票:逐单加载开票页并自动填写提交,底部进度条实时更新,成功后更新列表状态
/// </summary> /// </summary>
@@ -537,6 +544,11 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
order.IsSelected = false; order.IsSelected = false;
success++; success++;
AmountTotal += order.order_amount / 100m; AmountTotal += order.order_amount / 100m;
if (Config.IsSaveData)
{
var temp = OrderInvoiceInfoList?.FirstOrDefault(a => a.order_sn == order.order_sn);
if (temp != null) temp.IsInvoiced = true;
}
} }
else else
{ {
@@ -546,7 +558,13 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}。总金额:{AmountTotal.ToString("N2")}"; BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}。总金额:{AmountTotal.ToString("N2")}";
BottomRMsg = $"批量开票状态:成功 {success} 个,失败 {fail} 个。总金额:{AmountTotal.ToString("N2")}"; BottomRMsg = $"批量开票状态:成功 {success} 个,失败 {fail} 个。总金额:{AmountTotal.ToString("N2")}";
StatisticsInvoiceAmount(); StatisticsInvoiceAmount();
await Task.Delay(1000); await Task.Delay(200);
if (Config.IsSaveData)
{
SaveOrderInvoiceInfo();
}
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -652,36 +670,36 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
#region 数据解析 #region 数据解析
private void parserData(string data) private void parserData(string data)
{ {
parserData(data, out string _);
}
private void parserData(string data, out string lastOrderSN)
{
lastOrderSN = "0";
List<PddBrowserOrderInvoiceViewModel> list = JsonHelper.DeserializeJsonToList<PddBrowserOrderInvoiceViewModel>(JsonHelper.JObjectParse(data)["orders"].ParseToString()); List<PddBrowserOrderInvoiceViewModel> list = JsonHelper.DeserializeJsonToList<PddBrowserOrderInvoiceViewModel>(JsonHelper.JObjectParse(data)["orders"].ParseToString());
if (list.Count == 0) if (list.Count == 0)
{ {
StopAutoScroll(); StopAutoScroll();
return; return;
} }
lastOrderSN = list.Last().order_sn;
var currentLastItem = list.Last();
var matched = list.Where(item => item.status == 4 && item.pay_status == 2).ToList(); var matched = list.Where(item => item.status == 4 && item.pay_status == 2).ToList();
if (matched.Count == 0)
Application.Current?.Dispatcher.BeginInvoke(new Action(() =>
{ {
return; if (matched.Count > 0)
{
AddOrders(matched);
} }
// CEF 回调运行在后台线程,ObservableCollection 的更新需要切回 UI 线程 BottomMsg = $"正在读取订单,读取日期{currentLastItem.OrderTime.ToString("yyyy-MM-dd")}";
var dispatcher = Application.Current?.Dispatcher;
if (dispatcher == null || dispatcher.CheckAccess())
{
AddOrders(matched);
}
else
{
dispatcher.BeginInvoke(new Action(() =>
{
AddOrders(matched);
BottomMsg = $"正在读取订单,读取日期{matched.Last().OrderTime.ToString("yyyy-MM-dd")}";
})); }));
}
} }
@@ -716,10 +734,11 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
} }
} }
StatisticsInvoiceAmount(); StatisticsInvoiceAmount();
if (Config.IsSaveData)
{
SaveOrderInvoiceInfo(); SaveOrderInvoiceInfo();
} }
}
#endregion #endregion
@@ -814,6 +833,9 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
get => _progressMaximum; get => _progressMaximum;
set => SetValue(ref _progressMaximum, value); set => SetValue(ref _progressMaximum, value);
} }
public string Title => "发票助手";
public void SetProgress(int value, int maxValue) public void SetProgress(int value, int maxValue)
{ {
StopUnknownTotalProgressTimer(); StopUnknownTotalProgressTimer();
@@ -887,6 +909,28 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
} }
_unknownTotalProgressTimer = null; _unknownTotalProgressTimer = null;
} }
public void Dispose()
{
StopAutoScroll();
Browser.Dispose();
BrowserDetail.Dispose();
}
public void OnDialogOpened(IDialogParameters parameters)
{
}
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
Dispose();
}
#endregion #endregion
#endregion #endregion
} }
@@ -896,5 +940,13 @@ public class InvoiceConfig
public string Title { get; set; } public string Title { get; set; }
public string TaxNo { get; set; } public string TaxNo { get; set; }
public decimal MaxAmount { get; set; } public decimal MaxAmount { get; set; }
public bool IsSaveData { get; set; } public bool IsSaveData { get; set; } = true;
public void Assign(InvoiceConfig config)
{
Title = config.Title;
TaxNo = config.TaxNo;
MaxAmount = config.MaxAmount;
IsSaveData = config.IsSaveData;
}
} }
@@ -183,9 +183,16 @@
<DataGridTextColumn <DataGridTextColumn
Width="1.1*" Width="1.1*"
Binding="{Binding Remark}" Binding="{Binding Remark}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="备注" Header="备注"
Visibility="{Binding Source={StaticResource ViewModel}, Path=Data.IsBuyerUnrefunded, Converter={StaticResource Boolean2VisibilityConverter}}" /> Visibility="{Binding Source={StaticResource ViewModel}, Path=Data.IsBuyerUnrefunded, Converter={StaticResource Boolean2VisibilityConverter}}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="ToolTip" Value="{Binding Remark}" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<!-- 操作:仅“买手未退回金额的订单”弹窗显示(列可见性在构造函数里按订单明细类型设置) --> <!-- 操作:仅“买手未退回金额的订单”弹窗显示(列可见性在构造函数里按订单明细类型设置) -->
<DataGridTemplateColumn <DataGridTemplateColumn
x:Name="colUpdateRefund" x:Name="colUpdateRefund"
@@ -263,6 +263,7 @@ class ShopOrderDetailRow : BindableBaseEx
class ShowOrderDialogViewModel : BindableBaseEx class ShowOrderDialogViewModel : BindableBaseEx
{ {
private readonly ShopOrderDetailType _detailType;
private readonly IShopRevenueStatisticsService _statisticsService; private readonly IShopRevenueStatisticsService _statisticsService;
public ObservableCollection<ShopOrderDetailRow> Data { get; set; } public ObservableCollection<ShopOrderDetailRow> Data { get; set; }
@@ -274,6 +275,7 @@ class ShowOrderDialogViewModel : BindableBaseEx
Data = new ObservableCollection<ShopOrderDetailRow>(ShopOrderDetailRow.Flatten(list, detailType)); Data = new ObservableCollection<ShopOrderDetailRow>(ShopOrderDetailRow.Flatten(list, detailType));
DataView = CollectionViewSource.GetDefaultView(Data); DataView = CollectionViewSource.GetDefaultView(Data);
DataView.Filter = FilterRow; DataView.Filter = FilterRow;
_detailType = detailType;
_statisticsService = statisticsService; _statisticsService = statisticsService;
} }
@@ -377,7 +379,7 @@ class ShowOrderDialogViewModel : BindableBaseEx
private async Task UpdateRemark(ShopOrderDetailRow row) private async Task UpdateRemark(ShopOrderDetailRow row)
{ {
string? remark = InputDialog.ShowText("请输入备注:", "备注", row.Remark); string? remark = InputDialog.ShowText("请输入备注:", "备注", row.Remark, allowEmpty: true);
if (remark == null) if (remark == null)
return; return;
@@ -407,26 +409,34 @@ class ShowOrderDialogViewModel : BindableBaseEx
private string BuildCopyText(IEnumerable<ShopOrderDetailRow> rows) private string BuildCopyText(IEnumerable<ShopOrderDetailRow> rows)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
bool includeRemark = _detailType == ShopOrderDetailType.BuyerUnrefunded;
// 表头 // 表头
sb.AppendLine("店名\t订单\t创建时间\t金额\t退款金额\t平台费用\t利润\t买手单号\t外采金额\t买手退款\t退款状态"); List<string> headers = ["店名", "订单", "创建时间", "金额", "退款金额", "平台费用", "利润", "买手单号", "外采金额", "买手退款", "退款状态"];
if (includeRemark)
headers.Add("备注");
sb.AppendLine(string.Join("\t", headers));
// 数据行 // 数据行
foreach (var item in rows) foreach (var item in rows)
{ {
string shopName = CsvEscape(item.ShopName); var cols = new List<string>
string orderId = item.OrderId; {
string createTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm"); CsvEscape(item.ShopName),
string orderPrice = (item.OrderPrice / 100m).ToString("0.00"); item.OrderId,
string refundAmount = (item.OrderRefundAmount / 100m).ToString("0.00"); item.CreateTime.ToString("yyyy-MM-dd HH:mm"),
string platformFee = (item.PlatformFee / 100m).ToString("0.00"); (item.OrderPrice / 100m).ToString("0.00"),
string profitAmount = (item.ProfitAmount / 100m).ToString("0.00"); (item.OrderRefundAmount / 100m).ToString("0.00"),
string buyerOrderSn = CsvEscape(item.OutOrderSn); (item.PlatformFee / 100m).ToString("0.00"),
string buyerOutAmount = (item.BuyerOutAmount / 100m).ToString("0.00"); (item.ProfitAmount / 100m).ToString("0.00"),
string buyerRefundAmount = (item.BuyerRefundAmount / 100m).ToString("0.00"); CsvEscape(item.OutOrderSn),
string buyerRefundStatus = CsvEscape(item.BuyerRefundStatusText); (item.BuyerOutAmount / 100m).ToString("0.00"),
(item.BuyerRefundAmount / 100m).ToString("0.00"),
sb.AppendLine($"{shopName}\t{orderId}\t{createTime}\t{orderPrice}\t{refundAmount}\t{platformFee}\t{profitAmount}\t{buyerOrderSn}\t{buyerOutAmount}\t{buyerRefundAmount}\t{buyerRefundStatus}"); CsvEscape(item.BuyerRefundStatusText)
};
if (includeRemark)
cols.Add(CsvEscape(item.Remark));
sb.AppendLine(string.Join("\t", cols));
} }
return sb.ToString(); return sb.ToString();
+11 -1
View File
@@ -135,7 +135,7 @@
d:Visibility="Visible" d:Visibility="Visible"
Visibility="Collapsed" /> Visibility="Collapsed" />
<Grid <Grid
x:Name="gridPddBuyerOrderReadCtrl" x:Name="gridTbBuyerOrderReadCtrl"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
d:Visibility="Visible" d:Visibility="Visible"
Background="#7F000000" Background="#7F000000"
@@ -147,6 +147,7 @@
HorizontalAlignment="Right" HorizontalAlignment="Right"
Background="White" Background="White"
CornerRadius="10"> CornerRadius="10">
<Grid>
<buyerctrls:PDDBuyerOrderReadCtrl <buyerctrls:PDDBuyerOrderReadCtrl
x:Name="pddBuyerOrderReadCtrl" x:Name="pddBuyerOrderReadCtrl"
Grid.Column="1" Grid.Column="1"
@@ -155,6 +156,15 @@
Panel.ZIndex="-1" Panel.ZIndex="-1"
d:Visibility="Visible" d:Visibility="Visible"
Visibility="Collapsed" /> Visibility="Collapsed" />
<buyerctrls:TbBuyerOrderReadCtrl
x:Name="tbBuyerOrderReadCtrl"
Grid.Column="1"
Width="1200"
HorizontalAlignment="Right"
Panel.ZIndex="-1"
d:Visibility="Collapsed"
Visibility="Collapsed" />
</Grid>
</Border> </Border>
</Grid> </Grid>
<buyerctrls:PDDBuyerSelectCtrl <buyerctrls:PDDBuyerSelectCtrl
+1
View File
@@ -87,6 +87,7 @@ namespace _29WxOrderWpf
//shopListCtrl.Visibility = Visibility.Visible; //shopListCtrl.Visibility = Visibility.Visible;
orderListCtrl.Visibility = Visibility.Visible; orderListCtrl.Visibility = Visibility.Visible;
pddBuyerOrderReadCtrl.Visibility = Visibility.Visible; pddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
tbBuyerOrderReadCtrl.Visibility = Visibility.Visible;
pddBuyerSelectCtrl.Visibility = Visibility.Visible; pddBuyerSelectCtrl.Visibility = Visibility.Visible;
Task.Run(() => Task.Run(() =>
{ {
@@ -11,6 +11,8 @@ using NaiBa.Util.Extension;
using Org.BouncyCastle.Asn1.Ocsp; using Org.BouncyCastle.Asn1.Ocsp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Security.Policy; using System.Security.Policy;
using System.Text; using System.Text;
@@ -35,6 +37,8 @@ namespace _29WxOrderWpf.ViewModels
// 拼多多买手退货退款售后地址 // 拼多多买手退货退款售后地址
// https://mobile.yangkeduo.com/complaint.html?order_sn=260718-101481213440980&after_sales_reason=0&after_sales_type=2&after_sales_code=1002 // https://mobile.yangkeduo.com/complaint.html?order_sn=260718-101481213440980&after_sales_reason=0&after_sales_type=2&after_sales_code=1002
List<Process> cefSubProcesses = new List<Process>();
public static TaobaoLoginViewModel TaobaoLoginInstance { get; set; } = null; public static TaobaoLoginViewModel TaobaoLoginInstance { get; set; } = null;
/// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary> /// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary>
@@ -160,7 +164,6 @@ namespace _29WxOrderWpf.ViewModels
} }
Task.Run(() => Task.Run(() =>
{ {
AutoLogin(); AutoLogin();
}); });
} }
@@ -171,6 +174,90 @@ namespace _29WxOrderWpf.ViewModels
public void Stop() public void Stop()
{ {
_isWindowLoaded = false; _isWindowLoaded = false;
// 1. 解除 JS 绑定
CefWebBrowser?.JavascriptObjectRepository?.UnRegisterAll();
CefWebBrowser?.CloseDevTools();
// 2. 优雅关闭浏览器
CefWebBrowser?.GetBrowser()?.CloseBrowser(false);
// 3. 清理残留子进程(按路径判断,避免误杀)
CleanupBrowserSubprocesses(this.cefSubProcesses);
// 4. 释放控件
CefWebBrowser?.Dispose();
CefWebBrowser = null;
}
public static void CleanupBrowserSubprocesses(List<Process> processes = null)
{
// 有可能释放错误导致程序崩溃,废弃
return;
try
{
if (processes == null)
processes = new List<Process>();
string appBasePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\', '/');
Process[] subprocesses = Process.GetProcessesByName("CefSharp.BrowserSubprocess");
foreach (Process process in subprocesses)
{
bool shouldKill = false;
try
{
// 安全地获取进程模块信息,进程可能在我们检查时已退出
if (process != null && !process.HasExited)
{
string moduleFileName = process.MainModule?.FileName;
if (!string.IsNullOrEmpty(moduleFileName))
{
// 判断进程是否从当前应用目录启动
string processDir = System.IO.Path.GetDirectoryName(moduleFileName);
if (!string.IsNullOrEmpty(processDir) &&
(processDir.Equals(appBasePath, StringComparison.OrdinalIgnoreCase)
|| appBasePath.Contains(processDir) // 处理子目录情况
|| moduleFileName.Contains(appBasePath)))
{
if (!processes.Any(p => p.Handle.ParseToInt() == process.Handle.ParseToInt()))
shouldKill = true;
}
}
}
}
catch (InvalidOperationException)
{
// 进程可能在检查过程中已退出,忽略
continue;
}
catch (Win32Exception ex) when (ex.NativeErrorCode == 5) // 访问被拒绝
{
// 可能是权限问题或其他应用的进程,跳过
continue;
}
if (shouldKill)
{
try
{
process.Kill();
process.WaitForExit(500); // 等待最多500毫秒,确保进程终止
}
catch (Exception killEx)
{
// 记录日志,但通常进程已死
//System.Diagnostics.Debug.WriteLine($"终止进程时出错: {killEx.Message}");
}
}
}
}
catch (Exception ex)
{
// 这里最好不要用MessageBox,尤其是在关闭流程中,可能引发线程问题
// 建议记录到日志文件
//System.Diagnostics.Debug.WriteLine($"清理子进程时发生异常: {ex}");
}
} }
/// <summary> /// <summary>
@@ -184,6 +271,8 @@ namespace _29WxOrderWpf.ViewModels
{ {
if (CefWebBrowser == null) if (CefWebBrowser == null)
{ {
this.cefSubProcesses = Process.GetProcessesByName("CefSharp.BrowserSubprocess").ToList();
if (!string.IsNullOrEmpty(InitUrl)) if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(InitUrl, false); CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else else
@@ -223,10 +312,11 @@ namespace _29WxOrderWpf.ViewModels
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid) while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
await Task.Delay(20); await Task.Delay(20);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null)); //await WPFCEFBrowser.DeleteCookieAsync(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager //cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null)); //await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
if (OpenType != EnumOpenType.login)
foreach (var cook in cookieLst) foreach (var cook in cookieLst)
{ {
await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null)); await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
@@ -271,7 +361,8 @@ namespace _29WxOrderWpf.ViewModels
} }
} }
}); }
);
} }
@@ -320,7 +411,7 @@ namespace _29WxOrderWpf.ViewModels
// Task.Run(() => { CefWebBrowser.Load(buyerLoginUrl); }); // Task.Run(() => { CefWebBrowser.Load(buyerLoginUrl); });
//} //}
var data = responseData; var data = responseData;
if (data.Contains("karl_malone_32") || data.Contains("jtt_fan")) //if (data.Contains("karl_malone_32") || data.Contains("jtt_fan"))
{ {
//https://h5api.m.taobao.com/h5/mtop.user.getusersimple/1.0/?jsv=2.7.2&appKey=12574478&t=1789984970076&sign=6bb7d3b5cd8bd3ab32bd97c1a0df1c0f&jsonpIncPrefix=tbnavnew&api=mtop.user.getUserSimple&v=1.0&dataType=json&type=originaljson&data=%7B%7D //https://h5api.m.taobao.com/h5/mtop.user.getusersimple/1.0/?jsv=2.7.2&appKey=12574478&t=1789984970076&sign=6bb7d3b5cd8bd3ab32bd97c1a0df1c0f&jsonpIncPrefix=tbnavnew&api=mtop.user.getUserSimple&v=1.0&dataType=json&type=originaljson&data=%7B%7D
@@ -363,7 +454,8 @@ namespace _29WxOrderWpf.ViewModels
{ {
Thread.Sleep(2000); Thread.Sleep(2000);
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null)); //List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList("", CefWebBrowser.GetCookieManager(null));
var buyerUrl = BaseClass.Build29WxObjString("user/add_taobao_buyer"); var buyerUrl = BaseClass.Build29WxObjString("user/add_taobao_buyer");
@@ -55,8 +55,8 @@ namespace _29WxOrderWpf.Windows.OrderWindows
if (OrderItem != null) if (OrderItem != null)
{ {
this.cmbWareHouse.Text = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransId == OrderItem.ItemTransitOrderWithVoid?.platform)?.TransName; this.cmbWareHouse.Text = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransId == OrderItem.ItemTransitOrderWithVoid?.platform)?.TransName;
this.txtExpressName.Text = OrderItem.ItemTransitOrder?.express_2_company; this.txtExpressName.Text = OrderItem.ItemTransitOrder?.express_2_company ?? OrderItem.ItemTransitOrderWithVoid?.express_2_company;
this.txtWarehouseWaybill.Text = OrderItem.ItemTransitOrder?.express_2_waybill; this.txtWarehouseWaybill.Text = OrderItem.ItemTransitOrder?.express_2_waybill ?? OrderItem.ItemTransitOrderWithVoid?.express_2_waybill;
if (OrderItem.ItemTransitOrderAfterSale != null) if (OrderItem.ItemTransitOrderAfterSale != null)
{ {
@@ -151,7 +151,7 @@ namespace _29WxOrderWpf.Windows.OrderWindows
JObject data = new JObject(); JObject data = new JObject();
data["orderNo"] = OrderItem.order_id; data["orderNo"] = OrderItem.order_id;
data["orderCode"] = OrderItem.ItemTransitOrder?.order_code; data["orderCode"] = OrderItem.ItemTransitOrderWithVoid?.order_code;
data["refundProvince"] = txtProvince.Text.Trim(); data["refundProvince"] = txtProvince.Text.Trim();
data["refundCity"] = txtCity.Text.Trim(); data["refundCity"] = txtCity.Text.Trim();
data["refundCounty"] = txtCounty.Text.Trim(); data["refundCounty"] = txtCounty.Text.Trim();
@@ -251,12 +251,15 @@ namespace _29WxOrderWpf.Windows.OrderWindows
{ {
if (OrderItem.ItemTransitOrder?.warehouse_status == 3) if (OrderItem.ItemTransitOrder?.warehouse_status == 3)
return "\"success\":true,\"message\":\"已到仓,无需拦截工单\""; return "\"success\":true,\"message\":\"已到仓,无需拦截工单\"";
if (OrderItem.ItemTransitOrderWithVoid?.warehouse_status == 3)
return "\"success\":true,\"message\":\"已到仓,无需拦截工单\"";
string url = HttpResponseTransitWorkOrderBLL.WorkOrderUrl + "/api/open/v1/customer-work-orders/intercept-return-cloud-warehouse-after-outbound"; string url = HttpResponseTransitWorkOrderBLL.WorkOrderUrl + "/api/open/v1/customer-work-orders/intercept-return-cloud-warehouse-after-outbound";
JObject obj = new JObject(); JObject obj = new JObject();
obj["appId"] = this.OrderItem.Shop.ShopId; obj["appId"] = this.OrderItem.Shop?.ShopId;
obj["wechatOrderNo"] = this.OrderItem.order_id; obj["wechatOrderNo"] = this.OrderItem.order_id;
obj["purchaseOrderNo"] = this.OrderItem.PddBuyerAfterSale?.orderSn; //obj["purchaseOrderNo"] = this.OrderItem.PddBuyerAfterSale?.orderSn;
obj["purchaseOrderNo"] = OrderItem.ItemTransitOrderWithVoid?.order_code;
obj["creator"] = BaseClass.UserName; obj["creator"] = BaseClass.UserName;
obj["remark"] = "客户要求拦截并退回云仓"; obj["remark"] = "客户要求拦截并退回云仓";
@@ -134,8 +134,8 @@ namespace _29WxOrderWpf.Windows.OrderWindows
{ {
if (OrderItem?.ItemOrder?.OrderBuyType == "云仓" && (OrderItem?.ItemTransitOrder?.warehouse_status).ParseToInt() < 1) if (OrderItem?.ItemOrder?.OrderBuyType == "云仓" && (OrderItem?.ItemTransitOrder?.warehouse_status).ParseToInt() < 1)
{ {
BaseMsgWindow.ShowError("当前订单仓库状态不支持创建退货订单!"); //BaseMsgWindow.ShowError("当前订单仓库状态不支持创建退货订单!");
return; //return;
} }
if (txtWaybillId.Text.Trim().IsNullOrEmpty() || PddBuyerOrderLiteInfo.GetPddToTransitWarehouseExpressCompanyCode(cmbExpressName.SelectedItem.ParseToString()).IsNullOrEmpty()) if (txtWaybillId.Text.Trim().IsNullOrEmpty() || PddBuyerOrderLiteInfo.GetPddToTransitWarehouseExpressCompanyCode(cmbExpressName.SelectedItem.ParseToString()).IsNullOrEmpty())
{ {
+1 -1
View File
@@ -37,7 +37,7 @@ namespace AllBase
/// 版本ID /// 版本ID
/// </summary> /// </summary>
public static int VersionCount = 311; public static int VersionCount = 323;
public static string ServerUrl { get; set; } = "http://1.13.195.131:9000"; public static string ServerUrl { get; set; } = "http://1.13.195.131:9000";
public static string DebugUrl { get; set; } = "http://localhost:9000"; public static string DebugUrl { get; set; } = "http://localhost:9000";
@@ -50,7 +50,8 @@ XDYWHC ;武汉2仓 ;杨先生 ;13044121071 ;湖北省武汉市江汉区
XDYSHANDC ;山东2仓 ;鸿鹄小申 ;13044121239 ;山东省临沂市费县南外环东转盘往东200米顺通快递有限公司(仓库二楼) ;22 ;292 ;2415 ;山东省 ;临沂市 ;费县 ;费城街道 ;南外环东转盘往东200米顺通快递有限公司(仓库二楼) XDYSHANDC ;山东2仓 ;鸿鹄小申 ;13044121239 ;山东省临沂市费县南外环东转盘往东200米顺通快递有限公司(仓库二楼) ;22 ;292 ;2415 ;山东省 ;临沂市 ;费县 ;费城街道 ;南外环东转盘往东200米顺通快递有限公司(仓库二楼)
XDYSHC ;上海新仓 ;纪先生 ;13044121150 ;上海市上海市普陀区真如镇街道真北路2653弄T区 ;25 ;321 ;2709 ;上海市 ;上海市 ;普陀区 ;真如镇街道 ;真北路2653弄T区 XDYSHC ;上海新仓 ;纪先生 ;13044121150 ;上海市上海市普陀区真如镇街道真北路2653弄T区 ;25 ;321 ;2709 ;上海市 ;上海市 ;普陀区 ;真如镇街道 ;真北路2653弄T区
XDYSZC ;深圳仓 ;峰峰 ;15343351331 ;广东省东莞市凤岗镇浸校塘东良巷逸乐轩E栋5号楼 ;6 ;79 ;732 ;广东省 ;东莞市 ;凤岗镇 ;凤岗街道 ;浸校塘东良巷逸乐轩E栋5号楼 XDYSZC ;深圳仓 ;峰峰 ;15343351331 ;广东省东莞市凤岗镇浸校塘东良巷逸乐轩E栋5号楼 ;6 ;79 ;732 ;广东省 ;东莞市 ;凤岗镇 ;凤岗街道 ;浸校塘东良巷逸乐轩E栋5号楼
XDYYWC ;义乌仓 ;小田 ;19058117371 ;浙江省金华市义乌市北苑街道西站大道妈妈商贸18号库39号楼誉达 ;31 ;386 ;3409 ;浙江省 ;金华市 ;义乌市 ;北苑街道 ;西站大道妈妈商贸18号库39号楼誉达"; XDYYWC ;义乌仓 ;小田 ;19058117371 ;浙江省义乌市后宅街道金城高尔夫二期别墅区401栋 ;31 ;386 ;3409 ;浙江省 ;金华市 ;义乌市 ;后宅街道 ;金城高尔夫二期别墅区401栋";
//XDYYWC ;义乌仓 ;小田 ;19058117371 ;浙江省金华市义乌市北苑街道西站大道妈妈商贸18号库39号楼誉达 ;31 ;386 ;3409 ;浙江省 ;金华市 ;义乌市 ;北苑街道 ;西站大道妈妈商贸18号库39号楼誉达
//XDYJJC ;晋江仓 ;安群 ;19905951984 ;福建省泉州市南安市霞美镇温山村431号鸿鹄大厦 ;4 ;58 ;569 ;福建省 ;泉州市 //XDYJJC ;晋江仓 ;安群 ;19905951984 ;福建省泉州市南安市霞美镇温山村431号鸿鹄大厦 ;4 ;58 ;569 ;福建省 ;泉州市
//XDYCDC ;成都仓 ;谢春虹 ;15828201479 ;四川省资阳市乐至县仙鹤大道桑都街15-19号仓库(不要放驿站,送到仓库) ;26 ;340 ;2898 ;四川省 ;资阳市 //XDYCDC ;成都仓 ;谢春虹 ;15828201479 ;四川省资阳市乐至县仙鹤大道桑都街15-19号仓库(不要放驿站,送到仓库) ;26 ;340 ;2898 ;四川省 ;资阳市
//XDYCHONGQC ;重庆2仓 ;翁桂柱 ;18923911055 ;重庆市九龙坡区中梁山街道云飞九龙香山(二纵线东50米)重庆九龙坡区渝州公司 ;32 ;394 ;3339 //XDYCHONGQC ;重庆2仓 ;翁桂柱 ;18923911055 ;重庆市九龙坡区中梁山街道云飞九龙香山(二纵线东50米)重庆九龙坡区渝州公司 ;32 ;394 ;3339
+1 -1
View File
@@ -756,7 +756,7 @@ namespace AllBase.Model.DBModel
else else
IsShowChangeWaybillBtn = true; IsShowChangeWaybillBtn = true;
if (IsWaitBuy) if (IsWaitBuy || this.orderItems.All(oi => oi.ItemTransitOrderWithVoid == null))
IsShowTransitExtraPackagesBtn = false; IsShowTransitExtraPackagesBtn = false;
else else
IsShowTransitExtraPackagesBtn = true; IsShowTransitExtraPackagesBtn = true;
@@ -331,10 +331,16 @@ namespace AllBase.Model.DBModel
this.TransitOrderWaybillFakeStr = ItemTransitOrder.express_1_company + "-" + ItemTransitOrder.express_1_waybill; this.TransitOrderWaybillFakeStr = ItemTransitOrder.express_1_company + "-" + ItemTransitOrder.express_1_waybill;
// 仓库下游物流 // 仓库下游物流
if (ItemTransitOrder == null || ItemTransitOrder.express_2_company.IsNullOrEmpty() || ItemTransitOrder.express_2_waybill.IsNullOrEmpty()) //if (ItemTransitOrder == null || ItemTransitOrder.express_2_company.IsNullOrEmpty() || ItemTransitOrder.express_2_waybill.IsNullOrEmpty())
TransitOrderWaybillFromWareHouseStr = null; // TransitOrderWaybillFromWareHouseStr = null;
else //else
// TransitOrderWaybillFromWareHouseStr = ItemTransitOrder.express_2_company + "-" + ItemTransitOrder.express_2_waybill;
if (ItemTransitOrder != null && !ItemTransitOrder.express_2_company.IsNullOrEmpty() && !ItemTransitOrder.express_2_waybill.IsNullOrEmpty())
TransitOrderWaybillFromWareHouseStr = ItemTransitOrder.express_2_company + "-" + ItemTransitOrder.express_2_waybill; TransitOrderWaybillFromWareHouseStr = ItemTransitOrder.express_2_company + "-" + ItemTransitOrder.express_2_waybill;
else if (ItemTransitOrderWithVoid != null && !ItemTransitOrderWithVoid.express_2_company.IsNullOrEmpty() && !ItemTransitOrderWithVoid.express_2_waybill.IsNullOrEmpty())
TransitOrderWaybillFromWareHouseStr = ItemTransitOrderWithVoid.express_2_company + "-" + ItemTransitOrderWithVoid.express_2_waybill;
else
TransitOrderWaybillFromWareHouseStr = null;
if (order_id == "3739043283864307968") if (order_id == "3739043283864307968")
{ {
@@ -1287,7 +1293,7 @@ namespace AllBase.Model.DBModel
// 直拍按钮 // 直拍按钮
BtnDirectBuyOrderVisibility = Visibility.Collapsed; BtnDirectBuyOrderVisibility = Visibility.Collapsed;
if (GlobalConfig.CurrentBuyPlatform == "pdd") //if (GlobalConfig.CurrentBuyPlatform == "pdd")
{ {
if (this.ItemOrder?.GetIsWaitBuy() == true && this.BuyGoodsBtnTxt != "关联拍单") if (this.ItemOrder?.GetIsWaitBuy() == true && this.BuyGoodsBtnTxt != "关联拍单")
BtnDirectBuyOrderVisibility = Visibility.Visible; BtnDirectBuyOrderVisibility = Visibility.Visible;
@@ -1298,7 +1304,7 @@ namespace AllBase.Model.DBModel
BtnDirectBuyOrderVisibility = Visibility.Visible; BtnDirectBuyOrderVisibility = Visibility.Visible;
} }
} }
else if (GlobalConfig.CurrentBuyPlatform == "tb") //else if (GlobalConfig.CurrentBuyPlatform == "tb")
{ {
} }
} }
@@ -6,6 +6,11 @@ using System.Threading.Tasks;
namespace AllBase.Model.DBModel namespace AllBase.Model.DBModel
{ {
public class order_tb_buyer_after_sale : order_pdd_buyer_after_sale
{
}
public class order_pdd_buyer_after_sale public class order_pdd_buyer_after_sale
{ {
public long? id { get; set; } public long? id { get; set; }
@@ -26,7 +31,9 @@ namespace AllBase.Model.DBModel
public long? refundAmount { get; set; } public long? refundAmount { get; set; }
public long? orderDate { get; set; } public long? orderDate { get; set; }
public string statusText { get; set; } public string statusText { get; set; }
public string afterSaleAddress { get; set; } string _afterSaleAddress;
public string afterSaleAddress { get { return _afterSaleAddress.Replace("鹅歌(全程视频验货,请原封退回,以免售后失败)", "鹅歌"); } set {_afterSaleAddress = value; } }
public string order_detail { get; set; } public string order_detail { get; set; }
public DateTime add_time { get; set; } public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; } public DateTime mdy_time { get; set; }
@@ -6,6 +6,11 @@ using System.Threading.Tasks;
namespace AllBase.Model.DBModel namespace AllBase.Model.DBModel
{ {
public class order_tb_buyer_order : order_pdd_buyer_order
{
}
public class order_pdd_buyer_order public class order_pdd_buyer_order
{ {
public long? id { get; set; } public long? id { get; set; }
@@ -9,6 +9,10 @@ using System.Threading.Tasks;
namespace AllBase.Model.Result namespace AllBase.Model.Result
{ {
public class TbBuyerAfterSaleLiteInfo : PddBuyerAfterSaleLiteInfo
{
}
public class PddBuyerAfterSaleLiteInfo : PropertyNotifyObject public class PddBuyerAfterSaleLiteInfo : PropertyNotifyObject
{ {
public string WxSendTypeStr public string WxSendTypeStr
@@ -253,16 +257,19 @@ namespace AllBase.Model.Result
public string buyerId { get; set; } // 买手Id public string buyerId { get; set; } // 买手Id
public string buyerName { get; set; } // 买手名称 public string buyerName { get; set; } // 买手名称
public string tbOrderSn { get; set; } // 淘宝的买手单号
public string orderSn public string orderSn
{ {
get get
{ {
if (!string.IsNullOrEmpty(tbOrderSn))
return tbOrderSn;
var detailPage = listItemExtraVO.navToDetailPageUrl; var detailPage = listItemExtraVO.navToDetailPageUrl;
return BaseRegex.GetStringQuery(ref detailPage, "order_sn"); return BaseRegex.GetStringQuery(ref detailPage, "order_sn");
} }
set { }
} }
public int? orderDate { get { return orderSn.Split('-').FirstOrDefault().ParseToInt(); } set { } } public int? tbOrderDate { get; set; }
public int? orderDate { get { return tbOrderDate ?? orderSn.Split('-').FirstOrDefault().ParseToInt(); } }
public long? afterSalesId { get; set; } // 20129688312436, public long? afterSalesId { get; set; } // 20129688312436,
@@ -280,11 +287,11 @@ namespace AllBase.Model.Result
public class ListItemAmountVO public class ListItemAmountVO
{ {
public string orderAmountTitle { get; set; } // "实付:", public string orderAmountTitle { get; set; } = "实付:"; // "实付:",
public int? orderAmount { get; set; } // 1580, public int? orderAmount { get; set; } // 1580,
public object payLaterAmountTitle { get; set; } // null, public object payLaterAmountTitle { get; set; } // null,
public object payLaterAmount { get; set; } // null, public object payLaterAmount { get; set; } // null,
public string refundAmountTitle { get; set; } // "退款金额:", public string refundAmountTitle { get; set; } = "退款金额:"; // "退款金额:",
public int? refundAmount { get; set; } // 1580, public int? refundAmount { get; set; } // 1580,
public object refundAmountText { get; set; } // null, public object refundAmountText { get; set; } // null,
public bool? useCoupon { get; set; } // false public bool? useCoupon { get; set; } // false
+21 -1
View File
@@ -12,6 +12,11 @@ using System.Threading.Tasks;
namespace AllBase.Model.Result namespace AllBase.Model.Result
{ {
public class TbBuyerOrderLiteInfo : PddBuyerOrderLiteInfo
{
}
public class PddBuyerOrderLiteInfo : PropertyNotifyObject public class PddBuyerOrderLiteInfo : PropertyNotifyObject
{ {
/// <summary> /// <summary>
@@ -388,13 +393,16 @@ namespace AllBase.Model.Result
set { this.SetValue(x => x.OutAfterSaleStatusStr, value); } set { this.SetValue(x => x.OutAfterSaleStatusStr, value); }
} }
// 淘宝的物流公司名称,单独写
public string tbOutExpressCompanyMsg { get; set; } = null;
/// <summary> /// <summary>
/// 物流公司名称,可以尝试直接从列表中匹配 /// 物流公司名称,可以尝试直接从列表中匹配
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
public string outExpressCompanyMsg public string outExpressCompanyMsg
{ {
get { return extra_info?.order_hint?.message; } get { return tbOutExpressCompanyMsg ?? extra_info?.order_hint?.message; }
set { } set { }
} }
/// <summary> /// <summary>
@@ -420,6 +428,17 @@ namespace AllBase.Model.Result
return GetPddToWxExpressCompanyCode(outExpressCompanyName); return GetPddToWxExpressCompanyCode(outExpressCompanyName);
} }
} }
/// <summary>
/// 外采淘宝订单物流名称对应微信物流公司编码
/// </summary>
[JsonIgnore]
public string outTbToWxExpressCompanyCode
{
get
{
return GetPddToWxExpressCompanyCode(outExpressCompanyName);
}
}
public string outExpressCompanyName public string outExpressCompanyName
{ {
get get
@@ -433,6 +452,7 @@ namespace AllBase.Model.Result
if (outExpressCompanyMsg.Contains("申通快递")) return "申通快递"; if (outExpressCompanyMsg.Contains("申通快递")) return "申通快递";
if (outExpressCompanyMsg.Contains("韵达快递")) return "韵达快递"; if (outExpressCompanyMsg.Contains("韵达快递")) return "韵达快递";
if (outExpressCompanyMsg.Contains("圆通快递")) return "圆通快递"; if (outExpressCompanyMsg.Contains("圆通快递")) return "圆通快递";
if (outExpressCompanyMsg.Contains("圆通速递")) return "圆通快递";
if (outExpressCompanyMsg.Contains("中通快递")) return "中通快递"; if (outExpressCompanyMsg.Contains("中通快递")) return "中通快递";
if (outExpressCompanyMsg.Contains("百世快运")) return "百世快运"; if (outExpressCompanyMsg.Contains("百世快运")) return "百世快运";
if (outExpressCompanyMsg.Contains("百世快递")) return "百世快递"; if (outExpressCompanyMsg.Contains("百世快递")) return "百世快递";
+5
View File
@@ -6,6 +6,11 @@ using System.Threading.Tasks;
namespace AllBase.Model.Result namespace AllBase.Model.Result
{ {
public class TbPickInfo : PddPickInfo
{
}
public class PddPickInfo public class PddPickInfo
{ {
public string station_name {get;set;} // "" public string station_name {get;set;} // ""
+129 -20
View File
@@ -25,7 +25,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
@@ -34,6 +36,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
//using System.Web.Hosting; //using System.Web.Hosting;
using System.Windows.Forms; using System.Windows.Forms;
using Work; using Work;
@@ -63,7 +66,7 @@ namespace TemuKJD.ToolForms
/// </summary> /// </summary>
public string BuyType { get; set; } = "transit"; public string BuyType { get; set; } = "transit";
public int MaxCloseAfterSecond { get; set; } public int CloseAfterSecond { get; set; }
public string InitUrl = ""; public string InitUrl = "";
public string BuyMapUrl = ""; public string BuyMapUrl = "";
@@ -132,12 +135,12 @@ namespace TemuKJD.ToolForms
GlobalConfig.BuyConfig.IsUseAppBalance = true; GlobalConfig.BuyConfig.IsUseAppBalance = true;
if (IsAutoBuy) if (IsAutoBuy)
MaxCloseAfterSecond = 60; CloseAfterSecond = 60;
if (MaxCloseAfterSecond > 0) if (CloseAfterSecond > 0)
{ {
Task.Run(() => Task.Run(() =>
{ {
Thread.Sleep(1000 * MaxCloseAfterSecond); Thread.Sleep(1000 * CloseAfterSecond);
if (this.Created && IsAutoBuy) if (this.Created && IsAutoBuy)
{ {
Invoke(new Action(() => Invoke(new Action(() =>
@@ -158,6 +161,7 @@ namespace TemuKJD.ToolForms
if (this.Created) if (this.Created)
Invoke(new Action(() => Invoke(new Action(() =>
{ {
this.pnlMask.Dock = DockStyle.Fill;
this.pnlMask.Visible = true; this.pnlMask.Visible = true;
this.pnlMask.Text = "自动拍单倒计时\r\n" + i; this.pnlMask.Text = "自动拍单倒计时\r\n" + i;
})); }));
@@ -245,11 +249,6 @@ namespace TemuKJD.ToolForms
IsFormLoad = true; IsFormLoad = true;
} }
private void Rb_CheckedChanged(object sender, EventArgs e)
{
transitWarehouse = (sender as RadioButton)?.Tag as TransitWarehouseParam;
}
/// <summary> /// <summary>
/// 自动登录店铺后台 /// 自动登录店铺后台
/// </summary> /// </summary>
@@ -380,6 +379,8 @@ namespace TemuKJD.ToolForms
Invoke(() => { this.pnlMask.Visible = false; }); Invoke(() => { this.pnlMask.Visible = false; });
} }
else if (BuyType == "direct" && orderItem?.ItemOrder?.AddressStr.Contains("******") == false) else if (BuyType == "direct" && orderItem?.ItemOrder?.AddressStr.Contains("******") == false)
{
try
{ {
var dvProvince = GlobalConfig.PddDivisions.FirstOrDefault(d => d.name == orderItem.ItemOrder.province_name); var dvProvince = GlobalConfig.PddDivisions.FirstOrDefault(d => d.name == orderItem.ItemOrder.province_name);
var dvCity = dvProvince.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.city_name); var dvCity = dvProvince.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.city_name);
@@ -396,6 +397,10 @@ namespace TemuKJD.ToolForms
request.PostData.Elements[0].Bytes = System.Text.Encoding.UTF8.GetBytes(postData); request.PostData.Elements[0].Bytes = System.Text.Encoding.UTF8.GetBytes(postData);
Invoke(() => { this.pnlMask.Visible = false; }); Invoke(() => { this.pnlMask.Visible = false; });
} }
catch
{
}
}
HasChangeAddress = true; HasChangeAddress = true;
} }
@@ -637,13 +642,17 @@ namespace TemuKJD.ToolForms
} }
} }
/// <summary>
/// 自动拍单循环
/// </summary>
public void AotoBuyLoop() public void AotoBuyLoop()
{ {
Task.Run(async () => Task.Run(async () =>
{ {
// 自动下单 // 自动下单
while (true && IsAutoBuy) while (this.Created && IsAutoBuy)
{ {
Thread.Sleep(100);
if (HasChangeAddress && (this.cefWebBrowser?.GetMainFrame()?.Url).ParseToString().StartsWith("https://mobile.yangkeduo.com/order_checkout.html?sku_id=")) if (HasChangeAddress && (this.cefWebBrowser?.GetMainFrame()?.Url).ParseToString().StartsWith("https://mobile.yangkeduo.com/order_checkout.html?sku_id="))
{ {
try try
@@ -689,7 +698,7 @@ namespace TemuKJD.ToolForms
Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
if (!IsAutoBuy) return; if (!IsAutoBuy) return;
var ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "立即支付", true); var ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "立即支付", true);
for (int i = 0; i < 5; i++) for (int i = 0; i < 20; i++)
{ {
if (ts2.Result?.Value is string rstStr && rstStr == "success") if (ts2.Result?.Value is string rstStr && rstStr == "success")
break; break;
@@ -705,11 +714,11 @@ namespace TemuKJD.ToolForms
Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
if (!IsAutoBuy) return; if (!IsAutoBuy) return;
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "确认付款", true); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "确认付款", true);
for (int i = 0; i < 50; i++) for (int i = 0; i < 25; i++)
{ {
if (ts2.Result?.Value is string rstStr && rstStr == "success") if (ts2.Result?.Value is string rstStr && rstStr == "success")
break; break;
Thread.Sleep(100); Thread.Sleep(500);
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "确认付款", true); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("span", "确认付款", true);
} }
@@ -717,12 +726,12 @@ namespace TemuKJD.ToolForms
Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
if (!IsAutoBuy) return; if (!IsAutoBuy) return;
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("div", "输入支付密码"); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("div", "输入支付密码");
for (int i = 0; i < 50; i++) for (int i = 0; i < 20; i++)
{ {
if (ts2.Result?.Value is string rstStr && rstStr == "success") if (ts2.Result?.Value is string rstStr && rstStr == "success")
break; break;
Thread.Sleep(100); Thread.Sleep(500);
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("div", "输入支付密码"); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("div", "输入支付密码");
} }
Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
@@ -735,12 +744,12 @@ namespace TemuKJD.ToolForms
Thread.Sleep(Randomx.GetId(500, 1000)); Thread.Sleep(Randomx.GetId(500, 1000));
if (!IsAutoBuy) return; if (!IsAutoBuy) return;
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("button", "下一步", true); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("button", "下一步", true);
for (int i = 0; i < 50; i++) for (int i = 0; i < 20; i++)
{ {
if (ts2.Result?.Value is string rstStr && rstStr == "success") if (ts2.Result?.Value is string rstStr && rstStr == "success")
break; break;
Thread.Sleep(200); Thread.Sleep(500);
if (!IsAutoBuy) return; if (!IsAutoBuy) return;
ts2 = await EvaluateJsBuyTagNameAndInnerHtml("button", "下一步", true); ts2 = await EvaluateJsBuyTagNameAndInnerHtml("button", "下一步", true);
} }
@@ -837,10 +846,9 @@ namespace TemuKJD.ToolForms
/// <returns></returns> /// <returns></returns>
public async Task<string> ChangeAddress(TransitWarehouseParam transit) public async Task<string> ChangeAddress(TransitWarehouseParam transit)
{ {
Thread.Sleep(200);
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
{ {
Thread.Sleep(100); Thread.Sleep(200);
if (host == null || client == null) if (host == null || client == null)
{ {
host = cefWebBrowser.GetBrowser().GetHost(); host = cefWebBrowser.GetBrowser().GetHost();
@@ -928,7 +936,7 @@ namespace TemuKJD.ToolForms
} }
})();"; })();";
} }
for (int i = 0; i < 20; i++) for (int i = 0; i < 30; i++)
{ {
Thread.Sleep(100); Thread.Sleep(100);
if (!this.Created) if (!this.Created)
@@ -1011,6 +1019,20 @@ namespace TemuKJD.ToolForms
if (!this.Disposing && !this.IsDisposed) if (!this.Disposing && !this.IsDisposed)
{ {
//MainForm.instance.Invoke(new Action(() => { this.Dispose(); })); //MainForm.instance.Invoke(new Action(() => { this.Dispose(); }));
// 1. 解除 JS 绑定
cefWebBrowser?.JavascriptObjectRepository?.UnRegisterAll();
cefWebBrowser?.CloseDevTools();
// 2. 优雅关闭浏览器
cefWebBrowser?.GetBrowser()?.CloseBrowser(false);
// 3. 清理残留子进程(按路径判断,避免误杀)
//CleanupBrowserSubprocesses();
// 4. 释放控件
cefWebBrowser?.Dispose();
cefWebBrowser = null;
} }
}); });
} }
@@ -1791,5 +1813,92 @@ namespace TemuKJD.ToolForms
{ {
txtBuyTransitWarehouseStr = txtBuyTransitWarehouse.Text.Trim(); txtBuyTransitWarehouseStr = txtBuyTransitWarehouse.Text.Trim();
} }
private void lblErrMsg_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(lblErrMsg.Text))
pnlMsg.Visible = false;
else
pnlMsg.Visible = true;
}
private void pictureBox4_Click(object sender, EventArgs e)
{
this.pnlMsg.Visible = false;
}
/// <summary>
/// 清理本应用创建的CefSharp.BrowserSubprocess子进程
/// </summary>
private void CleanupBrowserSubprocesses()
{
// 有可能释放错误导致程序崩溃,废弃
return;
try
{
string appBasePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\', '/');
Process[] subprocesses = Process.GetProcessesByName("CefSharp.BrowserSubprocess");
foreach (Process process in subprocesses)
{
bool shouldKill = false;
try
{
// 安全地获取进程模块信息,进程可能在我们检查时已退出
if (process != null && !process.HasExited)
{
string moduleFileName = process.MainModule?.FileName;
if (!string.IsNullOrEmpty(moduleFileName))
{
// 判断进程是否从当前应用目录启动
string processDir = Path.GetDirectoryName(moduleFileName);
if (!string.IsNullOrEmpty(processDir) &&
(processDir.Equals(appBasePath, StringComparison.OrdinalIgnoreCase)
|| appBasePath.Contains(processDir) // 处理子目录情况
|| moduleFileName.Contains(appBasePath)))
{
shouldKill = true;
}
}
}
}
catch (InvalidOperationException)
{
// 进程可能在检查过程中已退出,忽略
continue;
}
catch (Win32Exception ex) when (ex.NativeErrorCode == 5) // 访问被拒绝
{
// 可能是权限问题或其他应用的进程,跳过
continue;
}
if (shouldKill)
{
try
{
process.Kill();
process.WaitForExit(500); // 等待最多500毫秒,确保进程终止
}
catch (Exception killEx)
{
// 记录日志,但通常进程已死
//System.Diagnostics.Debug.WriteLine($"终止进程时出错: {killEx.Message}");
}
}
}
}
catch (Exception ex)
{
// 这里最好不要用MessageBox,尤其是在关闭流程中,可能引发线程问题
// 建议记录到日志文件
//System.Diagnostics.Debug.WriteLine($"清理子进程时发生异常: {ex}");
}
}
private void pictureBox5_Click(object sender, EventArgs e)
{
pnlMask.Visible = false;
}
} }
} }
+77 -23
View File
@@ -30,8 +30,10 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.pnlMask = new DevComponents.DotNetBar.PanelEx(); this.pnlMsg = new System.Windows.Forms.Panel();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.lblErrMsg = new System.Windows.Forms.Label(); this.lblErrMsg = new System.Windows.Forms.Label();
this.pnlMask = new DevComponents.DotNetBar.PanelEx();
this.btnJumpOrderList = new DevComponents.DotNetBar.PanelEx(); this.btnJumpOrderList = new DevComponents.DotNetBar.PanelEx();
this.txtBuySkuName = new System.Windows.Forms.TextBox(); this.txtBuySkuName = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label(); this.label21 = new System.Windows.Forms.Label();
@@ -111,11 +113,15 @@
this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components); this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pnlMap = new System.Windows.Forms.Panel(); this.pnlMap = new System.Windows.Forms.Panel();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.pnlMsg.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.pnlMask.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout();
@@ -127,13 +133,13 @@
this.pnlBuy.SuspendLayout(); this.pnlBuy.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.pnlMap.SuspendLayout(); this.pnlMap.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// pbCloseBase // pbCloseBase
// //
this.pbCloseBase.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.pbCloseBase.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pbCloseBase.Location = new System.Drawing.Point(1326, 0); this.pbCloseBase.Location = new System.Drawing.Point(1326, 0);
this.pbCloseBase.Size = new System.Drawing.Size(32, 17);
// //
// splitContainer1 // splitContainer1
// //
@@ -149,30 +155,70 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.pnlMsg);
this.splitContainer1.Panel1.Controls.Add(this.pnlMask); this.splitContainer1.Panel1.Controls.Add(this.pnlMask);
this.splitContainer1.Panel1MinSize = 0; this.splitContainer1.Panel1MinSize = 0;
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.lblErrMsg);
this.splitContainer1.Panel2.Controls.Add(this.btnJumpOrderList); this.splitContainer1.Panel2.Controls.Add(this.btnJumpOrderList);
this.splitContainer1.Panel2MinSize = 0; this.splitContainer1.Panel2MinSize = 0;
this.splitContainer1.Size = new System.Drawing.Size(864, 903); this.splitContainer1.Size = new System.Drawing.Size(864, 888);
this.splitContainer1.SplitterDistance = 875; this.splitContainer1.SplitterDistance = 860;
this.splitContainer1.SplitterWidth = 3; this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4; this.splitContainer1.TabIndex = 4;
// //
// pnlMsg
//
this.pnlMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.pnlMsg.Controls.Add(this.pictureBox4);
this.pnlMsg.Controls.Add(this.lblErrMsg);
this.pnlMsg.Location = new System.Drawing.Point(47, 538);
this.pnlMsg.Name = "pnlMsg";
this.pnlMsg.Size = new System.Drawing.Size(771, 100);
this.pnlMsg.TabIndex = 898;
this.pnlMsg.Visible = false;
//
// pictureBox4
//
this.pictureBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pictureBox4.Image = global::Work.Properties.Resources.close;
this.pictureBox4.Location = new System.Drawing.Point(736, 3);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(32, 32);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox4.TabIndex = 897;
this.pictureBox4.TabStop = false;
this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click);
//
// lblErrMsg
//
this.lblErrMsg.BackColor = System.Drawing.Color.White;
this.lblErrMsg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblErrMsg.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblErrMsg.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold);
this.lblErrMsg.ForeColor = System.Drawing.Color.Red;
this.lblErrMsg.Location = new System.Drawing.Point(0, 0);
this.lblErrMsg.Name = "lblErrMsg";
this.lblErrMsg.Size = new System.Drawing.Size(771, 100);
this.lblErrMsg.TabIndex = 893;
this.lblErrMsg.Text = "errMsg ";
this.lblErrMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblErrMsg.TextChanged += new System.EventHandler(this.lblErrMsg_TextChanged);
//
// pnlMask // pnlMask
// //
this.pnlMask.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlMask.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlMask.Controls.Add(this.pictureBox5);
this.pnlMask.Cursor = System.Windows.Forms.Cursors.Hand; this.pnlMask.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlMask.DisabledBackColor = System.Drawing.Color.Empty; this.pnlMask.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlMask.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlMask.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlMask.Font = new System.Drawing.Font("微软雅黑", 50F); this.pnlMask.Font = new System.Drawing.Font("微软雅黑", 50F);
this.pnlMask.Location = new System.Drawing.Point(0, 0); this.pnlMask.Location = new System.Drawing.Point(0, 0);
this.pnlMask.Name = "pnlMask"; this.pnlMask.Name = "pnlMask";
this.pnlMask.Size = new System.Drawing.Size(864, 875); this.pnlMask.Size = new System.Drawing.Size(864, 426);
this.pnlMask.Style.Alignment = System.Drawing.StringAlignment.Center; 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.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.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(235)))), ((int)(((byte)(255)))));
@@ -188,17 +234,6 @@
this.pnlMask.Text = "自动拍单倒计时\r\n8"; this.pnlMask.Text = "自动拍单倒计时\r\n8";
this.pnlMask.Visible = false; this.pnlMask.Visible = false;
// //
// lblErrMsg
//
this.lblErrMsg.AutoSize = true;
this.lblErrMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblErrMsg.ForeColor = System.Drawing.Color.Red;
this.lblErrMsg.Location = new System.Drawing.Point(166, 5);
this.lblErrMsg.Name = "lblErrMsg";
this.lblErrMsg.Size = new System.Drawing.Size(87, 17);
this.lblErrMsg.TabIndex = 893;
this.lblErrMsg.Text = "errMsg ";
//
// btnJumpOrderList // btnJumpOrderList
// //
this.btnJumpOrderList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnJumpOrderList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -738,7 +773,7 @@
this.splitContainer2.BackColor = System.Drawing.Color.White; this.splitContainer2.BackColor = System.Drawing.Color.White;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(1, 18); this.splitContainer2.Location = new System.Drawing.Point(1, 33);
this.splitContainer2.Name = "splitContainer2"; this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
// //
@@ -750,7 +785,7 @@
// //
this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.panel1);
this.splitContainer2.Panel2.Controls.Add(this.splitContainer1); this.splitContainer2.Panel2.Controls.Add(this.splitContainer1);
this.splitContainer2.Size = new System.Drawing.Size(1358, 941); this.splitContainer2.Size = new System.Drawing.Size(1358, 926);
this.splitContainer2.SplitterDistance = 26; this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 5; this.splitContainer2.TabIndex = 5;
// //
@@ -801,7 +836,7 @@
this.panel1.Controls.Add(this.pnlMap); this.panel1.Controls.Add(this.pnlMap);
this.panel1.Location = new System.Drawing.Point(867, 3); this.panel1.Location = new System.Drawing.Point(867, 3);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(487, 905); this.panel1.Size = new System.Drawing.Size(487, 890);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// btnCancelAutoBuy // btnCancelAutoBuy
@@ -1174,11 +1209,24 @@
this.pnlMap.Controls.Add(this.cmbTransitWarehouse); this.pnlMap.Controls.Add(this.cmbTransitWarehouse);
this.pnlMap.Controls.Add(this.txtMapGoodsId); this.pnlMap.Controls.Add(this.txtMapGoodsId);
this.pnlMap.Controls.Add(this.txtMapSkuName); this.pnlMap.Controls.Add(this.txtMapSkuName);
this.pnlMap.Location = new System.Drawing.Point(12, 700); this.pnlMap.Location = new System.Drawing.Point(12, 685);
this.pnlMap.Name = "pnlMap"; this.pnlMap.Name = "pnlMap";
this.pnlMap.Size = new System.Drawing.Size(468, 203); this.pnlMap.Size = new System.Drawing.Size(468, 203);
this.pnlMap.TabIndex = 871; this.pnlMap.TabIndex = 871;
// //
// pictureBox5
//
this.pictureBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pictureBox5.Image = global::Work.Properties.Resources.close;
this.pictureBox5.Location = new System.Drawing.Point(829, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(32, 32);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox5.TabIndex = 898;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
//
// PddMobileBuyOrderForm // PddMobileBuyOrderForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1196,9 +1244,11 @@
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.pnlMsg.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.pnlMask.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false);
@@ -1216,6 +1266,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.pnlMap.ResumeLayout(false); this.pnlMap.ResumeLayout(false);
this.pnlMap.PerformLayout(); this.pnlMap.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -1304,5 +1355,8 @@
private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox2;
private DevComponents.DotNetBar.PanelEx btnCancelAutoBuy; private DevComponents.DotNetBar.PanelEx btnCancelAutoBuy;
private System.Windows.Forms.Label lblErrMsg; private System.Windows.Forms.Label lblErrMsg;
protected System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Panel pnlMsg;
protected System.Windows.Forms.PictureBox pictureBox5;
} }
} }