Compare commits

..
22 Commits
Author SHA1 Message Date
chfei 93b8b404f6 升级 2026-10-27 17:37:42 +08:00
chfei b842292817 合并控件 2026-10-22 13:42:04 +08:00
chfei 233ec5d58d 优化datagrid 2026-10-21 17:11:24 +08:00
chfei e12c419ef3 提交 2026-09-09 15:49:28 +08:00
chfei 11599bc7d3 修改订单列表页UI 2026-09-08 10:09:42 +08:00
wule e4e8c34f8d 发版,一些细节及小bug修改 2026-09-07 17:49:40 +08:00
chfei 39648cd9a9 修改订单详情UI 布局控件 2026-09-07 17:48:36 +08:00
wule f7082d8a7a 修改文字错误 2026-09-07 15:56:22 +08:00
wule b7abfb79c6 发新版 2026-09-07 15:56:22 +08:00
wule 57c8b69252 同上一条 2026-09-07 15:56:22 +08:00
wule 4f1fa75ec8 用户拍单可以通过商品选择sku 2026-09-07 15:56:22 +08:00
chfei a18191b1a6 修复复制 提示错误bug 2026-09-07 15:56:22 +08:00
wule 4e449f31bd 订单增加礼物单退费显示 2026-09-07 15:56:22 +08:00
wule d77ec5cc2e 记录关联商品所有sku并可以快速关联 2026-09-07 15:56:22 +08:00
wule 66f1381950 修复拍单后到再次读单前,拍单时间显示错误问题。 2026-09-07 15:56:22 +08:00
chfei dad8846752 统计页面增加明细按钮 2026-09-07 15:56:22 +08:00
chfei be54dff06b 修复登录 UI线程bug 2026-09-07 15:51:17 +08:00
chfei f772c35ede 增加 2026-09-02 13:45:52 +08:00
chfei 993a91a545 增加UI库 暂未改完 2026-09-01 16:02:50 +08:00
chfei 446224f4cf 修改主窗口 header 拖动bug.
拼多多登录 改为WPF 。PddMobileLoginForm 不再使用
2026-09-01 14:30:25 +08:00
chfei ce828fe467 Merge branch 'main' into 增加框架 2026-09-01 12:13:04 +08:00
chfei 726eb6de16 增加Prism 框架 2026-08-31 16:28:23 +08:00
230 changed files with 20545 additions and 13523 deletions

No files matched your search

+94 -2
View File
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WxOrder.Framework", "WxOrder.Framework\WxOrder.Framework.csproj", "{3123963C-A0EC-4AD5-9916-DC063F73490B}"
@@ -25,6 +26,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".test", ".test", "{14261B9B
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WXOrder.Test", "test\WXOrder.Test\WXOrder.Test.csproj", "{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trade.Client", "Source\Trade.Client\Trade.Client.csproj", "{BCABF48D-183D-A66F-33B6-B865CC0AD623}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAX.Core", "Source\MAX.Core\MAX.Core.csproj", "{313C8137-00DA-4116-B3B4-68FC45CC0CE7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trade.Framework", "Source\Trade.Framework\Trade.Framework.csproj", "{0180FDFA-6984-462D-B406-65B460CDB47A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Main.Test", "Main.Test\Main.Test.csproj", "{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAX.Framework", "Source\MAX.Framework\MAX.Framework.csproj", "{EABFACFE-C74D-4111-9683-C6E7714F432D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -73,8 +84,8 @@ Global
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x64.ActiveCfg = Debug|x64
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x64.Build.0 = Debug|x64
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x64.ActiveCfg = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x64.Build.0 = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x86.ActiveCfg = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Debug|x86.Build.0 = Debug|Any CPU
{5A410EB5-06AD-97BB-2314-9D7A808E12F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -117,6 +128,86 @@ Global
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x64.Build.0 = Release|Any CPU
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x86.ActiveCfg = Release|Any CPU
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x86.Build.0 = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x64.ActiveCfg = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x64.Build.0 = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x86.ActiveCfg = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x86.Build.0 = Debug|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Any CPU.Build.0 = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x64.ActiveCfg = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x64.Build.0 = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x86.ActiveCfg = Release|Any CPU
{BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x86.Build.0 = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x64.ActiveCfg = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x64.Build.0 = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x86.ActiveCfg = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x86.Build.0 = Debug|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Any CPU.Build.0 = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x64.ActiveCfg = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x64.Build.0 = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x86.ActiveCfg = Release|Any CPU
{313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x86.Build.0 = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x64.ActiveCfg = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x64.Build.0 = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x86.ActiveCfg = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x86.Build.0 = Debug|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Any CPU.Build.0 = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x64.ActiveCfg = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x64.Build.0 = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x86.ActiveCfg = Release|Any CPU
{0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x86.Build.0 = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x64.ActiveCfg = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x64.Build.0 = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x86.ActiveCfg = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x86.Build.0 = Debug|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Any CPU.Build.0 = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x64.ActiveCfg = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x64.Build.0 = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x86.ActiveCfg = Release|Any CPU
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x86.Build.0 = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x64.ActiveCfg = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x64.Build.0 = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x86.ActiveCfg = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x86.Build.0 = Debug|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Any CPU.Build.0 = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x64.ActiveCfg = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x64.Build.0 = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x86.ActiveCfg = Release|Any CPU
{EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -126,6 +217,7 @@ Global
{1AD45D66-6872-4522-ACF0-04E2C0514048} = {4A54DC2A-B47C-4ED1-A482-EE60161DB2C3}
{5A410EB5-06AD-97BB-2314-9D7A808E12F7} = {1A7830FA-AC8F-40FB-A232-F0626812B8BE}
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7} = {14261B9B-E3EA-4BC0-B08D-4B3591AC13E5}
{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF} = {14261B9B-E3EA-4BC0-B08D-4B3591AC13E5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {38687A61-0347-49AC-98C7-E7F7148C0234}
-6
View File
@@ -12,7 +12,6 @@
<OutputPath>..\bin\</OutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
@@ -71,10 +70,5 @@
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
<Resource Include="gear.ico" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\ChangePickNoView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>
+5 -2
View File
@@ -11,7 +11,6 @@
<converters:HasTextToVisibilityConverter x:Key="HasTextVisibility" />
<converters:TextEllipsisConverter x:Key="TextEllipsisConverter" />
<converters:TextEllipsisConverter26 x:Key="TextEllipsisConverter26" />
<converters:TextEllipsisConverter8 x:Key="TextEllipsisConverter8" />
<converters:NotHasTextToVisibilityConverter x:Key="NotHasTextVisibility" />
<converters:VisibleToVisibilityConverter x:Key="visibleToVisibilityConverter" />
<converters:ImageUrlToBitmapImageConverter x:Key="ImageUrlToBitmapImage" />
@@ -21,6 +20,11 @@
<converters:ListBoxIndexConverter x:Key="listBoxIndexConverter" />
<converters:FlagColorConverter x:Key="flagColorConverter" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic.xaml" />
<ResourceDictionary Source="pack://application:,,,/WxOrder.Framework;component/Resources/SkinLocal.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
<ResourceDictionary Source="Styles/BaseWindowStyle.xaml" />
<ResourceDictionary Source="Styles/BaseDataGridStyle.xaml" />
<ResourceDictionary Source="Styles/BaseButtonStyle.xaml" />
@@ -35,7 +39,6 @@
<ResourceDictionary Source="/Ctrls/Statistics/General.xaml" />
<ResourceDictionary Source="pack://application:,,,/WxOrder.Framework;component/Resources/Theme.xaml" />
<ResourceDictionary Source="Styles/TabControlStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
+14 -19
View File
@@ -1,5 +1,4 @@
using AllBase.Helper;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -50,14 +49,14 @@ namespace _29WxOrderWpf.BaseWindows
BaseMsgWindow msgBox = null;
Window owner = window ?? MainWindow.Instance;
//owner.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
owner.Dispatcher.Invoke(new Action(() =>
{
msgBox = CreateMsgForm(msg, title, wl);
msgBox.imgTip.Source = Application.Current.Resources["imgBaseMsgInfo"] as ImageSource;
//msgBox.Owner = owner;
msgBox.Owner = owner;
msgBox.ShowDialog();
});
}));
return msgBox;
}
@@ -66,26 +65,24 @@ namespace _29WxOrderWpf.BaseWindows
string title = string.IsNullOrEmpty(caption) ? "系统错误" : caption;
BaseMsgWindow msgBox = null;
Window owner = window ?? MainWindow.Instance;
//owner.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
owner.Dispatcher.Invoke(new Action(() =>
{
msgBox = CreateMsgForm(msg, title, wl);
msgBox.imgTip.Source = Application.Current.Resources["imgBaseMsgErr"] as ImageSource;
//msgBox.Owner = owner;
msgBox.Owner = owner;
msgBox.ShowDialog();
});
}));
return msgBox;
}
public static BaseMsgWindow ShowConfirm(string msg, string caption = "", Window window = null, MsgWindowLevel fl = MsgWindowLevel.MEDIUM, int? boxHeight = null)
public static BaseMsgWindow ShowConfirm(string msg, string caption = "", Window window = null, MsgWindowLevel fl = MsgWindowLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "确认系统提示" : caption;
BaseMsgWindow msgBox = null;
Window owner = window ?? MainWindow.Instance;
//owner.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
owner.Dispatcher.Invoke(() =>
{
msgBox = new BaseMsgWindow
{
lblTitle = { Content = title },
@@ -95,11 +92,9 @@ namespace _29WxOrderWpf.BaseWindows
if (fl.Equals(MsgWindowLevel.LARGE))
{
msgBox.Width = (int)MsgWindowLevel.LARGE;
if (boxHeight == null)
boxHeight = 500;
msgBox.Height = boxHeight.ParseToInt();
msgBox.Height = 500;
}
//msgBox.Owner = owner;
msgBox.Owner = owner;
msgBox.ShowDialog();
});
return msgBox;
+2 -2
View File
@@ -19,10 +19,10 @@ namespace _29WxOrderWpf.Common
private readonly Style dialogWindowStyle;
private bool isConstructorSuccessful = false;
private UserControl _content;
public DialogWindow(Window owner = null)
public DialogWindow()
{
InitializeComponent();
Owner = owner ?? Application.Current.MainWindow;
Owner = Application.Current.MainWindow;
isConstructorSuccessful = true;
dialogWindowStyle = (Style)TryFindResource("DialogWindowStyle");
Loaded += DialogWindow_Loaded;
@@ -5,192 +5,55 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Work;
namespace _29WxOrderWpf.Converters
{
public class ImageUrlToBitmapImageConverter : IMultiValueConverter
{
/// <summary> 缓存上限,防止大量缩略图重复下载导致内存膨胀 </summary>
private const int MaxCacheCount = 200;
public class ImageUrlToBitmapImageConverter : IValueConverter
{
/// <summary> 缓存上限,防止大量缩略图重复下载导致内存膨胀 </summary>
private const int MaxCacheCount = 200;
private readonly ConcurrentDictionary<string, BitmapImage> _imageCache = new ConcurrentDictionary<string, BitmapImage>();
private readonly ConcurrentDictionary<string, BitmapImage> _imageCache = new ConcurrentDictionary<string, BitmapImage>();
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 0 || values[0] == DependencyProperty.UnsetValue)
return null;
var url = values[0] as string;
var isLoad = values[1] is bool b && b;
if (!isLoad || string.IsNullOrEmpty(url))
return null; // 或返回占位图
if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
{
if (_imageCache.TryGetValue(url, out BitmapImage cached))
{
return cached;
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string url && Uri.IsWellFormedUriString(url, UriKind.Absolute))
{
if (_imageCache.TryGetValue(url, out BitmapImage cached))
{
return cached;
}
try
{
// 直接加载绑定如果遇到有问题的网络图片会直接崩溃。
BitmapImage bitMap = AllBase.ImageBuild.LoadBitmipImageFromUrl(url);
if (bitMap != null)
{
if (_imageCache.Count >= MaxCacheCount)
{
_imageCache.Clear();
}
_imageCache[url] = bitMap;
}
return bitMap;
}
catch
{
try
{
// 直接加载绑定如果遇到有问题的网络图片会直接崩溃。
BitmapImage bitMap = AllBase.ImageBuild.LoadBitmipImageFromUrl(url);
if (bitMap != null)
{
if (_imageCache.Count >= MaxCacheCount)
{
_imageCache.Clear();
}
_imageCache[url] = bitMap;
}
return bitMap;
}
catch
{
}
}
return null;
}
}
}
return null;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
// 建议作为静态字段复用,不要每次调用都 new HttpClient()
private static readonly HttpClient _httpClient = new HttpClient();
}
public class ImageLoadRequest
{
public string Url { get; set; }
public bool IsLoad { get; set; }
// 用于避免相同状态重复触发下载逻辑
public override bool Equals(object obj) =>
obj is ImageLoadRequest other && other.Url == Url && other.IsLoad == IsLoad;
public override int GetHashCode() => Url.GetHashCode();
}
public class ImageLoadRequestConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var url = values[0] as string;
var isLoad = values.Length > 1 && values[1] is bool b && b;
return new ImageLoadRequest { Url = url, IsLoad = isLoad };
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}
public static class AsyncImageLoader
{
private static readonly HttpClient _httpClient = new HttpClient();
private static readonly ConcurrentDictionary<string, Task<BitmapImage>> _cache
= new ConcurrentDictionary<string, Task<BitmapImage>>();
public static readonly DependencyProperty RequestProperty =
DependencyProperty.RegisterAttached(
"Request",
typeof(ImageLoadRequest),
typeof(AsyncImageLoader),
new PropertyMetadata(null, OnRequestChanged));
public static ImageLoadRequest GetRequest(DependencyObject obj) => (ImageLoadRequest)obj.GetValue(RequestProperty);
public static void SetRequest(DependencyObject obj, ImageLoadRequest value) => obj.SetValue(RequestProperty, value);
private static readonly DependencyProperty CurrentUrlProperty =
DependencyProperty.RegisterAttached("CurrentUrl", typeof(string), typeof(AsyncImageLoader), new PropertyMetadata(null));
private static string GetCurrentUrl(DependencyObject obj) => (string)obj.GetValue(CurrentUrlProperty);
private static void SetCurrentUrl(DependencyObject obj, string value) => obj.SetValue(CurrentUrlProperty, value);
private static readonly DependencyProperty CtsProperty =
DependencyProperty.RegisterAttached("Cts", typeof(CancellationTokenSource), typeof(AsyncImageLoader), new PropertyMetadata(null));
private static CancellationTokenSource GetCts(DependencyObject obj) => (CancellationTokenSource)obj.GetValue(CtsProperty);
private static void SetCts(DependencyObject obj, CancellationTokenSource value) => obj.SetValue(CtsProperty, value);
private static void OnRequestChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is Image image)) return;
// 值没变(Equals 重写过),不做任何事,避免无意义触发
if (Equals(e.OldValue, e.NewValue)) return;
var request = e.NewValue as ImageLoadRequest;
GetCts(image)?.Cancel();
if (request == null || !request.IsLoad || string.IsNullOrEmpty(request.Url))
{
return; // 滚动中,不加载,保留原图,不产生任何开销
}
string url = request.Url;
SetCurrentUrl(image, url);
var cts = new CancellationTokenSource();
SetCts(image, cts);
// 关键:把真正的下载动作丢到 Dispatcher 队列里、用较低优先级去做,
// 避免在当前这一帧的布局/绑定更新过程中做任何"重"的同步开销,
// 也顺便起到一个天然的"防抖"效果——如果这一帧内 Request 又变了
// (比如滚动中又切回别的 item),上面的 Cancel() 已经先取消了。
image.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(async () =>
{
if (cts.IsCancellationRequested) return;
try
{
var bitmap = await LoadBitmapAsync(url, cts.Token);
if (bitmap != null && GetCurrentUrl(image) == url && !cts.IsCancellationRequested)
{
image.Source = bitmap;
}
}
catch (OperationCanceledException) { }
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Error loading image from {url}: {ex.Message}");
}
}));
}
private static Task<BitmapImage> LoadBitmapAsync(string url, CancellationToken token)
{
return _cache.GetOrAdd(url, async u =>
{
using var response = await _httpClient.GetAsync(u, token);
response.EnsureSuccessStatusCode();
var data = await response.Content.ReadAsByteArrayAsync();
using var stream = new MemoryStream(data);
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.CreateOptions = BitmapCreateOptions.PreservePixelFormat | BitmapCreateOptions.IgnoreColorProfile;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.StreamSource = stream;
bitmap.DecodePixelWidth = 200;
bitmap.EndInit();
bitmap.Freeze();
return bitmap;
});
}
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 不需要反向转换,所以不实现。
}
}
}
@@ -14,7 +14,7 @@ namespace _29WxOrderWpf.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
if ( value == null)
return Visibility.Collapsed;
return !value.ParseToString().Trim().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
}
@@ -53,36 +53,20 @@ namespace _29WxOrderWpf.Converters
}
}
/// <summary>
/// 超出26个字的文本显示省略号
/// </summary>
public class TextEllipsisConverter26 : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ParseToString().Length > 26)
return string.Join("", value.ParseToString().Take(26)) + "…";
return value.ParseToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
/// <summary>
/// 超出10个字的文本显示省略号
/// </summary>
public class TextEllipsisConverter8 : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ParseToString().Length > 8)
return string.Join("", value.ParseToString().Take(8)) + "…";
return value.ParseToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
/// <summary>
/// 超出26个字的文本显示省略号
/// </summary>
public class TextEllipsisConverter26 : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ParseToString().Length > 26)
return string.Join("", value.ParseToString().Take(26)) + "…";
return value.ParseToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,7 +1,6 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using _29WxOrderWpf.ViewModels;
using AllBase;
using AllBase.Helper;
using AllBase.Model;
@@ -16,7 +15,6 @@ using CefSharp.Wpf;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using NPOI.OpenXmlFormats.Dml.Chart;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -39,12 +37,12 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml.XPath;
using _29WxOrderWpf.ViewModels;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.CefTools;
using Work.BaseForms;
using Work.BuyUsers;
using WxOrder.Framework.Commons;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace _29WxOrderWpf.Ctrls.BuyerCtrls
@@ -53,11 +51,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
/// PDDBuyerOrderReadCtrl.xaml 的交互逻辑
/// </summary>
public partial class PDDBuyerOrderReadCtrl : UserControl
{
Dictionary<BuyerLoginInfo, PddPickInfo> dicPddPickInfo = new Dictionary<BuyerLoginInfo, PddPickInfo>();
ConcurrentList<yh_sync_logistics> lstSyncLogistics = new ConcurrentList<yh_sync_logistics>();
ChromiumWebBrowser cefWebBrowser = null;
{
ChromiumWebBrowser cefWebBrowser = null;
public string cefAddress = "";
public static ConcurrentList<PddBuyerOrderLiteInfo> lstPddBuyerOrderInfoLite { get; set; } = new ConcurrentList<PddBuyerOrderLiteInfo>();
public static ObservableCollection<PddBuyerOrderLiteInfo> lstFilterPddBuyerOrderInfoLite { get; set; } = new ObservableCollection<PddBuyerOrderLiteInfo>();
@@ -77,7 +72,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
/// 是否已初始化已读的买手单
/// </summary>
bool isInitBuyerOrder = false;
bool isSkipNext = false;
/// <summary>
/// 是否已初始化已读的售后单
/// </summary>
@@ -303,32 +297,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
{
var url1 = url;
var data1 = responseData;
var send1 = sender;
//https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express&refer_page_id=10007_1790161262817_kcbn4ajosu&refer_page_sn=10007
//https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express&refer_page_id=10007_1790161262817_kcbn4ajosu&refer_page_sn=10007&show_no_pickup_package=0&tab_id=400&tab_type=1&list_index=80
if (url1.StartsWith ("https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express") ||
data1.Contains("\"pick_code\":\"取件码") /*|| data.Contains("21-2110")*/)
{
try
{
var combine_track_list = BaseRegex.GetJsonArrStrJson(ref data1, "combine_track_list");
var noPickupPackageData = BaseRegex.GetJsonObjStrJson(ref data1, "noPickupPackageData").FirstOrDefault();
if (!noPickupPackageData.IsNullOrEmpty() && send1 is ChromiumWebBrowser cef)
{
var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(buy => buy.wpf_browser == cef);
if (buyer != null)
{
dicPddPickInfo[buyer] = JsonHelper.DeserializeJsonToObject<PddPickInfo>(noPickupPackageData);
SetPickUpNo(dicPddPickInfo[buyer]);
}
}
}
catch
{
}
}
if (data1.Contains("214874201671006"))
{
@@ -586,7 +554,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
void UpdateOrderStatus(PddBuyerOrderLiteInfo pdd_order, oms_wei_order_info wx_order, oms_wei_order_item_info wx_order_item, oms_wei_external_procurement_log_info wx_transit_order)
{
pdd_order.ShopIdStr = (wx_order?.shop_id).ParseToString();
pdd_order.WxOrderStatus = wx_order?.status;
pdd_order.ShopOrderIdStr = wx_order_item?.order_id ?? wx_transit_order?.order_no;
pdd_order.ShopOrderSkuIdStr = wx_order_item?.sku_id ?? wx_transit_order?.order_sku_id;
pdd_order.ShopOrderSkuNameStr = wx_order_item?.sku_attr_str;
@@ -693,20 +660,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
// 装载同步单
var syncOrderList = OrderListCtrl.GetSyncLogistics(out_order_nos);
foreach (var syncOrder in syncOrderList)
{
if (!lstSyncLogistics.Contains(syncOrder))
lstSyncLogistics.Add(syncOrder);
else
{
lstSyncLogistics.RemoveAll(o => o.order_id == syncOrder.order_id);
lstSyncLogistics.Add(syncOrder);
}
}
// 根据拼多多外采订单列表查询中转仓订单信息
var transitOrderList = GetOrderTransitWarehouseInfo(out_order_nos);
// 根据拼多多外采订单列表查询中转仓订单信息
var transitOrderList = GetOrderTransitWarehouseInfo(out_order_nos);
// 根据拼多多外采订单列表查询订单扩展信息
var orderExtList = GetOrderItemExtInfo(out_order_nos);
@@ -737,7 +692,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
o.buyerId = buyer.buyer_id;
o.buyerName = buyer.buyer_name;
if (o.order_sn == "260923-573109716621688")
if (o.order_sn == "260817-535832839751006")
{
}
@@ -763,8 +718,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
o.ShopOrderRefundStr = "店铺售后";
}
}
o.WxOrderStatus = wxOrder?.status;
o.OutAfterSaleStatusStr = wxOrder.out_after_sale_status;
o.OutAfterSaleStatusStr = wxOrder.out_after_sale_status;
}
}
else
@@ -798,20 +752,18 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
else
{
string orderStr = JsonHelper.SerializeObject(order);
string orderStr = JsonHelper.SerializeObject(order);
string oStr = JsonHelper.SerializeObject(o);
if (JsonHelper.SerializeObject(order) != JsonHelper.SerializeObject(o))
{
if (order.order_sn == "260730-501334709841478")
{
}
order.WxSendTypeStr = o.WxSendTypeStr;
if (!o.tracking_number.IsNullOrEmpty() && o.tracking_number != order.tracking_number)
isUpdate = true;
if (!o.outExpressCompanyCode.IsNullOrEmpty() && o.outExpressCompanyCode != order.outExpressCompanyCode)
isUpdate = true;
if (o.order_status_prompt != order.order_status_prompt)
isUpdate = true;
if (order.WxSendTypeStr == "直发")
if (order.WxSendTypeStr == "直发")
{
if (order.order_status_prompt.Contains("待发货") && !o.order_status_prompt.Contains("待发货"))
order.sendStatus = "";
@@ -862,7 +814,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
order.ShopOrderRefundStr = o.ShopOrderRefundStr; // "" 或者 "店铺售后"
order.OutAfterSaleStatusStr = o.OutAfterSaleStatusStr; // 店铺售后状态文本描述
order.wxRefundStatus = o.wxRefundStatus;
order.WxOrderStatus = o.WxOrderStatus;
var index = lstPddBuyerOrderInfoLite.IndexOf(order);
@@ -897,6 +848,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 根据订单状态 取号/修改取号
if (order.WxSendTypeStr == "直发")
{
if (order.order_sn == "260802-185262415501688")
{
}
// 微信售后,客户端取消直发买手订单
if (order.ShopOrderRefundStr.ParseToString().Contains("售后"))
{
@@ -907,8 +862,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
isUpdate = true;
}
}
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill != true)
SendOrderE57(order);
SendOrderE57(order);
}
else
{
@@ -934,21 +888,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
SendTransitOrderE57(order);
}
if (order.order_sn == "260924-431226960203223")
{
}
if (order.ShopOrderIdStr == "3739392779260688128")
{
}
if (order.WxSendTypeStr == "直发")
{
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill && !string.IsNullOrEmpty(order.tracking_number) && order.WxOrderStatus < 30)
if (!lstSyncLogistics.Any(o => o.order_id == order.order_sn) || lstSyncLogistics.Any(o => o.order_id == order.order_sn && o.tracking_number.IsNullOrEmpty()))
isUpdate = true;
}
if (isUpdate && !string.IsNullOrEmpty(order.ShopOrderIdStr)/* && order.WxSendTypeStr != "直发"*/)
if (isUpdate && !string.IsNullOrEmpty(order.ShopOrderIdStr)/* && order.WxSendTypeStr != "直发"*/)
{
// 买手订单状态记录到数据库
order_pdd_buyer_order pddBuyerOrder = new order_pdd_buyer_order()
{
@@ -988,32 +929,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var html3 = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
html3 = GetHtml.PostUtf8(url3, data3);
//勾选了调用同步单接口,必须直发且库里已有物流单号
if (order.WxSendTypeStr == "直发")
{
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill && !string.IsNullOrEmpty(order.tracking_number) && html3.Contains("\"code\":200"))
if (!lstSyncLogistics.Any(o => o.order_id == order.order_sn) || lstSyncLogistics.Any(o => o.order_id == order.order_sn && o.tracking_number.IsNullOrEmpty()))
SendAsyncWaybillOrder(order);
}
}
if (order.order_sn == "260924-431226960203223")
{
}
// 填写取件码
if (order.WxSendTypeStr == "直发")
{
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill && !string.IsNullOrEmpty(order.tracking_number))
{
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn))
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && (o.upload_pickup_status == 0 || o.pickup_code.IsNullOrEmpty())))
SetPickUpNo(order);
}
}
});
}
});
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_buyer_order_list", lstPddBuyerOrderInfoLite);
}
@@ -1107,8 +1024,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (wxOrderItem != null)
{
af.ShopOrderSkuNameStr = wxOrderItem.sku_attr_str;
af.ShopOrderOutAfterSaleStatusStr = wxOrder.out_after_sale_status;
}
}
}
}
else
@@ -1182,8 +1098,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
afterSale.ShopOrderIdStr = af.ShopOrderIdStr;
afterSale.ShopOrderSkuIdStr = af.ShopOrderSkuIdStr;
afterSale.ShopOrderSkuNameStr = af.ShopOrderSkuNameStr;
afterSale.ShopOrderOutAfterSaleStatusStr = af.ShopOrderOutAfterSaleStatusStr;
afterSale.TransitBuyerOrderRefundStatus = af.TransitBuyerOrderRefundStatus;
afterSale.TransitBuyerOrderRefundStatus = af.TransitBuyerOrderRefundStatus;
afterSale.TransitWarehouseIdStr = af.TransitWarehouseIdStr;
afterSale.TransitWarehouseOrderCodeStr = af.TransitWarehouseOrderCodeStr;
afterSale.Express1WaybillStr = af.Express1WaybillStr;
@@ -1236,61 +1151,58 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
//return;
}
if (afterSale?.ShopIdStr == "3738859887048176128")
{
}
// 记录直发或者中转仓订单买手售后情况
if (isUpdate && !string.IsNullOrEmpty(afterSale?.ShopOrderIdStr))
{
if (afterSale.WxSendTypeStr == "直发")
{
// 退款状态有变化才发起修改(退款状态不能从退款成功变成未退款)
PddBuyerAfterSaleLiteInfo afterSaleRefundSuccessExist = null;
afterSaleRefundSuccessExist = lstPddBuyerAfterSaleInfoLite.FirstOrDefault(a => a.afterSalesId != afterSale.afterSalesId &&
a.orderSn == afterSale.orderSn && (a.AfterSaleStatusStr.Contains("退款成功") || a.AfterSaleStatusStr.Contains("交易已取消")));
if ((afterSaleRefundSuccessExist == null || afterSale.AfterSaleStatusStr == afterSaleRefundSuccessExist.AfterSaleStatusStr) &&
(afterSale.AfterSaleStatusOldStr != afterSale.AfterSaleStatusStr))
{
SendAfterSaleE57(afterSale);
afterSale.AfterSaleStatusOldStr = afterSale.AfterSaleStatusStr;
}
}
else
{
// 如果买手退款成功,仓库不是买手退款成功,则修改仓库售后字段为买手退款成功
if (afterSale.AfterSaleStatusStr.Contains("退款成功") || afterSale.AfterSaleStatusStr.Contains("交易已取消"))
{
if (afterSale.TransitBuyerOrderRefundStatus != "买手退款成功")
{
var orderTmp = new PddBuyerOrderLiteInfo() { ShopOrderIdStr = afterSale.ShopOrderIdStr, order_sn = afterSale.orderSn };
var refundRst = SendTransitAfterSaleE57(orderTmp, "买手退款成功");
if (refundRst.Contains("<code>0</code>") || refundRst.Contains("<code>200</code>"))
{
afterSale.afterSaleSendStatus = "退款成功 买手退款信息更新成功";
}
else
{
var msg = BaseRegex.GetStringXml(ref refundRst, "msg");
afterSale.afterSaleSendStatus = "退款成功 买手退款信息更新失败,服务端返回 " + msg;
}
}
}
// 如果中转仓表买手售后状态不等于买手售后单售后,更新仓库买手售后状态
else if (afterSale.TransitBuyerOrderRefundStatus != "买手退款成功" && afterSale.TransitBuyerOrderRefundStatus != afterSale.AfterSaleStatusStr)
{
if(afterSale.WxSendTypeStr == "直发")
{
// 退款状态有变化才发起修改(退款状态不能从退款成功变成未退款)
PddBuyerAfterSaleLiteInfo afterSaleRefundSuccessExist = null;
Dispatcher.Invoke(new Action(() =>
{
afterSaleRefundSuccessExist = lstPddBuyerAfterSaleInfoLite
.FirstOrDefault(a => a.orderSn == afterSale.orderSn && (a.AfterSaleStatusStr.Contains("退款成功") || a.AfterSaleStatusStr.Contains("交易已取消")));
}));
if ((afterSaleRefundSuccessExist == null || afterSale.AfterSaleStatusStr == afterSaleRefundSuccessExist.AfterSaleStatusStr) &&
afterSale.AfterSaleStatusOldStr != afterSale.AfterSaleStatusStr)
{
SendAfterSaleE57(afterSale);
afterSale.AfterSaleStatusOldStr = afterSale.AfterSaleStatusStr;
}
}
else
{
// 如果买手退款成功,仓库不是买手退款成功,则修改仓库售后字段为买手退款成功
if (afterSale.AfterSaleStatusStr.Contains("退款成功") || afterSale.AfterSaleStatusStr.Contains("交易已取消"))
{
if (afterSale.TransitBuyerOrderRefundStatus != "买手退款成功")
{
var orderTmp = new PddBuyerOrderLiteInfo() { ShopOrderIdStr = afterSale.ShopOrderIdStr, order_sn = afterSale.orderSn };
var refundRst = SendTransitAfterSaleE57(orderTmp, "买手退款成功");
if (refundRst.Contains("<code>0</code>") || refundRst.Contains("<code>200</code>"))
{
afterSale.afterSaleSendStatus = "退款成功 买手退款信息更新成功";
}
else
{
var msg = BaseRegex.GetStringXml(ref refundRst, "msg");
afterSale.afterSaleSendStatus = "退款成功 买手退款信息更新失败,服务端返回 " + msg;
}
}
}
// 如果中转仓表买手售后状态不等于买手售后单售后,更新仓库买手售后状态
else if (afterSale.TransitBuyerOrderRefundStatus != "买手退款成功" && afterSale.TransitBuyerOrderRefundStatus != afterSale.AfterSaleStatusStr)
{
if (afterSale.ShopOrderIdStr == "3738552208766960384")
{
}
var afterSaleExistList = lstPddBuyerAfterSaleInfoLite.Where(a => a.orderSn == afterSale.orderSn).ToList();
if ((afterSale.AfterSaleStatusStr == "退款失败" || afterSale.AfterSaleStatusStr == "申请已撤销") &&
if ((afterSale.AfterSaleStatusStr == "退款失败" || afterSale.AfterSaleStatusStr == "申请已撤销") &&
afterSaleExistList.Any(a => a.AfterSaleStatusStr != "退款失败" && a.AfterSaleStatusStr != "申请已撤销"))
{
}
{
}
else
{
//if (!afterSale.AfterSaleStatusStr.Contains("关闭") && !afterSale.AfterSaleStatusStr.Contains("撤销") && !afterSale.AfterSaleStatusStr.Contains("失败"))
@@ -1306,8 +1218,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
afterSale.afterSaleSendStatus = "买手退款信息更新失败,服务端返回 " + msg;
}
}
}
}
}
}
}
// 买手已退款,尝试作废仓库订单
@@ -1449,20 +1361,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
foreach (var buyer in GlobalConfig.PDDBuyerLoginList)
{
Dispatcher.Invoke(new Action(() =>
{
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
if (buyer.IsSelect != true)
{
foreach (var b in GlobalConfig.PDDBuyerLoginList)
{
b.IsSelect = false;
}
buyer.IsSelect = true;
}
}));
if (tokenSource.IsCancellationRequested)
if (tokenSource.IsCancellationRequested)
break;
PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
@@ -1502,10 +1401,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var t = WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), buyer.wpf_browser.GetCookieManager(null));
t.Wait();
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express");
Thread.Sleep(Randomx.GetId(2000, 3000));
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/personal.html");
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/personal.html");
Thread.Sleep(Randomx.GetId(2000, 3000));
string readBuyer = "";
@@ -1542,9 +1438,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
lastCefReadOrderTime = DateTime.Now;
while (currentReadBuyer == readBuyer)
{
if (isSkipNext)
break;
if (tokenSource.IsCancellationRequested)
{
BindBuyer(buyer, "已取消读取");
@@ -1621,9 +1514,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
lastCefReadOrderTime = DateTime.Now;
while (currentReadBuyer == readBuyer)
{
if (isSkipNext)
break;
if (tokenSource.IsCancellationRequested)
{
BindBuyer(buyer, "已取消读取");
@@ -1671,13 +1561,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
result.Wait(5000);
}
}
if (isSkipNext)
{
isSkipNext = false;
continue;
}
if (tokenSource.IsCancellationRequested)
}
if (tokenSource.IsCancellationRequested)
{
BindBuyer(buyer, "已取消读取");
break;
@@ -1710,11 +1595,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
top = 0;
lastCefReadOrderTime = DateTime.Now;
while (currentReadBuyer == readBuyer)
{
if (isSkipNext)
break;
if (tokenSource.IsCancellationRequested)
{
if (tokenSource.IsCancellationRequested)
{
BindBuyer(buyer, "已取消读取");
break;
@@ -1753,32 +1635,17 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
result.Wait(5000);
}
}
if (isSkipNext)
{
isSkipNext = false;
continue;
}
if (tokenSource.IsCancellationRequested)
{
BindBuyer(buyer, "已取消读取");
break;
}
//Invoke(new Action(() =>
//{
// if (row.Cells["colMessage"].Value.ParseToString().StartsWith("正在读取"))
// BindBuyer(buyer, " ");
//}));
}
}
//Invoke(new Action(() =>
//{
// if (row.Cells["colMessage"].Value.ParseToString().StartsWith("正在读取"))
// BindBuyer(buyer, " ");
//}));
}
catch (Exception ex)
{
if (isSkipNext)
{
isSkipNext = false;
continue;
}
}
Thread.Sleep(Randomx.GetId(6000, 8000));
{
}
Thread.Sleep(Randomx.GetId(6000, 8000));
}
isReadBuyerOrder = false;
@@ -1832,12 +1699,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
if (buyerOrder.WxSendTypeStr == "直发")
{
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill)
SendAsyncWaybillOrder(buyerOrder, true);
else
SendOrderE57(buyerOrder);
}
SendOrderE57(buyerOrder);
else
SendTransitOrderE57(buyerOrder, true);
@@ -2045,15 +1907,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
order.sendStatus = "";
Thread.Sleep(100);
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill)
{
return;
}
if (order.order_sn == "260730-501334709841478")
{
if (order.sendStatus.ParseToString().Contains("同步单已发货"))
{
return;
}
}
if (order.sendStatus.ParseToString().Contains("外采订单已发货") || order.sendStatus.ParseToString().Contains("微信发货成功") ||
order.sendStatus.ParseToString().Contains("已发送待发货订单") || order.sendStatus.ParseToString().Contains("接收成功") ||
@@ -2136,208 +1993,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
}
public void SetPickUpNo(PddPickInfo pddPickInfo)
{
List<combine_track_info> orderSnTracks = new List<combine_track_info>();
foreach (var combine in pddPickInfo.combine_list)
{
foreach (var combine_track in combine.combine_track_list)
{
if (!orderSnTracks.Any(o => o.order_sn == combine_track.order_sn))
orderSnTracks.Add(combine_track);
}
}
if (orderSnTracks.Count == 0)
return;
//var syncOrderAllList = OrderListCtrl.GetSyncLogistics(string.Join(",", orderSnTracks.Select(o => o.order_sn)));
var syncOrderList = OrderListCtrl.GetSyncLogistics(string.Join(",", orderSnTracks.Select(o => o.order_sn)), 1);
foreach (var sOrder in syncOrderList)
{
var orderSnTrack = orderSnTracks.FirstOrDefault(o => o.order_sn == sOrder.order_id);
var pNull = orderSnTracks.Where(p => p.pick_code.IsNullOrEmpty()).ToList();
if (orderSnTrack.pick_code == null)
{
}
if (orderSnTrack != null && !string.IsNullOrEmpty(orderSnTrack.pick_code))
{
var pickupCode = orderSnTrack.pick_code.Replace("取件码", "").Replace("取件出示快递单号后五位", "").Trim();
if (!string.IsNullOrWhiteSpace(pickupCode))
{
var url4 = BaseClass.Build29WxObjString("vlc/UploadPickup");
var data4 = UserLogin.GetSignPostData(new
{
orderId = orderSnTrack.order_sn,
pickupCode = pickupCode,
});
var html4 = GetHtml.PostJson(url4, data4);
}
}
}
}
public void SetPickUpNo(PddBuyerOrderLiteInfo order)
{
try
{
var syncOrder = lstSyncLogistics.FirstOrDefault(o => o.order_id == order.order_sn);
if (syncOrder == null)
return;
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && (o.upload_pickup_status > 0 && o.pickup_code.IsNullOrEmpty())))
return;
var pickupCode = ""; // "21-22-2110";
//var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(b => b.buyer_id == order.buyerId);
//if (dicPddPickInfo.Keys.Contains(buyer))
foreach(var buyer in dicPddPickInfo.Keys)
{
try
{
var pddPickInfo = dicPddPickInfo[buyer];
foreach (var combine in pddPickInfo.combine_list)
{
foreach (var combine_track in combine.combine_track_list)
{
if (combine_track.order_sn == order.order_sn)
{
pickupCode = combine_track.pick_code.ParseToString().Replace("取件码", "").Replace("取件出示快递单号后五位", "").Trim();
}
}
}
}
catch
{
}
}
if (!string.IsNullOrEmpty(pickupCode))
{
// 填写取件码
var url4 = BaseClass.Build29WxObjString("vlc/UploadPickup");
var data4 = UserLogin.GetSignPostData(new
{
orderId = order.order_sn,
pickupCode = pickupCode,
});
var html4 = GetHtml.PostJson(url4, data4);
//{"data":true,"code":200,"msg":"操作成功","isSuccess":true}
}
}
catch
{
}
}
public void SendAsyncWaybillOrder(PddBuyerOrderLiteInfo order, bool showErrBox = false)
{
try
{
if (order.WxOrderStatus < 30 == false)
{
if (showErrBox) BaseMsgWindow.ShowError("订单已发货无需重复创建同步单!");
return;
}
// 取最新订单状态
var wxOrder = GetOrderInfo(order.ShopOrderIdStr).FirstOrDefault();
if (wxOrder == null)
throw new Exception("买手单对应微信订单不存在!");
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == wxOrder.shop_id.ToString());
if (shop == null)
throw new Exception("买手单对应店铺不存在!");
if (order.WxOrderStatus < 30 == false)
{
if (showErrBox) BaseMsgWindow.ShowError("订单已发货无需重复创建同步单!");
return;
}
if (order.ShopOrderIdStr == "3739357317247975936")
{
}
//3739354841155797760
//3739338593856835840
//3739343419162669824
//3739334599561594624
//3739334374248562688
//3739334539482412288
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(shop, order.ShopOrderIdStr, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
throw new Exception("同步单代发查询失败!" + BaseRegex.GetStringJson(ref apiSearchDropship, "msg"));
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
if (string.IsNullOrEmpty(dsOrderId))
throw new Exception("同步单代发单号获取失败!");
var url3 = BaseClass.Build29WxObjString("vlc/Buy");
var data3 = UserLogin.GetSignPostData(new {
orderId = order.order_sn,
agentOrderId = dsOrderId,
});
var html3 = GetHtml.PostJson(url3, data3);
var test = "{\"data\":[{\"orderId\":\"260923-399088033421688\",\"trackingNumber\":\"37300000114322\",\"sourceTrackingNumber\":\"JT5528345110252\"}],\"code\":200,\"msg\":\"操作成功\",\"isSuccess\":true}";
//{"data":[{"orderId":"260923-399088033421688","trackingNumber":"37300000114322","sourceTrackingNumber":"JT5528345110252"}],"code":200,"msg":"操作成功","isSuccess":true}
//Result<JObject>
if (html3.Contains("\"code\":200") || wxOrder.out_express_no != order.tracking_number)
{
var mainOrder = GlobalConfig.lstOrder.FirstOrDefault(o => o.order_id == order.ShopOrderIdStr);
if (mainOrder != null)
mainOrder.RealSyncWaybillId = mainOrder.SyncWaybillIdInfo = BaseRegex.GetStringJson(ref html3, "trackingNumber");
var url = BaseClass.Build29WxObjString("order/wx_update_erp_out_waybill_status");
var data = UserLogin.GetSignaturex();
data += "&order_id=" + order.ShopOrderIdStr;
data += "&out_express_company=" + order.outExpressCompanyCode;
data += "&out_express_no=" + order.tracking_number;
var html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
// 更新拍单余额
StartUp.UpdateBalance();
}
else
{
var err = BaseRegex.GetStringJson(ref html3, "msg");
throw new Exception(err);
}
}
catch (Exception ex)
{
var mainOrder = GlobalConfig.lstOrder.FirstOrDefault(o => o.order_id == order.ShopOrderIdStr);
if (mainOrder != null)
{
var orderItem = mainOrder.orderItems?.FirstOrDefault(oi => oi.sku_id == order.ShopOrderSkuIdStr);
if (orderItem != null)
orderItem.SyncLogisticsMsg = ex.Message;
}
var url3 = BaseClass.Build29WxObjString("order/wx_add_mdy_buyer_order");
var data3 = UserLogin.GetSignaturex();
data3 += "&sync_logistics_msg=" + ex.Message;
data3 += "&pdd_order_sn=" + order.order_sn;
data3 += "&wx_order_id=" + order.ShopOrderIdStr;
data3 += "&wx_send_type=1";
var html3 = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
html3 = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
html3 = GetHtml.PostUtf8(url3, data3);
if (showErrBox)
{
BaseMsgWindow.ShowError("同步单创建失败:" + ex.Message);
}
}
}
// 向服务端更新售后退货信息更新状态 直发外采信息
public void SendAfterSaleE57(PddBuyerAfterSaleLiteInfo afterSale, bool resetSendStatus = false, bool isManualSendNoRecordCancelOrder = false)
{
@@ -2850,19 +2505,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (sender is TextBox txtBuyerNick)
txtBuyerNick.AddHandler(TextBox.MouseUpEvent, new MouseButtonEventHandler(txtBuyerNick_MouseLeftButtonDown), true);
}
}
private void dgBuyerOrder_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void btnNextBuyer_Click(object sender, RoutedEventArgs e)
{
isSkipNext = true;
}
}
public class YkdBuyerOrder
public class YkdBuyerOrder
{
public static string GetInitAfterSale(BuyerLoginInfo buyer, string orderSn)
{
@@ -1,214 +1,49 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PDDBuyerSelectCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:_29WxOrderWpf.Common"
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:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
xmlns:wpf="WPFCommon"
d:DesignHeight="30"
d:DesignWidth="320"
Loaded="UserControl_Loaded"
mc:Ignorable="d">
<Grid Margin="0,0,0,-26">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image
Width="24"
Height="24"
Margin="4,0,0,0"
Cursor="Hand"
MouseLeftButtonUp="Image_MouseLeftButtonUp"
Source="{StaticResource imgBuyerOrder}" />
<wpf:SpacingStackPanel
Grid.Column="1"
VerticalAlignment="Center"
Orientation="Vertical"
VerticalSpacing="2">
<WrapPanel x:Name="wpPddBuyer">
<ComboBox
x:Name="cmbPddBuyer"
Grid.Column="1"
Width="180"
Height="24"
Margin="0,0,0,0"
VerticalContentAlignment="Center"
MouseLeftButtonUp="cmbPddBuyer_MouseLeftButtonUp"
SelectedIndex="0"
SelectionChanged="cmbPddBuyer_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<Grid HorizontalAlignment="Stretch" MinWidth="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}">-->
<Grid
Height="auto"
MinWidth="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBox}}, Path=ActualWidth, Converter={StaticResource ValueMinus24Converter}}"
HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="tbName"
VerticalAlignment="Center"
Text="{Binding buyer_nick}" />
<userctrls:UcImageButton
x:Name="btnDeleteItem"
Grid.Column="0"
Width="15"
Height="15"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgCloseGray}"
Click="btnDeleteItem_Click"
Cursor="Hand"
MouseOverButtonImage="{StaticResource imgCloseGray}"
MousePressButtonImage="{StaticResource imgCloseGray}"
Tag="{Binding ElementName=tbName, Path=Text}"
Visibility="Collapsed" />
<TextBlock
x:Name="tbStatus"
Grid.Column="2"
VerticalAlignment="Center"
Foreground="{Binding status, Converter={StaticResource statusToColorBrushConverter}}"
Text="{Binding status}" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnDeleteItem" Property="Visibility" Value="Visible" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!--<TextBlock Text="选择买手" Grid.Column="12" Margin="12,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray"
Visibility="{Binding ElementName=cmbBuyer,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>-->
<Button
x:Name="btnLoginPdd"
Grid.Column="2"
Width="56"
Height="24"
Margin="4,0,0,0"
Click="btnLoginPdd_Click"
Content="多多登录"
Style="{StaticResource BasePageButtonStyle}" />
</WrapPanel>
<WrapPanel
x:Name="wpTaobaoBuyer"
d:Visibility="Visible"
Visibility="Collapsed">
<ComboBox
x:Name="cmbTaobaoBuyer"
Grid.Column="1"
Width="180"
Height="24"
Margin="0,0,0,0"
VerticalContentAlignment="Center"
MouseLeftButtonUp="cmbTaobao_MouseLeftButtonUp"
SelectedIndex="0"
SelectionChanged="cmbTaobao_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<Grid HorizontalAlignment="Stretch" MinWidth="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}">-->
<Grid
Height="auto"
MinWidth="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBox}}, Path=ActualWidth, Converter={StaticResource ValueMinus24Converter}}"
HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="tbName"
VerticalAlignment="Center"
Text="{Binding buyer_nick}" />
<userctrls:UcImageButton
x:Name="btnDeleteItem"
Grid.Column="0"
Width="15"
Height="15"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgCloseGray}"
Click="btnDeleteTaobaoItem_Click"
Cursor="Hand"
MouseOverButtonImage="{StaticResource imgCloseGray}"
MousePressButtonImage="{StaticResource imgCloseGray}"
Tag="{Binding ElementName=tbName, Path=Text}"
Visibility="Collapsed" />
<TextBlock
x:Name="tbStatus"
Grid.Column="2"
VerticalAlignment="Center"
Foreground="{Binding status, Converter={StaticResource statusToColorBrushConverter}}"
Text="{Binding status}" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnDeleteItem" Property="Visibility" Value="Visible" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!--<TextBlock Text="选择买手" Grid.Column="12" Margin="12,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray"
Visibility="{Binding ElementName=cmbBuyer,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>-->
<Button
x:Name="btnLoginTaobao"
Grid.Column="2"
Width="56"
Height="24"
Margin="4,0,0,0"
Click="btnLoginTaobao_Click"
Content="淘宝登录"
Style="{StaticResource BasePageButtonStyle}" />
</WrapPanel>
</wpf:SpacingStackPanel>
<Button
x:Name="btnSwitch"
Grid.Column="2"
Width="24"
Height="24"
Margin="4,0,0,0"
c:DebugVisibility.Enable="True"
d:Visibility="Visible"
Click="btnSwitch_Click"
Style="{StaticResource BasePageButtonStyle}">
<TextBlock
Grid.Column="2"
Margin="0,0,0,1"
d:Visibility="Visible"
FontSize="18"
Foreground="{StaticResource mainColorLightBrush}"
IsHitTestVisible="False"
Style="{StaticResource TextBlockIcon}"
Text="{StaticResource txt-arrow_sync_circle}" />
</Button>
<!-- Text="{StaticResource txt-arrow_clockwise}" -->
<!--<Image
x:Name="切换"
Grid.Column="2"
Width="24"
Height="24"
Margin="4,0,0,0"
c:DebugVisibility.Enable="True"
Cursor="Hand"
Source="{StaticResource imgBuyerOrder}" />-->
</Grid>
<UserControl x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PDDBuyerSelectCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls" xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DesignHeight="30" d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Margin="4,0,0,0" Width="24" Height="24" Source="{StaticResource imgBuyerOrder}" MouseLeftButtonUp="Image_MouseLeftButtonUp" Cursor="Hand"></Image>
<ComboBox Grid.Column="1" x:Name="cmbPddBuyer" Margin="8,0,0,0" VerticalContentAlignment="Center" Style="{StaticResource RoundedComboBox}" Height="24"
MouseLeftButtonUp="cmbPddBuyer_MouseLeftButtonUp" SelectionChanged="cmbPddBuyer_SelectionChanged" SelectedIndex="0">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<Grid HorizontalAlignment="Stretch" MinWidth="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}">-->
<Grid HorizontalAlignment="Stretch" MinWidth="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBox}},
Path=ActualWidth, Converter={StaticResource ValueMinus24Converter}}" Height="auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock x:Name="tbName" Text="{Binding buyer_nick}" VerticalAlignment="Center"/>
<userctrls:UcImageButton Width="15" Height="15" ButtonImage="{StaticResource imgCloseGray}" BorderThickness="0" Cursor="Hand" Grid.Column="0" Visibility="Collapsed"
MouseOverButtonImage="{StaticResource imgCloseGray}" MousePressButtonImage="{StaticResource imgCloseGray}" Background="Transparent"
x:Name="btnDeleteItem" Tag="{Binding ElementName=tbName, Path=Text}" HorizontalAlignment="Right" VerticalAlignment="Center"
Click="btnDeleteItem_Click"/>
<TextBlock x:Name="tbStatus" Text="{Binding status}" Foreground="{Binding status, Converter={StaticResource statusToColorBrushConverter}}" Grid.Column="2"
VerticalAlignment="Center"/>
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnDeleteItem" Property="Visibility" Value="Visible"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!--<TextBlock Text="选择买手" Grid.Column="12" Margin="12,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray"
Visibility="{Binding ElementName=cmbBuyer,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>-->
<Button Grid.Column="2" x:Name="btnLoginPdd" Style="{StaticResource BasePageButtonStyle}" Margin="4,0,0,0"
Content="多多登录" Width="56" Height="24" Click="btnLoginPdd_Click"/>
</Grid>
</UserControl>
@@ -1,6 +1,5 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using _29WxOrderWpf.ViewModels;
using _29WxOrderWpf.Views;
using AllBase;
@@ -41,7 +40,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
cmbPddBuyer.ItemsSource = GlobalConfig.PDDBuyerLoginList;
cmbTaobaoBuyer.ItemsSource = GlobalConfig.TaobaoBuyerLoginList;
}
private void btnLoginPdd_Click(object sender, RoutedEventArgs e)
@@ -147,163 +145,48 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
});
}
}
//var pddBuyer =
//var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
//var buyers = GlobalConfig.PDDBuyerLoginList.Where(b => ids.Contains(b.buyer_id)).ToList();
//this.statusBar.pgbTaskProgress.Maximum = buyers.Count;
//pbLoading.Visible = true;
//Task.Run(() =>
//{
// int i = 0;
// foreach (var buyer in buyers)
// {
// i++;
// this.Invoke(new Action(() =>
// {
// this.statusBar.lblTaskStatus.Text = "正在删除...";
// this.statusBar.pgbTaskProgress.Value = i;
// this.statusBar.pgbTaskProgress.Text = i + "/" + buyers.Count;
// }));
// Thread.Sleep(100);
// }
// this.Invoke(new Action(() =>
// {
// this.statusBar.lblTaskStatus.Text = "删除完成";
// this.statusBar.pgbTaskProgress.Value = buyers.Count;
// this.statusBar.pgbTaskProgress.Text = buyers.Count + "/" + buyers.Count;
// }));
// GetPddBuyer();
//});
}
private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (wpPddBuyer.Visibility == Visibility.Visible)
{
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible)
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1)
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1);
else
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1);
}
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible)
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1)
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1);
else
{
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1);
}
}
private void btnSwitch_Click(object sender, RoutedEventArgs e)
{
if (wpPddBuyer.Visibility == Visibility.Visible)
{
wpPddBuyer.Visibility = Visibility.Collapsed;
wpTaobaoBuyer.Visibility = Visibility.Visible;
GlobalConfig.CurrentBuyPlatform = "tb";
foreach (var order in GlobalConfig.lstOrder)
{
//OrderListCtrl.InitOrderObservableProp(order);
foreach (var orderItem in order.orderItems)
{
orderItem.UpdateOrderItemBuyButton();
orderItem.SetAbnormalAndDirectBtnVisibility();
}
}
}
else
{
wpPddBuyer.Visibility = Visibility.Visible;
wpTaobaoBuyer.Visibility = Visibility.Collapsed;
GlobalConfig.CurrentBuyPlatform = "pdd";
foreach (var order in GlobalConfig.lstOrder)
{
//OrderListCtrl.InitOrderObservableProp(order);
foreach (var orderItem in order.orderItems)
{
orderItem.UpdateOrderItemBuyButton();
orderItem.SetAbnormalAndDirectBtnVisibility();
}
}
}
}
private void btnLoginTaobao_Click(object sender, RoutedEventArgs e)
{
BuyerLoginInfo buyer = null;
if (cmbTaobaoBuyer.SelectedItem != null)
{
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
}
TaobaoLoginView taobaoBuyerForm = new TaobaoLoginView(buyer);
taobaoBuyerForm.ViewModel.OpenType = EnumOpenType.login;
taobaoBuyerForm.ViewModel.InitUrl = "https://login.taobao.com/havanaone/login/login.htm";
new DialogWindow()
{
Title = "淘宝买手登录",
Content = taobaoBuyerForm,
}.ShowDialog();
MainWindow.Instance.GetTaobaoBuyer();
}
private void cmbTaobao_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
BuyerLoginInfo buyer = null;
if (cmbTaobaoBuyer.SelectedItem != null)
{
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
}
GlobalConfig.CurrentTaobaoBuyer = buyer;
}
private void cmbTaobao_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (e.GetPosition(sender as IInputElement).X > cmbTaobaoBuyer.ActualWidth - 18)
return;
BuyerLoginInfo buyer = null;
if (cmbTaobaoBuyer.SelectedItem != null)
{
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
}
if (buyer == null)
return;
bool islogin = false;
//TaobaoBuyOrderViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
TaobaoLoginView buyerLoginForm = new TaobaoLoginView(buyer);
if (buyer.status == "在线")
{
buyerLoginForm.ViewModel.OpenType = EnumOpenType.manage;
buyerLoginForm.ViewModel.InitUrl = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?";
new DialogWindow()
{
Width = 1280,
Height = 800,
Title = "买手主页",
Content = buyerLoginForm,
}.Show();
}
else
{
buyerLoginForm.ViewModel.OpenType = EnumOpenType.login;
buyerLoginForm.ViewModel.InitUrl = "https://login.taobao.com/havanaone/login/login.htm";
new DialogWindow()
{
Width = 1280,
Height = 800,
Title = "买手登录",
Content = buyerLoginForm,
}.ShowDialog();
}
if (islogin)
MainWindow.Instance.GetTaobaoBuyer();
}
private void btnDeleteTaobaoItem_Click(object sender, RoutedEventArgs e)
{
if (BaseMsgWindow.ShowConfirm("确定删除吗?删除后不可恢复!").DialogResult != true)
return;
if (sender is Button btn)
{
if (btn.DataContext is BuyerLoginInfo buyer)
{
Task.Run(() =>
{
var url = BaseClass.Build29WxObjString("user/del_taobao_buyer");
var data = UserLogin.GetSignaturex()
+ "&buyer_id=" + buyer.buyer_id;
var result = GetHtml.PostUtf8(url, data);
if (result.Contains("\"code\":200"))
{
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.TaobaoBuyerLoginList.Remove(buyer);
this.cmbPddBuyer.SelectedIndex = 0;
}));
}
});
}
}
}
}
}
@@ -1,491 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.TaobaoBuyOrderCtrl"
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="taobaoBuyOrderCtrl"
Width="1360"
Height="768"
MinWidth="800"
MinHeight="600"
Loaded="taobaoBuyOrderCtrl_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="300" />
</Grid.ColumnDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True" />
<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">
<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
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="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>
<TextBox
x:Name="txtSendProvince"
Height="20"
Margin="0,0,96,0"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSendProvinceVal}" />
<Button
x:Name="btnManualUpdateSendProvince"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
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>
@@ -1,75 +0,0 @@
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>
/// TaobaoBuyOrderCtrl.xaml 的交互逻辑
/// </summary>
public partial class TaobaoBuyOrderCtrl : UserControl
{
/// <summary>视图模型</summary>
public TaobaoBuyOrderViewModel ViewModel { get; }
public TaobaoBuyOrderCtrl(BuyerLoginInfo buyerInfo, oms_wei_order_item_info orderItemInfo)
{
InitializeComponent();
foreach (var warehouse in TransitWarehouseData.TransitWarehouseList)
{
this.cmbTransitWarehouse.Items.Add(warehouse.TransName + " " + warehouse.TransDetailAddress);
}
ViewModel = new TaobaoBuyOrderViewModel(buyerInfo, orderItemInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private async void taobaoBuyOrderCtrl_Loaded(object sender, RoutedEventArgs e)
{
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)
{
}
}
File diff suppressed because it is too large. Load diff
@@ -22,18 +22,22 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls;
public partial class OrderListCtrl
{
#region 统计
private ShopRevenueStatisticsView _statisticsDialog;
private DialogWindow _statisticsDialog;
public ICommand ShowShopRevenueStatisticsDialogViewCommand => new DelegateCommand(ShowShopRevenueStatisticsDialogView);
private void ShowShopRevenueStatisticsDialogView()
{
if (_statisticsDialog == null)
{
_statisticsDialog =new ShopRevenueStatisticsView();
_statisticsDialog = new DialogWindow()
{
Title = "统计",
Content = new ShopRevenueStatisticsView(),
};
_statisticsDialog.Closed += (s, e) => _statisticsDialog = null;
}
_statisticsDialog.Show();
_statisticsDialog.Activate();
}
#endregion
+50 -215
View File
@@ -10,7 +10,6 @@
xmlns:usercontrols="clr-namespace:_29WxOrderWpf.UserControls"
xmlns:utils="clr-namespace:_29WxOrderWpf.Utils"
xmlns:wpf="WPFCommon"
d:DataContext="{d:DesignInstance Type=local:OrderListCtrl}"
d:DesignHeight="450"
d:DesignWidth="1560"
Loaded="Window_Loaded"
@@ -261,15 +260,17 @@
Unchecked="chkAutoReadBuyerOrder_CheckedChanged" />
<CheckBox
x:Name="chkSyncDirectOrderWaybill"
x:Name="chkHideGreenFlag"
Grid.Column="12"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkSyncDirectOrderWaybill_Click"
Content="同步物流单"
Click="chkHideGreenFlag_Click"
Content="隐藏标记订单"
FontSize="12"
IsChecked="False" />
IsChecked="{Binding orderFilterConfig.chkHideGreenFlagIsChecked}" />
</WrapPanel>
<wpf:SpacingStackPanel Grid.Column="13" HorizontalSpacing="5">
@@ -302,26 +303,6 @@
Grid.Row="1"
Margin="8,0,0,2">
<WrapPanel x:Name="wpFilter" VerticalAlignment="Top">
<CheckBox
x:Name="chkHideGreenFlag"
Grid.Column="12"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkHideGreenFlag_Click"
Content="隐藏标记订单"
FontSize="12"
IsChecked="{Binding orderFilterConfig.chkHideGreenFlagIsChecked}" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chkOnlyWarehouseOrder"
Margin="0,2,3,2"
@@ -348,7 +329,14 @@
FontSize="12"
IsChecked="{Binding orderFilterConfig.chkNoMultiOrderIsChecked}"
Unchecked="chkSubFilterSonditions_Checked" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chkTransitOrder"
Margin="0,2,3,2"
@@ -484,8 +472,8 @@
SelectedIndex="0"
SelectionChanged="ComboBox_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBoxItem Content="礼品一" />
<ComboBoxItem Content="礼品二(实物)" />
<ComboBoxItem Content="1.55" />
<ComboBoxItem Content="1.6" />
</ComboBox>
</wpf:TitleContent>
<Button
@@ -498,24 +486,6 @@
Content="同步订单"
Style="{StaticResource BasePageButtonStyle}"
ToolTip="同步选中的订单或选中的店铺" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chkNoPickupNumOrder"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkNoPickupNumOrder_Click"
Content="仅显示无取件码同步物流单"
FontSize="12"
IsChecked="False" />
</WrapPanel>
</Border>
<Grid
@@ -626,7 +596,7 @@
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkMapProd_Click"
Content="选择SKU"
Content="已关联商品"
FontSize="12" />
<CheckBox
x:Name="chkMapSku"
@@ -637,37 +607,7 @@
Click="chkMapProd_Click"
Content="已关联拍单"
FontSize="12" />
<Button
x:Name="btnAutoBuy"
Width="Auto"
Height="22"
MinWidth="48"
Margin="8,0,4,0"
Padding="4,0"
Click="btnAutoBuy_Click"
Content="自动拍单"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
<!-- c:DebugVisibility.Enable="true" -->
<Button
x:Name="btnAutoBuyIntorduction"
Width="Auto"
Height="22"
MinWidth="48"
Margin="0,0,8,0"
Padding="4,0"
Click="btnAutoBuyIntroduction_Click"
Content="自动拍单设置说明"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<Button
Width="Auto"
Height="22"
@@ -696,35 +636,15 @@
Margin="4,0,4,4"
BorderBrush="#e0e0e0"
BorderThickness="0,0,0,1">
<WrapPanel>
<CheckBox
x:Name="chkDirectSendFailed"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkDirectSendFailed_Click"
Content="直拍发货失败"
FontSize="12" />
<CheckBox
x:Name="chkWaitSend48HourNoWaybill"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkWaitSendNoWaybill_Click"
Content="48小时未发货"
FontSize="12" />
<CheckBox
x:Name="chkWaitSend72HourNoWaybill"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkWaitSendNoWaybill_Click"
Content="72小时未发货"
FontSize="12" />
</WrapPanel>
<CheckBox
x:Name="chkDirectSendFailed"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkDirectSendFailed_Click"
Content="直拍发货失败"
FontSize="12" />
</Border>
</TabItem>
<TabItem
@@ -750,43 +670,15 @@
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<WrapPanel>
<CheckBox
x:Name="chkNeedCheckExpress"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkNeedCheckExpress_Click"
Content="需核对物流"
FontSize="12" />
<Polyline
Grid.Column="3"
Width="10"
Margin="5,0"
VerticalAlignment="Center"
Points="5,0 5,8 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chk48HourNoWaybill"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkNoWaybill_Click"
Content="48小时未发货"
FontSize="12" />
<CheckBox
x:Name="chk72HourNoWaybill"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkNoWaybill_Click"
Content="72小时未发货"
FontSize="12" />
</WrapPanel>
<CheckBox
x:Name="chkNeedCheckExpress"
Margin="6,8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkNeedCheckExpress_Click"
Content="需核对物流"
FontSize="12" />
<WrapPanel
Grid.Column="2"
d:Opacity="0.2"
@@ -1089,14 +981,13 @@
<ComboBoxItem Content="请选择" />
<ComboBoxItem Content="未申请" />
<ComboBoxItem Content="申请中" />
<ComboBoxItem Content="申请失败" />
<ComboBoxItem Content="申请成功" />
<ComboBoxItem Content="拒收失败" />
<ComboBoxItem Content="拒收成功" />
</ComboBox>
</wpf:TitleContent>
<wpf:TitleContent
Title="拦截退回总店状态"
Margin="8,0,4,0"
Margin="4,0,4,0"
VerticalContentAlignment="Center"
FontSize="12"
Foreground="Black"
@@ -1112,7 +1003,7 @@
<ComboBoxItem Content="请选择" />
<ComboBoxItem Content="未拦截" />
<ComboBoxItem Content="拦截中" />
<ComboBoxItem Content="拦截失败" />
<!--<ComboBoxItem Content="拦截失败" />-->
<ComboBoxItem Content="拦截成功" />
</ComboBox>
</wpf:TitleContent>
@@ -1169,7 +1060,17 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<WrapPanel>
<Button
x:Name="btnBatchRefund2"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="6,6"
Padding="4,0"
Click="btnBatchRefund_Click"
Content="批量申请买手售后"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
<CheckBox
x:Name="chkShopIsRefund"
Grid.Column="0"
@@ -1208,72 +1109,6 @@
Click="chkUpShopAddressAnalyseFailed_Click"
Content="总店地址解析失败"
FontSize="12" />
<Polyline
Grid.Column="14"
Width="10"
Margin="5,0"
VerticalAlignment="Center"
Points="5,0 5,8 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2"
Visibility="Visible" />
<wpf:TitleContent
Title="买手退货状态"
Margin="4,0,4,0"
VerticalContentAlignment="Center"
FontSize="12"
Foreground="Black"
Placement="Left"
TitleVerticalAlignment="Center">
<ComboBox
x:Name="cmbReturnOrderBuyerStatus"
Width="130"
Height="23"
SelectedIndex="0"
SelectionChanged="cmbReturnOrderBuyerStatus_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBoxItem Content="请选择" />
<ComboBoxItem Content="买手待申请售后" />
<ComboBoxItem Content="买手待退货" />
<ComboBoxItem Content="买手已寄出待商家退款" />
<ComboBoxItem Content="买手退货失败" />
</ComboBox>
</wpf:TitleContent>
<Button
x:Name="btnBatchRefund2"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="6,6"
Padding="4,0"
Click="btnBatchRefund_Click"
Content="批量申请买手售后"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
<wpf:TitleContent
Title="退货仓状态"
Margin="8,0,4,0"
VerticalContentAlignment="Center"
FontSize="12"
Foreground="Black"
Placement="Left"
TitleVerticalAlignment="Center">
<ComboBox
x:Name="cmbReturnOrderStatus"
Width="100"
Height="23"
SelectedIndex="0"
SelectionChanged="cmbReturnOrderStatus_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBoxItem Content="请选择" />
<ComboBoxItem Content="未创建" />
<ComboBoxItem Content="创建失败" />
<ComboBoxItem Content="已创建未到仓" />
<ComboBoxItem Content="已到仓" />
<ComboBoxItem Content="已发回" />
</ComboBox>
</wpf:TitleContent>
</WrapPanel>
</Grid>
</Border>
@@ -5,8 +5,6 @@ using _29WxOrderWpf.Ctrls.BuyerCtrls;
using _29WxOrderWpf.Ctrls.Statistics;
using _29WxOrderWpf.Services;
using _29WxOrderWpf.Utils;
using _29WxOrderWpf.ViewModels;
using _29WxOrderWpf.Views;
using _29WxOrderWpf.Windows.OrderWindows;
using AllBase;
using AllBase.Extension;
@@ -44,9 +42,9 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Xml;
using System.Xml.Linq;
using _29WxOrderWpf.ViewModels;
using Work;
using Work._29Tools.BLL;
using Work.BaseForms;
using Work.BuyUsers;
using Work.KJDServer.API.Models;
using WPFCommon.Helpers;
@@ -60,7 +58,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
/// </summary>
public partial class OrderListCtrl : UserControl, INotifyPropertyChanged
{
public static bool IsAutoBuy { get; set; } = false;
public CheckBox chkSelectAll = null;
OrderFilterConfig _orderFilterConfig;
public OrderFilterConfig orderFilterConfig
@@ -77,7 +74,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public DateTime nextGetOrderTime = DateTime.MinValue;
public string strSearchAll { get; set; } = "";
public bool chkNoPickupNumOrderIsChecked { get; set; } = false;
public ShipGiftService _shipGiftService { get; }
public OrderListCtrl()
{
@@ -105,8 +101,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
orderFilterConfig.lstFilterRemarkText = new ConcurrentList<string>();
orderFilterConfig.txtFilterShopNameText = "";
chkSyncDirectOrderWaybill.IsChecked = GlobalConfig.BuyConfig?.IsSyncDirectBuyOrderWaybill;
dateStart.SelectedDate = DateTime.Now.Date.AddDays(-7);
dateEnd.SelectedDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
@@ -295,9 +289,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 读取中转仓拍单订单
var transitOrderList = GetTransitWarehouseList(order_ids);
// 额外订单包裹补发
var transitExtraPackageList = GetTransitExtraPackageList(order_ids);
// 读取中转仓拍单订单售后状态
var transitAfterSaleList = GetTransitWarehouseAfterSaleList(order_ids);
@@ -310,19 +301,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 读取暂时记录的买手售后单,后面想办法放到中转订单库里去
var pddBuyerAfterSales = GetPddBuyerAfterSales(order_ids);
// 同步单
var buyerIds = string.Join(",", pddBuyerOrders.Select(o => o.order_sn));
var syncLogistics = GetSyncLogistics(buyerIds);
// 读取关联拍单商品
var buyMapList = GetBuyProdMap(orderItems);
// 读取关联拍单的所有sku
var buyMapSkusList = GetBuyProdMapSkus(orderItems);
// 读取物流轨迹
var ewaybillLst = GetEWaybillPath(order_ids);
// 装载订单
foreach (JObject jObj in jArr)
{
@@ -349,32 +332,15 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 关联拍单关系 // 危险物品禁止拍单,仅关联安全商品
//if (!GlobalConfig.lstDangerItemWord.Any(d => (item.title).ParseToString().Contains(d)))
{
var pddBuyMapLst = buyMapList.Where(m => m.platform == "pdd").ToList();
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
if (item.BuyMap == null)
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
if (item.BuyMap == null)
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
if (item.BuyMap == null)
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
}
item.PddBuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time)
.Where(s => s.platform == "pdd").ToList();
{
var tbBuyMapLst = buyMapList.Where(m => m.platform == "tb").ToList();
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
}
item.TbBuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time)
.Where(s => s.platform == "tb").ToList();
item.BuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time).ToList();
// 中转仓订单
if (item.ItemOrder.orderItems.Count > 1)
@@ -382,13 +348,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
else
item.ItemTransitOrders.AddRange(transitOrderList.Where(t => t.order_no == item.order_id));
// 中转仓退货包裹订单
if (item.order_id == "3739241588056569856")
{
}
item.ItemTransitOrderAfterSales = transitAfterSaleList.Where(a => item.ItemTransitOrders.Any(t => t.out_order_no == a.order_code || t.order_code == a.order_code)).ToList();
item.ItemTransitOrderAfterSales = transitAfterSaleList.Where(a => item.ItemTransitOrders.Any(t => t.out_order_no == a.order_code)).ToList();
item.DistribReturnOrderInfos = transitReturnOrderList.Where(tr => tr.order_code_source == item.order_id).ToList();
item.ItemTransitExtraOrders = transitExtraPackageList.Where(p => item.ItemTransitOrders.Any(t => t.order_code == p.order_code)).ToList();
// 中转仓买手订单(wx_send_type等于0)
item.PddBuyerOrders = pddBuyerOrders.Where(po => po.wx_order_id == item.order_id && po.wx_sku_id == item.sku_id && po.wx_send_type == 0).ToList();
@@ -403,22 +364,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 装载订单售后详情
order.refundItems = new ObservableCollection<oms_wei_refund_info>(refunds.Where(of => of.order_id == order.order_id));
// 装载同步单
order.SyncLogisticsList = [.. syncLogistics.Where(os => order.orderItems.Any(oi => oi.DirectPddBuyerOrders.Any(od => od.order_sn == os.order_id))),];
if (order.SyncLogisticsList.Count > 0)
{
}
if (order.order_id.Contains("3738794693820307200"))
{
}
// 装载订单物流最后一条信息
order.latestEWaybills = [.. ewaybillLst.Where(ew => ew.order_id == order.order_id.ParseToLong())];
// 读取订单后立即赋值,防止滚动时实时赋值造成卡顿
InitOrderObservableProp(order);
@@ -621,33 +566,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return new List<oms_wei_external_procurement_log_info>();
}
public static List<oms_wei_transfer_extra_package> GetTransitExtraPackageList(string order_ids)
{
if (string.IsNullOrEmpty(order_ids))
return new List<oms_wei_transfer_extra_package>();
var url3 = BaseClass.Build29WxObjString("order/wx_get_transfer_extra_package");
var data3 = UserLogin.GetSignaturex();
data3 += "&order_no=" + order_ids;
var html3 = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
html3 = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
{
BaseMsgWindow.ShowAnimateMessage("订单读取失败 " + BaseRegex.GetStringJson(ref html3, "msg"), "Error", 5);
}
List<oms_wei_transfer_extra_package> transitExtraPackageList = new List<oms_wei_transfer_extra_package>();
try
{
transitExtraPackageList = JsonHelper.DeserializeJsonToList<oms_wei_transfer_extra_package>(JObject.Parse(html3)["data"].ParseToString());
return transitExtraPackageList;
}
catch
{
}
return new List<oms_wei_transfer_extra_package>();
}
public static List<oms_wei_external_procurement_after_sale_info> GetTransitWarehouseAfterSaleList(string order_ids)
{
if (string.IsNullOrEmpty(order_ids))
@@ -764,67 +682,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
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)
{
var url6 = BaseClass.Build29WxObjString("order/wx_get_sync_waybill");
var data6 = UserLogin.GetSignaturex();
data6 += "&order_id=" + buyer_order_ids;
if (not_upload_pickup_status != null)
data6 += "&not_upload_pickup_status=" + not_upload_pickup_status;
List<yh_sync_logistics> pddBuyerAfterSales = new List<yh_sync_logistics>();
if (!string.IsNullOrEmpty(buyer_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<yh_sync_logistics>();
}
try
{
pddBuyerAfterSales = JsonHelper.DeserializeJsonToList<yh_sync_logistics>(JObject.Parse(html6)["data"].ParseToString()).OrderByDescending(p => p.id).ToList();
return pddBuyerAfterSales;
}
catch
{
}
}
return new List<yh_sync_logistics>();
}
public static List<oms_wei_ewaybill_path> GetEWaybillPath(string order_ids)
{
List<oms_wei_ewaybill_path> oms_wei_ewaybill_path_list = null;
if (!string.IsNullOrEmpty(order_ids))
{
try
{
var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_latest_list");
var data = UserLogin.GetSignaturex();
data += "&erp_order_id_in=" + order_ids;
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"))
{
BaseMsgWindow.ShowAnimateMessage("物流查询失败 " + BaseRegex.GetStringJson(ref html, "msg"), "Error", 6);
}
else
{
oms_wei_ewaybill_path_list = JsonHelper.DeserializeJsonToList<oms_wei_ewaybill_path>(JObject.Parse(html)["data"].ParseToString()).OrderByDescending(p => p.update_time).ToList();
}
}
catch
{
}
}
if (oms_wei_ewaybill_path_list == null)
oms_wei_ewaybill_path_list = new List<oms_wei_ewaybill_path>();
return oms_wei_ewaybill_path_list;
}
public static List<WXBuyMapInfo> GetBuyProdMap(List<oms_wei_order_item_info> orderItems)
{
//foreach (var item in orderItems.ToList())
@@ -863,10 +720,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
var buyMapList = JsonHelper.DeserializeJsonToList<WXBuyMapInfo>(JObject.Parse(resultMap)["data"].ParseToString());
buyMapList = buyMapList.Where(b => !GlobalConfig.BuyMapList.Any(m => m.sku_code == b.sku_code && m.spu_code == b.spu_code)).ToList();
GlobalConfig.BuyMapList.AddRange(buyMapList);
if (buyMapList.Count > 0)
{
}
}
catch
{
@@ -1065,7 +918,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
if (orderItem.TransitRefundStatusStr.ParseToString().Contains("需手动申请售后") &&
orderItem.ItemTransitOrderWithVoid?.has_reject == 3 /*&& orderItem.ItemTransitOrderWithVoid?.platform != "XDYYWC"*/) // 义乌仓不支持拒收,等于3也是失败
orderItem.ItemTransitOrderWithVoid?.has_reject == 3 && orderItem.ItemTransitOrderWithVoid?.platform != "XDYYWC") // 义乌仓不支持拒收,等于3也是失败
{
// 拒收后24小时才去总店填拒收退货
if (orderItem.ItemTransitOrderWithVoid?.rejected_time > DateTime.Now.AddHours(-24))
@@ -1088,7 +941,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
/// <summary>
/// 中转仓拦截去总店填写退货物流信息(申请拦截退回总店以后回填退货物流)
/// 中转仓拦截去总店填写退货物流信息
/// </summary>
public void AutoUpdateTransitPackageToPddShop()
{
@@ -1104,12 +957,21 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// orderItem.ItemTransitOrderAfterSale = new oms_wei_external_procurement_after_sale_info()
// {
// downstream_waybill = "315090716621027",
// };
//}
// 260801-439070256640980 260801-439070256640980
if (orderItem.order_id == "3738534855500515072")
{
}
// 260801-439070256640980260801-439070256640980
// string url = "https://mobile.yangkeduo.com/complaint.html?mode=128&after_sales_id=22059412840967&order_sn=260801-439070256640980"
if (orderItem.TransitRefundStatusStr.Contains("待用户发货") && !(orderItem.ItemTransitOrderAfterSale?.downstream_waybill).IsNullOrEmpty())
{
if (orderItem.order_id == "3738382691615546112")
{
}
string orderSn = orderItem.ItemTransitOrderWithVoid.out_order_no;
if (orderSn.IsNullOrEmpty())
continue;
@@ -1125,19 +987,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
var waybillId = orderItem.ItemTransitOrderAfterSale.downstream_waybill;
var chkRst = AddReturnPddShopPackageInfocheck(buyer, orderSn, afterSalesId, waybillId);
var type = 4;
if (chkRst.Contains("\"interactType\":0"))
type = 2;
var result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", type.ToString());
if (!result.Contains("\"result\":\"ok\""))
{
type = type == 4 ? 2 : 4;
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", type.ToString());
}
if (!result.Contains("\"result\":\"ok\""))
{
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", "5");
}
var result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId);
if (result.Contains("\"result\":\"ok\""))
{
@@ -1186,9 +1036,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
foreach (var orderItem in order.orderItems)
{
if (orderItem.order_id == "3739105285145538816")
if (orderItem.order_id == "3738534855500515072")
{
}
if (order.OrderBuyType == "直发" || order.OrderBuyType == "云改直")
@@ -1219,10 +1068,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
type = type == 4 ? 2 : 4;
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", type.ToString());
}
if (!result.Contains("\"result\":\"ok\""))
{
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", "5");
}
if (result.Contains("\"result\":\"ok\""))
{
@@ -1304,10 +1149,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
type = type == 4 ? 2 : 4;
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", type.ToString());
}
if (!result.Contains("\"result\":\"ok\""))
{
result = AddReturnPddShopPackageInfo(buyer, orderSn, afterSalesId, waybillId, "韵达快递", "121", "5");
}
if (result.Contains("\"result\":\"ok\""))
{
@@ -1398,7 +1239,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (tabItem != null)
{
var filteLstTmp = userOrderLst.Where(o => !GetOrderIsFilter(o, "异常需重拍"));
Dispatcher.Invoke(new Action(() => { tabItem.Header = "异常需重拍(" + userOrderLst.Where(r => r.IsAbnormal).Count() + "|" + filteLstTmp.Count() + ")"; }));
Dispatcher.Invoke(new Action(() => { tabItem.Header = "异常需重拍(" + userOrderLst.Where(r => r.isAbnormal).Count() + "|" + filteLstTmp.Count() + ")"; }));
}
Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("全部订单")); }));
if (tabItem != null)
@@ -1547,12 +1388,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 仓库退款单号
else if (order.orderItems.Any(oi => oi.ItemTransitOrderAfterSales.Any(t => t.refund_waybill.ParseToString().Contains(strSearchAll))))
isFilter = false;
// 直发订单号
else if (order.out_order_no.Contains(strSearchAll))
isFilter = false;
// 直发物流单号
else if (order.out_express_no.Contains(strSearchAll))
isFilter = false;
if (isFilter)
return true;
}
@@ -1600,14 +1435,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (!orderFilterConfig.chkTransitChangeDirectOrderIsChecked == true && order.OrderBuyType == "云改直")
return true;
if (chkNoPickupNumOrderIsChecked == true)
{
if (order.SyncWaybillIdInfo.IsNullOrEmpty())
return true;
if (!order.SyncWaybillPickNo.IsNullOrEmpty())
return true;
}
var filterTimeRst = false;
Dispatcher.Invoke(new Action(() =>
{
@@ -1683,17 +1510,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
if (filterHeadStr.StartsWith("待采购"))
{
if (order.order_id == "3739161507780018688")
{
}
if (!order.IsWaitBuy)
return true;
if (chkMapSku.IsChecked == true && order.orderItems.Any(oi => oi.PddBuyMap == null))
if (chkMapSku.IsChecked == true && order.orderItems.All(oi => oi.BuyMap == null && (oi.BuyMapSkus == null || oi.BuyMapSkus.Count == 0)))
return true;
if (chkMapProd.IsChecked == true && order.orderItems.All(oi => oi.PddBuyMapSkus == null || oi.PddBuyMapSkus.Count == 0 || oi.PddBuyMap != null))
if (chkMapProd.IsChecked == true && order.orderItems.All(oi => oi.BuyMapSkus == null || oi.BuyMapSkus.Count == 0))
return true;
if (chkNoMapProd.IsChecked == true && (order.orderItems.All(oi => oi.PddBuyMap != null) || order.orderItems.All(oi => oi.PddBuyMapSkus != null && oi.PddBuyMapSkus.Count > 0)))
if (chkNoMapProd.IsChecked == true && order.orderItems.All(oi => oi.BuyMap != null))
return true;
}
if (filterHeadStr.StartsWith("待发货"))
@@ -1708,35 +1531,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (!rst2)
return true;
}
if (chkWaitSend72HourNoWaybill.IsChecked == true)
{
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
// 直发没有单号正常发货才判断中转仓总店是否超时发货
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else
return true;
}
else if (chkWaitSend48HourNoWaybill.IsChecked == true)
{
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
// 直发没有单号才判断中转仓总店是否超时发货
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
else
return true;
}
}
if (filterHeadStr.StartsWith("待收货"))
{
@@ -1765,41 +1559,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return true;
if (chkWaitReceiveWarehouseIsSendOut.IsChecked == true && order.orderItems.All(oi => oi.WarehouseWaybillStatusStr != "中转已出库"))
return true;
if (chk72HourNoWaybill.IsChecked == true)
{
if (order.order_id == "3739190405314033408")
{
}
// 直发没有单号才判断中转仓总店是否超时发货
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else
return true;
}
else if (chk48HourNoWaybill.IsChecked == true)
{
// 直发没有单号才判断中转仓总店是否超时发货
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
else if (order.orderItems.Any(oi =>(oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
else
return true;
}
}
if (filterHeadStr.StartsWith("异常需重拍") && !order.IsAbnormal)
if (filterHeadStr.StartsWith("异常需重拍") && !order.isAbnormal)
{
return true;
}
@@ -1810,15 +1571,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
//"System.Windows.Controls.ComboBoxItem: 未申请";
var cmbRejectStatusText = cmbRejectStatus.SelectedItem.ParseToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
if (cmbRejectStatusText == "未申请" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr == "未申请"))
if (cmbRejectStatusText == "未申请" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr == "申请"))
return true;
if (cmbRejectStatusText == "申请中" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr == "已申请拒收"))
return true;
if (cmbRejectStatusText == "申请成功" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr.StartsWith("申请成功")))
if (cmbRejectStatusText == "拒收成功" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr.StartsWith("申请拒收成功")))
return true;
if (cmbRejectStatusText == "申请失败" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr.StartsWith("申请失败")))
return true;
if (cmbRejectStatusText == "拒收成功" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr.StartsWith("拒收成功")))
if (cmbRejectStatusText == "拒收失败" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseRejectStr.StartsWith("申请拒收失败")))
return true;
if (order.order_id == "3738674216947317248")
@@ -1826,7 +1585,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
var cmbReturnPackageStatusText = cmbReturnPackageStatus.SelectedItem.ParseToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
if (cmbReturnPackageStatusText == "未拦截" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseAfterSaleStr == "未添加"))
if (cmbReturnPackageStatusText == "未拦截" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseAfterSaleStr == "添加"))
return true;
if (cmbReturnPackageStatusText == "拦截中" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseAfterSaleStr == "已添加"))
return true;
@@ -1898,9 +1657,12 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
foreach (var orderItem in order.orderItems)
{
var receiver = TransitReturnOrderWindow.PddAddressAnalysis(orderItem.PddBuyerAfterSale?.afterSaleAddress);
if (!receiver.receiver_address.IsNullOrEmpty() && receiver.receiver_name.Length <= 15)
return true;
for (int i = 0; i < 1000; i++)
{
var receiver = TransitReturnOrderWindow.PddAddressAnalysis(orderItem.PddBuyerAfterSale?.afterSaleAddress);
if (!receiver.receiver_address.IsNullOrEmpty())
return true;
}
}
}
else
@@ -1911,34 +1673,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
foreach (var orderItem in order.orderItems)
{
var receiver = TransitReturnOrderWindow.PddAddressAnalysis(orderItem.DirectPddBuyerAfterSale?.afterSaleAddress);
if (!receiver.receiver_address.IsNullOrEmpty() && receiver.receiver_name.Length <= 15)
if (!receiver.receiver_address.IsNullOrEmpty())
return true;
}
}
}
var cmbReturnOrderStatusText = cmbReturnOrderStatus.SelectedItem.ParseToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
if (cmbReturnOrderStatusText == "未创建" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseReturnOrderStr == "未创建"))
return true;
if (cmbReturnOrderStatusText == "创建失败" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseReturnOrderStr == "创建失败"))
return true;
if (cmbReturnOrderStatusText == "已创建未到仓" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseReturnOrderStr.StartsWith("已创建未到仓")))
return true;
if (cmbReturnOrderStatusText == "已到仓" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseReturnOrderStr.StartsWith("已到仓")))
return true;
if (cmbReturnOrderStatusText == "已发回" && !order.orderItems.Any(oi => oi.AddEditTransitWarehouseReturnOrderStr.StartsWith("已发回")))
return true;
var cmbReturnOrderBuyerStatusText = cmbReturnOrderBuyerStatus.SelectedItem.ParseToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
if (cmbReturnOrderBuyerStatusText == "买手待申请售后" && order.orderItems.All(oi => !oi.TransitRefundStatusStr.Contains("需手动申请售后")))
return true;
else if (cmbReturnOrderBuyerStatusText == "买手待退货" && order.orderItems.All(oi => !oi.TransitRefundStatusStr.Contains("待用户发货")))
return true;
else if (cmbReturnOrderBuyerStatusText == "买手已寄出待商家退款" && order.orderItems.All(oi => !oi.TransitRefundStatusStr.Contains("商家处理中")))
return true;
else if (cmbReturnOrderBuyerStatusText == "买手退货失败" && order.orderItems.All(oi => !oi.TransitRefundStatusStr.Contains("退款失败")))
return true;
}
if (filterHeadStr.StartsWith("售后完成单"))
{
@@ -2286,7 +2025,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
/// <summary>
/// 中转仓拦截退货包裹申请买手退货退款并获取总店地址,暂时不使用此功能防止需交涉或者可拒收的订单被自动申请退货退款
/// 中转仓拦截退货包裹申请买手退货退款并获取总店地址,暂时不使用此功能防止需交涉或者可拦截的订单被自动申请退货退款
/// </summary>
/// <returns></returns>
public async Task DoReturnPackageBuyerRefendSlient()
@@ -2335,13 +2074,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
foreach (var orderItem in order.orderItems)
{
if (order.order_id == "3739105285145538816")
if (order.order_id == "3738564728075491584")
{
}
// 退货地址不是退货仓,跳过
if (orderItem.ItemRefund?.return_detail?.ToUpper().Contains(GlobalConfig.TransitReturnOrderReturnAddressLite) != true)
if (orderItem.ItemRefund?.return_detail.StartsWith(GlobalConfig.TransitReturnOrderReturnAddress) == false)
continue;
if (orderItem.DistribReturnOrderInfo == null || orderItem.DistribReturnOrderInfo.warehouse_status == 0)
@@ -2385,13 +2124,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
foreach (var orderItem in order.orderItems)
{
if (order.order_id == "3739105285145538816")
if (order.order_id == "3738534855500515072")
{
}
// 退货地址不是退货仓,跳过
if (orderItem.ItemRefund?.return_detail?.ToUpper().Contains(GlobalConfig.TransitReturnOrderReturnAddressLite) != true)
if (orderItem.ItemRefund?.return_detail.StartsWith(GlobalConfig.TransitReturnOrderReturnAddress) == false)
continue;
// 退货包裹未发货,跳过(仅退货退款已发货的才自动去申请拼多多退货退款)
if ((orderItem.ItemRefund?.return_waybill_id).IsNullOrEmpty())
@@ -2401,15 +2140,14 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (orderItem?.ItemOrder?.OrderBuyType == "云仓")
{
if (!string.IsNullOrEmpty(orderItem.ItemTransitOrderWithVoid?.out_order_no) && orderItem.PddBuyerAfterSaleAddressStr.IsNullOrEmpty() &&
(orderItem.TransitRefundStatusStr.Contains("需手动申请售后") || orderItem.TransitRefundStatusStr.Contains("需手动申请售后") || orderItem.TransitRefundStatusStr.IsNullOrEmpty()))
(orderItem.TransitRefundStatusStr.Contains("需手动申请售后") || orderItem.TransitRefundStatusStr.Contains("待用户发货")))
tmpOrderItems.Add(orderItem);
}
if (orderItem?.ItemOrder?.OrderBuyType == "直发")
{
if (orderItem != null && !string.IsNullOrEmpty(orderItem.ItemOrder?.out_order_no) && orderItem.DirectPddBuyerAfterSaleAddressStr.IsNullOrEmpty() &&
((orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("需手动申请售后") || (orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("待用户发货") ||
(orderItem.ItemOrder?.out_after_sale_status).IsNullOrEmpty()))
((orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("需手动申请售后") || (orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("待用户发货")))
tmpOrderItems.Add(orderItem);
}
@@ -2417,8 +2155,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (orderItem?.ItemOrder?.OrderBuyType == "云改直")
{
if (orderItem != null && !string.IsNullOrEmpty(orderItem.ItemOrder?.out_order_no) && orderItem.DirectPddBuyerAfterSaleAddressStr.IsNullOrEmpty() &&
((orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("需手动申请售后") || (orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("待用户发货") ||
(orderItem.ItemOrder?.out_after_sale_status).IsNullOrEmpty()))
((orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("需手动申请售后") || (orderItem.ItemOrder?.out_after_sale_status).ParseToString().Contains("待用户发货")))
tmpOrderItems.Add(orderItem);
}
}
@@ -2439,7 +2176,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
int index = 0;
foreach (var tmpOrderItem in tmpOrderItems)
{
if (tmpOrderItem.order_id == "3739105285145538816")
if (tmpOrderItem.order_id == "3738534855500515072")
{
}
@@ -2474,8 +2211,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
continue;
}
await Task.Run(() => { MainWindow.Instance.orderListCtrl.GetOrder(tmpOrderItem.order_id); });
MainWindow.Instance.orderListCtrl.GetOrder(tmpOrderItem.order_id);
oms_wei_order_info order = null;
Dispatcher.Invoke(new Action(() => { order = GlobalConfig.lstOrder.FirstOrDefault(oi => oi.order_id == tmpOrderItem.order_id); }));
@@ -2502,7 +2238,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
AfterSaleAddressStr = orderItem.DirectPddBuyerAfterSaleAddressStr;
}
if (string.IsNullOrEmpty(outOrderNo) || !AfterSaleAddressStr.IsNullOrEmpty() ||
(!refundStatusStr.Contains("需手动申请售后") && !refundStatusStr.Contains("待用户发货") && !refundStatusStr.IsNullOrEmpty()))
(!refundStatusStr.Contains("需手动申请售后") && !refundStatusStr.Contains("待用户发货")))
continue;
PddBuyerOrderLiteInfo pddBuyerOrderLiteInfo = new PddBuyerOrderLiteInfo();
@@ -2534,7 +2270,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
pddBuyerAfterSale = orderItem.DirectPddBuyerAfterSale;
bool isSimPddAfterSaleSuccess = true;
if (refundStatusStr.Contains("需手动申请售后") || string.IsNullOrEmpty(refundStatusStr))
if (refundStatusStr.Contains("需手动申请售后"))
{
isSimPddAfterSaleSuccess = false;
// pddBuyerAfterSale作为参数传入,获取退货退款金额
@@ -2591,7 +2327,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
BaseMsgWindow.ShowAnimateMessage("买手退款信息更新成功" + orderItem.order_id, "Msg", 3);
isSimPddAfterSaleSuccess = true;
await Task.Run(() => { Thread.Sleep(Randomx.GetId(10000, 12001)); });
Thread.Sleep(Randomx.GetId(10000, 12001));
}
else
{
@@ -2606,7 +2342,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
BaseMsgWindow.ShowAnimateMessage("买手退款信息更新成功", "Msg", 3);
isSimPddAfterSaleSuccess = true;
await Task.Run(() => { Thread.Sleep(Randomx.GetId(10000, 12001)); });
Thread.Sleep(Randomx.GetId(10000, 12001));
}
else
{
@@ -2969,89 +2705,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
FilterOrders();
}
private async void btnAutoBuy_Click(object sender, RoutedEventArgs e)
{
var buyOrders = GlobalConfig.lstFilterOrder.Where(o => o.IsWaitBuy && o.orderItems?.Count == 1 && o.orderItems.FirstOrDefault()?.PddBuyMap != null && o.IsSelect == true).ToList();
if (buyOrders.Count == 0)
{
BaseMsgWindow.ShowError("未勾选符合条件的订单!");
return;
}
IsAutoBuy = true;
foreach (var order in buyOrders)
{
var orderItem = order.orderItems.FirstOrDefault();
await OrderListRowItemCtrl.BuyOrder(orderItem, true);
if (IsAutoBuy == false)
break;
}
IsAutoBuy = false;
}
private void btnAutoBuyIntroduction_Click(object sender, RoutedEventArgs e)
{
AutoBuyIntroductionView autoBuyIntroForm = new AutoBuyIntroductionView();
new DialogWindow()
{
Title = "自动拍单设置说明",
Content = autoBuyIntroForm,
}.ShowDialog();
}
private void chkNoWaybill_Click(object sender, RoutedEventArgs e)
{
if (sender is CheckBox chk)
{
var isCheck = !chk.IsChecked.ParseToBool();
chk48HourNoWaybill.IsChecked = chk72HourNoWaybill.IsChecked = false;
chk.IsChecked = !isCheck;
}
FilterOrders();
}
private void chkWaitSendNoWaybill_Click(object sender, RoutedEventArgs e)
{
if (sender is CheckBox chk)
{
var isCheck = !chk.IsChecked.ParseToBool();
chkWaitSend48HourNoWaybill.IsChecked = chkWaitSend72HourNoWaybill.IsChecked = false;
chk.IsChecked = !isCheck;
}
FilterOrders();
}
private void cmbReturnOrderStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
FilterOrders();
}
private void cmbReturnOrderBuyerStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
FilterOrders();
}
private void chkSyncDirectOrderWaybill_Click(object sender, RoutedEventArgs e)
{
if (chkSyncDirectOrderWaybill.IsChecked == true)
{
if (BaseMsgWindow.ShowConfirm("外部单号无法直填,电子面单同步上家物流信息发货。").DialogResult != true)
{
chkSyncDirectOrderWaybill.IsChecked = false;
return;
}
}
GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill = chkSyncDirectOrderWaybill.IsChecked.ParseToBool();
StartUp.SaveBuyConfig();
}
private void chkNoPickupNumOrder_Click(object sender, RoutedEventArgs e)
{
chkNoPickupNumOrderIsChecked = chkNoPickupNumOrder.IsChecked.ParseToBool();
FilterOrders();
}
}
public class OrderFilterConfig : PropertyNotifyObject
@@ -26,9 +26,11 @@
<Style TargetType="wpf:SpacingStackPanel">
<Setter Property="Margin" Value="3,0" />
</Style>
<!-- BasedOn="{StaticResource ButtonBaseStyle}" -->
<Style x:Key="LinkButton" TargetType="Button">
<Setter Property="Height" Value="18" />
<Style
x:Key="LinkButton"
BasedOn="{StaticResource ButtonBaseStyle}"
TargetType="Button">
<Setter Property="Height" Value="20" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{StaticResource PageLinkBrush}" />
@@ -39,9 +41,9 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0" />
<RowDefinition Height="2" />
<RowDefinition Height="*" />
<RowDefinition Height="0" />
<RowDefinition Height="2" />
</Grid.RowDefinitions>
<Grid
x:Name="gridListItem"
@@ -51,9 +53,9 @@
<ColumnDefinition Width="36" />
<ColumnDefinition Width="28" />
<ColumnDefinition Width="200*" />
<ColumnDefinition Width="100*" MinWidth="180" />
<ColumnDefinition Width="75*" MinWidth="130" />
<ColumnDefinition Width="170*" MinWidth="280" />
<ColumnDefinition Width="100*" MinWidth="200" />
<ColumnDefinition Width="75*" MinWidth="150" />
<ColumnDefinition Width="170*" MinWidth="380" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="72*" />
@@ -196,7 +198,7 @@
VerticalSpacing="2">
<wpf:TitleContent Title="成交时间:">
<uc:UcWaterMarkTextBox1
d:Text="00-01-01 01:01:01"
d:Text="2000-01-01 01:01:01"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
@@ -207,7 +209,6 @@
<wpf:TitleContent Title="发货时间:" Visibility="{Binding ItemOrder.ship_done_time_visibility}">
<uc:UcWaterMarkTextBox1
d:Text="00-01-01 01:01:01"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
@@ -218,7 +219,6 @@
<wpf:TitleContent Title="退款时间:" Visibility="{Binding RefundTimeVisibility}">
<uc:UcWaterMarkTextBox1
d:Text="00-01-01 01:01:01"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
@@ -247,16 +247,6 @@
WaterMark="售价" />
</wpf:TitleContent>
<wpf:TitleContent Title="店铺运费:">
<uc:UcWaterMarkTextBox1
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding PostagePriceStr}"
TextWrapping="Wrap"
WaterMark="店铺运费" />
</wpf:TitleContent>
<wpf:TitleContent Title="平台优惠:">
<uc:UcWaterMarkTextBox1
d:Text="¥100.00"
@@ -268,25 +258,24 @@
WaterMark="平台优惠" />
</wpf:TitleContent>
<wpf:TitleContent Title="进价:" Visibility="{Binding PurchasePriceVisibility}">
<wpf:TitleContent Title="进价:" Visibility="{Binding purchase_price_visibility}">
<uc:UcWaterMarkTextBox1
d:Text="¥100.00"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding PurchasePriceStr}"
Text="{Binding purchase_price_str}"
TextWrapping="Wrap"
Visibility="{Binding PurchasePriceVisibility}"
Visibility="{Binding purchase_price_visibility}"
WaterMark="进价" />
</wpf:TitleContent>
<wpf:TitleContent Title="运费:" Visibility="{Binding FreightVisibility}">
<uc:UcWaterMarkTextBox1
d:Text="¥100.00"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding FreightStr}"
Text="{Binding freight_str}"
TextWrapping="Wrap"
Visibility="{Binding FreightVisibility}"
WaterMark="运费" />
@@ -430,33 +419,15 @@
</WrapPanel>
<!-- 售后状态 -->
<WrapPanel>
<TextBlock
x:Name="txtOrderItemStatusStr"
HorizontalAlignment="Center"
VerticalAlignment="Top"
d:Text="物品售后状态"
Background="Transparent"
Foreground="{Binding ItemRefund.RefundStatusColor}"
Text="{Binding RefundStatusStr}"
Visibility="{Binding ElementName=txtOrderItemStatusStr, Path=Text, Converter={StaticResource HasTextVisibility}}" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="Transparent"
Foreground="{Binding ItemRefund.RefundStatusColor}"
Text=":"
Visibility="{Binding ElementName=txtOrderItemStatusStr, Path=Text, Converter={StaticResource HasTextVisibility}}" />
<TextBlock
x:Name="txtStatusStr"
HorizontalAlignment="Center"
VerticalAlignment="Top"
d:Text="售后状态"
Background="Transparent"
Foreground="{Binding ItemRefund.RefundStatusColor}"
Text="{Binding ItemRefund.RefundStatusStr}"
Visibility="{Binding ElementName=txtStatusStr, Path=Text, Converter={StaticResource HasTextVisibility}}" />
</WrapPanel>
<TextBlock
x:Name="txtStatusStr"
HorizontalAlignment="Center"
VerticalAlignment="Top"
d:Text="售后状态"
Background="Transparent"
Foreground="{Binding ItemRefund.RefundStatusColor}"
Text="{Binding ItemRefund.RefundStatusStr}"
Visibility="{Binding ElementName=txtStatusStr, Path=Text, Converter={StaticResource HasTextVisibility}}" />
<!-- 售后原因 -->
<TextBlock
x:Name="txtRefundReasonTextStr"
@@ -596,10 +567,15 @@
Orientation="Vertical"
VerticalSpacing="2">
<!-- 状态标签行 -->
<!-- 状态标签行(原 Row 1-2) -->
<WrapPanel
x:Name="wpTransitBuyerRefundStatus"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<WrapPanel
x:Name="wpTransitWaybillStatus"
Margin="0,0,0,2"
Margin="0,0,0,4"
HorizontalAlignment="Center">
<Border
x:Name="borderBuyStatas"
@@ -673,8 +649,7 @@
Title="采购账户:"
Cursor="Hand"
Foreground="#0099ff"
MouseLeftButtonUp="TransitOrderBuye_Click"
Visibility="{Binding ElementName=txtTransitOrderBuyerStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
MouseLeftButtonUp="TransitOrderBuye_Click">
<WrapPanel Orientation="Horizontal">
<uc:UcWaterMarkTextBox1
x:Name="txtTransitOrderBuyerStr"
@@ -720,11 +695,11 @@
Title="采购单号:"
Cursor="Hand"
Foreground="#0099ff"
Visibility="{Binding ElementName=txtTransitOrderNumStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
MouseLeftButtonUp="TransitOrderBuye_Click">
<WrapPanel Orientation="Horizontal">
<uc:UcWaterMarkTextBox1
x:Name="txtTransitOrderNumStr"
Margin="-2,0"
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
@@ -758,11 +733,10 @@
<wpf:TitleContent
x:Name="wpBuyTime"
Title="采购时间:"
Foreground="{Binding OutOrderTimeQualifiedBrush}"
Visibility="{Binding ElementName=txtOutOrderTimeQualifiedStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
Foreground="{Binding OutOrderTimeQualifiedBrush}">
<uc:UcWaterMarkTextBox1
x:Name="txtOutOrderTimeQualifiedStr"
Margin="-2,0"
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
@@ -780,7 +754,7 @@
Foreground="{StaticResource PageOkBrush}"
Visibility="{Binding TransitOrderWaybillToWareHouseStr, Converter={StaticResource HasTextVisibility}}">
<uc:UcWaterMarkTextBox1
Margin="-2,0"
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
@@ -809,51 +783,16 @@
<!-- 仓库物流 -->
<wpf:TitleContent Title="仓库物流:" Visibility="{Binding TransitOrderWaybillFromWareHouseStr, Converter={StaticResource HasTextVisibility}}">
<WrapPanel>
<uc:UcWaterMarkTextBox1
Margin="-2,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding TransitOrderWaybillFromWareHouseStr}"
TextWrapping="Wrap"
WaterMark="仓库物流" />
<Button
x:Name="btnGetTransitWaybillDetail"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="查看"
Click="btnGetTransitWaybillDetail_Click"
Content="{Binding LatestTransitEWaybill.StatusStr}"
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
<!-- 仓库物流 -->
<wpf:TitleContent Title="补发物流:" Visibility="{Binding TransitExtraPackageWaybillStr, Converter={StaticResource HasTextVisibility}}">
<WrapPanel>
<uc:UcWaterMarkTextBox1
Margin="-2,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding TransitExtraPackageWaybillStr}"
TextWrapping="Wrap"
WaterMark="补发物流" />
<Button
x:Name="btnVoidTransitExtraOrder"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="作废"
Click="btnVoidTransitExtraOrder_Click"
Content="{Binding TransitExtraPackageWaybillBtnStr}"
Style="{StaticResource LinkButton}"
Visibility="{Binding TransitExtraPackageWaybillBtnStr, Converter={StaticResource HasTextVisibility}}" />
</WrapPanel>
<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding TransitOrderWaybillFromWareHouseStr}"
TextWrapping="Wrap"
WaterMark="仓库物流" />
</wpf:TitleContent>
<!-- 外采买手 -->
@@ -933,23 +872,6 @@
</Border>
</WrapPanel>
</wpf:TitleContent>
<!-- 采购时间 -->
<wpf:TitleContent
x:Name="wpDirectBuyTime"
Title="外采时间:"
Visibility="{Binding ElementName=txtDirectOrderBuyTimeStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
<uc:UcWaterMarkTextBox1
x:Name="txtDirectOrderBuyTimeStr"
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding DirectOrderBuyTimeStr}"
TextWrapping="Wrap"
WaterMark="采购时间:" />
</wpf:TitleContent>
<!-- 外采物流 -->
<wpf:TitleContent Title="外采物流:" Visibility="{Binding ItemOrder.OutExpressNoStr, Converter={StaticResource HasTextVisibility}}">
@@ -957,7 +879,7 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
@@ -968,7 +890,7 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
@@ -979,108 +901,14 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
d:Text="外采物流单号"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
IsReadOnly="True"
Text="{Binding ItemOrder.OutExpressNoStr}"
TextWrapping="Wrap"
WaterMark="外采物流的那好" />
<Button
x:Name="btnGetDirectWaybillDetail"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="查看"
Click="btnGetDirectWaybillDetail_Click"
Content="{Binding LatestDirectEWaybill.StatusStr}"
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
<wpf:TitleContent Title="同步物流:" Visibility="{Binding ItemOrder.SyncWaybillIdInfo, Converter={StaticResource HasTextVisibility}}">
<WrapPanel Orientation="Horizontal">
<!--<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
IsReadOnly="True"
Text="{Binding ItemOrder.out_express_company}"
TextWrapping="Wrap"
WaterMark="外采物流" />-->
<!--<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
IsReadOnly="True"
Text="-"
TextWrapping="Wrap"
WaterMark="-" />-->
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
d:Text="物流单"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding ItemOrder.SyncWaybillIdInfo}"
TextWrapping="Wrap"
WaterMark="同步物流" />
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
d:Text="取件码"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding ItemOrder.SyncWaybillPickNo}"
TextWrapping="Wrap"
WaterMark="取件码" />
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
d:Text="报错信息"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding SyncLogisticsMsg}"
TextWrapping="Wrap"
WaterMark="同步单信息" />
<Button
x:Name="btnTrySendSyncOrder"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="发送"
Click="btnTrySendSyncOrder_Click"
Content="发送"
Style="{StaticResource LinkButton}"
Tag="{Binding ItemOrder.OutExpressNoStr}"
Visibility="{Binding ItemOrder.RealSyncWaybillId, Converter={StaticResource NotHasTextVisibility}}" />
<Button
x:Name="btnEditPickNo"
Padding="0,0,0,0"
d:Content="填取件码"
Click="btnEditPickNo_Click"
Content="填取件码"
Style="{StaticResource LinkButton}"
Tag="{Binding ItemOrder.OutExpressNoStr}"
Visibility="{Binding ItemOrder.RealSyncWaybillId, Converter={StaticResource HasTextVisibility}}" />
WaterMark="外采物流" />
</WrapPanel>
</wpf:TitleContent>
@@ -1131,12 +959,12 @@
<!-- 买家留言 -->
<wpf:TitleContent Title="买家留言:">
<uc:UcWaterMarkTextBox1
d:Text="留言留言"
Background="Transparent"
BorderThickness="1"
IsReadOnly="True"
Text=""
TextWrapping="Wrap" />
TextWrapping="Wrap"
WaterMark="买家留言" />
</wpf:TitleContent>
<!-- 店铺备注 -->
@@ -1151,7 +979,7 @@
IsReadOnly="True"
Text="{Binding ItemOrder.shop_remark}"
TextWrapping="Wrap"
Visibility="{Binding ItemOrder.shop_remark, Converter={StaticResource HasTextVisibility}}"
Visibility="Visible"
WaterMark="店铺备注" />
<Button
x:Name="btnEditShopRemark"
@@ -1180,7 +1008,6 @@
IsReadOnly="True"
Text="{Binding ItemOrder.soft_remark}"
TextWrapping="Wrap"
Visibility="{Binding ItemOrder.soft_remark, Converter={StaticResource HasTextVisibility}}"
WaterMark="软件备注" />
<Button
x:Name="btnEditAppRemark"
@@ -1209,7 +1036,6 @@
IsReadOnly="True"
Text="{Binding TransitWarehouseRejectSuccessTimeStr}"
TextWrapping="Wrap"
Visibility="{Binding TransitWarehouseRejectSuccessTimeStr, Converter={StaticResource HasTextVisibility}}"
WaterMark="中转仓拒收" />
<Button
x:Name="btnAddEditTransitWarehouseReject"
@@ -1221,7 +1047,7 @@
x:Name="btnPddRefundTransitWarehouseRejectOrder"
d:Visibility="Visible"
Click="btnPddRefundTransitWarehouseRejectOrder_Click"
Content="测试拒收"
Content="测试退货"
Style="{StaticResource LinkButton}"
Visibility="Collapsed" />
</WrapPanel>
@@ -1239,7 +1065,6 @@
IsReadOnly="True"
Text="{Binding TransitWarehouseAfterSaleWayBillStr}"
TextWrapping="Wrap"
Visibility="{Binding TransitWarehouseAfterSaleWayBillStr, Converter={StaticResource HasTextVisibility}}"
WaterMark="拦截退回总店" />
<Button
x:Name="btnAddEditTransitWarehouseAfterSale"
@@ -1247,19 +1072,6 @@
Click="btnAddEditTransitWarehouseAfterSale_Click"
Content="{Binding AddEditTransitWarehouseAfterSaleStr}"
Style="{StaticResource LinkButton}" />
<uc:UcWaterMarkTextBox1
x:Name="txtInterceptReturnInfoStr"
Margin="0,1,0,1"
VerticalAlignment="Top"
d:Text="拦截失败原因"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="1"
IsReadOnly="True"
Text="{Binding InterceptReturnInfoStr, Converter={StaticResource TextEllipsisConverter8}}"
TextWrapping="Wrap"
ToolTip="{Binding InterceptReturnInfoStr}"
Visibility="{Binding InterceptReturnInfoStr, Converter={StaticResource HasTextVisibility}}" />
</WrapPanel>
</wpf:TitleContent>
@@ -1275,15 +1087,13 @@
IsReadOnly="True"
Text="{Binding AddEditTransitWarehouseReturnOrderWaybillStr}"
TextWrapping="Wrap"
Visibility="{Binding AddEditTransitWarehouseReturnOrderWaybillStr, Converter={StaticResource HasTextVisibility}}"
WaterMark="云仓退货" />
<Button
x:Name="btnRetrunOrder"
d:Content="创建"
d:Content="添加"
Click="btnReturnOrder_Click"
Content="{Binding AddEditTransitWarehouseReturnOrderStr}"
Style="{StaticResource BasePageButtonLightStyle}" />
<!-- Style="{StaticResource LinkButton}" -->
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
@@ -1343,7 +1153,7 @@
Background="Transparent"
Cursor="Hand"
MouseLeftButtonDown="pathDirectBuyerAfterSaleAddress_MouseLeftButtonDown"
Visibility="{Binding ElementName=txtDirectBuyerRefundAddress, Path=Visibility}">
Visibility="{Binding ElementName=txtBuyerRefundAddress, Path=Visibility}">
<Path
Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z"
Fill="{StaticResource PageLinkBrush}"
@@ -1355,45 +1165,30 @@
</wpf:SpacingStackPanel>
<!-- 操作 -->
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
HorizontalSpacing="1"
ItemHorizontalAlignment="Right"
ItemVerticalAlignment="Center"
Orientation="Horizontal"
VerticalSpacing="6">
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Vertical"
VerticalSpacing="6">
<wpf:TitleContent>
Orientation="Vertical"
VerticalSpacing="5">
<!-- 操作按钮行(原 Row 1) -->
<wpf:TitleContent>
<WrapPanel HorizontalAlignment="Center">
<Button
x:Name="btnMapSkus"
Height="22"
Height="24"
MinWidth="38"
Margin="0,0,0,0"
Margin="4,4,0,4"
HorizontalAlignment="Center"
Click="btnMapSkus_Click"
Content="选择SKU"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding MapSkusBtnVisibility}" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnBuyOrder"
Height="22"
Height="24"
MinWidth="38"
Margin="0,0,0,0"
Margin="4,0,0,0"
HorizontalAlignment="Center"
d:Background="{StaticResource pageColorLightBrush}"
d:BorderBrush="{StaticResource pageColorBrush}"
@@ -1409,140 +1204,61 @@
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsWaitBuy, Converter={StaticResource visibleToVisibilityConverter}}" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnVoidTransitOrder"
Height="22"
Height="24"
MinWidth="38"
Margin="0,0,0,0"
Margin="4,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnVoidTransitOrder_Click"
Content="作废重拍"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="Collapsed" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnAbnormalOrderRebuy"
Height="22"
Height="24"
MinWidth="38"
Margin="0,0,0,0"
Margin="4,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnAbnormalOrderRebuy_Click"
Content="异常重拍"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="Collapsed" />
</wpf:TitleContent>
</WrapPanel>
</wpf:TitleContent>
<!-- 直发拍单 -->
<wpf:TitleContent>
<Button
x:Name="btnDirectBuyOrder"
Height="22"
MinWidth="38"
Margin="0,0,0,0"
HorizontalAlignment="Center"
Click="btnDirectBuyOrder_Click"
Content="直发拍单"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding BtnDirectBuyOrderVisibility}" />
</wpf:TitleContent>
<!-- 礼品发货 -->
<wpf:TitleContent>
<Button
x:Name="btnShipGift"
Height="22"
MinWidth="38"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btn_ShipGiftCommand"
Content="礼品发货"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsWaitSend, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Vertical"
VerticalSpacing="3">
<!-- 直发拍单 -->
<wpf:TitleContent>
<Button
x:Name="btnChangeWaybill"
x:Name="btnDirectBuyOrder"
Height="24"
MinWidth="38"
MinHeight="20"
Margin="0,0,0,0"
Padding="0"
Margin="4,0,0,0"
HorizontalAlignment="Center"
Click="btnDirectBuyOrder_Click"
Content="直发拍单"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding BtnDirectBuyOrderVisibility}" />
</wpf:TitleContent>
<!-- 礼品发货 -->
<wpf:TitleContent>
<Button
x:Name="btnShipGift"
Height="24"
MinWidth="38"
Margin="4,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnChangeWaybill_Click"
Content="补发/修改物流"
FontSize="11"
Click="btn_ShipGiftCommand"
Content="礼品发货"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsShowChangeWaybillBtn, Converter={StaticResource VisibleToVisibilityConverter}}" />
<Button
x:Name="btnAddEditTransitWarehouseReject_New"
MinWidth="38"
MinHeight="20"
Margin="0,0,0,0"
Padding="0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnAddEditTransitWarehouseReject_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
云仓拒收<LineBreak />
退回总店</TextBlock>
</Button>
<Button
x:Name="btnAddEditTransitWarehouseAfterSale_n1"
MinWidth="38"
MinHeight="20"
Margin="0,0,0,0"
Padding="0"
Click="btnAddEditTransitWarehouseAfterSale_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
拒收失败<LineBreak />
转寄总店</TextBlock>
</Button>
<Button
x:Name="btnAddEditTransitWarehouseAfterSale_n2"
MinWidth="38"
MinHeight="20"
Margin="0,0,0,0"
Padding="0"
Click="btnAddEditTransitWarehouseAfterSale_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
出库拦截<LineBreak />
退回仓库</TextBlock>
</Button>
<Button
x:Name="btnTransitExtraPackages"
Height="20"
MinWidth="38"
Margin="0,0,0,0"
Padding="0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnTransitExtraPackages_Click"
Content="滞留补发买家"
FontSize="11"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsShowTransitExtraPackagesBtn, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:SpacingStackPanel>
Visibility="{Binding ItemOrder.IsWaitSend, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
</Grid>
File diff suppressed because it is too large. Load diff
@@ -1,87 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.PDDInvoice.PDDInvoiceDialog"
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.PDDInvoice"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
Width="400"
Height="250"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:PDDInvoiceDialog}"
mc:Ignorable="d">
<UserControl.Resources>
<Style BasedOn="{StaticResource TitleContentBaseStyle}" TargetType="wpf:TitleContent">
<Setter Property="Placement" Value="Left" />
<Setter Property="Height" Value="28" />
<Setter Property="TitleVerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="TitleHorizontalAlignment" Value="Right" />
<Setter Property="TitleWidth" Value="50" />
<Style.Resources>
<Style TargetType="TextBox">
<Setter Property="Height" Value="28" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</Style.Resources>
</Style>
</UserControl.Resources>
<Border
Margin="10"
Padding="5"
BorderBrush="Gray"
BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<wpf:SpacingStackPanel
Grid.Row="0"
Orientation="Vertical"
VerticalSpacing="10">
<wpf:TitleContent Title="公司:">
<TextBox d:Text="嵩县雷神商贸有限责任公司" Text="{Binding Config.Title}" />
</wpf:TitleContent>
<wpf:TitleContent Title="税号:">
<TextBox d:Text="91410325MADQERT68E" Text="{Binding Config.TaxNo}" />
</wpf:TitleContent>
<wpf:TitleContent Title="最大金额:">
<wpf:NumberBox
Width="80"
HorizontalAlignment="Left"
Maximum="999999"
Minimum="0"
Value="{Binding Config.MaxAmount}" />
</wpf:TitleContent>
<wpf:TitleContent Title="数据保存:">
<CheckBox IsChecked="{Binding Config.IsSaveData}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
<Border
Grid.Row="1"
Margin="-5"
Padding="0,5"
BorderBrush="Gray"
BorderThickness="0,1,0,0">
<wpf:SpacingStackPanel HorizontalAlignment="Center" HorizontalSpacing="30">
<Button
Padding="10,5"
Command="{Binding ConfirmCommand}"
Content="确定"
Style="{StaticResource BasePageButtonStyle}" />
<Button
Padding="10,5"
Command="{Binding CancelCommand}"
Content="取消"
Style="{StaticResource BasePageButtonLightStyle}" />
</wpf:SpacingStackPanel>
</Border>
</Grid>
</Border>
</UserControl>
@@ -1,64 +0,0 @@
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPFCommon.Models;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace _29WxOrderWpf.Ctrls.PDDInvoice;
/// <summary>
/// PDDInvoiceDialog.xaml 的交互逻辑
/// </summary>
public partial class PDDInvoiceDialog : UserControl
{
public PDDInvoiceDialog()
{
InitializeComponent();
DataContext = this;
Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig<InvoiceConfig>(ConfigPath);
}
private void PDDInvoiceDialog_Loaded(object sender, RoutedEventArgs e)
{
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
}
private const string ConfigPath = "./invoice.config";
public InvoiceConfig Config { get; }
public ICommand ConfirmCommand => new DelegateCommand(Confirm);
private void Confirm()
{
NaiBa.Util.Helper.ConfigHelper.SaveConfig(ConfigPath, Config);
ViewModel_RequestClose();
}
public ICommand CancelCommand => new DelegateCommand(Cancel);
private void Cancel()
{
ViewModel_RequestClose();
}
}
+95 -106
View File
@@ -16,15 +16,15 @@
d:DataContext="{d:DesignInstance Type=vm:PDDInvoiceViewModel,
IsDesignTimeCreatable=True}"
d:DesignHeight="720"
d:DesignWidth="1960"
d:DesignWidth="1260"
Background="White"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
<converters:ImageUrlToBitmapImageConverter x:Key="ImageUrlToBitmapImageConverter" />
<converters:ImageUrlToBitmapImageConverter x:Key="ImageUrlToBitmapImage" />
<converters:InverseVisibleToVisibilityConverter x:Key="InverseBooleanToVisibility" />
<converters:ImageLoadRequestConverter x:Key="ImageLoadRequestConverter" />
<!-- 原型配色 -->
<SolidColorBrush x:Key="PageBgBrush" Color="#F5F6F8" />
<SolidColorBrush x:Key="CardBgBrush" Color="#FFFFFF" />
@@ -50,7 +50,7 @@
<!-- 搜索 / 表单输入框 -->
<Style x:Key="SearchTextBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="30" />
<Setter Property="Height" Value="36" />
<Setter Property="Padding" Value="12,0" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="13" />
@@ -81,9 +81,76 @@
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource BasePageButtonStyle}" TargetType="Button">
<Setter Property="Height" Value="30" />
<!-- 主按钮 -->
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
<Setter Property="Height" Value="36" />
<Setter Property="Padding" Value="18,0" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="{StaticResource PrimaryBrush}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="{StaticResource PrimaryHoverBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Opacity" Value="0.8" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 默认按钮 -->
<Style x:Key="DefaultButtonStyle" TargetType="Button">
<Setter Property="Height" Value="36" />
<Setter Property="Padding" Value="18,0" />
<Setter Property="Foreground" Value="{StaticResource TextNormalBrush}" />
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#F5F7FA" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Opacity" Value="0.8" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 文字链接按钮 -->
<Style x:Key="LinkButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
@@ -129,7 +196,7 @@
<Border Padding="10,10,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
@@ -138,9 +205,10 @@
<Border Grid.Row="0">
<wpf:SpacingStackPanel Background="{StaticResource CardBgBrush}" HorizontalSpacing="10">
<Grid Width="200">
<Grid Width="300">
<TextBox
x:Name="txtSearch"
Height="30"
Padding="5,0,0,0"
KeyDown="txtSearch_KeyDown"
Style="{StaticResource SearchTextBoxStyle}"
@@ -154,56 +222,17 @@
Text="请输入订单号 / 商品名称"
Visibility="{Binding Text, ElementName=txtSearch, Converter={StaticResource NotHasTextVisibility}}" />
</Grid>
<wpf:TitleContent
Title="发票状态"
Placement="Left"
TitleVerticalAlignment="Center">
<ComboBox
Width="100"
Height="30"
d:SelectedIndex="0"
SelectedIndex="{Binding InvoiceStatus}"
Style="{StaticResource RoundedComboBox}">
<ComboBoxItem Content="全部" />
<ComboBoxItem Content="待开票" />
<ComboBoxItem Content="已申请" />
</ComboBox>
</wpf:TitleContent>
<wpf:TitleContent
Title="时间范围:"
HorizontalContentAlignment="Center"
Placement="Left"
TitleVerticalAlignment="Center">
<WrapPanel>
<DatePicker
Height="30"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
d:SelectedDate="2026/01/01"
SelectedDate="{Binding StartTime}" />
<Border
Width="5"
Height="1"
BorderBrush="LightGray"
BorderThickness="1" />
<DatePicker
Height="30"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
d:SelectedDate="2026/01/01"
SelectedDate="{Binding EndTime}" />
</WrapPanel>
</wpf:TitleContent>
<Button
Width="50"
Height="30"
Command="{Binding SearchCommand}"
Content="搜索" />
Content="搜索"
Style="{StaticResource BasePageButtonStyle}" />
<Button
Height="30"
Command="{Binding ResetCommand}"
Content="重置"
Style="{StaticResource LinkButtonStyle}" />
Style="{StaticResource DefaultButtonStyle}" />
<wpf:TitleContent
Title="买手号:"
@@ -218,9 +247,11 @@
Style="{StaticResource RoundedComboBox}" />
</wpf:TitleContent>
<Button
Height="30"
Padding="5,0"
Command="{Binding ReadOrderCommand}"
Content="读取订单"
Style="{StaticResource BasePageButtonStyle}"
Visibility="{Binding IsReadOrder, Converter={StaticResource Boolean2VisibilityReConverter}}" />
<Button
Height="30"
@@ -230,22 +261,13 @@
Style="{StaticResource BasePageButtonStyle}"
Visibility="{Binding IsReadOrder, Converter={StaticResource Boolean2VisibilityConverter}}" />
<Button
Height="30"
Padding="10,0"
Command="{Binding BatchInvoiceCommand}"
Content="批量开票"
Visibility="{Binding IsBatchInvoicing, Converter={StaticResource Boolean2VisibilityReConverter}}" />
<Button
Padding="10,0"
Command="{Binding StopBatchInvoiceCommand}"
Content="停止开票"
Visibility="{Binding IsBatchInvoicing, Converter={StaticResource Boolean2VisibilityConverter}}" />
<Button
Padding="10,0"
Command="{Binding ShowSettingDialogCommand}"
Content="设置"
Style="{StaticResource BasePageButtonLightStyle}" />
Style="{StaticResource BasePageButtonStyle}" />
<!--<wpf:TitleContent
<wpf:TitleContent
Title="公司:"
Placement="Left"
TitleVerticalAlignment="Center">
@@ -277,12 +299,11 @@
Maximum="999999"
Minimum="0"
Value="{Binding MaxAmount}" />
</wpf:TitleContent>-->
</wpf:TitleContent>
<CheckBox
VerticalContentAlignment="Center"
Content="显示订单窗口"
IsChecked="{Binding IsOrderListDialogOpen}" />
</wpf:SpacingStackPanel>
</Border>
<!-- 订单列表(已移除分页与订单分组) -->
@@ -382,18 +403,15 @@
<Border Background="White">
<!-- 列表(虚拟化滚动加载) -->
<ItemsControl
x:Name="itemsControl"
Margin="0,2,0,-2"
Padding="0"
HorizontalContentAlignment="Stretch"
ItemsSource="{Binding OrdersView}">
ItemsSource="{Binding Orders}">
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer
x:Name="PART_ScrollViewer"
CanContentScroll="True"
HorizontalScrollBarVisibility="Disabled"
ScrollChanged="ScrollViewer_ScrollChanged"
VerticalScrollBarVisibility="Auto">
<ItemsPresenter />
</ScrollViewer>
@@ -461,7 +479,8 @@
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected}" />
IsChecked="{Binding IsSelected}"
IsEnabled="{Binding IsSelected}" />
<!-- 商品 -->
<Grid Grid.Column="1" VerticalAlignment="Center">
@@ -474,27 +493,7 @@
Height="72"
Background="#EEEEEE"
CornerRadius="5">
<Image Stretch="UniformToFill">
<converters:AsyncImageLoader.Request>
<MultiBinding Converter="{StaticResource ImageLoadRequestConverter}">
<Binding Path="ThumbUrl" />
<Binding Path="DataContext.IsLoadImage" RelativeSource="{RelativeSource AncestorType=UserControl}" />
</MultiBinding>
</converters:AsyncImageLoader.Request>
</Image>
<!--<Image
converters:AsyncImageLoader.IsLoadImage="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.IsLoadImage}"
converters:AsyncImageLoader.SourceUrl="{Binding ThumbUrl}"
Stretch="UniformToFill">
-->
<!--<Image.Source>
<MultiBinding Converter="{StaticResource ImageUrlToBitmapImageConverter}" Mode="OneWay">
<Binding IsAsync="True" Path="ThumbUrl" />
<Binding Path="DataContext.IsLoadImage" RelativeSource="{RelativeSource AncestorType=UserControl}" />
</MultiBinding>
</Image.Source>-->
<!--
</Image>-->
<Image Source="{Binding ThumbUrl, Converter={StaticResource ImageUrlToBitmapImage}, IsAsync=True}" Stretch="UniformToFill" />
</Border>
<StackPanel
Grid.Column="1"
@@ -654,12 +653,13 @@
Value="{Binding ProgressValue}" />
<Grid Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="100*" />
</Grid.ColumnDefinitions>
<TextBox
Grid.Column="0"
Grid.Row="2"
Grid.Column="1"
Margin="4,0,0,0"
VerticalAlignment="Center"
d:Text="共计:{}"
@@ -668,17 +668,6 @@
Foreground="White"
IsReadOnly="True"
Text="{Binding BottomMsg}" />
<TextBox
Grid.Column="1"
Margin="4,0,0,0"
VerticalAlignment="Center"
HorizontalContentAlignment="Right"
d:Text="共计:{}"
Background="Transparent"
BorderThickness="0"
Foreground="White"
IsReadOnly="True"
Text="{Binding BottomRMsg}" />
</Grid>
</Grid>
@@ -13,7 +13,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace _29WxOrderWpf.Ctrls.PDDInvoice;
@@ -22,17 +21,10 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice;
/// </summary>
public partial class PDDInvoiceView : UserControl
{
private PDDInvoiceViewModel vm = new PDDInvoiceViewModel();
public PDDInvoiceView()
{
InitializeComponent();
DataContext = vm;
vm.BatchInvoiceChanged += Vm_BatchInvoiceChanged;
}
private void Vm_BatchInvoiceChanged(object sender, int e)
{
ScrollToCurrent(e);
DataContext = new PDDInvoiceViewModel();
}
private void txtSearch_KeyDown(object sender, KeyEventArgs e)
@@ -42,62 +34,4 @@ public partial class PDDInvoiceView : UserControl
viewModel.SearchCommand.Execute(null);
}
}
private DispatcherTimer _scrollStopTimer;
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
// 每次滚动都重置计时器
if (_scrollStopTimer == null)
{
_scrollStopTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(100) // 200ms 内无滚动视为停止
};
_scrollStopTimer.Tick += ScrollStopTimer_Tick;
}
_scrollStopTimer.Stop();
_scrollStopTimer.Start();
(DataContext as PDDInvoiceViewModel).IsLoadImage = false;
}
private void ScrollStopTimer_Tick(object sender, EventArgs e)
{
_scrollStopTimer.Stop();
System.Diagnostics.Debug.WriteLine("滚动停止了");
// 用 Background 优先级设置,避免和当前这一帧的滚动惯性/渲染争抢,
// 让 UI 线程先把滚动动画收尾,再去处理这一波图片加载触发
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
{
vm.IsLoadImage = true;
}));
}
private void ScrollToCurrent(int index)
{
if (itemsControl == null) return;
// 方案A:逻辑滚动(你的 CanContentScroll=True,推荐)
var sv = itemsControl.Template.FindName("PART_ScrollViewer", itemsControl) as ScrollViewer;
if (sv != null)
{
if (index >= 0)
{
sv.ScrollToVerticalOffset(index - 1);
return;
}
}
// 方案B:兜底,用容器 BringIntoView
itemsControl.UpdateLayout();
var container = itemsControl.ItemContainerGenerator
.ContainerFromItem(vm.SelectedOrder) as FrameworkElement;
container?.BringIntoView();
}
}
@@ -97,7 +97,7 @@ async function fillInvoiceAndApply(data = {}) {
console.log('✅ 已经申请过,无需重复操作');
return true;
}
const successElement = findElement('//*[text()="确认发票信息无误后再提交"]');
const successElement = findElement('//*[text()="确认您的发票信息无误后再提交"]');
if (successElement == null) {
return false;
}
@@ -1,5 +1,4 @@
using AllBase.Model.Result;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,6 +22,7 @@ public class PddBrowserOrderInvoiceViewModel : BindableBaseEx
get => _isSelected;
set => SetProperty(ref _isSelected, value, nameof(IsSelected));
}
public string buyerId { get; set; } // 买手Id
public string buyerName { get; set; } // 买手名称
/// <summary>
@@ -41,6 +41,7 @@ public class PddBrowserOrderInvoiceViewModel : BindableBaseEx
/// 订单号
/// </summary>
public string order_sn { get; set; }
public int status { get; set; }
public int pay_status { get; set; }
public string order_status_prompt { get; set; }
@@ -50,10 +51,11 @@ public class PddBrowserOrderInvoiceViewModel : BindableBaseEx
public string order_link_url { get; set; }
public List<order_good> order_Goods { get; set; }
public List<OrderButtonItem> order_buttons { get; set; }
private string _goodsName;
public string GoodsName { get => _goodsName ?? order_Goods?.FirstOrDefault()?.goods_name ?? ""; set => _goodsName = value; }
public string GoodsName { get => order_Goods?.FirstOrDefault()?.goods_name ?? ""; }
/// <summary>
/// 是否已开票
/// </summary>
@@ -76,27 +78,8 @@ public class PddBrowserOrderInvoiceViewModel : BindableBaseEx
{
get => DateTimeHelper.ConvertFromUnixTimestampInSeconds(order_time);
}
private string _thumburl;
public string ThumbUrl
{
get { return _thumburl ?? order_Goods?.FirstOrDefault()?.thumb_url ?? ""; }
set { _thumburl = value; }
}
public string ThumbUrl => order_Goods?.FirstOrDefault()?.thumb_url ?? "";
public string DisplayAmount => (order_amount / 100.0).ToString("F2");
public PddBrowserOrderInvoiceViewModel()
{
}
public PddBrowserOrderInvoiceViewModel(OrderInvoiceInfo info)
{
_goodsName = info.GoodsName;
order_amount = info.order_amount;
order_time = info.order_time;
order_sn = info.order_sn;
order_link_url = info.order_link_url;
IsInvoiced = info.IsInvoiced;
_thumburl = info.ThumbUrl;
}
}
public class OrderButtonItem
@@ -108,31 +91,4 @@ public class OrderButtonItem
public class ButtonTypeValue
{
public string Url { get; set; }
}
public class OrderInvoiceInfo
{
/// <summary>
/// 订单价
/// </summary>
public int order_amount { get; set; }
/// <summary>
/// 下单时间
/// </summary>
public long order_time { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string order_sn { get; set; }
/// <summary>
/// 订单详情
/// </summary>
public string order_link_url { get; set; }
/// <summary>
/// 是否已开票
/// </summary>
public bool IsInvoiced { get; set; }
public string ThumbUrl { get; set; }
public string GoodsName { get; set; }
}
@@ -23,14 +23,14 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
public partial class PDDInvoiceViewModel
{
/// <summary>
/// 订单列表浏览器
/// 订单列表浏览器
/// </summary>
public ChromiumWebBrowser Browser { get; private set; }
/// <summary>
/// 内容浏览器
/// 订单详情
/// 发票详情
/// 申请发票
/// 内容浏览器
/// 订单详情
/// 发票详情
/// 申请发票
/// </summary>
public ChromiumWebBrowser BrowserDetail { get; private set; }
@@ -89,7 +89,7 @@ public partial class PDDInvoiceViewModel
}
else
{
// 页面异常(未渲染出发票表单)时直接判定失败,避免批量开票长时间等待
// 页面异常(未渲染出发票表单)时直接判定失败,避免批量开票长时间等待
_currentInvoiceTcs?.TrySetResult(false);
}
}
@@ -98,23 +98,23 @@ public partial class PDDInvoiceViewModel
}
/// <summary>
/// 注入发票填写脚本并执行。
/// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的
/// <c>window.__invoiceApplyResult</c>,完成后通过 <see cref="_currentInvoiceTcs"/> 回传结果。
/// 注入发票填写脚本并执行。
/// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的
/// <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);
content = content.Replace("{公司}", InvoiceTitle);
content = content.Replace("{税号}", TaxNo);
if (string.IsNullOrEmpty(content)) return;
await b.EvaluateScriptAsync(content);
if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行为
if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行为
// 批量模式:等待异步脚本执行完成
// 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果
// 批量模式:等待异步脚本执行完成
// 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果
var tcs = _currentInvoiceTcs;
for (int i = 0; i < 120; i++)
{
@@ -148,7 +148,7 @@ public partial class PDDInvoiceViewModel
set => SetValue(value);
}
/// <summary>
/// 显示主浏览器
/// 显示主浏览器
/// </summary>
public void ShowOrderBrowser()
{
@@ -156,7 +156,7 @@ public partial class PDDInvoiceViewModel
BrowserDetailZIndex = -1;
}
/// <summary>
/// 显示子浏览器
/// 显示子浏览器
/// </summary>
public void ShowOrderBrowserDetail()
{
@@ -200,16 +200,18 @@ public partial class PDDInvoiceViewModel
public void StartAutoScroll()
{
if (IsReadOrder) return;
IsReadOrder = true;
_ = autoScroll(_cancellationTokenSource.Token);
}
// 停止滚动
// 停止滚动
public void StopAutoScroll()
{
IsReadOrder = false;
_cancellationTokenSource?.Cancel();
_cancellationTokenSource?.Dispose();
_cancellationTokenSource = null;
}
private async Task autoScroll(CancellationToken token)
@@ -222,7 +224,7 @@ public partial class PDDInvoiceViewModel
var jsStr = @"window.scroll({
top: " + top + @",
left: 0,
behavior: 'smooth' // 可选,使滚动平滑
behavior: 'smooth' // 可选,使滚动平滑
});";
var client = Browser.GetDevToolsClient();
@@ -2,7 +2,6 @@ using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.Ctrls.Statistics;
using AllBase;
using AllBase.Helper;
using AllBase.Model.DBModel;
@@ -14,7 +13,6 @@ using CefSharp.Wpf;
using MAX.Core.Helpers;
using NaiBa.Util.Extension;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -29,13 +27,10 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using Work._29Tools.CefTools;
using Work.BaseForms;
using WPFCommon.Converters;
using WPFCommon.Helpers;
using WPFCommon.Models;
using WxOrder.Framework.Helpers;
@@ -46,8 +41,7 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
/// </summary>
public partial class PDDInvoiceViewModel : BindableBaseEx
{
private const string ConfigPath = "./invoice.config";
private List<OrderInvoiceInfo> OrderInvoiceInfoList = new();
private readonly ObservableCollection<PddBrowserOrderInvoiceViewModel> _allOrders = new();
private readonly HashSet<string> _orderSns = new();
private string _searchText = "";
private PddBrowserOrderInvoiceViewModel _selectedOrder;
@@ -55,55 +49,26 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
private bool _isInvoiceDetailOpen;
private string _invoiceTitle = "";
private string _taxNo = "";
private CancellationTokenSource _cancellationTokenSource;
private InvoiceConfig Config { get; set; }
/// <summary> 订单列表 </summary>
public ObservableCollection<PddBrowserOrderInvoiceViewModel> Orders { get; }
public ICollectionView OrdersView { get; }
public PDDInvoiceViewModel()
private CancellationTokenSource _cancellationTokenSource; public PDDInvoiceViewModel()
{
_cancellationTokenSource = new CancellationTokenSource();
Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig<InvoiceConfig>(ConfigPath);
Orders = new ObservableCollection<PddBrowserOrderInvoiceViewModel>();
Orders.CollectionChanged += Orders_CollectionChanged;
OrdersView = CollectionViewSource.GetDefaultView(Orders);
OrdersView.Filter = FilterPredicate;
OrdersView.SortDescriptions.Add(
new SortDescription(nameof(PddBrowserOrderInvoiceViewModel.order_time), ListSortDirection.Ascending));
BuyerLoginList = GlobalConfig.PDDBuyerLoginList;
//Orders = new ObservableCollection<PDDInvoiceOrderModel>(_allOrders);
InitBrowser();
if (Config == null) Config = new InvoiceConfig();
EndTime = DateTime.Now;
StartTime = EndTime.AddMonths(-1);
if (EnvironmentHelper.IsTest)
{
Config.Title = "嵩县雷神商贸有限责任公司";
Config.TaxNo = "91410325MADQERT68E";
Config.MaxAmount = 99;
InvoiceTitle = "嵩县雷神商贸有限责任公司";
TaxNo = "91410325MADQERT68E";
MaxAmount = 99;
_ = InitSampleData();
}
}
private bool FilterPredicate(object obj)
{
if (obj is not PddBrowserOrderInvoiceViewModel order) return false;
// 发票状态过滤
bool? temp = InvoiceStatus == 0 ? null : InvoiceStatus == 2;
if (temp.HasValue && order.IsInvoiced != temp.Value)
return false;
// 关键字过滤
var keyword = SearchText?.Trim();
if (!IsKeywordMatch(order, keyword))
return false;
if (order.OrderTime < StartTime || EndTime < order.OrderTime) return false;
return true;
}
partial void InitBrowser();
/// <summary> 列表增删时订阅/退订订单勾选状态,用于刷新表头全选状态 </summary>
@@ -140,13 +105,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
public ObservableCollectionThreadSafe<BuyerLoginInfo> BuyerLoginList { get; set; } = new ObservableCollectionThreadSafe<BuyerLoginInfo>();
private void InvoiceStatusChanged()
{
}
public BuyerLoginInfo SelectedBuyer
{
get => GetProperty(() => SelectedBuyer);
@@ -157,8 +115,11 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
{
WPFCEFBrowser.SetCookieAsync(SelectedBuyer.cookie, Browser.GetCookieManager()).GetAwaiter();
WPFCEFBrowser.SetCookieAsync(SelectedBuyer.cookie, BrowserDetail.GetCookieManager()).GetAwaiter();
}
/// <summary> 订单列表 </summary>
public ObservableCollection<PddBrowserOrderInvoiceViewModel> Orders { get; }
/// <summary> 搜索关键字:订单号 / 商品名称 / 买家 </summary>
public string SearchText
@@ -166,21 +127,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
get => _searchText;
set => SetProperty(ref _searchText, value, nameof(SearchText));
}
public int InvoiceStatus
{
get => GetValue<int>();
set => SetValue(value, InvoiceStatusChanged);
}
public DateTime StartTime
{
get => GetValue<DateTime>();
set => SetValue(value);
}
public DateTime EndTime
{
get => GetValue<DateTime>();
set => SetValue(value);
}
/// <summary> 开票弹窗是否打开 </summary>
public bool IsOrderListDialogOpen
@@ -214,19 +160,19 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
set => SetProperty(ref _selectedOrder, value, nameof(SelectedOrder));
}
///// <summary> 发票抬头 </summary>
//public string InvoiceTitle
//{
// get => _invoiceTitle;
// set => SetProperty(ref _invoiceTitle, value, nameof(InvoiceTitle));
//}
/// <summary> 发票抬头 </summary>
public string InvoiceTitle
{
get => _invoiceTitle;
set => SetProperty(ref _invoiceTitle, value, nameof(InvoiceTitle));
}
///// <summary> 税号 </summary>
//public string TaxNo
//{
// get => _taxNo;
// set => SetProperty(ref _taxNo, value, nameof(TaxNo));
//}
/// <summary> 税号 </summary>
public string TaxNo
{
get => _taxNo;
set => SetProperty(ref _taxNo, value, nameof(TaxNo));
}
/// <summary>
/// 开始开票总金额
/// </summary>
@@ -235,14 +181,14 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
get => GetValue<decimal>();
set => SetValue(value);
}
///// <summary>
///// 最大开票金额
///// </summary>
//public decimal MaxAmount
//{
// get => GetValue<decimal>();
// set => SetValue(value);
//}
/// <summary>
/// 最大开票金额
/// </summary>
public decimal MaxAmount
{
get => GetValue<decimal>();
set => SetValue(value);
}
/// <summary>
/// 已开票金额
/// </summary>
@@ -259,16 +205,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
get => GetValue<decimal>();
set => SetValue(value);
}
public bool IsLoadImage
{
get => GetValue<bool>();
set => SetValue(value);
}
public ICommand SearchCommand => new DelegateCommand(Search);
public ICommand ResetCommand => new DelegateCommand(ResetSearch);
@@ -290,6 +226,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
BaseMsgWindow.ShowError("未填选择买手号");
return;
}
_cancellationTokenSource = new CancellationTokenSource();
Debug.WriteLine("开始读单");
BottomMsg = $"开始读取订单";
StartProgress();
@@ -298,34 +235,12 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
if (!IsReadOrder)
{
_orderSns.Clear();
_allOrders.Clear();
Orders.Clear();
OrderInvoiceInfoList.Clear();
string path = string.Format(inviceDataPath, SelectedBuyer.buyer_id);
if (File.Exists(NaiBa.Util.Helper.ConfigHelper.GetConfigUserPath(path)))
{
var ret = BaseMsgWindow.ShowConfirm("检测到已有历史数据是否加载?").DialogResult;
if (ret == true)
{
var data = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<OrderInvoiceInfo>>(path);
AddOrders(data.Select(a => new PddBrowserOrderInvoiceViewModel(a)));
BottomMsg = $"已加载历史数据";
return;
}
else if (ret == null)
{
return;
}
}
Browser.Load("https://mobile.yangkeduo.com/orders.html");
await Task.Delay(Timeout.Infinite, _cancellationTokenSource.Token);
}
await Task.Delay(Timeout.Infinite, _cancellationTokenSource.Token);
}
catch (TaskCanceledException)
@@ -434,57 +349,31 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
{
if (IsBatchInvoicing) return;
if (string.IsNullOrEmpty(Config.Title) || string.IsNullOrEmpty(Config.TaxNo))
if (string.IsNullOrEmpty(InvoiceTitle) || string.IsNullOrEmpty(TaxNo))
{
BaseMsgWindow.ShowError("未填写公司或税号");
return;
}
var targets = OrdersView.Cast<PddBrowserOrderInvoiceViewModel>().Where(o => o.IsSelected && !o.IsInvoiced).ToList();
var targets = Orders.Where(o => o.IsSelected && !o.IsInvoiced).ToList();
if (targets.Count == 0)
{
BaseMsgWindow.ShowError("请先勾选需要开票的订单");
return;
}
if (Config.MaxAmount <= 0)
if (MaxAmount <= 0)
{
BaseMsgWindow.ShowError("请填写开票总金额");
return;
}
var confirm = BaseMsgWindow.ShowConfirm(
$"已勾选 {targets.Count} 个待开票订单,确定开始批量开票吗?\n请确认发票抬头与税号无误。\n开票总金额:{Config.MaxAmount}",
$"已勾选 {targets.Count} 个待开票订单,确定开始批量开票吗?\n请确认发票抬头与税号无误。\n开票总金额:{MaxAmount}",
"批量开票");
if (confirm.DialogResult != true) return;
//Config.Title = InvoiceTitle;
//Config.TaxNo = TaxNo;
//Config.MaxAmount = MaxAmount;
//NaiBa.Util.Helper.ConfigHelper.SaveConfig(ConfigPath, Config);
await BatchInvoiceAsync(targets);
}
public ICommand StopBatchInvoiceCommand => new AsyncDelegateCommand(StopBatchInvoice);
private async Task StopBatchInvoice()
{
IsBatchInvoicing = false;
}
public ICommand ShowSettingDialogCommand => new DelegateCommand(ShowSettingDialog);
private void ShowSettingDialog()
{
var view = new PDDInvoiceDialog();
new DialogWindow
{
Title = "设置",
Content = view,
}.ShowDialog();
Config = view.Config;
}
public event EventHandler<int> BatchInvoiceChanged;
/// <summary>
/// 后台批量开票:逐单加载开票页并自动填写提交,底部进度条实时更新,成功后更新列表状态
/// </summary>
@@ -501,21 +390,13 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
for (int i = 0; i < targets.Count; i++)
{
if (IsBatchInvoicing == false)
{
BottomMsg = "已取消批量开票";
return;
}
if (AmountTotal >= Config.MaxAmount)
if (AmountTotal >= MaxAmount)
{
return;
}
var order = targets[i];
BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}";
ProgressValue = i;
SelectedOrder = order;
BatchInvoiceChanged?.Invoke(this, OrdersView.Cast<PddBrowserOrderInvoiceViewModel>().ToList().IndexOf(order));
bool ok = false;
if (EnvironmentHelper.IsTest)
{
@@ -544,7 +425,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
}
ProgressValue = success + fail;
BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}。总金额:{AmountTotal.ToString("N2")}";
BottomRMsg = $"批量开票状态:成功 {success} 个,失败 {fail} 个。总金额:{AmountTotal.ToString("N2")}";
StatisticsInvoiceAmount();
await Task.Delay(1000);
}
@@ -559,6 +439,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
_currentInvoiceTcs = null;
ProgressMaximum = targets.Count;
ProgressValue = targets.Count;
BottomMsg = $"批量开票完成:成功 {success} 个,失败 {fail} 个。总金额:{AmountTotal.ToString("N2")}";
IsBatchInvoicing = false;
BaseMsgWindow.ShowInfo(BottomMsg);
}
@@ -568,8 +449,8 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
/// </summary>
private void StatisticsInvoiceAmount()
{
InvoicedAmountTotal = OrdersView.Cast<PddBrowserOrderInvoiceViewModel>().Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m;
UninvoicedAmountTotal = OrdersView.Cast<PddBrowserOrderInvoiceViewModel>().Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m;
InvoicedAmountTotal = Orders.Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m;
UninvoicedAmountTotal = Orders.Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m;
}
#endregion
@@ -577,22 +458,12 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
/// <summary> 按 订单号 / 商品名称 过滤订单 </summary>
private void Search()
{
OrdersView.Refresh();
StatisticsInvoiceAmount();
//var keyword = SearchText?.Trim();
//bool? _tempIsInvoiced = InvoiceStatus == 0 ? null : InvoiceStatus == 2;
//foreach (var order in Orders)
//{
// if (_tempIsInvoiced.HasValue)
// {
// if (order.IsInvoiced != _tempIsInvoiced.Value) continue;
// }
// if (!IsKeywordMatch(order, keyword))
// {
// continue;
// }
// Orders.Add(order);
//}
var keyword = SearchText?.Trim();
Orders.Clear();
foreach (var order in _allOrders.Where(o => IsKeywordMatch(o, keyword)))
{
Orders.Add(order);
}
}
private static bool IsKeywordMatch(PddBrowserOrderInvoiceViewModel order, string keyword)
@@ -605,9 +476,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
private void ResetSearch()
{
SearchText = "";
InvoiceStatus = 0;
EndTime = DateTime.Now;
StartTime = EndTime.AddMonths(-1);
Search();
}
/// <summary>
@@ -617,7 +485,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
private void OpenInvoice(PddBrowserOrderInvoiceViewModel order)
{
SelectedOrder = order;
if (string.IsNullOrEmpty(Config.Title) || string.IsNullOrEmpty(Config.TaxNo))
if (string.IsNullOrEmpty(InvoiceTitle) || string.IsNullOrEmpty(TaxNo))
{
BaseMsgWindow.ShowError("未填写公司或税号");
return;
@@ -695,30 +563,15 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
{
continue;
}
if (item.IsInvoiced == false)
_allOrders.Add(item);
if (IsKeywordMatch(item, keyword))
{
item.IsInvoiced = item.order_buttons?.Any(a => a.brief_prompt == "发票详情") ?? false;
}
Orders.Add(item);
if (Config.IsSaveData)
{
OrderInvoiceInfoList.Add(new OrderInvoiceInfo
{
GoodsName = item.GoodsName,
order_amount = item.order_amount,
order_time = item.order_time,
order_sn = item.order_sn,
order_link_url = item.order_link_url,
IsInvoiced = item.IsInvoiced,
ThumbUrl = item.ThumbUrl
});
Orders.Add(item);
}
}
StatisticsInvoiceAmount();
SaveOrderInvoiceInfo();
}
#endregion
@@ -755,33 +608,10 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
}
}
Orders.FirstOrDefault().IsInvoiced = true;
return Task.CompletedTask;
}
private const string inviceDataPath = "inviceData_{0}";
/// <summary>
/// 保存数据
/// </summary>
private void SaveOrderInvoiceInfo()
{
if (SelectedBuyer == null) return;
string path = string.Format(inviceDataPath, SelectedBuyer.buyer_id);
NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<OrderInvoiceInfo>>(path, OrderInvoiceInfoList);
}
private void GetOrderInvoiceInfo()
{
if (SelectedBuyer == null) return;
string path = string.Format(inviceDataPath, SelectedBuyer.buyer_id);
if (File.Exists(NaiBa.Util.Helper.ConfigHelper.GetConfigUserPath(path)))
{
if (BaseMsgWindow.ShowConfirm("检测到已有旧数据是否加载?").DialogResult == true)
{
var data = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<OrderInvoiceInfo>>(path);
AddOrders(data.Select(a => new PddBrowserOrderInvoiceViewModel(a)));
}
}
}
@@ -794,13 +624,6 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
set => SetValue(ref _bottomMsg, value);
}
private string _bottomRMsg = "";
public string BottomRMsg
{
get => _bottomRMsg;
set => SetValue(ref _bottomRMsg, value);
}
private double _progressValue;
public double ProgressValue
{
@@ -891,10 +714,3 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
#endregion
}
public class InvoiceConfig
{
public string Title { get; set; }
public string TaxNo { get; set; }
public decimal MaxAmount { get; set; }
public bool IsSaveData { get; set; }
}
@@ -1,252 +0,0 @@
<Window
x:Class="_29WxOrderWpf.Ctrls.Settings.SettingsView"
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.Settings"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="[vm ]clr-namespace:_29WxOrderWpf.ViewModels"
xmlns:wpf="WPFCommon"
Title="设置"
Width="800"
Height="450"
d:DataContext="{d:DesignInstance Type=vm:SettingViewModel}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"
WindowState="Normal"
mc:Ignorable="d">
<Border BorderBrush="#e8eaed" BorderThickness="1">
<TabControl
ItemContainerStyle="{StaticResource SideTabItem}"
Style="{StaticResource SideTabControl}"
TabStripPlacement="Left">
<TabItem Header="发货">
<StackPanel>
<Border Style="{StaticResource SettingRow}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Style="{StaticResource SettingTitle}" Text="礼品单发送" />
<TextBlock Style="{StaticResource SettingDesc}" Text="超出6元自动改为礼品二(实物)" />
</StackPanel>
<CheckBox
Grid.Column="1"
VerticalAlignment="Center"
IsChecked="{Binding AutoSwitchGiftType}"
Style="{StaticResource ToggleSwitch}" />
</Grid>
</Border>
</StackPanel>
</TabItem>
<!-- ========== 外观 ========== -->
<!--
<TabItem Header="外观" Tag="🎨">
<StackPanel
MaxWidth="720"
Margin="40,32,40,32"
HorizontalAlignment="Left">
<TextBlock Style="{StaticResource PageTitle}" Text="外观" />
<TextBlock Style="{StaticResource PageSubtitle}" Text="自定义界面的主题、颜色和字体。" />
<Border Style="{StaticResource SettingsCard}">
<StackPanel>
<Border Style="{StaticResource SettingRow}">
<StackPanel>
<TextBlock Style="{StaticResource SettingTitle}" Text="主题" />
<TextBlock Style="{StaticResource SettingDesc}" Text="选择浅色、深色或跟随系统" />
<StackPanel Margin="0,12,0,0" Orientation="Horizontal">
<RadioButton
Margin="0,0,20,0"
Content="浅色"
IsChecked="True" />
<RadioButton Margin="0,0,20,0" Content="深色" />
<RadioButton Content="跟随系统" />
</StackPanel>
</StackPanel>
</Border>
<Border BorderThickness="0" Style="{StaticResource SettingRow}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Style="{StaticResource SettingTitle}" Text="强调色" />
<TextBlock Style="{StaticResource SettingDesc}" Text="用于按钮、选中项等强调元素" />
</StackPanel>
<StackPanel
Grid.Column="1"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border
Width="24"
Height="24"
Margin="0,0,8,0"
Background="#0078D4"
CornerRadius="12" />
<Border
Width="24"
Height="24"
Margin="0,0,8,0"
Background="#6E4AFF"
CornerRadius="12" />
<Border
Width="24"
Height="24"
Background="#E73C3C"
CornerRadius="12" />
</StackPanel>
</Grid>
</Border>
</StackPanel>
</Border>
</StackPanel>
</TabItem>
-->
<!-- ========== 账户 ========== -->
<!--
<TabItem Header="账户" Tag="👤">
<StackPanel
MaxWidth="720"
Margin="40,32,40,32"
HorizontalAlignment="Left">
<TextBlock Style="{StaticResource PageTitle}" Text="账户" />
<TextBlock Style="{StaticResource PageSubtitle}" Text="管理你的账号、头像和登录方式。" />
<Border Padding="20" Style="{StaticResource SettingsCard}">
<StackPanel Orientation="Horizontal">
<Border
Width="64"
Height="64"
Background="#0078D4"
CornerRadius="32">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="28"
Foreground="White"
Text="A" />
</Border>
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
<TextBlock
FontSize="16"
FontWeight="SemiBold"
Foreground="#1F2329"
Text="Alex" />
<TextBlock
Margin="0,2,0,0"
FontSize="13"
Foreground="#8A9099"
Text="alex@example.com" />
</StackPanel>
<Button
Margin="20,0,0,0"
Padding="16,6"
VerticalAlignment="Center"
Content="编辑资料" />
</StackPanel>
</Border>
</StackPanel>
</TabItem>
-->
<!-- ========== 隐私 ========== -->
<!--
<TabItem Header="隐私" Tag="🔒">
<StackPanel
MaxWidth="720"
Margin="40,32,40,32"
HorizontalAlignment="Left">
<TextBlock Style="{StaticResource PageTitle}" Text="隐私" />
<TextBlock Style="{StaticResource PageSubtitle}" Text="控制应用如何使用你的数据。" />
<Border Style="{StaticResource SettingsCard}">
<StackPanel>
<Border Style="{StaticResource SettingRow}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Style="{StaticResource SettingTitle}" Text="发送匿名使用数据" />
<TextBlock Style="{StaticResource SettingDesc}" Text="帮助改进产品,不含个人身份信息" />
</StackPanel>
<CheckBox
Grid.Column="1"
VerticalAlignment="Center"
IsChecked="True"
Style="{StaticResource ToggleSwitch}" />
</Grid>
</Border>
<Border BorderThickness="0" Style="{StaticResource SettingRow}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Style="{StaticResource SettingTitle}" Text="个性化推荐" />
<TextBlock Style="{StaticResource SettingDesc}" Text="根据使用习惯推荐内容" />
</StackPanel>
<CheckBox
Grid.Column="1"
VerticalAlignment="Center"
Style="{StaticResource ToggleSwitch}" />
</Grid>
</Border>
</StackPanel>
</Border>
</StackPanel>
</TabItem>
-->
<!-- ========== 关于 ========== -->
<!--
<TabItem Header="关于" Tag="{StaticResource txt-table_stack_above}">
<StackPanel
MaxWidth="720"
Margin="40,32,40,32"
HorizontalAlignment="Left">
<TextBlock Style="{StaticResource PageTitle}" Text="关于" />
<TextBlock Style="{StaticResource PageSubtitle}" Text="版本与许可信息。" />
<Border Padding="20" Style="{StaticResource SettingsCard}">
<StackPanel>
<TextBlock
FontSize="18"
FontWeight="SemiBold"
Foreground="#1F2329"
Text="MyApp" />
<TextBlock
Margin="0,4,0,0"
FontSize="13"
Foreground="#8A9099"
Text="版本 1.0.0 (Build 20261005)" />
<TextBlock
Margin="0,16,0,0"
FontSize="12"
Foreground="#8A9099"
Text="© 2026 My Company. All rights reserved." />
<StackPanel Margin="0,16,0,0" Orientation="Horizontal">
<Button
Margin="0,0,8,0"
Padding="16,6"
Content="检查更新" />
<Button Padding="16,6" Content="查看许可" />
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</TabItem>-->
</TabControl>
</Border>
</Window>
@@ -1,55 +0,0 @@
using _29WxOrderWpf.ViewModels;
using AllBase;
using AllBase.Model.Config;
using Newtonsoft.Json;
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.Shapes;
using Work.BaseForms;
namespace _29WxOrderWpf.Ctrls.Settings;
/// <summary>
/// SettingsView.xaml 的交互逻辑
/// </summary>
public partial class SettingsView : Window
{
private SettingViewModel vm;
public SettingsView()
{
InitializeComponent();
vm = new SettingViewModel();
this.DataContext = vm;
this.Loaded += SettingsView_Loaded;
this.Closed += SettingsView_Closed;
}
private void SettingsView_Loaded(object sender, RoutedEventArgs e)
{
vm.Assign(BaseClass.Setting);
}
private void SettingsView_Closed(object sender, EventArgs e)
{
try
{
var setting = vm.ToConfig();
BaseClass.Setting = setting;
NaiBa.Util.Helper.ConfigHelper.SaveConfig(SettingViewModel.SettingFileName, JsonConvert.SerializeObject(setting));
}
catch (Exception ex)
{
BaseMsgForm.ShowError("配置保存错误");
}
}
}
@@ -1,224 +1,156 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using WPFCommon.Models;
namespace _29WxOrderWpf.Ctrls.Statistics.Models
{
/// <summary>
/// 店铺营收统计 - 查询参数。
/// 对应新接口 shop_revenue_statistics/get_shop_order_amount 与
/// shop_revenue_statistics/get_shop_stats_details 的请求体(StartDate / EndDate / ShopIds)。
/// 店铺营收统计 - 查询参数
/// </summary>
public class ShopRevenueStatisticsQuery
{
/// <summary>开始日期</summary>
/// <summary>开始时间</summary>
public DateTime StartDate { get; set; }
/// <summary>结束日期</summary>
/// <summary>结束时间</summary>
public DateTime EndDate { get; set; }
/// <summary>
/// 选中的店铺 ERP 店铺ID(ShopLoginInfo.ErpShopId)列表;
/// 空/Null 表示全部店铺(服务层会取全部店铺的 ErpShopId)。
/// </summary>
public List<string> ShopIds { get; set; }
/// <summary>选中的店铺 app_key 列表;空/Null 表示全部店铺</summary>
public List<string> ShopKeys { get; set; }
}
/// <summary>
/// 店铺统计记录(接口返回)。
/// 接口返回结构:
/// shop_revenue_statistics/GetShopStats -> Result&lt;Dictionary&lt;string, List&lt;ShopStatsResponse&gt;&gt;&gt;
/// Key = 店铺ID,Value = 该店铺按 <see cref="ShopStatsGroupType"/> 聚合后的记录列表
/// (汇总=1 条;天/周/月=每个自然日/自然周/自然月各 1 条)。
/// 注意:接口只返回按 GroupType 聚合后的记录,不返回“整段汇总”,
/// 页面上的汇总卡片由客户端对返回记录自行合计(GroupType=Summary 时每店铺一条,直接相加即可)。
/// 金额字段单位均为“分”,显示时需除以 100 转为元。
/// 店铺营收统计 - 接口返回的原始明细行。
/// 与后端 WXOrderAmountInfo 保持一致(camelCase JSON):
/// shopName, createTime, orderId, status, productPrice, orderPrice, purchasePrice, freight,
/// predictCommissionFee, commissionAmount, discountedPrice, profit, purchaseStatus,
/// outAmount, refundStatus, refundStatusString, refundAmount, externalProcurement
/// 金额字段单位均为分(显示时需除以 100)。
/// </summary>
public class ShopStatsResponse
public class ShopRevenueStatisticsRow
{
/// <summary>
/// 店铺ID
/// </summary>
public string ShopId { get; set; }
/// <summary>
/// 销售订单创建日期
/// </summary>
public DateTime StatDate { get; set; }
/// <summary>
/// 订单数(有效订单,不含退款订单)
/// </summary>
public int OrderCount { get; set; }
/// <summary>
/// 销售总额(分)
/// </summary>
public long SalesAmount { get; set; }
/// <summary>
/// 利润(分)
/// </summary>
public long ProfitAmount { get; set; }
/// <summary>
/// 平台佣金(分)
/// </summary>
public long PlatformFee { get; set; }
/// <summary>
/// 退款订单数
/// </summary>
public int RefundOrderCount { get; set; }
/// <summary>
/// 已成功退款金额(分,店铺端已退款成功)
/// </summary>
public long RefundDone { get; set; }
/// <summary>
/// 退款处理中金额(分,店铺端退款中)
/// </summary>
public long RefundPending { get; set; }
/// <summary>
/// 采购单数
/// </summary>
public int PurchaseCount { get; set; }
/// <summary>
/// 总花费金额(分,买手号采购付款金额)
/// </summary>
public long TotalPurchase { get; set; }
/// <summary>
/// 售后中买手总金额(分)
/// </summary>
public long TotalRefund => DoneRefund + PendingRefund + RejectedRefund;
/// <summary>
/// 已成功退款金额(分,买手号采购退款成功)
/// </summary>
public long DoneRefund { get; set; }
/// <summary>
/// 未退回金额(分)
/// </summary>
public long PendingRefund { get; set; }
/// <summary>
/// 被拒绝金额(分)
/// </summary>
public long RejectedRefund { get; set; }
}
/// <summary>
/// 销售趋势记录(接口返回):跨店铺合计后的按天趋势,供综合统计页的销售趋势折线图使用。
/// 接口返回结构:
/// shop_revenue_statistics/GetShopStatsTrend
/// -> Result&lt;List&lt;ShopStatsTrendResponse&gt;&gt;
/// 请求参数:StartDate / EndDate / ShopIds(不需要 GroupType,固定按天返回)。
/// 金额字段单位为“分”,显示时需除以 100 转为元。
/// </summary>
public class ShopStatsTrendResponse
{
/// <summary>
/// 统计日期(天)
/// </summary>
public DateTime StatDate { get; set; }
/// <summary>
/// 销售额(分)
/// </summary>
public long SalesAmount { get; set; }
/// <summary>
/// 订单数
/// </summary>
public int OrderCount { get; set; }
}
/// <summary>
/// 订单明细(接口返回):订单列表弹窗 ShowOrderDialogView 的数据行。
/// 接口返回结构:
/// shop_revenue_statistics/GetShopOrderDetails
/// -> Result&lt;List&lt;ShopOrderDetailResponse&gt;&gt;
/// 请求参数:StartDate / EndDate / ShopIds / OrderType(见 <see cref="ShopOrderDetailType"/>)。
/// 金额字段单位均为“分”,显示时需除以 100 转为元。
/// </summary>
public class ShopOrderDetailResponse
{
/// <summary>
/// 店铺ID
/// </summary>
public long ShopId { get; set; }
/// <summary>
/// 店铺名称
/// </summary>
[JsonProperty("shop_name")]
public string ShopName { get; set; }
/// <summary>
/// 商铺订单号
/// 下单时间(秒级时间戳)
/// </summary>
[JsonProperty("create_time")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime CreateTime { get; set; }
/// <summary>
/// 订单号
/// </summary>
[JsonProperty("order_id")]
public string OrderId { get; set; }
/// <summary>
/// 订单创建时间
/// 订单状态
/// </summary>
public DateTime CreateTime { get; set; }
[JsonProperty("status")]
public int Status { get; set; }
/// <summary>
/// 商品总价(分)
/// </summary>
[JsonProperty("product_price")]
public int ProductPrice { get; set; }
/// <summary>
/// 订单金额(分)
/// </summary>
[JsonProperty("order_price")]
public int OrderPrice { get; set; }
/// <summary>
/// 订单退款金额(分),即商铺订单商品明细的退款金额之和;有效订单为 0
/// 采购价(分)
/// </summary>
public int OrderRefundAmount { get; set; }
[JsonProperty("purchase_price")]
public int PurchasePrice { get; set; }
/// <summary>
/// 外采金额(分),即该订单下所有买手订单的购买金额之和
/// 运费(分)
/// </summary>
[JsonProperty("freight")]
public int Freight { get; set; }
/// <summary>
/// 平台服务费(预计技术服务费,分)
/// </summary>
[JsonProperty("predict_commission_fee")]
public int PredictCommissionFee { get; set; }
/// <summary>
/// 达人佣金(分)
/// </summary>
[JsonProperty("commission_amount")]
public int CommissionAmount { get; set; }
/// <summary>
/// 优惠金额(分)
/// </summary>
[JsonProperty("discounted_price")]
public int DiscountedPrice { get; set; }
/// <summary>
/// 利润(分)
/// </summary>
[JsonProperty("profit")]
public int Profit { get; set; }
/// <summary>
/// 采购状态
/// </summary>
[JsonProperty("purchase_status")]
public int PurchaseStatus { get; set; }
/// <summary>
/// 外采金额(分),out_amount为空或0时从中转仓订单表补全
/// </summary>
[JsonProperty("out_amount")]
public int OutAmount { get; set; }
/// <summary>
/// 买手未退回金额(分),即买手订单中退款未成功的退款金额之和;无售后时为 0
/// 售后状态(订单明细 refund_status)
/// </summary>
public int UnrefundedAmount { get; set; }
[JsonProperty("refund_status")]
public int RefundStatus { get; set; }
/// <summary>
/// 买手订单信息(一个订单号对应多个买手订单)
/// 售后状态(退款单 status)
/// </summary>
public List<BuyerOrderInfo> BuyerOrders { get; set; } = new List<BuyerOrderInfo>();
}
/// <summary>
/// 买手订单信息(订单明细下的子项,一个商铺订单可对应多个买手订单)
/// </summary>
public class BuyerOrderInfo
{
/// <summary>
/// 外部订单(买手订单)号
/// </summary>
public string OutOrderSn { get; set; }
[JsonProperty("refund_status_string")]
public string RefundStatusString { get; set; }
/// <summary>
/// 金额(分)
/// </summary>
public int OutAmount { get; set; }
/// <summary>
/// 退款金额(分)
/// 售后退款金额(分)
/// </summary>
[JsonProperty("refund_amount")]
public int RefundAmount { get; set; }
/// <summary>
/// 退款状态
/// 是否外采:0=未从中转仓订单表查到,1=查到
/// </summary>
public string RefundStatusText { get; set; }
[JsonProperty("external_procurement")]
public int ExternalProcurement { get; set; }
/// <summary>
/// 买手退款金额
/// </summary>
[JsonProperty("buyer_refund_amount")]
public int BuyerRefundAmount { get; set; }
/// <summary>
/// 买手退款状态
/// </summary>
[JsonProperty("buyer_refund_status")]
public string BuyerRefundStatus { get; set; }
}
/// <summary>
@@ -234,7 +166,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>利润(实际利润)</summary>
public decimal Profit { get; set; }
/// <summary>退款金额(统计期间店铺端退款:已成功 + 处理中)</summary>
/// <summary>退款金额(统计期间退款)</summary>
public decimal RefundAmount { get; set; }
/// <summary>退款订单数</summary>
@@ -243,10 +175,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>平台服务费总额(元)</summary>
public decimal PlatformFeeTotal { get; set; }
/// <summary>
/// 达人佣金(元)。
/// 新接口未提供该字段,固定为 0,保留属性与页面展示,待后端补充字段后直接接上。
/// </summary>
/// <summary>达人佣金(元)</summary>
public decimal Commission { get; set; }
/// <summary>客单价(平均每单金额)</summary>
@@ -309,7 +238,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>店铺名称</summary>
public string ShopName { get; set; }
/// <summary>订单数(有效订单,不含退款订单)</summary>
/// <summary>订单数</summary>
public int OrderCount { get; set; }
/// <summary>销售额(元)</summary>
@@ -325,7 +254,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>平台服务费总额(元)</summary>
public decimal PlatformFeeTotal { get; set; }
/// <summary>达人佣金(元)。新接口未提供该字段,固定为 0。</summary>
/// <summary>达人佣金(元)</summary>
public decimal Commission { get; set; }
/// <summary>客单价(元)</summary>
@@ -350,51 +279,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
Month = 2
}
/// <summary>
/// 接口聚合方式(请求参数 GroupType,按数字传值)。
/// 每种方式都返回 Dictionary&lt;店铺ID, List&lt;ShopStatsResponse&gt;&gt;:
/// 汇总时每个店铺 1 条,天/周/月时每个店铺每个周期 1 条。
/// </summary>
public enum ShopStatsGroupType
{
/// <summary>
/// 汇总:每个商铺只返回一条(整个查询范围合计)
/// </summary>
Summary = 0,
/// <summary>
/// 天:按自然日聚合,每个商铺每天一条
/// </summary>
Day = 1,
/// <summary>
/// 周:按自然周聚合(周一为一周开始),每个商铺每周一条
/// </summary>
Week = 2,
/// <summary>
/// 月:按自然月聚合,每个商铺每月一条
/// </summary>
Month = 3
}
/// <summary>
/// 订单明细类型(订单列表弹窗的入口类型,对应接口参数 OrderType,按数字传值)。
/// 数值与后端枚举保持一致:有效订单=1、退款订单=2、买手未退回金额的订单=3
/// (后端枚举里的“全部订单 All=0”本页不使用,故不定义)。
/// </summary>
public enum ShopOrderDetailType
{
/// <summary>有效订单:没有发生售后的订单(对应统计里的订单数 / 销售额 / 利润口径)</summary>
Valid = 1,
/// <summary>退款订单:发生过售后的订单(对应统计里的退款订单数口径)</summary>
Refund = 2,
/// <summary>买手未退回金额的订单:退款订单中买手款项还没退回的(对应统计里的未退回金额口径)</summary>
BuyerUnrefunded = 3
}
/// <summary>
/// 天/周/月周期统计表格行(金额单位:元)。
/// 按所选店铺(或全部店铺)统计:天统计每天一行;周统计每周一行;月统计每月一行。
@@ -407,7 +291,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>周期显示文本(天:yyyy-MM-dd;周:yyyy-MM-dd ~ yyyy-MM-dd;月:yyyy-MM)</summary>
public string Period { get; set; }
/// <summary>订单数(有效订单,不含退款订单)</summary>
/// <summary>订单数</summary>
public int OrderCount { get; set; }
/// <summary>销售额(元)</summary>
@@ -424,7 +308,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
/// <summary>平台服务费总额(元)</summary>
public decimal PlatformFeeTotal { get; set; }
/// <summary>达人佣金(元)。新接口未提供该字段,固定为 0。</summary>
/// <summary>达人佣金(元)</summary>
public decimal Commission { get; set; }
/// <summary>平均利润率(利润 / 采购金额,百分数,如 12.34 表示 12.34%)</summary>
@@ -437,51 +321,14 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
public decimal AvgOrderAmount { get; set; }
}
/// <summary>
/// 店铺营收统计 - 一次查询的全部聚合结果(综合统计页使用)。
/// 由两次请求组成:
/// shop_revenue_statistics/GetShopStats(GroupType=Summary)-> 卡片/店铺统计表/销售占比(每店铺一条,与区间长度无关)
/// shop_revenue_statistics/GetShopStatsTrend -> 销售趋势(跨店铺合计的按天序列)
/// </summary>
public class ShopRevenueStatisticsResult
{
/// <summary>汇总卡片数据</summary>
public ShopRevenueSummary Summary { get; set; }
/// <summary>销售趋势(按天,缺失日期补 0)</summary>
public List<RevenueTrendPoint> Trend { get; set; }
/// <summary>店铺销售占比(饼图)</summary>
public List<ShopSalesProportionItem> ShopProportions { get; set; }
/// <summary>店铺统计表格</summary>
public List<ShopStatisticsItem> ShopStatistics { get; set; }
}
/// <summary>
/// 店铺营收统计 - 天/周/月周期统计查询结果(周期统计页使用)。
/// 接口不返回整段汇总,Summary 由返回的周期数据在客户端合计得出。
/// </summary>
public class ShopPeriodStatisticsResult
{
/// <summary>汇总卡片数据(整个查询时间段,客户端合计)</summary>
public ShopRevenueSummary Summary { get; set; }
/// <summary>周期统计表格(天/周/月各一行)</summary>
public List<ShopPeriodStatisticsItem> Items { get; set; }
}
/// <summary>
/// 店铺下拉选项
/// </summary>
public class ShopOption
{
/// <summary>店铺ID(ShopLoginInfo.ShopId)</summary>
/// <summary>店铺 app_key(A.app_key)</summary>
public string AppKey { get; set; }
public string ShopId { get; set; }
/// <summary>ERP 店铺ID(ShopLoginInfo.ErpShopId),统计接口的 ShopIds 使用该字段</summary>
public string ErpShopId { get; set; }
/// <summary>店铺名称</summary>
public string ShopName { get; set; }
}
@@ -498,4 +345,55 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models
public string Value { get; set; }
}
class UnixDateTimeConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(DateTime);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
// 读取数值(支持 long 和 int 类型)
if (reader.TokenType == JsonToken.Integer)
{
long milliseconds = (long)reader.Value;
// Unix 纪元:1970-01-01 UTC
//DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime epoch = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
if (milliseconds.ToString().Length == 13)
{
return epoch.AddMilliseconds(milliseconds);
}
return epoch.AddSeconds(milliseconds);
}
// 如果传入的是字符串(如 "1700000000000"),也支持
else if (reader.TokenType == JsonToken.String)
{
if (long.TryParse((string)reader.Value, out long milliseconds))
{
//DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime epoch = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
if (milliseconds.ToString().Length == 13)
{
return epoch.AddMilliseconds(milliseconds);
}
return epoch.AddSeconds(milliseconds);
}
}
throw new JsonSerializationException($"无法将 {reader.Value} 转换为 DateTime");
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
// 序列化时转回时间戳
//DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime epoch = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long milliseconds = (long)((DateTime)value - epoch).TotalMilliseconds;
writer.WriteValue(milliseconds);
}
}
}
@@ -13,6 +13,5 @@ namespace _29WxOrderWpf.Ctrls.Statistics
{
InitializeComponent();
}
}
}
@@ -1,10 +1,14 @@
using _29WxOrderWpf.Ctrls.Statistics.Models;
using _29WxOrderWpf.Ctrls.Statistics.Models;
using AllBase;
using AllBase.Helper;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Work;
using WxOrder.Framework.Commons;
@@ -13,99 +17,127 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
{
/// <summary>
/// 店铺营收统计 - 数据服务调用接口。
/// 页面只依赖此接口,接入其他数据源时新建实现类,
/// 并通过 ViewModel 构造函数注入即可,无需改动页面。
/// 页面只依赖此接口,接入真实数据源时新建实现类(如对接 HTTP 接口 / SQL 查询),
/// 并通过 ShopRevenueStatisticsViewModel 构造函数注入即可,无需改动页面。
/// </summary>
public interface IShopRevenueStatisticsService
{
/// <summary>
/// 综合统计查询:返回汇总卡片、销售趋势(按天)、店铺销售占比、店铺统计表格。
/// 用 GroupType=Day 一次请求取回按店铺按天的记录,再由客户端汇总,无缓存。
/// 查询原始统计明细(接口返回的 A.* / B.* / c.* 原始字段)。
/// 真实实现通常通过 SQL / HTTP 一次性返回这些行,再由聚合器计算。
/// </summary>
Task<ShopRevenueStatisticsResult> QueryAsync(ShopRevenueStatisticsQuery query);
Task<List<ShopRevenueStatisticsRow>> QueryRowsAsync(ShopRevenueStatisticsQuery query);
/// <summary>
/// 天/周/月周期统计查询:返回汇总卡片 + 按周期(天/周/月)聚合的表格数据。
/// 接口不返回整段汇总,Summary 由返回的周期记录在客户端合计。
/// </summary>
Task<ShopPeriodStatisticsResult> QueryPeriodStatisticsAsync(ShopRevenueStatisticsQuery query, PeriodStatisticType periodType);
/// <summary>获取顶部汇总卡片数据</summary>
Task<ShopRevenueSummary> GetSummaryAsync(ShopRevenueStatisticsQuery query);
/// <summary>获取销售趋势(按天)</summary>
Task<List<RevenueTrendPoint>> GetSalesTrendAsync(ShopRevenueStatisticsQuery query);
/// <summary>获取店铺销售占比(饼图)</summary>
Task<List<ShopSalesProportionItem>> GetShopSalesProportionAsync(ShopRevenueStatisticsQuery query);
/// <summary>获取店铺统计表格</summary>
Task<List<ShopStatisticsItem>> GetShopStatisticsAsync(ShopRevenueStatisticsQuery query);
/// <summary>获取天/周/月周期统计表格(每天/每周/每月各一行,按所选店铺或全部店铺统计)</summary>
Task<List<ShopPeriodStatisticsItem>> GetPeriodStatisticsAsync(ShopRevenueStatisticsQuery query, PeriodStatisticType periodType);
/// <summary>获取店铺下拉列表(用于查询条件)</summary>
Task<List<ShopOption>> GetShopOptionsAsync();
/// <summary>
/// 订单明细列表(有效订单 / 退款订单 / 买手未退回金额的订单),供订单列表弹窗使用。
/// </summary>
Task<List<ShopOrderDetailResponse>> QueryOrderRowsAsync(ShopRevenueStatisticsQuery query, ShopOrderDetailType detailType);
}
/// <summary>
/// 统计聚合器:把接口返回的 <see cref="ShopStatsResponse"/> 聚合成页面所需的汇总/趋势/占比/表格数据。
/// 数据来源:shop_revenue_statistics/GetShopStats(GroupType = Day/Week/Month),
/// 接口只返回“按周期聚合的记录”,页面上所有汇总口径都在这里由客户端合计。
/// 口径说明(依据接口字段含义):
/// - OrderCount 为“有效订单数”,已不含退款订单;因此退款率分母 = OrderCount + RefundOrderCount。
/// - 店铺端退款:RefundDone(已成功)+ RefundPending(处理中)→ 退款金额。
/// - 买手端(采购)退款:TotalRefund = DoneRefund + PendingRefund + RejectedRefund → 售后采购金额;
/// DoneRefund → 已退回采购金额;剩余(待退回)= TotalRefund - DoneRefund。
/// - 接口无“达人佣金”字段,Commission 固定为 0(保留属性与页面展示,待后端补字段)。
/// 统计聚合器:把接口返回的原始明细行聚合成页面所需的汇总/趋势/占比/表格数据。
/// 聚合口径说明(依据接口字段描述):
/// - 订单状态 status:10-待付款;20-待发货;21-部分发货;30-待收货;100-完成;
/// 200-全部商品售后之后订单取消;250-未付款用户主动取消或超时未付款订单自动取消。
/// - 有效订单:已付款(20/21/30/100)且未退款;10/250 未付款不计入销售额。
/// - 已退款:c.refund_status 为 4/11,或订单状态为 200(全部商品售后后取消)。
/// - 金额字段单位均为“分”,除以 100 转为元。
/// </summary>
public static class ShopStatsAggregator
public static class RevenueStatisticsAggregator
{
/// <summary>金额换算:分 → 元</summary>
private const decimal FenPerYuan = 100m;
/// <summary>订单状态 - 待付款</summary>
public const int StatusPendingPay = 10;
/// <summary>分转元</summary>
public static decimal ToYuan(long fen)
/// <summary>订单状态 - 待发货</summary>
public const int StatusWaitSend = 20;
/// <summary>订单状态 - 部分发货</summary>
public const int StatusPartSend = 21;
/// <summary>订单状态 - 待收货</summary>
public const int StatusWaitReceive = 30;
/// <summary>订单状态 - 完成</summary>
public const int StatusFinished = 100;
/// <summary>订单状态 - 全部商品售后之后订单取消</summary>
public const int StatusCancelAfterAfterSale = 200;
/// <summary>订单状态 - 未付款用户主动取消/超时未付款自动取消</summary>
public const int StatusCancelNotPay = 250;
/// <summary>是否已付款的订单(20/21/30/100;10 待付款、250 未付款取消不计入)</summary>
public static bool IsPaidOrder(ShopRevenueStatisticsRow row)
{
return fen / FenPerYuan;
if (row == null) return false;
return row.Status == StatusWaitSend
|| row.Status == StatusPartSend
|| row.Status == StatusWaitReceive
|| row.Status == StatusFinished;
}
private static List<ShopStatsResponse> ToList(IEnumerable<ShopStatsResponse> stats)
/// <summary>是否已退款(c.refund_status 为 4/11,或订单状态为 200 全部商品售后后取消)</summary>
public static bool IsRefunded(ShopRevenueStatisticsRow row)
{
return (stats ?? Enumerable.Empty<ShopStatsResponse>())
.Where(a => a != null)
.ToList();
if (row == null) return false;
return row.RefundStatus > 1 || row.RefundStatusString == "MERCHANT_REFUND_SUCCESS" || row.RefundStatusString == "MERCHANT_RETURN_SUCCESS";
}
private static IEnumerable<IGrouping<string, ShopStatsResponse>> GroupByShop(IEnumerable<ShopStatsResponse> stats)
/// <summary>是否有效订单(已付款且未退款)</summary>
public static bool IsValidOrder(ShopRevenueStatisticsRow row)
{
return ToList(stats).GroupBy(a => a.ShopId ?? string.Empty);
return !IsRefunded(row);
}
/// <summary>店铺显示名:优先按 ERP 店铺ID匹配,其次按平台店铺ID匹配,都匹配不到时退回店铺ID</summary>
public static string ResolveShopName(string shopId)
/// <summary>买手号退款成功</summary>
public static bool IsBuyerRefundSuccessful(ShopRevenueStatisticsRow row)
{
if (string.IsNullOrEmpty(shopId))
return "未知店铺";
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(a => a.ErpShopId == shopId)
?? GlobalConfig.ShopLoginList.FirstOrDefault(a => a.ShopId == shopId);
if (shop == null || string.IsNullOrEmpty(shop.ShopAccount))
return shopId;
return shop.ShopAccount;
return row.BuyerRefundStatus == "退款成功";
}
/// <summary>汇总卡片(整个查询时间段,所有选中店铺合计)</summary>
public static ShopRevenueSummary GetSummary(IEnumerable<ShopStatsResponse> stats)
private static List<ShopRevenueStatisticsRow> GetPaymentOrderList(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = ToList(stats);
return (rows ?? new List<ShopRevenueStatisticsRow>()).Where(a => a.OutAmount > 0).ToList(); //买手付钱后的订单数量
}
/// <summary>汇总卡片</summary>
public static ShopRevenueSummary GetSummary(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = GetPaymentOrderList(rows); //买手付钱后的订单数量
var valid = list.Where(IsValidOrder).ToList();
var refunded = list.Where(IsRefunded).ToList();
decimal salesAmount = ToYuan(list.Sum(a => a.SalesAmount));
decimal profit = ToYuan(list.Sum(a => a.ProfitAmount));
decimal platformFeeTotal = ToYuan(list.Sum(a => a.PlatformFee));
decimal refundAmount = ToYuan(list.Sum(a => a.RefundDone) + list.Sum(a => a.RefundPending));
decimal buyerPaymentAmount = ToYuan(list.Sum(a => a.TotalPurchase));
decimal buyerRefundAmount = ToYuan(list.Sum(a => a.TotalRefund));
decimal buyerRefundSuccessedAmount = ToYuan(list.Sum(a => a.DoneRefund));
decimal salesAmount = valid.Sum(r => (decimal)(r.OrderPrice)) / 100m;//有效订单总金额
decimal profit = valid.Concat(refunded).Sum(r => (decimal)(r.Profit)) / 100m;
decimal refundAmount = refunded.Sum(r => (decimal)(r.OrderPrice)) / 100m;
decimal platformFeeTotal = valid.Sum(r => (decimal)(r.PredictCommissionFee)) / 100m;
decimal commission = valid.Sum(r => (decimal)(r.CommissionAmount)) / 100m;
decimal purchaseAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m;
decimal buyerPaymentAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号付款金额(采购金额)
decimal buyerRefundAmount = refunded.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号退款金额(采购退款金额)
decimal buyerRefundSuccessedAmount = refunded.Where(IsBuyerRefundSuccessful).Sum(r => (decimal)(r.BuyerRefundAmount)) / 100m; //买手号退款成功金额
int validOrderCount = list.Sum(a => a.OrderCount); // 新接口 OrderCount 不含退款订单
int refundOrderCount = list.Sum(a => a.RefundOrderCount);
int totalOrderCount = validOrderCount + refundOrderCount;
int validOrderCount = valid.Select(r => r.OrderId).Distinct().Count();
// 总订单数(退款率分母)= 已付款订单 + 已退款订单,不含未付款的 10/250
int totalOrderCount = list.Count();
int refundOrderCount = refunded.Select(r => r.OrderId).Distinct().Count();
Debug.WriteLine($"计算利润:{(salesAmount - buyerPaymentAmount - platformFeeTotal)}");
Debug.WriteLine($"正常订单利润:{valid.Sum(r => (decimal)(r.Profit)) / 100}");
Debug.WriteLine($"售后订单利润:{refunded.Sum(r => (decimal)(r.Profit)) / 100}");
return new ShopRevenueSummary
{
SalesAmount = salesAmount,
@@ -114,65 +146,65 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
RefundAmount = refundAmount,
RefundOrderCount = refundOrderCount,
PlatformFeeTotal = platformFeeTotal,
Commission = 0m, // 新接口无“达人佣金”字段,保留占位
Commission = commission,
AvgOrderAmount = validOrderCount == 0 ? 0m : salesAmount / validOrderCount,
RefundRate = totalOrderCount == 0 ? 0m : (decimal)refundOrderCount * 100m / totalOrderCount,
AverageProfitRate = buyerPaymentAmount == 0m ? 0m : profit / buyerPaymentAmount * 100m,
AverageProfitRate = purchaseAmount == 0m ? 0m : profit / purchaseAmount * 100m,
BuyerPaymentAmount = buyerPaymentAmount,
BuyerRefundAmount = buyerRefundAmount,
BuyerRefundSuccessedAmount = buyerRefundSuccessedAmount,
};
}
/// <summary>店铺统计表格(按店铺汇总,销售额倒序)</summary>
public static List<ShopStatisticsItem> GetShopStatistics(IEnumerable<ShopStatsResponse> stats)
{
return GroupByShop(stats)
.Select(g => BuildShopStatisticsItem(g.Key, g))
.OrderByDescending(i => i.SalesAmount)
.ToList();
}
/// <summary>店铺销售占比(饼图,按店铺汇总,销售额倒序)</summary>
public static List<ShopSalesProportionItem> GetShopSalesProportion(IEnumerable<ShopStatsResponse> stats)
{
var items = GroupByShop(stats)
.Select(g => new ShopSalesProportionItem
{
ShopName = ResolveShopName(g.Key),
SalesAmount = ToYuan(g.Sum(a => a.SalesAmount))
})
.OrderByDescending(i => i.SalesAmount)
.ToList();
decimal total = items.Sum(i => i.SalesAmount);
foreach (var item in items)
{
item.Percentage = total == 0m ? 0d : (double)(item.SalesAmount / total * 100m);
}
return items;
}
/// <summary>
/// 销售趋势(按天,缺失日期补 0)。
/// 数据来自 GetShopStatsTrend:服务端已经跨店铺合计,这里只做日期规整与补零。
/// 获取有效订单
/// </summary>
public static List<RevenueTrendPoint> GetSalesTrend(IEnumerable<ShopStatsTrendResponse> trend, DateTime startDate, DateTime endDate)
/// <param name="rows"></param>
/// <returns></returns>
public static List<ShopRevenueStatisticsRow> GetValidOrder(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = (trend ?? Enumerable.Empty<ShopStatsTrendResponse>())
.Where(a => a != null && a.StatDate != default(DateTime))
.ToList();
var list = GetPaymentOrderList(rows); //买手付钱后的订单数量
return list.Where(IsValidOrder).ToList();
}
/// <summary>
/// 获取退款订单
/// </summary>
/// <param name="rows"></param>
/// <returns></returns>
public static List<ShopRevenueStatisticsRow> GetRefundOrder(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = GetPaymentOrderList(rows); //买手付钱后的订单数量
return list.Where(IsRefunded).ToList();
}
/// <summary>
/// 获取退款订单
/// </summary>
/// <param name="rows"></param>
/// <returns></returns>
public static List<ShopRevenueStatisticsRow> GetBuyerRefundRemainingOrder(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = GetPaymentOrderList(rows); //买手付钱后的订单数量
var refunded = list.Where(IsRefunded).ToList();
decimal buyerRefundAmount = refunded.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号退款金额(采购退款金额)
decimal buyerRefundSuccessedAmount = refunded.Where(a => IsBuyerRefundSuccessful(a) == false).Sum(r => (decimal)(r.BuyerRefundAmount)) / 100m; //买手号退款成功金额
return refunded.Where(a => IsBuyerRefundSuccessful(a) == false).ToList();
}
/// <summary>销售趋势(按天,缺失日期补 0,仅统计有效订单)</summary>
public static List<RevenueTrendPoint> GetSalesTrend(IEnumerable<ShopRevenueStatisticsRow> rows, DateTime startDate, DateTime endDate)
{
var list = GetPaymentOrderList(rows);
list = list.Where(IsValidOrder).ToList();
var map = list
.Where(a => a.StatDate.Date >= startDate.Date && a.StatDate.Date <= endDate.Date)
.GroupBy(a => a.StatDate.Date)
.GroupBy(r => r.CreateTime.Date)
.ToDictionary(
g => g.Key,
g => new RevenueTrendPoint
{
Date = g.Key,
SalesAmount = ToYuan(g.Sum(a => a.SalesAmount)),
OrderCount = g.Sum(a => a.OrderCount)
SalesAmount = g.Sum(r => (decimal)(r.OrderPrice)) / 100m,
OrderCount = g.Select(r => r.OrderId).Distinct().Count()
});
var result = new List<RevenueTrendPoint>();
@@ -186,23 +218,95 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return result;
}
/// <summary>
/// 天/周/月周期统计表格(每天/每周/每月各一行,无数据的周期也补一行,金额单位:元)。
/// 结果按周期倒序(最新的周期在最上面)。
/// 说明:接口按“自然周期”聚合(周从周一起、月从 1 号起),所以筛选也按周期起点比较,
/// 否则区间从周三开始时,那一周(周一起)的数据会被误判为越界而丢掉。
/// </summary>
public static List<ShopPeriodStatisticsItem> GetPeriodStatistics(IEnumerable<ShopStatsResponse> stats, DateTime startDate, DateTime endDate, PeriodStatisticType periodType)
/// <summary>店铺销售占比(饼图,仅统计有效订单)</summary>
public static List<ShopSalesProportionItem> GetShopSalesProportion(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var startPeriod = GetPeriodStart(startDate, periodType);
var endPeriod = GetPeriodStart(endDate, periodType);
var list = GetPaymentOrderList(rows);
list = list.Where(IsValidOrder).ToList();
decimal total = list.Sum(r => (decimal)(r.OrderPrice)) / 100m;
var map = ToList(stats)
.Where(a => a.StatDate != default(DateTime))
.Select(a => new { Stat = a, PeriodStart = GetPeriodStart(a.StatDate, periodType) })
.Where(a => a.PeriodStart >= startPeriod && a.PeriodStart <= endPeriod)
.GroupBy(a => a.PeriodStart)
.ToDictionary(g => g.Key, g => BuildPeriodStatisticsItem(g.Key, g.Select(a => a.Stat), periodType));
return list
.GroupBy(r => r.ShopName)
.Select(g => new ShopSalesProportionItem
{
ShopName = string.IsNullOrEmpty(g.Key) ? "未知店铺" : g.Key,
SalesAmount = g.Sum(r => (decimal)(r.OrderPrice)) / 100m,
Percentage = total == 0m ? 0d : (double)(g.Sum(r => (decimal)(r.OrderPrice)) / 100m / total * 100m)
})
.OrderByDescending(i => i.SalesAmount)
.ToList();
}
/// <summary>店铺统计表格</summary>
public static List<ShopStatisticsItem> GetShopStatistics(IEnumerable<ShopRevenueStatisticsRow> rows)
{
var list = GetPaymentOrderList(rows); //买手付钱后的订单
return list
.GroupBy(r => r.ShopName)
.Select(g =>
{
var valid = g.Where(IsValidOrder).ToList();
var refunded = g.Where(IsRefunded).ToList();
decimal salesAmount = valid.Sum(r => (decimal)(r.OrderPrice)) / 100m; //与 GetSummary 一致:不含已退款订单的销售额
int orderCount = valid.Select(r => r.OrderId).Distinct().Count();
decimal profit = valid.Concat(refunded).Sum(r => (decimal)(r.Profit)) / 100m; //与 GetSummary 一致:有效+退款订单利润
decimal purchaseAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m; //与 GetSummary 一致:买手付款金额(采购金额)
decimal buyerPaymentAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号付款金额(采购金额)
return new ShopStatisticsItem
{
ShopName = string.IsNullOrEmpty(g.Key) ? "未知店铺" : g.Key,
OrderCount = orderCount,
SalesAmount = salesAmount,
BuyerPaymentAmount = buyerPaymentAmount,
Profit = profit,
RefundAmount = refunded.Sum(r => (decimal)(r.OrderPrice)) / 100m,
PlatformFeeTotal = valid.Sum(r => (decimal)(r.PredictCommissionFee)) / 100m,
Commission = valid.Sum(r => (decimal)(r.CommissionAmount)) / 100m,
AvgOrderAmount = orderCount == 0 ? 0m : salesAmount / orderCount,
AverageProfitRate = purchaseAmount == 0m ? 0m : profit / purchaseAmount * 100m
};
})
.OrderByDescending(i => i.SalesAmount)
.ToList();
}
/// <summary>天/周/月周期统计表格(每天/每周/每月各一行,无数据的周期也补一行,金额单位:元)</summary>
public static List<ShopPeriodStatisticsItem> GetPeriodStatistics(IEnumerable<ShopRevenueStatisticsRow> rows, DateTime startDate, DateTime endDate, PeriodStatisticType periodType)
{
var list = (rows ?? new List<ShopRevenueStatisticsRow>()).Where(a => a.OutAmount > 0).ToList(); //买手付钱后的订单
// 有数据的周期
var map = list
.GroupBy(r => GetPeriodStart(r.CreateTime, periodType))
.ToDictionary(
g => g.Key,
g =>
{
var valid = g.Where(IsValidOrder).ToList();
var refunded = g.Where(IsRefunded).ToList();
decimal salesAmount = valid.Sum(r => (decimal)(r.OrderPrice)) / 100m; //与 GetSummary 一致:不含已退款订单的销售额
decimal profit = valid.Concat(refunded).Sum(r => (decimal)(r.Profit)) / 100m; //与 GetSummary 一致:有效+退款订单利润
decimal purchaseAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m; //与 GetSummary 一致:买手付款金额(采购金额)
int orderCount = valid.Select(r => r.OrderId).Distinct().Count();
decimal buyerPaymentAmount = valid.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号付款金额(采购金额)
return new ShopPeriodStatisticsItem
{
PeriodStart = g.Key,
Period = GetPeriodText(g.Key, periodType),
OrderCount = orderCount,
SalesAmount = salesAmount,
BuyerPaymentAmount = buyerPaymentAmount,
Profit = profit,
RefundAmount = refunded.Sum(r => (decimal)(r.OrderPrice)) / 100m,
PlatformFeeTotal = valid.Sum(r => (decimal)(r.PredictCommissionFee)) / 100m,
Commission = valid.Sum(r => (decimal)(r.CommissionAmount)) / 100m,
AverageProfitRate = purchaseAmount == 0m ? 0m : profit / purchaseAmount * 100m,
CustomerCount = orderCount,
AvgOrderAmount = orderCount == 0 ? 0m : salesAmount / orderCount
};
});
// 按周期补齐整段时间:无数据的周期也生成一行(全 0)
var result = new List<ShopPeriodStatisticsItem>();
@@ -217,7 +321,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
Period = GetPeriodText(periodStart, periodType),
OrderCount = 0,
SalesAmount = 0m,
BuyerPaymentAmount = 0m,
Profit = 0m,
RefundAmount = 0m,
PlatformFeeTotal = 0m,
@@ -233,56 +336,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return result;
}
/// <summary>店铺统计行(金额单位:元)</summary>
private static ShopStatisticsItem BuildShopStatisticsItem(string shopId, IEnumerable<ShopStatsResponse> shopStats)
{
var list = ToList(shopStats);
decimal salesAmount = ToYuan(list.Sum(a => a.SalesAmount));
decimal profit = ToYuan(list.Sum(a => a.ProfitAmount));
decimal buyerPaymentAmount = ToYuan(list.Sum(a => a.TotalPurchase));
int orderCount = list.Sum(a => a.OrderCount);
return new ShopStatisticsItem
{
ShopName = ResolveShopName(shopId),
OrderCount = orderCount,
SalesAmount = salesAmount,
BuyerPaymentAmount = buyerPaymentAmount,
Profit = profit,
RefundAmount = ToYuan(list.Sum(a => a.RefundDone) + list.Sum(a => a.RefundPending)),
PlatformFeeTotal = ToYuan(list.Sum(a => a.PlatformFee)),
Commission = 0m, // 新接口无“达人佣金”字段,保留占位
AvgOrderAmount = orderCount == 0 ? 0m : salesAmount / orderCount,
AverageProfitRate = buyerPaymentAmount == 0m ? 0m : profit / buyerPaymentAmount * 100m
};
}
/// <summary>周期统计行(金额单位:元)</summary>
private static ShopPeriodStatisticsItem BuildPeriodStatisticsItem(DateTime periodStart, IEnumerable<ShopStatsResponse> periodStats, PeriodStatisticType periodType)
{
var list = ToList(periodStats);
decimal salesAmount = ToYuan(list.Sum(a => a.SalesAmount));
decimal profit = ToYuan(list.Sum(a => a.ProfitAmount));
decimal buyerPaymentAmount = ToYuan(list.Sum(a => a.TotalPurchase));
int orderCount = list.Sum(a => a.OrderCount);
return new ShopPeriodStatisticsItem
{
PeriodStart = periodStart,
Period = GetPeriodText(periodStart, periodType),
OrderCount = orderCount,
SalesAmount = salesAmount,
BuyerPaymentAmount = buyerPaymentAmount,
Profit = profit,
RefundAmount = ToYuan(list.Sum(a => a.RefundDone) + list.Sum(a => a.RefundPending)),
PlatformFeeTotal = ToYuan(list.Sum(a => a.PlatformFee)),
Commission = 0m, // 新接口无“达人佣金”字段,保留占位
AverageProfitRate = buyerPaymentAmount == 0m ? 0m : profit / buyerPaymentAmount * 100m,
CustomerCount = orderCount,
AvgOrderAmount = orderCount == 0 ? 0m : salesAmount / orderCount
};
}
/// <summary>枚举 startDate~endDate 覆盖的所有周期开始日期(天/周/月)</summary>
private static IEnumerable<DateTime> EnumeratePeriods(DateTime startDate, DateTime endDate, PeriodStatisticType periodType)
{
@@ -334,261 +387,252 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return periodStart.ToString("yyyy-MM-dd");
}
}
}
/// <summary>
/// 默认实现:请求新接口(无缓存,每次查询实时获取)。
/// shop_revenue_statistics/GetShopStats
/// -> Result&lt;Dictionary&lt;店铺ID, List&lt;ShopStatsResponse&gt;&gt;&gt;
/// 请求体:UserLogin.GetSignPostData(new { StartDate, EndDate, ShopIds, GroupType });
/// GroupType 决定聚合粒度(0=汇总 1=天 2=周 3=月),汇总时每个店铺只有一条。
/// shop_revenue_statistics/GetShopStatsTrend
/// -> Result&lt;List&lt;ShopStatsTrendResponse&gt;&gt;
/// 请求体:UserLogin.GetSignPostData(new { StartDate, EndDate, ShopIds });
/// 服务端跨店铺合计,固定按天返回,用于销售趋势折线图。
/// shop_revenue_statistics/GetShopOrderDetails
/// -> Result&lt;List&lt;ShopOrderDetailResponse&gt;&gt;
/// 请求体:UserLogin.GetSignPostData(new { StartDate, EndDate, ShopIds, OrderType });
/// 订单列表弹窗的明细数据(OrderType 见 ShopOrderDetailType)。
/// 接口不返回“整段汇总”,页面上的汇总卡片一律由客户端对返回记录合计。
/// 默认实现:请求真实接口(shop_revenue_statistics/get_shop_order_amount)。
/// 接入其他数据源时,新建实现类并注入即可(见 IShopRevenueStatisticsService 注释)。
/// </summary>
public class ShopRevenueStatisticsService : IShopRevenueStatisticsService
{
/// <summary>统计接口地址(聚合粒度由请求参数 GroupType 决定)</summary>
private const string GetShopStatsApi = "shop_revenue_statistics/GetShopStats";
/// <summary>缓存有效期:订单/退款数据会持续变化,超过该时长后缓存自动失效并重新请求。</summary>
private static readonly TimeSpan CacheDuration = TimeSpan.FromSeconds(60);
/// <summary>销售趋势接口地址(服务端跨店铺合计,固定按天)</summary>
private const string GetShopStatsTrendApi = "shop_revenue_statistics/GetShopStatsTrend";
/// <summary>
/// 明细数据缓存(按天缓存,纯时间维度,不含店铺)。
/// key = 日期(yyyyMMdd),value = 该天全部店铺的明细 + 缓存时间。
/// 查询时按天命中:未命中的天合并成连续段一次请求,返回后按天拆分写入;
/// 前台选某一个或某多个店铺时,按所选店铺(ShopName)过滤,复用同一批时间数据。
/// </summary>
private static readonly Dictionary<string, CacheEntry> _rowCache =
new Dictionary<string, CacheEntry>();
private readonly object _cacheLock = new object();
/// <summary>订单明细接口地址(订单列表弹窗用)</summary>
private const string GetShopOrderDetailsApi = "shop_revenue_statistics/GetShopOrderDetails";
/// <summary>Unix 纪元(本地时区),用于解析以时间戳作为 Key 的返回数据</summary>
private static readonly DateTime UnixEpoch = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
public async Task<ShopRevenueStatisticsResult> QueryAsync(ShopRevenueStatisticsQuery query)
private sealed class DateRange
{
// 综合统计页分两次取数,各取所需:
// 1) Summary:每店铺一条(与区间长度无关),作为卡片/店铺统计表/销售占比的权威合计
// 2) Trend :跨店铺合计的按天序列,只给趋势折线图用(数据量只与天数有关,不随店铺数膨胀)
// 顺序请求:签名中的 time/code 由当前时间生成,并发请求有被判重复签名的风险。
var summaryStats = await RequestStatsAsync(query, ShopStatsGroupType.Summary);
var trend = await RequestTrendAsync(query);
return new ShopRevenueStatisticsResult
{
Summary = ShopStatsAggregator.GetSummary(summaryStats),
Trend = ShopStatsAggregator.GetSalesTrend(trend, query.StartDate, query.EndDate),
ShopProportions = ShopStatsAggregator.GetShopSalesProportion(summaryStats),
ShopStatistics = ShopStatsAggregator.GetShopStatistics(summaryStats),
};
public DateTime Start;
public DateTime End;
}
public async Task<ShopPeriodStatisticsResult> QueryPeriodStatisticsAsync(ShopRevenueStatisticsQuery query, PeriodStatisticType periodType)
private sealed class CacheEntry
{
// 按天/周/月粒度取数;接口不返回整段汇总,卡片由返回的周期记录在客户端合计
var stats = await RequestStatsAsync(query, ToGroupType(periodType));
return new ShopPeriodStatisticsResult
{
Summary = ShopStatsAggregator.GetSummary(stats),
Items = ShopStatsAggregator.GetPeriodStatistics(stats, query.StartDate, query.EndDate, periodType),
};
public List<ShopRevenueStatisticsRow> Rows;
public DateTime CachedAt;
}
/// <summary>页面统计周期 → 接口聚合方式</summary>
private static ShopStatsGroupType ToGroupType(PeriodStatisticType periodType)
private static string CacheKey(DateTime day)
{
switch (periodType)
return day.Date.ToString("yyyyMMdd");
}
/// <summary>枚举 startDate ~ endDate 之间的每一天(含首尾)</summary>
private static IEnumerable<DateTime> EnumerateDays(DateTime startDate, DateTime endDate)
{
for (var d = startDate.Date; d <= endDate.Date; d = d.AddDays(1))
yield return d;
}
/// <summary>该天缓存是否有效(存在且未过期);调用方需持有 _cacheLock</summary>
private bool IsValidLocked(DateTime day)
{
return _rowCache.TryGetValue(CacheKey(day), out var entry)
&& DateTime.Now - entry.CachedAt <= CacheDuration;
}
/// <summary>把缺失日期合并为连续日期段(每段一次请求)</summary>
private static List<DateRange> BuildRuns(List<DateTime> missingDays)
{
var sorted = missingDays.OrderBy(d => d).ToList();
var runs = new List<DateRange>();
int i = 0;
while (i < sorted.Count)
{
case PeriodStatisticType.Week:
return ShopStatsGroupType.Week;
case PeriodStatisticType.Month:
return ShopStatsGroupType.Month;
default:
return ShopStatsGroupType.Day;
var start = sorted[i];
var end = start;
i++;
while (i < sorted.Count && sorted[i] == end.AddDays(1))
{
end = sorted[i];
i++;
}
runs.Add(new DateRange { Start = start, End = end });
}
return runs;
}
public async Task<List<ShopRevenueStatisticsRow>> QueryRowsAsync(ShopRevenueStatisticsQuery query)
{
var startDay = query.StartDate.Date;
var endDay = query.EndDate.Date;
if (startDay > endDay)
{
var tmp = startDay;
startDay = endDay;
endDay = tmp;
}
// 1. 找出未命中或已过期的天
List<DateTime> missingDays;
lock (_cacheLock)
{
missingDays = EnumerateDays(startDay, endDay)
.Where(d => !IsValidLocked(d))
.ToList();
}
// 2. 有缺失:按连续段请求整个时间范围的全部店铺明细,并按天写入缓存
if (missingDays.Count > 0)
{
var shopIds = GetShopOptions().Select(a => a.ShopId).ToList();
if (shopIds.Count == 0)
return new List<ShopRevenueStatisticsRow>();
foreach (var run in BuildRuns(missingDays))
{
var rows = await RequestRowsAsync(shopIds, run.Start, run.End);
CacheResponse(run.Start, run.End, rows);
}
}
// 3. 按天从缓存拼装完整范围,再按所选店铺过滤(ShopKeys 为空 = 全部店铺)
return FilterByShop(GetCachedRows(startDay, endDay), query.ShopKeys);
}
/// <summary>
/// 把一次请求的结果按天写入缓存。
/// 本次请求覆盖的每一天都以返回数据为准整体替换(无数据的天记为空的已缓存,
/// 避免“该天无数据”被反复判定为未命中而重复请求)。
/// </summary>
private void CacheResponse(DateTime startDate, DateTime endDate, List<ShopRevenueStatisticsRow> rows)
{
if (rows == null)
rows = new List<ShopRevenueStatisticsRow>();
lock (_cacheLock)
{
RemoveExpiredEntriesLocked();
var byDay = rows
.Where(r => r.CreateTime.Date >= startDate.Date && r.CreateTime.Date <= endDate.Date)
.GroupBy(r => r.CreateTime.Date)
.ToDictionary(g => g.Key, g => g.ToList());
foreach (var day in EnumerateDays(startDate, endDate))
{
byDay.TryGetValue(day, out var dayRows);
_rowCache[CacheKey(day)] = new CacheEntry { Rows = dayRows ?? new List<ShopRevenueStatisticsRow>(), CachedAt = DateTime.Now };
}
}
}
/// <summary>
/// 请求 GetShopStats:返回按 GroupType 聚合的记录
/// (汇总时每店铺一条;天/周/月时每店铺每个自然日/自然周/自然月一条)。
/// </summary>
private static async Task<List<ShopStatsResponse>> RequestStatsAsync(ShopRevenueStatisticsQuery query, ShopStatsGroupType groupType)
/// <summary>按天从缓存拼装某时间范围的明细(返回新列表,避免外部修改污染缓存)</summary>
private List<ShopRevenueStatisticsRow> GetCachedRows(DateTime startDate, DateTime endDate)
{
var shopIds = BuildShopIds(query);
if (shopIds.Count == 0)
return new List<ShopStatsResponse>();
var url = BaseClass.Build29WxObjString(GetShopStatsApi);
var html = await GetHtml.PostJsonAsync(url, BuildPostData(query, shopIds, groupType));
var ret = Deserialize<Result<Dictionary<string, List<ShopStatsResponse>>>>(html);
EnsureSuccess(ret);
var result = new List<ShopStatsResponse>();
if (ret.Data == null)
return result;
foreach (var kv in ret.Data)
result.AddRange(Normalize(kv.Key, kv.Value));
var result = new List<ShopRevenueStatisticsRow>();
lock (_cacheLock)
{
foreach (var day in EnumerateDays(startDate, endDate))
{
if (_rowCache.TryGetValue(CacheKey(day), out var entry))
result.AddRange(entry.Rows);
}
}
return result;
}
/// <summary>
/// 请求 GetShopStatsTrend:跨店铺合计的按天销售趋势(服务端已合计,不需要 GroupType)。
/// </summary>
private static async Task<List<ShopStatsTrendResponse>> RequestTrendAsync(ShopRevenueStatisticsQuery query)
/// <summary>按所选店铺过滤明细:ShopKeys 为空/Null 返回全部;否则按店铺名(ShopName)精确匹配。</summary>
private static List<ShopRevenueStatisticsRow> FilterByShop(List<ShopRevenueStatisticsRow> rows, List<string> shopKeys)
{
var shopIds = BuildShopIds(query);
if (shopIds.Count == 0)
return new List<ShopStatsTrendResponse>();
if (rows == null)
return new List<ShopRevenueStatisticsRow>();
var url = BaseClass.Build29WxObjString(GetShopStatsTrendApi);
var html = await GetHtml.PostJsonAsync(url, BuildTrendPostData(query, shopIds));
if (shopKeys == null || shopKeys.Count == 0)
return new List<ShopRevenueStatisticsRow>(rows);
var ret = Deserialize<Result<List<ShopStatsTrendResponse>>>(html);
EnsureSuccess(ret);
return ret.Data ?? new List<ShopStatsTrendResponse>();
}
var shops = GetShopOptions()
.Where(a => shopKeys.Contains(a.AppKey))
.Where(a => !string.IsNullOrEmpty(a.ShopName))
.ToList();
if (shops.Count == 0)
return new List<ShopRevenueStatisticsRow>();
/// <summary>
/// 组装请求体:StartDate / EndDate 传日期,ShopIds 传 ERP 店铺ID 列表,
/// GroupType 传枚举数字(0=汇总 1=天 2=周 3=月)。
/// </summary>
private static object BuildPostData(ShopRevenueStatisticsQuery query, List<string> shopIds, ShopStatsGroupType groupType)
{
return UserLogin.GetSignPostData(new
{
StartDate = query.StartDate.Date,
EndDate = query.EndDate.Date,
ShopIds = shopIds,
GroupType = (int)groupType,
});
}
/// <summary>组装趋势接口请求体:StartDate / EndDate + ShopIds(无 GroupType)</summary>
private static object BuildTrendPostData(ShopRevenueStatisticsQuery query, List<string> shopIds)
{
return UserLogin.GetSignPostData(new
{
StartDate = query.StartDate.Date,
EndDate = query.EndDate.Date,
ShopIds = shopIds,
});
}
/// <summary>
/// 组装订单明细请求体:StartDate / EndDate + ShopIds + OrderType
/// (OrderType 传枚举数字:1=有效订单 2=退款订单 3=买手未退回金额的订单)。
/// </summary>
private static object BuildOrderDetailPostData(ShopRevenueStatisticsQuery query, List<string> shopIds, ShopOrderDetailType detailType)
{
return UserLogin.GetSignPostData(new
{
StartDate = query.StartDate,
EndDate = query.EndDate,
ShopIds = shopIds,
OrderType = (int)detailType,
});
}
/// <summary>
/// 查询店铺范围:query.ShopIds 为空表示全部店铺(取全部店铺的 ERP 店铺ID)。
/// 接口的 ShopIds 使用 ShopLoginInfo.ErpShopId。
/// </summary>
private static List<string> BuildShopIds(ShopRevenueStatisticsQuery query)
{
var selected = (query == null || query.ShopIds == null)
? new List<string>()
: query.ShopIds.Where(a => !string.IsNullOrEmpty(a)).Distinct().ToList();
if (selected.Count > 0)
return selected;
return GetShopOptions()
.Select(a => a.ErpShopId)
.Where(a => !string.IsNullOrEmpty(a))
.Distinct()
return rows
.Where(r => shops.Any(s => string.Equals(r.ShopName, s.ShopName, StringComparison.OrdinalIgnoreCase)))
.ToList();
}
/// <summary>
/// 反序列化接口返回;失败时统一抛出可读异常。
/// 说明:Newtonsoft 默认按属性名匹配(忽略大小写),因此 PascalCase / camelCase 均可解析。
/// </summary>
private static T Deserialize<T>(string html)
/// <summary>清理已过期的缓存条目(调用方需持有 _cacheLock)</summary>
private void RemoveExpiredEntriesLocked()
{
var expiredKeys = _rowCache
.Where(p => DateTime.Now - p.Value.CachedAt > CacheDuration)
.Select(p => p.Key)
.ToList();
foreach (var key in expiredKeys)
_rowCache.Remove(key);
}
/// <summary>请求接口一次(可传多个店铺),返回原始明细行</summary>
private async Task<List<ShopRevenueStatisticsRow>> RequestRowsAsync(List<string> shopIds, DateTime startDate, DateTime endDate)
{
var url = BaseClass.Build29WxObjString("shop_revenue_statistics/get_shop_order_amount");
var sb = new StringBuilder();
sb.Append(UserLogin.GetSignaturex());
sb.Append("&shop_ids=").Append(string.Join(",", shopIds));
sb.Append("&start_time=").Append(BaseClass.ConvertDateTimeLong(startDate.Date));
sb.Append("&end_time=").Append(BaseClass.ConvertDateTimeLong(endDate.Date.AddDays(1).AddTicks(-1)));
var html = await GetHtml.PostUtf8Async(url, sb.ToString());
try
{
return JsonConvert.DeserializeObject<T>(html);
}
catch (Exception ex)
{
throw new Exception("查询失败:接口返回数据解析异常", ex);
}
}
/// <summary>校验接口返回码</summary>
private static void EnsureSuccess(Result result)
{
if (result == null)
throw new Exception("查询失败:接口无返回数据");
if (result.Code != 200)
throw new Exception(string.IsNullOrEmpty(result.Msg) ? "查询失败" : result.Msg);
}
/// <summary>
/// 摊平某个 Key(店铺ID)下的记录,并用 Key 兜底补齐缺失的 ShopId / StatDate。
/// </summary>
private static List<ShopStatsResponse> Normalize(string key, List<ShopStatsResponse> items)
{
var result = new List<ShopStatsResponse>();
if (items == null)
return result;
foreach (var item in items)
{
if (item == null)
continue;
if (string.IsNullOrEmpty(item.ShopId))
item.ShopId = key;
if (item.StatDate == default(DateTime))
var ret = JsonConvert.DeserializeObject<Result<List<ShopRevenueStatisticsRow>>>(html, new JsonSerializerSettings
{
var date = ParseDateFromKey(key);
if (date.HasValue)
item.StatDate = date.Value;
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
if (ret.Code != 200)
{
throw new Exception(ret.Msg);
}
return ret.Data ?? new List<ShopRevenueStatisticsRow>();
result.Add(item);
}
return result;
catch
{
throw new Exception("查询失败");
}
}
/// <summary>尝试把返回数据的 Key 解析为日期(支持 yyyy-MM-dd / yyyyMMdd / 秒或毫秒时间戳)</summary>
private static DateTime? ParseDateFromKey(string key)
public async Task<ShopRevenueSummary> GetSummaryAsync(ShopRevenueStatisticsQuery query)
{
if (string.IsNullOrEmpty(key))
return null;
var rows = await QueryRowsAsync(query);
return RevenueStatisticsAggregator.GetSummary(rows);
}
if (DateTime.TryParse(key, out var date))
return date;
public async Task<List<RevenueTrendPoint>> GetSalesTrendAsync(ShopRevenueStatisticsQuery query)
{
var rows = await QueryRowsAsync(query);
return RevenueStatisticsAggregator.GetSalesTrend(rows, query.StartDate, query.EndDate);
}
if (DateTime.TryParseExact(key, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out date))
return date;
public async Task<List<ShopSalesProportionItem>> GetShopSalesProportionAsync(ShopRevenueStatisticsQuery query)
{
var rows = await QueryRowsAsync(query);
return RevenueStatisticsAggregator.GetShopSalesProportion(rows);
}
if (long.TryParse(key, out var timestamp))
{
return timestamp.ToString().Length == 13
? UnixEpoch.AddMilliseconds(timestamp)
: UnixEpoch.AddSeconds(timestamp);
}
public async Task<List<ShopStatisticsItem>> GetShopStatisticsAsync(ShopRevenueStatisticsQuery query)
{
var rows = await QueryRowsAsync(query);
return RevenueStatisticsAggregator.GetShopStatistics(rows);
}
return null;
/// <summary>获取天/周/月周期统计表格</summary>
public async Task<List<ShopPeriodStatisticsItem>> GetPeriodStatisticsAsync(ShopRevenueStatisticsQuery query, PeriodStatisticType periodType)
{
var rows = await QueryRowsAsync(query);
return RevenueStatisticsAggregator.GetPeriodStatistics(rows, query.StartDate, query.EndDate, periodType);
}
/// <summary>店铺下拉列表(同步读取,供查询与过滤使用)</summary>
@@ -597,8 +641,8 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return GlobalConfig.ShopLoginList.Select(a =>
new ShopOption()
{
ShopId = a.ShopId,
ErpShopId = a.ErpShopId,
AppKey = a.ShopId,
ShopId = a.ErpShopId,
ShopName = a.ShopAccount
}).ToList();
}
@@ -608,23 +652,5 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return Task.FromResult(GetShopOptions());
}
/// <summary>
/// 订单明细列表(有效订单 / 退款订单 / 买手未退回金额的订单),供订单列表弹窗使用。
/// 请求 shop_revenue_statistics/GetShopOrderDetails:
/// StartDate / EndDate / ShopIds / OrderType(OrderType 由 detailType 决定,按数字传值)。
/// </summary>
public async Task<List<ShopOrderDetailResponse>> QueryOrderRowsAsync(ShopRevenueStatisticsQuery query, ShopOrderDetailType detailType)
{
var shopIds = BuildShopIds(query);
if (shopIds.Count == 0)
return new List<ShopOrderDetailResponse>();
var url = BaseClass.Build29WxObjString(GetShopOrderDetailsApi);
var html = await GetHtml.PostJsonAsync(url, BuildOrderDetailPostData(query, shopIds, detailType));
var ret = Deserialize<Result<List<ShopOrderDetailResponse>>>(html);
EnsureSuccess(ret);
return ret.Data ?? new List<ShopOrderDetailResponse>();
}
}
}
@@ -1,4 +1,4 @@
<Window
<UserControl
x:Class="_29WxOrderWpf.Ctrls.Statistics.ShopRevenueStatisticsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -13,8 +13,10 @@
IsDesignTimeCreatable=True}"
d:DesignHeight="900"
d:DesignWidth="1600"
wpf:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
wpf:DialogWindowProperty.ShowMinButton="False"
mc:Ignorable="d">
<Window.Resources>
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
<!-- 卡片样式(白底、圆角、阴影) -->
@@ -117,7 +119,7 @@
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
</UserControl.Resources>
<Grid Background="#F5F7FB">
<TabControl SelectionChanged="TabControl_SelectionChanged" Style="{StaticResource StatisticsTabControlStyle}">
@@ -346,4 +348,4 @@
</StackPanel>
</Border>
</Grid>
</Window>
</UserControl>
@@ -1,5 +1,4 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls;
using _29WxOrderWpf.Ctrls.Statistics.ViewModels;
namespace _29WxOrderWpf.Ctrls.Statistics
@@ -10,7 +9,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics
/// 如需注入自定义数据服务,请使用
/// new ShopRevenueStatisticsView(new ShopRevenueStatisticsViewModel(你的 IShopRevenueStatisticsService 实现))。
/// </summary>
public partial class ShopRevenueStatisticsView : Window
public partial class ShopRevenueStatisticsView : UserControl
{
public ShopRevenueStatisticsView()
: this(new ShopRevenueStatisticsViewModel())
@@ -20,9 +19,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics
public ShopRevenueStatisticsView(ShopRevenueStatisticsViewModel viewModel)
{
InitializeComponent();
viewModel.GetWindow = () => this;
DataContext = viewModel;
}
private void help_mouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
@@ -1,20 +1,13 @@
<UserControl
<UserControl
x:Class="_29WxOrderWpf.Ctrls.Statistics.ShowOrderDialogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.Statistics"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
comn:DialogWindowProperty.Height="620"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.Width="1320"
d:Background="White"
d:DesignHeight="450"
d:DesignWidth="800"
Focusable="True"
PreviewKeyDown="ShowOrderDialogView_PreviewKeyDown"
mc:Ignorable="d">
<UserControl.Resources>
<!-- 单元格文字居中 -->
@@ -23,69 +16,17 @@
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<!--
选中行高亮:用主题色填充选中行,并且不区分表格是否拥有焦点
(默认样式的选中色在焦点离开表格后会变成浅灰,点了“复制数据”就看不出选中了哪些行)
-->
<Style x:Key="SelectedCellStyle" TargetType="DataGridCell">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource pageColorBrush}" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border
Grid.Row="0"
Padding="10"
BorderBrush="Gray"
BorderThickness="0,0,0,1">
<wpf:SpacingStackPanel HorizontalSpacing="10" Orientation="Horizontal">
<wpf:TitleContent
Title="订单号:"
Width="180"
Placement="Left"
TitleVerticalAlignment="Center">
<TextBox
Height="22"
Text="{Binding OrderId, UpdateSourceTrigger=PropertyChanged}"
ToolTip="按订单号筛选;表格内可用 Ctrl+A 全选、Ctrl+C 复制数据" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Border>
<DataGrid
x:Name="dgOrders"
Grid.Row="1"
<DataGrid Margin="5"
d:ItemsSource="{d:SampleData ItemCount=10}"
AlternatingRowBackground="#FAFAFA"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
CellStyle="{StaticResource SelectedCellStyle}"
ColumnHeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
HorizontalGridLinesBrush="#EEEEEE"
IsReadOnly="True"
ItemsSource="{Binding DataView}"
RowHeight="44"
SelectionMode="Extended"
ItemsSource="{Binding Data}"
SelectionMode="Single"
SelectionUnit="FullRow"
VerticalScrollBarVisibility="Auto">
Style="{StaticResource DefaultDataGridStyle}"
VerticalScrollBarVisibility="Visible">
<DataGrid.Columns>
<!-- 店名 -->
<DataGridTextColumn
@@ -109,6 +50,7 @@
<Button
Margin="5,0,0,0"
Click="CopyOrderId_Click"
Foreground="{StaticResource pageColorBrush}"
ToolTip="复制订单号">
<Button.Style>
<Style BasedOn="{StaticResource IconButtonStyle}" TargetType="Button">
@@ -128,13 +70,6 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- 创建时间 -->
<DataGridTextColumn
Width="1.4*"
Binding="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="创建时间" />
<!-- 金额(分转元) -->
<DataGridTextColumn
Width="*"
@@ -143,7 +78,7 @@
Header="金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding OrderRefundAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
Binding="{Binding RefundAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="退款金额" />
<DataGridTextColumn
@@ -151,33 +86,6 @@
Binding="{Binding OutAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="外采金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding UnrefundedAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="未退回金额" />
<!-- 买手订单:一笔买手订单占一行,不合并 -->
<DataGridTextColumn
Width="1.6*"
Binding="{Binding OutOrderSn}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="买手单号" />
<DataGridTextColumn
Width="*"
Binding="{Binding BuyerOutAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="买手金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding BuyerRefundAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="买手退款" />
<DataGridTextColumn
Width="1.1*"
Binding="{Binding BuyerRefundStatusText}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="退款状态" />
</DataGrid.Columns>
</DataGrid>
</Grid>
@@ -1,17 +1,12 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Ctrls.Statistics.Models;
using _29WxOrderWpf.ToolCtrls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@@ -19,7 +14,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPFCommon.Models;
namespace _29WxOrderWpf.Ctrls.Statistics;
@@ -28,37 +22,10 @@ namespace _29WxOrderWpf.Ctrls.Statistics;
/// </summary>
public partial class ShowOrderDialogView : UserControl
{
private readonly KeyEventHandler shortcutKeyHandler;
public ShowOrderDialogView(List<ShopOrderDetailResponse> list)
public ShowOrderDialogView(List<ShopRevenueStatisticsRow> list)
{
InitializeComponent();
this.DataContext = new ShowOrderDialogViewModel(list);
shortcutKeyHandler = ShowOrderDialogView_PreviewKeyDown;
// 快捷键必须挂到弹窗窗口上:弹窗刚打开时键盘焦点在窗口本身(不在本控件的可视树里),
// 事件路由中就不会有本控件,只在本控件上挂 PreviewKeyDown 的话,
// 必须先用鼠标点一下表格(焦点进到表格里)Ctrl+A/Ctrl+C 才会生效。
Loaded += (s, e) => AttachShortcutHandler();
Unloaded += (s, e) => DetachShortcutHandler();
}
/// <summary>把快捷键处理器挂到所在窗口(隧道事件,焦点在窗口上的任意位置都能收到)</summary>
private void AttachShortcutHandler()
{
Window window = Window.GetWindow(this);
if (window == null)
return;
// 先移除再挂,避免重复挂载后按一次键执行两次
window.RemoveHandler(PreviewKeyDownEvent, shortcutKeyHandler);
window.AddHandler(PreviewKeyDownEvent, shortcutKeyHandler);
}
private void DetachShortcutHandler()
{
Window.GetWindow(this)?.RemoveHandler(PreviewKeyDownEvent, shortcutKeyHandler);
}
/// <summary>
@@ -67,259 +34,27 @@ public partial class ShowOrderDialogView : UserControl
private void CopyOrderId_Click(object sender, RoutedEventArgs e)
{
if (sender is FrameworkElement element
&& element.DataContext is ShopOrderDetailRow row
&& element.DataContext is ShopRevenueStatisticsRow row
&& !string.IsNullOrEmpty(row.OrderId))
{
Window window = Window.GetWindow(this);
try
{
Clipboard.SetDataObject(row.OrderId);
ToastHelper.Show(window, "复制成功");
BaseMsgWindow.ShowAnimateMessage("复制成功");
}
catch (Exception ex)
{
ToastHelper.Show(window, "复制失败 " + ex.Message, type: ToastType.Error);
BaseMsgWindow.ShowError("复制失败 " + ex.Message,window: window);
}
}
}
/// <summary>
/// 弹窗级快捷键:Ctrl+A 全选(筛选后显示的)行,Ctrl+C 复制数据。
/// 焦点在文本框里(如订单号搜索框)时不拦截,保留文本自身的 Ctrl+A/Ctrl+C/Ctrl+V 行为。
/// </summary>
private void ShowOrderDialogView_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Handled || Keyboard.Modifiers != ModifierKeys.Control)
return;
// 文本框(含搜索框)优先,走文本自己的全选/复制/粘贴
if (Keyboard.FocusedElement is TextBoxBase)
return;
if (DataContext is not ShowOrderDialogViewModel viewModel)
return;
if (e.Key == Key.A)
{
SelectAllRows(viewModel);
e.Handled = true;
}
else if (e.Key == Key.C)
{
// 有选中就复制选中的行,没有选中则复制筛选后的全部数据
viewModel.CopyRows(GetSelectedRows());
e.Handled = true;
}
}
/// <summary>
/// Ctrl+A:全选当前筛选后显示的所有行(被过滤掉的行不会选中)。
/// 选中行取自与复制同一份筛选结果,保证“选中的”和“复制的”完全一致。
/// </summary>
private void SelectAllRows(ShowOrderDialogViewModel viewModel)
{
// 让键盘焦点回到表格,全选后仍可用键盘继续操作
dgOrders.Focus();
dgOrders.SelectedItems.Clear();
foreach (var row in viewModel.GetFilteredRows())
{
dgOrders.SelectedItems.Add(row);
}
}
/// <summary>当前选中的行</summary>
private List<ShopOrderDetailRow> GetSelectedRows()
{
return dgOrders.SelectedItems.OfType<ShopOrderDetailRow>().ToList();
}
}
/// <summary>
/// 订单明细表格行:把一个商铺订单按买手订单“展平”成多行(有几笔买手订单就几行,
/// 没有买手订单时占一行且买手字段为空),不把多笔买手订单合并到同一行。
/// 商铺订单级字段(店名/订单号/创建时间/金额等)在多行之间重复,保证每行都是一条完整记录。
/// </summary>
class ShopOrderDetailRow
class ShowOrderDialogViewModel
{
public string ShopName { get; set; }
public string OrderId { get; set; }
public DateTime CreateTime { get; set; }
public int OrderPrice { get; set; }
public int OrderRefundAmount { get; set; }
public int OutAmount { get; set; }
public int UnrefundedAmount { get; set; }
/// <summary>买手(外部)订单号;无买手订单时为空</summary>
public string OutOrderSn { get; set; }
/// <summary>买手订单金额(分)</summary>
public int BuyerOutAmount { get; set; }
/// <summary>买手订单退款金额(分)</summary>
public int BuyerRefundAmount { get; set; }
/// <summary>买手订单退款状态</summary>
public string BuyerRefundStatusText { get; set; }
/// <summary>把接口返回的订单明细按买手订单展平成表格行</summary>
public static List<ShopOrderDetailRow> Flatten(IEnumerable<ShopOrderDetailResponse> list)
public List<ShopRevenueStatisticsRow> Data { get; set; }
public ShowOrderDialogViewModel(List<ShopRevenueStatisticsRow> list)
{
var rows = new List<ShopOrderDetailRow>();
if (list == null)
return rows;
foreach (var item in list)
{
if (item == null)
continue;
if (item.BuyerOrders == null || item.BuyerOrders.Count == 0)
{
rows.Add(Create(item, null));
continue;
}
foreach (var buyerOrder in item.BuyerOrders)
rows.Add(Create(item, buyerOrder));
}
return rows;
}
private static ShopOrderDetailRow Create(ShopOrderDetailResponse item, BuyerOrderInfo buyerOrder)
{
return new ShopOrderDetailRow
{
ShopName = item.ShopName,
OrderId = item.OrderId,
CreateTime = item.CreateTime,
OrderPrice = item.OrderPrice,
OrderRefundAmount = item.OrderRefundAmount,
OutAmount = item.OutAmount,
UnrefundedAmount = item.UnrefundedAmount,
OutOrderSn = buyerOrder == null ? null : buyerOrder.OutOrderSn,
BuyerOutAmount = buyerOrder == null ? 0 : buyerOrder.OutAmount,
BuyerRefundAmount = buyerOrder == null ? 0 : buyerOrder.RefundAmount,
BuyerRefundStatusText = buyerOrder == null ? null : buyerOrder.RefundStatusText,
};
}
}
class ShowOrderDialogViewModel : BindableBaseEx
{
public ObservableCollection<ShopOrderDetailRow> Data { get; set; }
public ICollectionView DataView { get; private set; }
public ShowOrderDialogViewModel(List<ShopOrderDetailResponse> list)
{
// 按买手订单展平:一笔买手订单一一行,不合并
Data = new ObservableCollection<ShopOrderDetailRow>(ShopOrderDetailRow.Flatten(list));
DataView = CollectionViewSource.GetDefaultView(Data);
DataView.Filter = FilterRow;
}
private bool FilterRow(object obj)
{
if (string.IsNullOrWhiteSpace(OrderId))
return true;
if (obj is ShopOrderDetailRow row)
{
return (row.OrderId ?? string.Empty).Contains(OrderId);
}
return false;
}
public string OrderId
{
get => GetValue<string>();
set => SetValue(value, () => DataView.Refresh());
}
/// <summary>当前筛选后显示的行(按表格显示顺序)</summary>
public List<ShopOrderDetailRow> GetFilteredRows()
{
return DataView.Cast<ShopOrderDetailRow>().ToList();
}
/// <summary>
/// 复制指定行到剪贴板(带表头,制表符分隔)。
/// rows 为空时复制筛选后的全部数据;复制结果用提示条反馈。
/// </summary>
public void CopyRows(IEnumerable<ShopOrderDetailRow> rows)
{
List<ShopOrderDetailRow> list = rows?.ToList() ?? new List<ShopOrderDetailRow>();
if (list.Count == 0)
{
// 没有选中行时,复制筛选后的全部数据
list = GetFilteredRows();
}
Window window = Application.Current.Windows
.OfType<Window>()
.FirstOrDefault(w => w.IsActive) ?? Application.Current.MainWindow;
if (list.Count == 0)
{
ToastHelper.Show(window, "没有可复制的数据", type: ToastType.Warning);
return;
}
try
{
string text = BuildCopyText(list);
Application.Current.Dispatcher.Invoke(() => Clipboard.SetText(text));
ToastHelper.Show(window, "复制成功");
}
catch (Exception ex)
{
ToastHelper.Show(window, "复制失败 " + ex.Message, type: ToastType.Error);
}
}
/// <summary>把行拼成制表符分隔的文本(第一行是表头)</summary>
private string BuildCopyText(IEnumerable<ShopOrderDetailRow> rows)
{
var sb = new StringBuilder();
// 表头
sb.AppendLine("店名\t订单\t创建时间\t金额\t退款金额\t外采金额\t未退回金额\t买手单号\t买手金额\t买手退款\t退款状态");
// 数据行
foreach (var item in rows)
{
string shopName = CsvEscape(item.ShopName);
string orderId = item.OrderId;
string createTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm");
string orderPrice = (item.OrderPrice / 100m).ToString("0.00");
string refundAmount = (item.OrderRefundAmount / 100m).ToString("0.00");
string outAmount = (item.OutAmount / 100m).ToString("0.00");
string unrefundedAmount = (item.UnrefundedAmount / 100m).ToString("0.00");
string buyerOrderSn = CsvEscape(item.OutOrderSn);
string buyerOutAmount = (item.BuyerOutAmount / 100m).ToString("0.00");
string buyerRefundAmount = (item.BuyerRefundAmount / 100m).ToString("0.00");
string buyerRefundStatus = CsvEscape(item.BuyerRefundStatusText);
sb.AppendLine($"{shopName}\t{orderId}\t{createTime}\t{orderPrice}\t{refundAmount}\t{outAmount}\t{unrefundedAmount}\t{buyerOrderSn}\t{buyerOutAmount}\t{buyerRefundAmount}\t{buyerRefundStatus}");
}
return sb.ToString();
}
private string CsvEscape(string value)
{
if (string.IsNullOrEmpty(value))
return "";
// 含逗号、引号、换行时,用双引号包起来,内部引号翻倍
if (value.Contains(',') || value.Contains('"') || value.Contains('\n') || value.Contains('\r'))
{
return "\"" + value.Replace("\"", "\"\"") + "\"";
}
return value;
Data = list ?? new List<ShopRevenueStatisticsRow>();
}
}
@@ -1,4 +1,4 @@
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.Ctrls.Statistics.Models;
using _29WxOrderWpf.Ctrls.Statistics.Services;
@@ -39,12 +39,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
private int _totalCount;
private string _pagerText = string.Empty;
/// <summary>是否已完成首次初始化(用于避免页签来回切换时重复初始化、重复查询)</summary>
private bool _initialized;
/// <summary>上一次真正生效(并据此计算过日期)的时间范围选项,避免同一个选项被重复应用</summary>
private TimeRangeOption _appliedTimeRange;
public PeriodRevenueStatisticsViewModel(PeriodStatisticType periodType)
: this(periodType, new ShopRevenueStatisticsService())
{
@@ -71,18 +65,8 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
}
/// <summary>
/// 页面首次显示时初始化查询条件并加载数据(由外层 TabControl 的选中事件调用)。
/// 重复调用(在“综合统计 / 天统计 / 周统计 / 月统计”页签之间来回切换)会被忽略:
/// 否则每次切回来都会把时间范围和店铺重置成默认值,并重新发起一次查询。
/// 需要刷新数据时点“查询”按钮即可。
/// </summary>
public void Init()
{
if (_initialized)
return;
_initialized = true;
InitializeAsync();
}
@@ -188,16 +172,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
set
{
this.SetValue(x => x.SelectedTimeRange, value);
// 只有用户真正切换到“另一个”时间范围选项时才重新计算起止日期。
// 页签切换时下拉框会把同一个选项(甚至先 null 再回写)重放一遍,
// 若照样重算,就会把用户手工调过的日期覆盖掉(例如自定义区间被改回“本周”)。
if (value != null && !ReferenceEquals(_appliedTimeRange, value))
{
_appliedTimeRange = value;
ApplyTimeRange();
}
ApplyTimeRange();
OnPropertyChanged(nameof(IsCustomDateRange));
}
}
@@ -506,28 +481,25 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
}
}
/// <summary>
/// 根据选中店铺生成查询用 ERP 店铺ID 列表(接口 ShopIds 使用 ShopLoginInfo.ErpShopId):
/// 未选/全选/选中“全部店铺”时返回空列表(表示全部店铺)。
/// </summary>
private List<string> BuildSelectedShopIds()
/// <summary>根据选中店铺生成查询店铺 key 列表:未选/全选/选中“全部店铺”时返回空列表(表示全部店铺)</summary>
private List<string> BuildSelectedShopKeys()
{
var selected = SelectedShops;
if (selected == null || selected.Count == 0)
return new List<string>();
var ids = selected.Select(s => s == null ? string.Empty : s.ErpShopId).ToList();
if (ids.Any(string.IsNullOrEmpty))
var keys = selected.Select(s => s == null ? string.Empty : s.AppKey).ToList();
if (keys.Any(string.IsNullOrEmpty))
return new List<string>();
if (selected.Count >= ShopOptions.Count)
return new List<string>();
return ids;
return keys;
}
/// <summary>组装查询参数(起止日期已保证先后顺序)</summary>
private ShopRevenueStatisticsQuery BuildQuery()
/// <summary>执行查询,刷新周期统计表格并回到第一页</summary>
private async Task LoadAsync()
{
if (StartDate > EndDate)
{
@@ -536,23 +508,19 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
EndDate = temp;
}
return new ShopRevenueStatisticsQuery
{
StartDate = StartDate,
EndDate = EndDate,
ShopIds = BuildSelectedShopIds(),
};
}
/// <summary>执行查询,刷新周期统计表格并回到第一页</summary>
private async Task LoadAsync()
{
IsLoading = true;
try
{
var result = await _service.QueryPeriodStatisticsAsync(BuildQuery(), _periodType);
Summary = result.Summary;
_allItems = result.Items ?? new List<ShopPeriodStatisticsItem>();
var query = new ShopRevenueStatisticsQuery
{
StartDate = StartDate,
EndDate = EndDate,
ShopKeys = BuildSelectedShopKeys(),
};
var table = await _service.GetPeriodStatisticsAsync(query, _periodType);
Summary = await _service.GetSummaryAsync(query);
_allItems = table ?? new List<ShopPeriodStatisticsItem>();
TotalCount = _allItems.Count;
TotalPages = TotalCount == 0 ? 1 : (int)Math.Ceiling(TotalCount / (double)PageSize);
GoToPage(1);
@@ -585,51 +553,35 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
private async Task ShowOrderList(string type)
{
var detailType = ParseDetailType(type);
List<ShopOrderDetailResponse> showList;
// 明细接口数据量大、耗时长,期间显示页面统一的加载遮罩,避免点了没反应
IsLoading = true;
try
var query = new ShopRevenueStatisticsQuery
{
showList = await _service.QueryOrderRowsAsync(BuildQuery(), detailType)
?? new List<ShopOrderDetailResponse>();
}
catch (Exception ex)
StartDate = StartDate,
EndDate = EndDate,
ShopKeys = BuildSelectedShopKeys(),
};
var rows = await _service.QueryRowsAsync(query);
List<ShopRevenueStatisticsRow> showList = new List<ShopRevenueStatisticsRow>();
switch (type)
{
MessageBox.Show("订单明细查询失败:" + ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
finally
{
IsLoading = false;
}
if (showList.Count == 0)
{
MessageBox.Show("未查询到符合条件的订单明细。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
case "ValidOrderCount":
showList = RevenueStatisticsAggregator.GetValidOrder(rows);
break; //有效订单
case "RefundOrderCount":
showList = RevenueStatisticsAggregator.GetRefundOrder(rows);
break;//退款订单
case "BuyerRefundRemainingAmount":
showList = RevenueStatisticsAggregator.GetBuyerRefundRemainingOrder(rows);
break;//待退回采购金额
default:
break;
}
new DialogWindow()
{
Title = "订单列表",
Content = new ShowOrderDialogView(showList),
DataContext = showList
DataContext = rows
}.ShowDialog();
}
/// <summary>卡片“明细”按钮参数 → 订单明细类型(对应接口参数 OrderType)</summary>
private static ShopOrderDetailType ParseDetailType(string type)
{
switch (type)
{
case "RefundOrderCount":
return ShopOrderDetailType.Refund; //退款订单
case "BuyerRefundRemainingAmount":
return ShopOrderDetailType.BuyerUnrefunded; //买手未退回金额的订单
default:
return ShopOrderDetailType.Valid; //有效订单
}
}
}
}
@@ -1,4 +1,4 @@
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.Ctrls.Statistics.Models;
using _29WxOrderWpf.Ctrls.Statistics.Services;
@@ -10,9 +10,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Work.BaseForms;
namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
{
@@ -32,9 +30,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
private ObservableCollection<ShopOption> _selectedShops;
private string _selectedPlatform;
/// <summary>上一次真正生效(并据此计算过日期)的时间范围选项,避免同一个选项被重复应用</summary>
private TimeRangeOption _appliedTimeRange;
public ShopRevenueStatisticsViewModel()
: this(new ShopRevenueStatisticsService())
{
@@ -74,16 +69,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
set
{
this.SetValue(x => x.SelectedTimeRange, value);
// 只有用户真正切换到“另一个”时间范围选项时才重新计算起止日期。
// 页签切换时下拉框会把同一个选项(甚至先 null 再回写)重放一遍,
// 若照样重算,就会把用户手工调过的日期覆盖掉。
if (value != null && !ReferenceEquals(_appliedTimeRange, value))
{
_appliedTimeRange = value;
ApplyTimeRange();
}
ApplyTimeRange();
OnPropertyChanged(nameof(IsCustomDateRange));
}
}
@@ -248,66 +234,57 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
}
}
/// <summary>
/// 根据选中店铺生成查询用 ERP 店铺ID 列表(接口 ShopIds 使用 ShopLoginInfo.ErpShopId):
/// 未选/全选/选中“全部店铺”时返回空列表(表示全部店铺)。
/// </summary>
private List<string> BuildSelectedShopIds()
/// <summary>根据选中店铺生成查询店铺 key 列表:未选/全选/选中“全部店铺”时返回空列表(表示全部店铺)</summary>
private List<string> BuildSelectedShopKeys()
{
var selected = SelectedShops;
if (selected == null || selected.Count == 0)
return new List<string>();
var ids = selected.Select(s => s == null ? string.Empty : s.ErpShopId).ToList();
if (ids.Any(string.IsNullOrEmpty))
var keys = selected.Select(s => s == null ? string.Empty : s.AppKey).ToList();
if (keys.Any(string.IsNullOrEmpty))
return new List<string>();
if (selected.Count >= ShopOptions.Count)
return new List<string>();
return ids;
return keys;
}
/// <summary>组装查询参数(起止日期已保证先后顺序)</summary>
private ShopRevenueStatisticsQuery BuildQuery()
/// <summary>执行查询,刷新页面所有统计数据</summary>
private async Task LoadAsync()
{
if (StartDate == EndDate)
{
EndDate = EndDate.AddDays(1).AddSeconds(-1);
}
else if (StartDate > EndDate)
if (StartDate > EndDate)
{
var temp = StartDate;
StartDate = EndDate;
EndDate = temp;
}
return new ShopRevenueStatisticsQuery
{
StartDate = StartDate,
EndDate = EndDate,
ShopIds = BuildSelectedShopIds(),
};
}
/// <summary>执行查询,刷新页面所有统计数据</summary>
private async Task LoadAsync()
{
IsLoading = true;
try
{
var result = await _service.QueryAsync(BuildQuery());
var query = new ShopRevenueStatisticsQuery
{
StartDate = StartDate,
EndDate = EndDate,
ShopKeys = BuildSelectedShopKeys(),
};
Summary = result.Summary;
TrendData = new ObservableCollection<RevenueTrendPoint>(result.Trend ?? new List<RevenueTrendPoint>());
ShopProportionData = new ObservableCollection<ShopSalesProportionItem>(result.ShopProportions ?? new List<ShopSalesProportionItem>());
ShopStatistics = new ObservableCollection<ShopStatisticsItem>(result.ShopStatistics ?? new List<ShopStatisticsItem>());
Summary = await _service.GetSummaryAsync(query);
var trend = await _service.GetSalesTrendAsync(query);
TrendData = new ObservableCollection<RevenueTrendPoint>(trend);
var proportion = await _service.GetShopSalesProportionAsync(query);
ShopProportionData = new ObservableCollection<ShopSalesProportionItem>(proportion);
var table = await _service.GetShopStatisticsAsync(query);
ShopStatistics = new ObservableCollection<ShopStatisticsItem>(table);
}
catch (Exception ex)
catch (Exception)
{
// 查询异常:保留上一次数据,并弹框提示
BaseMsgForm.ShowError("查询失败:" + ex.Message, "提示");
// 查询异常:保留上一次数据,可在此接入日志/错误提示
}
finally
{
@@ -331,53 +308,35 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
private async Task ShowOrderList(string type)
{
var detailType = ParseDetailType(type);
List<ShopOrderDetailResponse> showList;
// 明细接口数据量大、耗时长,期间显示页面统一的加载遮罩,避免点了没反应
IsLoading = true;
try
var query = new ShopRevenueStatisticsQuery
{
showList = await _service.QueryOrderRowsAsync(BuildQuery(), detailType)
?? new List<ShopOrderDetailResponse>();
}
catch (Exception ex)
{
BaseMsgForm.ShowError("订单明细查询失败:" + ex.Message, "提示");
return;
}
finally
{
IsLoading = false;
}
if (showList.Count == 0)
{
BaseMsgForm.ShowInfo("未查询到符合条件的订单明细。", "提示");
return;
}
new DialogWindow(GetWindow())
{
Title = "订单列表",
Content = new ShowOrderDialogView(showList),
DataContext = showList
}.Show();
}
/// <summary>卡片“明细”按钮参数 → 订单明细类型(对应接口参数 OrderType)</summary>
private static ShopOrderDetailType ParseDetailType(string type)
{
StartDate = StartDate,
EndDate = EndDate,
ShopKeys = BuildSelectedShopKeys(),
};
var rows = await _service.QueryRowsAsync(query);
List<ShopRevenueStatisticsRow> showList = new List<ShopRevenueStatisticsRow>();
switch (type)
{
case "ValidOrderCount":
showList = RevenueStatisticsAggregator.GetValidOrder(rows);
break; //有效订单
case "RefundOrderCount":
return ShopOrderDetailType.Refund; //退款订单
showList = RevenueStatisticsAggregator.GetRefundOrder(rows);
break;//退款订单
case "BuyerRefundRemainingAmount":
return ShopOrderDetailType.BuyerUnrefunded; //买手未退回金额的订单
showList = RevenueStatisticsAggregator.GetBuyerRefundRemainingOrder(rows);
break;//待退回采购金额
default:
return ShopOrderDetailType.Valid; //有效订单
break;
}
}
public Func<Window> GetWindow;
new DialogWindow()
{
Title="订单列表",
Content = new ShowOrderDialogView(showList),
DataContext = rows
}.ShowDialog();
}
}
}
+43 -62
View File
@@ -34,9 +34,8 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image
Width="50"
@@ -57,68 +56,48 @@
Foreground="{StaticResource mainColorLightBrush}" />
<WrapPanel
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center">
<Button Click="bt_setting" Style="{StaticResource IconButtonStyle}">
<TextBlock
FontSize="22"
Foreground="{StaticResource mainColorLightBrush}"
Style="{StaticResource TextBlockIcon}"
Text="{StaticResource txt-settings}" />
</Button>
<Border
Width="1"
Height="20"
Margin="10,0"
Background="#b893b2" />
</WrapPanel>
<WrapPanel
Grid.Column="3"
Grid.Column="12"
Margin="0,4,80,0"
HorizontalAlignment="Right"
VerticalAlignment="Top">
<Label
x:Name="lblDebug"
Grid.Column="4"
Margin="2,4,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Content="[release]"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
<Label
x:Name="lblVersion"
Grid.Column="4"
Margin="2,4,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Content="版本信息"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
<UniformGrid Rows="2">
<WrapPanel>
<Label
x:Name="lblDebug"
Margin="2,4,0,0"
Content="[release]"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
<Label
x:Name="lblVersion"
Margin="2,4,0,0"
Content="版本信息"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
</WrapPanel>
<Label
x:Name="lblBalance"
Grid.Column="4"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
d:Content="快递余额:999.99"
Content="{Binding Balance}"
Cursor="Hand"
FontSize="12"
Foreground="#60ff66"
MouseLeftButtonUp="lblBalance_MouseLeftButtonUp"
Opacity="0.7" />
</UniformGrid>
</WrapPanel>
<userctrls:UcWindowBoxes
x:Name="ucWindowBox"
<Label
x:Name="lblBalance"
Grid.Column="4"
Margin="4"
Margin="0,25,80,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
MaxBoxVisibility="Visible" />
VerticalContentAlignment="Center"
Content="{Binding Balance}"
Cursor="Hand"
FontSize="12"
Foreground="#60ff66"
MouseLeftButtonUp="lblBalance_MouseLeftButtonUp"
Opacity="0.7" />
</Grid>
<Grid
x:Name="gridContainer"
@@ -132,12 +111,10 @@
<orderctrls:OrderListCtrl
x:Name="orderListCtrl"
Grid.Column="1"
d:Visibility="Visible"
Visibility="Collapsed" />
<Grid
x:Name="gridPddBuyerOrderReadCtrl"
Grid.ColumnSpan="2"
d:Visibility="Visible"
Background="#7F000000"
MouseLeftButtonUp="gridPddBuyerOrderReadCtrl_MouseLeftButtonUp"
Visibility="Hidden">
@@ -153,17 +130,16 @@
Width="1200"
HorizontalAlignment="Right"
Panel.ZIndex="-1"
d:Visibility="Visible"
Visibility="Collapsed" />
</Border>
</Grid>
<buyerctrls:PDDBuyerSelectCtrl
x:Name="pddBuyerSelectCtrl"
Grid.Column="1"
Width="280"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
d:Visibility="Visible"
Visibility="Collapsed" />
<Grid
x:Name="gridUser"
@@ -183,7 +159,12 @@
</Border>
</Grid>
</Grid>
<userctrls:UcWindowBoxes
x:Name="ucWindowBox"
Margin="4"
HorizontalAlignment="Right"
VerticalAlignment="Top"
MaxBoxVisibility="Visible" />
<Border
x:Name="borderMessage"
+5 -110
View File
@@ -1,7 +1,6 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Ctrls.BuyerCtrls;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using _29WxOrderWpf.Ctrls.Settings;
using _29WxOrderWpf.Windows.LoginWindows;
using AllBase;
using AllBase.DouYinModel.Result;
@@ -41,7 +40,6 @@ using System.Xml.Linq;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.UserForms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace _29WxOrderWpf
{
@@ -91,13 +89,11 @@ namespace _29WxOrderWpf
Task.Run(() =>
{
GetServerShop();
GetShopSupplier(GlobalConfig.ShopLoginList.ToList());
});
});
Task.Run(() =>
{
GetPddBuyer();
GetTaobaoBuyer();
});
});
}
}
protected virtual void OnPropertyChanged(string propertyName)
@@ -352,35 +348,6 @@ namespace _29WxOrderWpf
tList.RemoveAll(ta => ta.IsFaulted || ta.IsCompleted || ta.IsCanceled); Thread.Sleep(100);
}
}
public void GetShopSupplier(List<ShopLoginInfo> shops)
{
// 同步单代发申请,放在拍单时候做
while (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill == false)
{
Thread.Sleep(500);
}
foreach (var shop in shops)
{
var rst = new WxApiBLL().GetShopSupplier(shop);
try
{
var jArr = JsonHelper.JObjectParse(rst)["list"] as JArray;
// appid "wx7809625286c28f2f" name "百川日用";
if (jArr.Any(aa => aa["appid"].ParseToString() == "wx7809625286c28f2f" && aa["status"].ParseToInt() == 1))
//if (rst.Contains("wx7809625286c28f2f") || rst.Contains("百川日用"))
continue;
rst = new WxApiBLL().SetShopSupplier(shop, "wx7809625286c28f2f", "4431685489938137094");
if (!rst.Contains("\"errcode\":0"))
{
//return;
}
}
catch
{ }
}
}
#endregion
#region 读取拼多多买手号
@@ -468,74 +435,9 @@ namespace _29WxOrderWpf
isGetPddBuyer = false;
hasGetPddBuyer = true;
}
#endregion
#endregion
#region 读取拼多多买手号
public bool isGetTaobaoBuyer = false;
public bool hasGetTaobaoBuyer = false;
/// <summary>
/// 读取拼多多买手
/// </summary>
public void GetTaobaoBuyer()
{
if (isGetTaobaoBuyer)
return;
isGetTaobaoBuyer = true;
try
{
var url = BaseClass.Build29WxObjString("user/get_taobao_buyer");
var data = UserLogin.GetSignaturex();
data += "&page_size=200";
var result = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (result.Contains("\"code\":200"))
{
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
foreach (var buyer in GlobalConfig.TaobaoBuyerLoginList.Where(bu => !loginInfoLst.Any(b => b.buyer_id == bu.buyer_id)).ToList())
{
Dispatcher.Invoke(new Action(() => { GlobalConfig.TaobaoBuyerLoginList.Remove(buyer); }));
}
foreach (var b in loginInfoLst)
{
Dispatcher.Invoke(new Action(() =>
{
var buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(bu => bu.buyer_id == b.buyer_id);
if (buyer == null)
GlobalConfig.TaobaoBuyerLoginList.Add(b);
else
{
buyer.add_time = b.add_time;
buyer.buyer_id = b.buyer_id;
buyer.buyer_name = b.buyer_name;
buyer.buyer_nick = b.buyer_nick;
buyer.cookie = b.cookie;
buyer.mdy_time = b.mdy_time;
buyer.notes = b.notes;
buyer.status = b.status;
buyer.user_name = b.user_name;
}
}));
}
}
}
catch
{
}
isGetTaobaoBuyer = false;
hasGetTaobaoBuyer = true;
}
#endregion
private void lblBalance_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
private void lblBalance_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
WXGetBalanceQrCodeForm balanceQrCodeForm = new WXGetBalanceQrCodeForm(StartUp.UpdateBalance);
balanceQrCodeForm.ShowDialog();
@@ -563,12 +465,5 @@ namespace _29WxOrderWpf
this.DragMove();
}
}
private void bt_setting(object sender, RoutedEventArgs e)
{
SettingsView view = new SettingsView();
view.ShowDialog();
}
}
}
}
+2 -7
View File
@@ -20,7 +20,7 @@ namespace _29WxOrderWpf.Services;
/// 礼物单服务
///
/// </summary>
public class ShipGiftService : SingleInstance<ShipGiftService>
public class ShipGiftService: SingleInstance<ShipGiftService>
{
public enum GiftType
{
@@ -42,11 +42,6 @@ public class ShipGiftService : SingleInstance<ShipGiftService>
{
giftAmount = 1.55m;
}
if (BaseClass.Setting.AutoSwitchGiftType && (item.product_price ?? 0) > 6 * 1000)
{
giftAmount = 1.6m;
}
decimal amount = giftAmount + BaseClass.OemGiftAmount;
@@ -83,6 +78,6 @@ public class ShipGiftService : SingleInstance<ShipGiftService>
var ret = await _api.SendShipGift([orderId], (int)giftType, amount, BaseClass.OemGiftAmount);
return ret;
}
}
+1 -13
View File
@@ -1,12 +1,10 @@
using _29WxOrderWpf.ViewModels;
using AllBase;
using AllBase;
using AllBase.DouYinModel.Param.ConfigManage;
using AllBase.Helper;
using AllBase.Model.Config;
using AllBase.Model.DBModel;
using NaiBa.Util;
using NaiBa.Util.Helper;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,16 +26,6 @@ namespace _29WxOrderWpf
if (GlobalConfig.lstWXShopTokenInfo == null)
GlobalConfig.lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
// 自动拍单支付宝密码
var alipayPassword = ConfigHelper.LoadConfig<List<string>>("ali_pay_password")?.FirstOrDefault() ?? "";
GlobalConfig.AutoBuyConfig = ConfigHelper.LoadConfig<AutoBuyConfig>("auto_buy_config");
if (GlobalConfig.AutoBuyConfig == null)
GlobalConfig.AutoBuyConfig = new AutoBuyConfig() { AlipayPassword = alipayPassword, IsLimitMinProfit = false, MinProfit = 0 };
BaseClass.Setting = NaiBa.Util.Helper.ConfigHelper.LoadConfig<SettingConfig>(SettingViewModel.SettingFileName);
if (BaseClass.Setting==null) BaseClass.Setting = new SettingConfig();
new WxOrder.Framework.Startup();
}
@@ -1,41 +1,41 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="mainColorBrush" Color="#FF98638f" />
<SolidColorBrush x:Key="mainColorLightBrush" Color="#f5ebff" />
<SolidColorBrush x:Key="mainColorDarkBrush" Color="#FF6b5393" />
<SolidColorBrush x:Key="mainForegroundColorBrush" Color="#FF666666" />
<LinearGradientBrush x:Key="mainLinearColorBrush" StartPoint="0,0" EndPoint="1,0">
<GradientStop Offset="0.0" Color="#FF98638f" />
<GradientStop Offset="1.0" Color="#FF6b5393" />
</LinearGradientBrush>
<SolidColorBrush x:Key="pageColorBrush" Color="#FF98638f" />
<SolidColorBrush x:Key="pageColorLightBrush" Color="#f5ebff" />
<SolidColorBrush x:Key="pageColorDarkBrush" Color="#FF6b5393" />
<SolidColorBrush x:Key="mainColorBrush" Color="#FF98638f" />
<SolidColorBrush x:Key="mainColorLightBrush" Color="#f5ebff" />
<SolidColorBrush x:Key="mainColorDarkBrush" Color="#FF6b5393" />
<SolidColorBrush x:Key="mainForegroundColorBrush" Color="#FF666666" />
<LinearGradientBrush x:Key="mainLinearColorBrush" StartPoint="0,0" EndPoint="1,0">
<GradientStop Offset="0.0" Color="#FF98638f" />
<GradientStop Offset="1.0" Color="#FF6b5393" />
</LinearGradientBrush>
<SolidColorBrush x:Key="pageColorBrush" Color="#FF98638f" />
<SolidColorBrush x:Key="pageColorLightBrush" Color="#f5ebff" />
<SolidColorBrush x:Key="pageColorDarkBrush" Color="#FF6b5393" />
<SolidColorBrush x:Key="ListCtrlBackColorBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ListHeadBackColorBrush" Color="#FFf8f8f9" />
<SolidColorBrush x:Key="ListHeadBorderColorBrush" Color="#FFe9e9ea" />
<SolidColorBrush x:Key="ListBackColorBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ListRowTitleBackColorBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="ListRowBorderColorBrush" Color="#FFf8f8f9" />
<SolidColorBrush x:Key="ListRowHoverBackColorBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="ListCtrlBackColorBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ListHeadBackColorBrush" Color="#FFf8f8f9" />
<SolidColorBrush x:Key="ListHeadBorderColorBrush" Color="#FFe9e9ea" />
<SolidColorBrush x:Key="ListBackColorBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ListRowTitleBackColorBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="ListRowBorderColorBrush" Color="#FFf8f8f9" />
<SolidColorBrush x:Key="ListRowHoverBackColorBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="HorizontalGridLinesBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="VerticalGridLinesBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="HorizontalGridLinesBrush" Color="#FFf5f7fa" />
<SolidColorBrush x:Key="VerticalGridLinesBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="PageOkBrush" Color="#FF67c23a" />
<SolidColorBrush x:Key="PageOkBrush50" Color="#5067c23a" />
<SolidColorBrush x:Key="PageWarningBrush" Color="#FFfa4733" />
<SolidColorBrush x:Key="PageWarningBrushCC" Color="#CCfa4733" />
<SolidColorBrush x:Key="PageWarningBrush80" Color="#80fa4733" />
<SolidColorBrush x:Key="PageWarningBrush50" Color="#50fa4733" />
<SolidColorBrush x:Key="PageWarningBrush20" Color="#20fa4733" />
<SolidColorBrush x:Key="PageLinkBrush" Color="#409eff" />
<SolidColorBrush x:Key="PageOkBrush" Color="#FF67c23a" />
<SolidColorBrush x:Key="PageOkBrush50" Color="#5067c23a" />
<SolidColorBrush x:Key="PageWarningBrush" Color="#FFfa4733" />
<SolidColorBrush x:Key="PageWarningBrushCC" Color="#CCfa4733" />
<SolidColorBrush x:Key="PageWarningBrush80" Color="#80fa4733" />
<SolidColorBrush x:Key="PageWarningBrush50" Color="#50fa4733" />
<SolidColorBrush x:Key="PageWarningBrush20" Color="#20fa4733" />
<SolidColorBrush x:Key="PageLinkBrush" Color="#409eff" />
<SolidColorBrush x:Key="FlagGrayBrush" Color="#ffaaaaaa" />
<SolidColorBrush x:Key="FlagRedBrush" Color="#FFfa4733" />
<SolidColorBrush x:Key="FlagOrangeBrush" Color="#FFfab533" />
<SolidColorBrush x:Key="FlagGreenBrush" Color="#FF67c23a" />
<SolidColorBrush x:Key="FlagBlueBrush" Color="#409eff" />
<SolidColorBrush x:Key="FlagPurpleBrush" Color="#FFc883bf" />
<SolidColorBrush x:Key="FlagGrayBrush" Color="#ffaaaaaa" />
<SolidColorBrush x:Key="FlagRedBrush" Color="#FFfa4733" />
<SolidColorBrush x:Key="FlagOrangeBrush" Color="#FFfab533" />
<SolidColorBrush x:Key="FlagGreenBrush" Color="#FF67c23a" />
<SolidColorBrush x:Key="FlagBlueBrush" Color="#409eff" />
<SolidColorBrush x:Key="FlagPurpleBrush" Color="#FFc883bf" />
</ResourceDictionary>
-197
View File
@@ -1,197 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- ========== 侧边 TabControl ========== -->
<Style x:Key="SideTabControl" TargetType="TabControl">
<Setter Property="Background" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabControl">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 左侧导航 -->
<Border
Grid.Column="0"
Background="#F7F8FA"
BorderBrush="#E8EAED"
BorderThickness="0,0,1,0">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0,12">
<TextBlock
Margin="20,8,0,16"
FontSize="20"
FontWeight="Bold"
Foreground="{StaticResource mainColorBrush}"
Text="设置" />
<TabPanel IsItemsHost="True" />
</StackPanel>
</ScrollViewer>
</Border>
<!-- 右侧内容 -->
<ScrollViewer
Grid.Column="1"
Padding="0"
VerticalScrollBarVisibility="Auto">
<ContentPresenter ContentSource="SelectedContent" />
</ScrollViewer>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ========== 侧边 TabItem ========== -->
<Style x:Key="SideTabItem" TargetType="TabItem">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border
x:Name="Bd"
Margin="0,2"
Padding="12,10"
Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="Icon"
Grid.Column="0"
Margin="0,0,12,0"
VerticalAlignment="Center"
FontSize="22"
Foreground="{StaticResource mainColorBrush}"
Style="{StaticResource TextBlockIcon}"
Text="{TemplateBinding Tag}" />
<!-- 只给 Header 文字设字号/颜色 -->
<ContentPresenter
x:Name="HeaderHost"
Grid.Column="1"
VerticalAlignment="Center"
ContentSource="Header"
TextElement.FontSize="14"
TextElement.FontWeight="Normal"
TextElement.Foreground="{StaticResource mainColorBrush}" />
<!-- 选中时的右侧小圆点 -->
<Ellipse
x:Name="Dot"
Grid.Column="2"
Width="6"
Height="6"
VerticalAlignment="Center"
Fill="#0078D4"
Visibility="Collapsed" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#ECEEF2" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#E6F0FB" />
<Setter TargetName="Dot" Property="Visibility" Value="Visible" />
<Setter TargetName="HeaderHost" Property="TextElement.Foreground" Value="{StaticResource mainColorBrush}" />
<Setter TargetName="HeaderHost" Property="TextElement.FontWeight" Value="SemiBold" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ========== 设置卡片 ========== -->
<Style x:Key="SettingsCard" TargetType="Border">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="#E8EAED" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="8" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0,0,0,16" />
</Style>
<!-- ========== 设置项行 ========== -->
<Style x:Key="SettingRow" TargetType="Border">
<Setter Property="Padding" Value="16,14" />
<Setter Property="BorderBrush" Value="#F0F1F3" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
</Style>
<!-- ========== 设置项标题 ========== -->
<Style x:Key="SettingTitle" TargetType="TextBlock">
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="#1F2329" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<!-- ========== 设置项说明 ========== -->
<Style x:Key="SettingDesc" TargetType="TextBlock">
<Setter Property="FontSize" Value="12" />
<Setter Property="Foreground" Value="#8A9099" />
<Setter Property="Margin" Value="0,4,0,0" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<!-- ========== 页面标题 ========== -->
<Style x:Key="PageTitle" TargetType="TextBlock">
<Setter Property="FontSize" Value="22" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="#1F2329" />
<Setter Property="Margin" Value="0,0,0,4" />
</Style>
<Style x:Key="PageSubtitle" TargetType="TextBlock">
<Setter Property="FontSize" Value="13" />
<Setter Property="Foreground" Value="#8A9099" />
<Setter Property="Margin" Value="0,0,0,24" />
</Style>
<!-- ========== 开关样式 ========== -->
<Style x:Key="ToggleSwitch" TargetType="CheckBox">
<Setter Property="Width" Value="44" />
<Setter Property="Height" Value="24" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Border
x:Name="Track"
Width="44"
Height="24"
Background="#D0D3D8"
CornerRadius="12">
<Ellipse
x:Name="Thumb"
Width="18"
Height="18"
Margin="3,0,0,0"
HorizontalAlignment="Left"
Fill="White" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Track" Property="Background" Value="#0078D4" />
<Setter TargetName="Thumb" Property="HorizontalAlignment" Value="Right" />
<Setter TargetName="Thumb" Property="Margin" Value="0,0,3,0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Track" Property="Opacity" Value="0.9" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
-161
View File
@@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
namespace _29WxOrderWpf.ToolCtrls;
public enum ToastType { Info, Success, Warning, Error }
/// <summary>
/// 在指定 Window 内显示自动消失的提示框(Toast)
/// 用法:ToastHelper.Show(window, "保存成功", ToastType.Success);
/// </summary>
public static class ToastHelper
{
// 每个 Window 对应一个提示容器,用于多个提示堆叠
private static readonly ConditionalWeakTable<Window, ToastAdorner> Hosts = new();
private static SolidColorBrush msgBrush;
static ToastHelper()
{
msgBrush = Application.Current.Resources["pageColorBrush"] as SolidColorBrush;
msgBrush = Application.Current.Resources["pageColorBrush"] as SolidColorBrush;
}
/// <param name="owner">要展示提示的窗口</param>
/// <param name="message">提示内容</param>
/// <param name="type">类型(决定背景色)</param>
/// <param name="durationMs">停留时长(毫秒,不含淡入淡出)</param>
public static void Show(Window owner, string message,
ToastType type = ToastType.Info, int durationMs = 2000)
{
if (owner == null || string.IsNullOrEmpty(message)) return;
// 允许在非 UI 线程调用
if (!owner.Dispatcher.CheckAccess())
{
owner.Dispatcher.BeginInvoke(new Action(() => Show(owner, message, type, durationMs)));
return;
}
// 窗口还没加载完,等加载后再显示
if (!owner.IsLoaded)
{
RoutedEventHandler handler = null;
handler = (s, e) =>
{
owner.Loaded -= handler;
Show(owner, message, type, durationMs);
};
owner.Loaded += handler;
return;
}
if (owner.Content is not UIElement content) return;
var layer = AdornerLayer.GetAdornerLayer(content);
if (layer == null) return;
if (!Hosts.TryGetValue(owner, out var host))
{
host = new ToastAdorner(content);
layer.Add(host);
Hosts.Add(owner, host);
}
var toast = CreateToast(message, type);
host.Panel.Children.Add(toast);
// 淡入 -> 停留 -> 淡出
var fadeIn = TimeSpan.FromMilliseconds(250);
var fadeOut = TimeSpan.FromMilliseconds(400);
var hold = TimeSpan.FromMilliseconds(Math.Max(durationMs, 0));
var anim = new DoubleAnimationUsingKeyFrames();
anim.KeyFrames.Add(new LinearDoubleKeyFrame(0, TimeSpan.Zero));
anim.KeyFrames.Add(new LinearDoubleKeyFrame(1, fadeIn));
anim.KeyFrames.Add(new LinearDoubleKeyFrame(1, fadeIn + hold));
anim.KeyFrames.Add(new LinearDoubleKeyFrame(0, fadeIn + hold + fadeOut));
anim.Completed += (s, e) =>
{
host.Panel.Children.Remove(toast);
if (host.Panel.Children.Count == 0)
{
layer.Remove(host);
Hosts.Remove(owner);
}
};
toast.BeginAnimation(UIElement.OpacityProperty, anim);
}
private static Border CreateToast(string message, ToastType type)
{
var color = type switch
{
ToastType.Success => Color.FromRgb(0x2E, 0x9E, 0x5B),
ToastType.Warning => Color.FromRgb(0xE6, 0x9A, 0x1A),
ToastType.Error => Color.FromRgb(0xD9, 0x4A, 0x4A),
_ => msgBrush.Color,//Color.FromRgb(0x40, 0x40, 0x40),
};
return new Border
{
Background = new SolidColorBrush(color),
CornerRadius = new CornerRadius(6),
Padding = new Thickness(18, 10, 18, 10),
Margin = new Thickness(0, 0, 0, 8),
Opacity = 0,
MaxWidth = 480,
Effect = new DropShadowEffect
{
BlurRadius = 12,
ShadowDepth = 2,
Opacity = 0.3,
Color = Colors.Black
},
Child = new TextBlock
{
Text = message,
Foreground = Brushes.White,
FontSize = 14,
TextWrapping = TextWrapping.Wrap
}
};
}
/// <summary>覆盖在窗口内容上方的提示容器,顶部居中</summary>
private sealed class ToastAdorner : Adorner
{
public StackPanel Panel { get; }
public ToastAdorner(UIElement adornedElement) : base(adornedElement)
{
IsHitTestVisible = false; // 不拦截鼠标事件
Panel = new StackPanel { Orientation = Orientation.Vertical };
AddVisualChild(Panel);
}
protected override int VisualChildrenCount => 1;
protected override Visual GetVisualChild(int index) => Panel;
protected override Size MeasureOverride(Size constraint)
{
Panel.Measure(constraint);
return AdornedElement.RenderSize;
}
protected override Size ArrangeOverride(Size finalSize)
{
var size = Panel.DesiredSize;
double x = (finalSize.Width - size.Width) / 2;
Panel.Arrange(new Rect(new Point(Math.Max(x, 0), 30), size)); // 距顶部 30
return finalSize;
}
}
}
@@ -1,37 +1,21 @@
<UserControl
x:Class="_29WxOrderWpf.UserControls.UcWaterMarkTextBox"
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.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="28"
d:DesignWidth="100"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<local:WaterMarkVisibilityConverter x:Key="WaterMarkVisibility" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<TextBox
x:Name="txt"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="{Binding TextBorderThickness}"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding Text, Mode=TwoWay}"
TextChanged="txt_TextChanged"
TextWrapping="{Binding TextWrapping}" />
<TextBlock
x:Name="tbWaterMark"
Margin="4,0,4,0"
VerticalAlignment="Center"
Foreground="DarkGray"
IsHitTestVisible="False"
Text="{Binding WaterMark}"
Visibility="{Binding ElementName=txt, Path=Text, Converter={StaticResource WaterMarkVisibility}}" />
</Grid>
<UserControl x:Class="_29WxOrderWpf.UserControls.UcWaterMarkTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d"
d:DesignHeight="28" d:DesignWidth="100">
<UserControl.Resources>
<ResourceDictionary>
<local:WaterMarkVisibilityConverter x:Key="WaterMarkVisibility"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<TextBox x:Name="txt" Text="{Binding Text, Mode=TwoWay}" Style="{StaticResource BaseRoundCornerTextBoxStyle}" BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="{Binding TextBorderThickness}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" TextWrapping="{Binding TextWrapping}" TextChanged="txt_TextChanged"/>
<TextBlock x:Name="tbWaterMark" Text="{Binding WaterMark}" Margin="4,0,4,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="DarkGray"
Visibility="{Binding ElementName=txt,Path=Text,Converter={StaticResource WaterMarkVisibility}}"></TextBlock>
</Grid>
</UserControl>
+33 -77
View File
@@ -1,99 +1,55 @@
<UserControl
x:Class="_29WxOrderWpf.UserControls.UcWindowBoxes"
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.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="Auto"
Height="Auto"
d:DesignHeight="30"
d:DesignWidth="60"
Background="Transparent"
Loaded="WindowBoxes_Loaded"
mc:Ignorable="d">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<UserControl x:Class="_29WxOrderWpf.UserControls.UcWindowBoxes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Width="Auto" Height="Auto"
d:DesignHeight="30" d:DesignWidth="60" Background="Transparent" Loaded="WindowBoxes_Loaded">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--<Border Background="{StaticResource imgBrushCloseHover}" Width="17" Height="17" Margin="4">
<!--<Border Background="{StaticResource imgBrushCloseHover}" Width="17" Height="17" Margin="4">
</Border>
<Border Grid.Column="1" Width="17" Height="17" Margin="4">
<Image Source="{StaticResource imgCloseHover}"/>
</Border>-->
<!-- 不使用静态资源,在用户控件嵌套时,会发生预览错误 -->
<local:UcImageButton
x:Name="btnMin"
Grid.Column="0"
Width="17"
Height="17"
Margin="4"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgMin}"
MouseOverButtonImage="{StaticResource imgMinHover}"
MousePressButtonImage="{StaticResource imgMinHover}" />
<local:UcImageButton
x:Name="btnMax"
Grid.Column="1"
Width="17"
Height="17"
Margin="4"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgMax}"
MouseOverButtonImage="{StaticResource imgMaxHover}"
MousePressButtonImage="{StaticResource imgMaxHover}"
Visibility="Collapsed" />
<local:UcImageButton
x:Name="btnNormal"
Grid.Column="2"
Width="17"
Height="17"
Margin="4"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgNormal}"
MouseOverButtonImage="{StaticResource imgNormalHover}"
MousePressButtonImage="{StaticResource imgNormalHover}"
Visibility="Collapsed" />
<local:UcImageButton
x:Name="btnClose"
Grid.Column="3"
Width="17"
Height="17"
Margin="4"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgClose}"
MouseOverButtonImage="{StaticResource imgCloseHover}"
MousePressButtonImage="{StaticResource imgCloseHover}" />
<!--不使用静态资源,在用户控件嵌套时,会发生预览错误-->
<local:UcImageButton x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
ButtonImage="{StaticResource imgMin}" MouseOverButtonImage="{StaticResource imgMinHover}" MousePressButtonImage="{StaticResource imgMinHover}"/>
<local:UcImageButton x:Name="btnMax" Grid.Column="1" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
ButtonImage="{StaticResource imgMax}" MouseOverButtonImage="{StaticResource imgMaxHover}" MousePressButtonImage="{StaticResource imgMaxHover}"/>
<local:UcImageButton x:Name="btnNormal" Grid.Column="2" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
ButtonImage="{StaticResource imgNormal}" MouseOverButtonImage="{StaticResource imgNormalHover}" MousePressButtonImage="{StaticResource imgNormalHover}"/>
<local:UcImageButton x:Name="btnClose" Grid.Column="3" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
ButtonImage="{StaticResource imgClose}" MouseOverButtonImage="{StaticResource imgCloseHover}" MousePressButtonImage="{StaticResource imgCloseHover}"/>
<!--<local:UcImageButton x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
ButtonImage="/Resources/WindowBoxes/min.png"
<!--<local:UcImageButton x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
ButtonImage="/Resources/WindowBoxes/min.png"
MouseOverButtonImage="/Resources/WindowBoxes/min.hover.png"
MousePressButtonImage="/Resources/WindowBoxes/min.hover.png" />
<local:UcImageButton x:Name="btnMax" Grid.Column="1" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
ButtonImage="/Resources/WindowBoxes/max.png"
ButtonImage="/Resources/WindowBoxes/max.png"
MouseOverButtonImage="/Resources/WindowBoxes/max.hover.png"
MousePressButtonImage="/Resources/WindowBoxes/max.hover.png" />
<local:UcImageButton x:Name="btnNormal" Grid.Column="2" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
ButtonImage="/Resources/WindowBoxes/normal.png"
ButtonImage="/Resources/WindowBoxes/normal.png"
MouseOverButtonImage="/Resources/WindowBoxes/normal.hover.png"
MousePressButtonImage="/Resources/WindowBoxes/normal.hover.png" />
<local:UcImageButton x:Name="btnClose" Grid.Column="3" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
ButtonImage="/Resources/WindowBoxes/close.png"
ButtonImage="/Resources/WindowBoxes/close.png"
MouseOverButtonImage="/Resources/WindowBoxes/close.hover.png"
MousePressButtonImage="/Resources/WindowBoxes/close.hover.png" />-->
<!--<Button x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4">
<!--<Button x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4">
<Border>
<Grid>
<Image Source="/Resources/WindowBoxes/min.png" Stretch="Uniform"/>
@@ -125,5 +81,5 @@
</Grid>
</Border>
</Button>-->
</Grid>
</Grid>
</UserControl>
@@ -1,267 +0,0 @@
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using AllBase;
using AllBase.Helper;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using CefSharp;
using CefSharp.Handler;
using CefSharp.Wpf;
using NaiBa.Util.Extension;
using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using TemuKJD.ToolForms;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.CefTools;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 拼多多买手移动版登录窗口 视图模型(WPF 版 TaobaoLoginForm)
/// </summary>
public class BaiduGetWaybillInfoViewModel : PropertyNotifyObject
{
// 拼多多买手退货退款售后地址
// https://mobile.yangkeduo.com/complaint.html?order_sn=260718-101481213440980&after_sales_reason=0&after_sales_type=2&after_sales_code=1002
public static BaiduGetWaybillInfoViewModel BaiduGetWaybillInfoInstance { get; set; } = null;
/// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary>
public event Action<ChromiumWebBrowser> BrowserCreated;
/// <summary>请求关闭窗口</summary>
public event Action RequestClose;
private string CookieHead { get; set; } = "baidu.com";
public string InitUrl { get; set; } = "";
private string MainUrl = "https://www.baidu.com/";
public ChromiumWebBrowser CefWebBrowser { get; private set; }
private string currentUrl = "";
private volatile bool _isWindowLoaded = false;
#region 界面绑定属性
public oms_wei_order_item_info OrderItem
{
get { return this.GetValue(x => x.OrderItem); }
set { this.SetValue(x => x.OrderItem, value); }
}
/// <summary>地址栏</summary>
public string Address
{
get { return this.GetValue(x => x.Address); }
set { this.SetValue(x => x.Address, value); }
}
/// <summary>物流信息</summary>
public string LatestWaybillStr
{
get { return this.GetValue(x => x.LatestWaybillStr); }
set { this.SetValue(x => x.LatestWaybillStr, value); }
}
public bool IsLoading
{
get { return this.GetValue(x => x.IsLoading); }
set { this.SetValue(x => x.IsLoading, value); }
}
#endregion
#region 命令
public ICommand ReloadCommand { get; }
public ICommand SetRejectStatusCommand { get; }
#endregion
public BaiduGetWaybillInfoViewModel(oms_wei_order_item_info orderItem)
{
IsLoading = true;
BaiduGetWaybillInfoInstance = this;
OrderItem = orderItem;
ReloadCommand = new DelegateCommand(Reload);
SetRejectStatusCommand = new DelegateCommand(SetRejectStatus);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public async Task Start()
{
await AutoLogin();
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
/// <summary>
/// 自动登录店铺后台
/// </summary>
private async Task AutoLogin()
{
_ = Application.Current.Dispatcher.InvokeAsync(async () =>
{
if (CefWebBrowser == null)
{
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(MainUrl, false);
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
CefWebBrowser.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
CefWebBrowser.LifeSpanHandler = lifeSapnHandler;
//CefWebBrowser.KeyboardHandler = new KeyboardHandler();
CefWebBrowser.KeyboardHandler = new CefKeyboardHandler();
CefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
CefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
CefWebBrowser.LoadError += CefWebBrowser_LoadError;
// 通知视图把浏览器加入可视树(必须在等待浏览器初始化之前完成)
BrowserCreated?.Invoke(CefWebBrowser);
}
//chat-submit-button
while (CefWebBrowser == null || CefWebBrowser.IsLoading)
{
Thread.Sleep(100);
}
await Task.Run(() =>
{
Thread.Sleep(4000);
IsLoading = false;
if (string.IsNullOrEmpty(LatestWaybillStr))
{
var jsStr = "document.getElementById('chat-submit-button').click();";
var client = CefWebBrowser.GetDevToolsClient();
if (client != null)
{
client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
}
}
});
});
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
{
}
private void CefWebBrowser_AddressChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (Application.Current?.Dispatcher != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
currentUrl = e.NewValue.ParseToString();
Address = e.NewValue.ParseToString();
}));
}
}
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
{
//js绑定C#对象 html页面内声明绑定的C#对象
StringBuilder sb = new StringBuilder();
sb.Append("(function(){");
sb.Append("CefSharp.BindObjectAsync('shopObj');");
sb.Append("})();");
CefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
return false;
}
private async void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
await DoResourceLoadComplete(url, responseData);
}
private async Task DoResourceLoadComplete(string url, string responseData)
{
if (url.Contains("https://alayn.baidu.com/express/appdetail/pc_express"))
{
await Task.Run(async () =>
{
if (responseData.Contains("\"status\":0"))
{
//jsonp_1790501236188_28581({"status":0,"error_code":0,"msg":"","data":{"context":[{"time":1790324628,"desc":"您的快件已退回签收。如有疑问请联系网点,网点电话:95554,投诉电话:95554。感谢使用圆通速递,期待再次为您服务!","zone":""},{"time":1790324332,"desc":"【广东省广州市番禺区火车南站】的周继双(17396260642)正在为您派件(95161和18521号段的上海号码为圆通快递员专属号码,请放心接听。如遇物流问题,请联系快递员为您解决,或联系网点电话:18521191496,或致电专属客服95554)","zone":""},{"time":1790312940,"desc":"您的快件已经到达【广东省广州市番禺区沙湾】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790287250,"desc":"您的快件离开【佛山转运中心】,已发往【广东省广州市番禺区沙湾】","zone":""},{"time":1790284964,"desc":"您的快件已经到达【佛山转运中心】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790272720,"desc":"您的快件离开【深圳转运中心】,已发往【佛山转运中心】","zone":""},{"time":1790272619,"desc":"您的快件已经到达【深圳转运中心】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790263927,"desc":"您的快件离开【广东省东莞市凤岗】,已发往【深圳转运中心】","zone":""},{"time":1790263156,"desc":"您的快件已经到达【广东省东莞市凤岗】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790257882,"desc":"您的快件已被【广东省东莞市凤岗】安排退回,退回原因:客户要求退回","zone":""},{"time":1790257874,"desc":"发件人拦截,快件将原路退回或更改派送地址!如有疑问请联系【广东省东莞市凤岗】(专属客服电话:95554)","zone":""},{"time":1790164947,"desc":"您的快件已到达[喵站](浸校塘喵站)兔喜快递超市(浸校塘东良巷店),请及时取件,如有取件码问题或找不到包裹等问题,请联系站点:13556614729,或联系快递员:18521194191,或联系网点电话:18521871340,或致电专属客服95554。感谢使用圆通速递,期待再次为您服务!","zone":""},{"time":1790139598,"desc":"【广东省东莞市凤岗】的黎志威(18521194191)正在为您派件(95161和18521号段的上海号码为圆通快递员专属号码,请放心接听。如遇物流问题,请联系快递员为您解决,或联系网点电话:18521871340,或致电专属客服95554)","zone":""},{"time":1790139558,"desc":"您的快件已经到达【广东省东莞市凤岗】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790124801,"desc":"您的快件离开【深圳转运中心】,已发往【广东省东莞市凤岗】","zone":""},{"time":1790124513,"desc":"您的快件已经到达【深圳转运中心】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790111473,"desc":"您的快件离开【佛山转运中心】,已发往【深圳转运中心】","zone":""},{"time":1790111393,"desc":"您的快件已经到达【佛山转运中心】【物流问题请致电(专属热线:95554)更快解决】","zone":""},{"time":1790107910,"desc":"您的快件离开【广东省广州市番禺区火车南站】,已发往【佛山转运中心】","zone":""},{"time":1790104565,"desc":"您的快件在【广东省广州市番禺区火车南站】已揽收,揽收人: 董伟咏(18521870969)【物流问题请致电(专属热线:95554)更快解决】","zone":""}],"status":"1","state":"3","officalService":{"comCode":"yuantong","com":"圆通","comName":"圆通速递","urlDesc":"官网地址:","url":"https://www.yto.net.cn/","logo":"https://cityservice-hb.cdn.bcebos.com/amis/img/b5f54f0b2d6b.png","servicePhoneDesc":"官方电话:","servicePhone":"95554","service":[{"url":"https://www.yto.net.cn/ytoExpress/subCreatePages/create","name":"我要寄件"},{"url":"https://www.yto.net.cn/ytoExpress/querySupport/standardPrice","name":"运价查询"},{"url":"https://online.yto.net.cn/#/","name":"在线客服"}]}}})
LatestWaybillStr = BaseRegex.GetStringJson(ref responseData, "desc");
if (LatestWaybillStr.Contains("退回") || LatestWaybillStr.Contains("拒收") || LatestWaybillStr.Contains("拦截"))
{
if (!LatestWaybillStr.Contains("√"))
LatestWaybillStr = "√ " + LatestWaybillStr;
var transitOrder = OrderItem.ItemTransitOrderWithVoid;
if (transitOrder.has_reject != 99)
{
var url = BaseClass.Build29WxObjString("order/wx_update_transit_order_reject_status");
var data = UserLogin.GetSignaturex();
data += "&order_no=" + OrderItem.order_id;
data += "&order_sku_id=" + OrderItem.sku_id;
data += "&has_reject=" + 99;
var html = GetHtml.PostUtf8(url, data);
transitOrder.has_reject = 99;
OrderListCtrl.InitOrderItemObservableProp(OrderItem);
MainWindow.Instance.Dispatcher.Invoke(() => { MainWindow.Instance.orderListCtrl.FilterOneOrder(OrderItem.ItemOrder); });
}
}
}
});
}
}
private void SetRejectStatus()
{
}
private void Reload()
{
if (CefWebBrowser != null)
{
if (Address != "about:blank")
CefWebBrowser.Load(Address);
else
CefWebBrowser.Load(MainUrl);
}
}
}
}
+4 -10
View File
@@ -76,9 +76,9 @@ public class BuyMapSkuViewModel : PropertyNotifyObject
this.ShopSkuName = orderItem.sku_attr_str;
this.ShopSkuPrice = (orderItem.real_price * 0.01m).ParseToString();
}
if (orderItem?.PddBuyMapSkus != null && orderItem?.PddBuyMapSkus.Count > 0)
if (orderItem?.BuyMapSkus != null && orderItem?.BuyMapSkus.Count > 0)
{
BuyMapSkus = new ObservableCollection<WXBuyMapSkusInfo>(orderItem.PddBuyMapSkus);
BuyMapSkus = new ObservableCollection<WXBuyMapSkusInfo>(orderItem.BuyMapSkus);
SetCurrentFrontSkuInfo3(BuyMapSkus?.FirstOrDefault());
}
}
@@ -91,12 +91,6 @@ public class BuyMapSkuViewModel : PropertyNotifyObject
}
skuInfo.IsChecked = true;
FrontSkuInfos = new ObservableCollection<frontSkuInfo3>(skuInfo?.pdd_front_goods3_Lite.skus);
// 把名称给附上
foreach (var sku in FrontSkuInfos)
{
sku.GoodsNameStr = skuInfo?.pdd_front_goods3_Lite.goodsName;
}
}
/// <summary>
@@ -122,7 +116,7 @@ public class BuyMapSkuViewModel : PropertyNotifyObject
public async Task SetOrderMapSku(frontSkuInfo3 upSku)
{
var mapSkuProd = OrderItem.PddBuyMapSkus.FirstOrDefault(s => s.map_goods_id == upSku.goodsId.ParseToString());
var mapSkuProd = OrderItem.BuyMapSkus.FirstOrDefault(s => s.map_goods_id == upSku.goodsId.ParseToString());
if (mapSkuProd == null)
return;
@@ -225,7 +219,7 @@ public class BuyMapSkuViewModel : PropertyNotifyObject
(item.product_id == map.spu_code && item.out_sku_id == map.sku_code) ||
(item.product_id == map.spu_code && item.sku_attr_str == map.sku_code))
{
item.PddBuyMap = map;
item.BuyMap = map;
item.SetOrderItemTextProperty();
// todo 此处刷新一条可能不够
@@ -1,117 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 更改运单号ViewModel
/// </summary>
public class ChangePickNoViewModel : PropertyNotifyObject
{
public oms_wei_order_item_info OrderItem
{
get { return this.GetValue(x => x.OrderItem); }
set { this.SetValue(x => x.OrderItem, value); }
}
public string PickNo
{
get { return this.GetValue(x => x.PickNo); }
set { this.SetValue(x => x.PickNo, value); }
}
public bool IsChangeingPickNo
{
get { return this.GetValue(x => x.IsChangeingPickNo); }
set { this.SetValue(x => x.IsChangeingPickNo, value); }
}
/// <summary>
/// 请求关闭窗口
/// </summary>
public event Action RequestClose;
#region 命令
public ICommand ChangePickNoCommand { get; }
#endregion
private volatile bool _isWindowLoaded = false;
public ChangePickNoViewModel(oms_wei_order_item_info _orderItem)
{
OrderItem = _orderItem;
IsChangeingPickNo = false;
PickNo = (_orderItem?.ItemOrder?.SyncWaybillPickNo).ParseToString();
ChangePickNoCommand = new DelegateCommand(ChangePickNo);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
_isWindowLoaded = true;
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
public void ChangePickNo()
{
IsChangeingPickNo = false;
string orderId = OrderItem.order_id;
ShopLoginInfo shop = OrderItem.Shop;
if (string.IsNullOrEmpty(PickNo))
{
BaseMsgWindow.ShowInfo("取件码不能为空");
return;
}
Task.Run(async () =>
{
var url4 = BaseClass.Build29WxObjString("vlc/UploadPickup");
var data4 = UserLogin.GetSignPostData(new
{
orderId = OrderItem.DirectPddBuyerOrder.order_sn,
pickupCode = PickNo,
});
var html4 = GetHtml.PostJson(url4, data4);
if (html4.Contains("\"code\":200"))
{
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
OrderItem.ItemOrder.SyncWaybillPickNo = PickNo;
IsChangeingPickNo = false;
BaseMsgWindow.ShowInfo("修改取件码成功");
RequestClose?.Invoke();
}));
}
else
{
BaseMsgWindow.ShowInfo("修改取件码失败" + BaseRegex.GetStringJson(ref html4, "msg"));
}
});
}
}
}
@@ -1,265 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 更改运单号ViewModel
/// </summary>
public class ChangeWaybillViewModel : PropertyNotifyObject
{
public oms_wei_order_item_info OrderItem
{
get { return this.GetValue(x => x.OrderItem); }
set { this.SetValue(x => x.OrderItem, value); }
}
public string WaybillId
{
get { return this.GetValue(x => x.WaybillId); }
set { this.SetValue(x => x.WaybillId, value); }
}
public string CompensationWaybillId
{
get { return this.GetValue(x => x.CompensationWaybillId); }
set { this.SetValue(x => x.CompensationWaybillId, value); }
}
public bool IsChangeingWaybill
{
get { return this.GetValue(x => x.IsChangeingWaybill); }
set { this.SetValue(x => x.IsChangeingWaybill, value); }
}
public bool ChangeWaybillSuccess
{
get { return this.GetValue(x => x.ChangeWaybillSuccess); }
set { this.SetValue(x => x.ChangeWaybillSuccess, value); }
}
/// <summary>
/// 请求关闭窗口
/// </summary>
public event Action RequestClose;
#region 命令
public ICommand ChangeWaybillCommand { get; }
public ICommand SendCompensationDeliveryCommand { get; }
#endregion
private volatile bool _isWindowLoaded = false;
public ChangeWaybillViewModel(oms_wei_order_item_info _orderItem)
{
OrderItem = _orderItem;
//IsChangeingWaybill = true;
ChangeWaybillCommand = new DelegateCommand(ChangeWaybill);
SendCompensationDeliveryCommand = new DelegateCommand(SendCompensationDelivery);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
_isWindowLoaded = true;
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
public void ChangeWaybill()
{
ChangeWaybillSuccess = false;
string orderId = OrderItem.order_id;
ShopLoginInfo shop = OrderItem?.ItemOrder?.Shop;
Task.Run(async () =>
{
// 查询订单是否在代发货中,如果代发需要取消代发
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(shop, orderId, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
{
BaseMsgWindow.ShowError("代发查询失败," + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
return;
}
if (apiSearchDropship.Contains("ds_order_id_list") && !apiSearchDropship.Contains("\"ds_order_id_list\":[]"))
{
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
var apiCancelDropship = await new WxApiBLL().WxApiDropshipCancel(shop, OrderItem?.ItemOrder, dsOrderId);
if (!apiCancelDropship.Contains("\"errcode\":0"))
{
IsChangeingWaybill = false;
BaseMsgWindow.ShowError("取消代发失败!请确商品未加入代发!" + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
return;
}
}
IsChangeingWaybill = true;
var rst = WxSimOrderSendBLL.initDeliveryInfo(shop, orderId);
// {"code":0,"orderDetail":{"commonInfo":{"orderId":"3736582386601580032","orderType":0,"statusStr":"待发货","status":20,"originalStatus":11,"openid":"ow5ty7Kyik_dSqtrivr5hY2t4cwY","createTime":1779540820,"createTimeStr":"2026-05-23 20:53","isPayScoreOrder":false,"isPayDone":true,"isVirtualOrder":false,"isAuthorizedAccount":false,"giftOrderType":"","isInspectOrder":false,"isCommissionOrderDone":false,"isRechargeOrder":false,"isExpediteOrder":false,"isOverTimeOrder":2,"isMultiPackage":false,"inspectType":0,"isGiftOrder":false,"isBuyTogetherOrder":false,"isLotteryOrder":false,"isEducationOrder":false,"hideGiftOrderAddressInfo":false,"cosignmentFlag":1,"isNationalSubsidy":0,"isSameCityOrder":false,"isNationalSubsidyMerchant":false,"isSupplyOrder":false},"orderProducts":{"orderProductInfo":[{"productId":"10000863142394","thumbImg":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/6a092e3a000107862152a36aa881bc1e000000a100004f50","title":"脂砚斋评石头记(全三册) 烫金珍藏版 彩绘绣像 双色印刷","skuId":"15274875174","saleParam":["默认"],"productType":1,"productCnt":1,"salePrice":"3400","spuCode":"9787555418979","skuCode":"BSEC12302592708637555055A","isPreSale":false,"isIflashbuy":false,"isFreeGift":false,"canAfterSale":true,"realPrice":3350,"perRealPrice":3350,"tags":[{"class":"black","desc":"7天无理由","iconUrl":"","mainUrl":"","tagType":4},{"class":"black","desc":"运费险","iconUrl":"","mainUrl":"","tagType":5}],"icons":[],"perExchangeScore":"","productSource":{"show":false},"afterSaleInfo":{"afterId":"","canAfterSale":true,"canNotAfterSaleReason":"","jumpUrl":"","title":"","content":"","afterSaleDoneStr":"","afterSaleDoneAmountStr":"","afterSaleDoneAmount":0,"afterSaleDoneProductCnt":0,"afterSaleIngProductCnt":0,"isGuaranteeIng":false,"hasFakeOnePayFourDoneGuarantee":false},"changeProduct":0,"afterSaleDoneProductCnt":0,"afterSaleIngProductCnt":0,"supplyProductId":"","supplyNickName":"","supplyOrderId":"","supplyAppid":""}],"priceInfo":{"productPrice":"3400","orderPrice":"3350","freight":0,"originalOrderPrice":"3400","estimateProductPrice":"3350","handingFee":"0","maxUnsplitAmount":"3350","totalDiscountedPrice":"50","merchantReceievePrice":"3350","platformActivityMerchantDiscountedPrice":"50"},"activityInfo":{},"presentFee":{}},"acceptInfo":{"decodeSensitiveTime":0,"editAddrInfo":{"applyEditAddrStatus":0,"applyEditAddrAuditStaff":"","applyEditAddrAuditTimeText":"","negotiationEditTextForB":"","negotiationEditTextForA":"","negotiationEditStatus":0,"negotiationEditHistory":[],"canNegotiation":true,"hasUnResolvedRequest":0,"hasHistoryMerchantEditAddr":0,"editHistory":[]},"customerNotes":"","merchantNotes":"","presentNotes":"","addressInfo":{"cityName":"宝鸡市","countyName":"眉县","provinceName":"陕西省","userName":"刘**","telNumber":"187****9569","detailInfo":"****","virtualOrderTelNumber":""},"virtualNumberInfo":{},"quota":{"code":0,"limit":10,"used":10,"hideSensitiveInfo":true},"rechargeData":{"label":"","content":"","deliverMethod":0},"addressErrType":0},"expressInfo":{"phone":"9569","deliveryProductInfo":[],"orderProductCnt":1,"deliveryCnt":0,"isIntracityOrder":false,"intracityTracking":null,"formatUnshippedProductList":[{"productId":"10000863142394","thumbImg":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/6a092e3a000107862152a36aa881bc1e000000a100004f50","title":"脂砚斋评石头记(全三册) 烫金珍藏版 彩绘绣像 双色印刷","skuId":"15274875174","saleParam":["默认"],"productType":1,"productCnt":1,"salePrice":"3400","spuCode":"9787555418979","skuCode":"BSEC12302592708637555055A","isPreSale":false,"isIflashbuy":false,"isFreeGift":false,"canAfterSale":true,"realPrice":3350,"perRealPrice":3350,"tags":[{"class":"black","desc":"7天无理由","iconUrl":"","mainUrl":"","tagType":4},{"class":"black","desc":"运费险","iconUrl":"","mainUrl":"","tagType":5}],"icons":[],"perExchangeScore":"","productSource":1,"afterSaleInfo":{"afterId":"","canAfterSale":true,"canNotAfterSaleReason":"","jumpUrl":"","title":"","content":"","afterSaleDoneStr":"","afterSaleDoneAmountStr":"","afterSaleDoneAmount":0,"afterSaleDoneProductCnt":0,"afterSaleIngProductCnt":0,"isGuaranteeIng":false,"hasFakeOnePayFourDoneGuarantee":false},"changeProduct":0,"afterSaleDoneProductCnt":0,"afterSaleIngProductCnt":0,"supplyProductId":"","supplyNickName":"","supplyOrderId":"","supplyAppid":""}],"product2Img":{"15274875174":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/6a092e3a000107862152a36aa881bc1e000000a100004f50"}},"ewaybillInfo":{"isAllPrintOne":false,"isOpen":false,"deliveryId":"","deliveryName":"","waybillId":""}},"sendAddressInfo":{"userName":"陈图书","postalCode":"","provinceName":"安徽省","cityName":"合肥市","countyName":"肥西县","detailInfo":"上派镇中盟电子产业园8栋一单元(东电梯3楼快递指定存放点)","telNumber":"13023098035","lat":0,"lng":0},"deliveryCompanyOptions":[{"label":"极兔Line truncated
if (!rst.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJsonByRegs(ref rst, rst, "err_msg", "error_msg", "errMsg", "errorMsg", "msg");
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("修改订单物流失败 " + error);
return;
}
var statusStr = BaseRegex.GetStringJson(ref rst, "statusStr");
if (statusStr == "待发货")
{
// 待发货暂不处理
//{"orderId":"3736580679658008320","deliveryProduct":{"deliveryId":"YUNDA","waybillId":"313023381086999","isAllProduct":true,"deliverType":1}}
//{"code":0,"errcode":0,"errmsg":"ok"}
rst = WxSimOrderSendBLL.orderSendOut(shop, orderId, WaybillId);
if (!rst.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJsonByRegs(ref rst, rst, "err_msg", "error_msg", "errMsg", "errorMsg", "msg");
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("修改订单物流失败 " + error);
return;
}
var url = BaseClass.Build29WxObjString("order/wx_update_erp_soft_remark");
var data = UserLogin.GetSignaturex();
if (OrderItem?.ItemOrder != null && !(OrderItem?.ItemOrder?.soft_remark).ParseToString().Contains("已修改物流"))
OrderItem.ItemOrder.soft_remark = ("已修改物流 " + OrderItem.ItemOrder.soft_remark).Trim();
data += "&order_id=" + OrderItem?.ItemOrder?.order_id;
data += "&soft_remark=" + OrderItem?.ItemOrder?.soft_remark;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
ChangeWaybillSuccess = true;
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("修改订单物流成功");
RequestClose?.Invoke();
}));
}
else
{
//{"orderId":"3736580679658008320","changeInfo":[{"old":{"deliveryId":"YUNDA","waybillId":"313023381086999","productInfos":[{"productId":"10000875072190","skuId":"15516018429","productCnt":1}]},"new":{"deliveryId":"OTHER","waybillId":"772064082455686","productInfos":[{"productId":"10000875072190","skuId":"15516018429","productCnt":1}]}}]}
//{"code":0,"errcode":0,"errmsg":""}
var orderExpressInfoObj = JsonHelper.JObjectParse(rst)["orderDetail"]["expressInfo"];
var orderExpressInfo = JsonHelper.DeserializeJsonToObject<WxOrderExpressInfo>(JsonHelper.SerializeObject(orderExpressInfoObj));
UpdateDeliverInfoParam param = new UpdateDeliverInfoParam();
param.orderId = orderId;
param.changeInfo = new List<Dictionary<string, UpdateDeliverChangeInfo>>();
foreach (var deliveryProductInfo in orderExpressInfo.deliveryProductInfo)
{
Dictionary<string, UpdateDeliverChangeInfo> dicChange = new Dictionary<string, UpdateDeliverChangeInfo>();
dicChange["old"] = new UpdateDeliverChangeInfo
{
deliveryId = deliveryProductInfo.deliveryId,
waybillId = deliveryProductInfo.waybillId,
productInfos = new List<UpdateDeliverProductInfo>()
};
dicChange["new"] = new UpdateDeliverChangeInfo
{
deliveryId = "OTHER",
waybillId = WaybillId,
productInfos = new List<UpdateDeliverProductInfo>()
};
foreach (var prod in deliveryProductInfo.productInfos)
{
dicChange["old"].productInfos.Add(new UpdateDeliverProductInfo() { productCnt = prod.productCnt, productId = prod.productId, skuId = prod.skuId });
dicChange["new"].productInfos.Add(new UpdateDeliverProductInfo() { productCnt = prod.productCnt, productId = prod.productId, skuId = prod.skuId });
}
param.changeInfo.Add(dicChange);
}
rst = WxSimOrderSendBLL.updateDeliveryInfo(shop, param);
var str = JsonHelper.SerializeObject(param);
if (!rst.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJsonByRegs(ref rst, rst, "err_msg", "error_msg", "errMsg", "errorMsg", "msg");
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("修改订单物流失败 " + error);
return;
}
var url = BaseClass.Build29WxObjString("order/wx_update_erp_soft_remark");
var data = UserLogin.GetSignaturex();
if (OrderItem?.ItemOrder != null && !OrderItem.ItemOrder.soft_remark.ParseToString().Contains("已修改物流"))
OrderItem.ItemOrder.soft_remark = ("已修改物流 " + OrderItem.ItemOrder.soft_remark).Trim();
data += "&order_id=" + OrderItem?.ItemOrder?.order_id;
data += "&soft_remark=" + OrderItem?.ItemOrder?.soft_remark;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
ChangeWaybillSuccess = true;
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("修改订单物流成功");
RequestClose?.Invoke();
}));
}
});
}
public void SendCompensationDelivery()
{
var orderId = OrderItem.order_id;
var shop = OrderItem?.ItemOrder?.Shop;
// 模拟接口补发
//rst = WxSimOrderSendBLL.orderCompensationDelivery(shop, orderId, "ZTO", WaybillId, OrderItem.product_id, OrderItem.sku_id, OrderItem.sku_cnt.ParseToInt());
var rst = WxSimOrderSendBLL.orderCompensationDelivery(shop, orderId, "OTHER", CompensationWaybillId, OrderItem.product_id, OrderItem.sku_id, OrderItem.sku_cnt.ParseToInt());
var url = BaseClass.Build29WxObjString("order/wx_update_erp_soft_remark");
var data = UserLogin.GetSignaturex();
if (OrderItem?.ItemOrder != null && !OrderItem.ItemOrder.soft_remark.ParseToString().Contains("已补发包裹"))
OrderItem.ItemOrder.soft_remark = ("已补发包裹 " + OrderItem.ItemOrder.soft_remark).Trim();
data += "&order_id=" + OrderItem?.ItemOrder?.order_id;
data += "&soft_remark=" + OrderItem?.ItemOrder?.soft_remark;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!rst.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJsonByRegs(ref rst, rst, "err_msg", "error_msg", "errMsg", "errorMsg", "msg");
IsChangeingWaybill = false;
BaseMsgWindow.ShowError("订单补发失败 " + error);
return;
}
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
ChangeWaybillSuccess = true;
IsChangeingWaybill = false;
BaseMsgWindow.ShowInfo("订单补发成功");
RequestClose?.Invoke();
}));
}
}
}
@@ -1,134 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
using Work.BaseForms;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 更改运单号ViewModel
/// </summary>
public class EWaybillPathViewModel : PropertyNotifyObject
{
public oms_wei_order_info Order
{
get { return this.GetValue(x => x.Order); }
set { this.SetValue(x => x.Order, value); }
}
public string OrderId
{
get { return this.GetValue(x => x.OrderId); }
set { this.SetValue(x => x.OrderId, value); }
}
public string ExpressName
{
get { return this.GetValue(x => x.ExpressName); }
set { this.SetValue(x => x.ExpressName, value); }
}
public string WaybillId
{
get { return this.GetValue(x => x.WaybillId); }
set { this.SetValue(x => x.WaybillId, value); }
}
public bool IsGetWaybillPath
{
get { return this.GetValue(x => x.IsGetWaybillPath); }
set { this.SetValue(x => x.IsGetWaybillPath, value); }
}
public ObservableCollection<oms_wei_ewaybill_path> WaybillPathInfos
{
get { return this.GetValue(x => x.WaybillPathInfos); }
set { this.SetValue(x => x.WaybillPathInfos, value); }
}
/// <summary>
/// 请求关闭窗口
/// </summary>
public event Action RequestClose;
#region 命令
public ICommand GetEWaybillPathCommand { get; }
#endregion
private volatile bool _isWindowLoaded = false;
public EWaybillPathViewModel(oms_wei_order_info _order, string _waybillId, string _expressName)
{
Order = _order;
OrderId = Order?.order_id;
ExpressName = _expressName;
WaybillId = _waybillId;
IsGetWaybillPath = false;
GetEWaybillPathCommand = new DelegateCommand(GetEWaybillPath);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
_isWindowLoaded = true;
GetEWaybillPath();
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
public void GetEWaybillPath()
{
string orderId = Order.order_id;
ShopLoginInfo shop = Order.Shop;
Task.Run(async () =>
{
IsGetWaybillPath = true;
var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_list");
//var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_latest_list");
var data = UserLogin.GetSignaturex();
//data += "&erp_order_id_in=" + order_id;
data += "&waybill_id_in=" + WaybillId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
BaseMsgWindow.ShowError("查询失败请重试");
return;
}
this.WaybillPathInfos = new ObservableCollection<oms_wei_ewaybill_path>(
JsonHelper.DeserializeJsonToList<oms_wei_ewaybill_path>(JObject.Parse(html)["data"].ParseToString()).OrderByDescending(p => p.update_time).ToList());
IsGetWaybillPath = false;
});
}
}
}
@@ -4,12 +4,10 @@ using AllBase;
using AllBase.Helper;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using CefSharp;
using CefSharp.Handler;
using CefSharp.Wpf;
using NaiBa.Util.Extension;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -34,7 +32,7 @@ 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
Dictionary<BuyerLoginInfo, PddPickInfo> dicPddPickInfo = new Dictionary<BuyerLoginInfo, PddPickInfo>();
public static PddMobileLoginViewModel PddMobileLoginInstance { get; set; } = null;
/// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary>
@@ -204,7 +202,7 @@ namespace _29WxOrderWpf.ViewModels
CefWebBrowser.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
CefWebBrowser.LifeSpanHandler = lifeSapnHandler;
CefWebBrowser.KeyboardHandler = new CefKeyboardHandler();
CefWebBrowser.KeyboardHandler = new KeyboardHandler();
CefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
CefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
CefWebBrowser.LoadError += CefWebBrowser_LoadError;
@@ -319,28 +317,6 @@ namespace _29WxOrderWpf.ViewModels
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
var data = responseData;
var send = sender;
if (data.Contains("\"pick_code\":\"取件码") /*|| data.Contains("21-2110")*/)
{
try
{
var combine_track_list = BaseRegex.GetJsonArrStrJson(ref data, "combine_track_list");
var noPickupPackageData = BaseRegex.GetJsonObjStrJson(ref data, "noPickupPackageData").FirstOrDefault();
if (!noPickupPackageData.IsNullOrEmpty() && send is ChromiumWebBrowser cef)
{
var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(buy => buy.wpf_browser == cef);
if (buyer != null)
{
dicPddPickInfo[buyer] = JsonHelper.DeserializeJsonToObject<PddPickInfo>(noPickupPackageData);
}
}
}
catch
{
}
}
if (url.Contains("https://mobile.yangkeduo.com/index.html") && OpenType == EnumOpenType.login)
{
Task.Run(() => { CefWebBrowser.Load("https://mobile.yangkeduo.com/personal.html"); });
@@ -1,40 +0,0 @@
using AllBase.Model.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPFCommon.Models;
namespace _29WxOrderWpf.ViewModels;
public class SettingViewModel : BindableBaseEx
{
public const string SettingFileName = "setting";
public SettingViewModel()
{
}
/// <summary>版本号</summary>
public string Version
{
get => GetValue<string>();
private set => SetValue(value);
}
public bool AutoSwitchGiftType
{
get => GetValue<bool>();
set => SetValue(value);
}
public void Assign(SettingConfig config)
{
AutoSwitchGiftType = config.AutoSwitchGiftType;
}
public SettingConfig ToConfig()
{
return new SettingConfig
{
AutoSwitchGiftType = AutoSwitchGiftType
};
}
}
@@ -1,583 +0,0 @@
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Helper;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using CefSharp;
using CefSharp.Handler;
using CefSharp.Wpf;
using NaiBa.Util.Extension;
using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using TemuKJD.ToolForms;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.CefTools;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 拼多多买手移动版登录窗口 视图模型(WPF 版 TaobaoLoginForm)
/// </summary>
public class TaobaoLoginViewModel : PropertyNotifyObject
{
// 拼多多买手退货退款售后地址
// https://mobile.yangkeduo.com/complaint.html?order_sn=260718-101481213440980&after_sales_reason=0&after_sales_type=2&after_sales_code=1002
public static TaobaoLoginViewModel TaobaoLoginInstance { get; set; } = null;
/// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary>
public event Action<ChromiumWebBrowser> BrowserCreated;
/// <summary>请求关闭窗口</summary>
public event Action RequestClose;
public int CloseAfterSecond { get; set; }
private EnumOpenType _openType = EnumOpenType.manage;
public EnumOpenType OpenType
{
get { return _openType; }
set
{
_openType = value;
OnPropertyChanged(nameof(OpenType));
OnPropertyChanged(nameof(IsLoginMode));
}
}
public string InitUrl { get; set; } = "";
private string shopCookieHead = "taobao.com";
private string buyerLoginUrl = "https://login.taobao.com/havanaone/login/login.htm";
private string buyerMainUrl = "https://i.taobao.com/my_itaobao"; //"https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?";
public ChromiumWebBrowser CefWebBrowser { get; private set; }
private BuyerLoginInfo buyer = null;
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
private string currentUrl = "";
private volatile bool _isWindowLoaded = false;
#region 界面绑定属性
/// <summary>用户名</summary>
public string UserName
{
get { return this.GetValue(x => x.UserName); }
set { this.SetValue(x => x.UserName, value); }
}
/// <summary>密码</summary>
public string PassWord
{
get { return this.GetValue(x => x.PassWord); }
set { this.SetValue(x => x.PassWord, value); }
}
/// <summary>地址栏</summary>
public string Address
{
get { return this.GetValue(x => x.Address); }
set { this.SetValue(x => x.Address, value); }
}
/// <summary>登录成功后关闭窗口</summary>
public bool IsCloseAfterLogin
{
get { return this.GetValue(x => x.IsCloseAfterLogin); }
set { this.SetValue(x => x.IsCloseAfterLogin, value); }
}
/// <summary>登录模式</summary>
public bool IsLoginMode
{
get { return this.GetValue(x => x.IsLoginMode); }
set { this.SetValue(x => x.IsLoginMode, value); }
}
#endregion
#region 命令
public ICommand ReloadCommand { get; }
public ICommand LoginAgainCommand { get; }
public ICommand StopCommand { get; }
public ICommand CopyUserNameCommand { get; }
public ICommand CopyPasswordCommand { get; }
#endregion
public TaobaoLoginViewModel(BuyerLoginInfo buyerInfo)
{
TaobaoLoginInstance = this;
buyer = buyerInfo;
UserName = buyerInfo?.buyer_name;
PassWord = ""; //DataOpenSSL.DecryptString(buyerInfo.Password);
IsCloseAfterLogin = true;
IsLoginMode = OpenType == EnumOpenType.login;
ReloadCommand = new DelegateCommand(Reload);
LoginAgainCommand = new DelegateCommand(LoginAgain);
StopCommand = new DelegateCommand(StopButton);
CopyUserNameCommand = new DelegateCommand(CopyUserName);
CopyPasswordCommand = new DelegateCommand(CopyPassword);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
IsLoginMode = OpenType == EnumOpenType.login;
_isWindowLoaded = true;
if (CloseAfterSecond > 0)
{
Task.Run(() =>
{
Thread.Sleep(1000 * CloseAfterSecond);
if (_isWindowLoaded)
{
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
if (_isWindowLoaded)
RequestClose?.Invoke();
}));
}
});
}
Task.Run(() =>
{
AutoLogin();
});
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
/// <summary>
/// 自动登录店铺后台
/// </summary>
private async void AutoLogin()
{
if (OpenType != EnumOpenType.login && buyer == null)
return;
_ = Application.Current.Dispatcher.InvokeAsync(async () =>
{
if (CefWebBrowser == null)
{
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(buyerMainUrl, false);
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
CefWebBrowser.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
CefWebBrowser.LifeSpanHandler = lifeSapnHandler;
//CefWebBrowser.KeyboardHandler = new KeyboardHandler();
CefWebBrowser.KeyboardHandler = new CefKeyboardHandler();
CefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
CefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
CefWebBrowser.LoadError += CefWebBrowser_LoadError;
// 通知视图把浏览器加入可视树(必须在等待浏览器初始化之前完成)
BrowserCreated?.Invoke(CefWebBrowser);
List<Cookie> cookieLst = new List<Cookie>();
try
{
if (buyer != null)
{
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(buyer?.cookie);
if (cookieLst == null)
cookieLst = new List<Cookie>();
}
}
catch
{
}
// cef138必须init后方可设置或删除cookie
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
await Task.Delay(20);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
foreach (var cook in cookieLst)
{
await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
//t.Wait(5000);
}
//根据登录的具体店铺设置local storage
if (!string.IsNullOrEmpty(buyer?.buyer_id))
{
//var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//storageJsCode += "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
// Thread.Sleep(20);
//CefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
}
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser.Load(InitUrl);
else
CefWebBrowser.Load(buyerMainUrl);
//不是登录的话就此返回
if (OpenType != EnumOpenType.login)
{
return;
}
for (int i = 0; i < 50; i++)
{
if (CefWebBrowser.IsLoading)
await Task.Delay(100);
}
await Task.Delay(Randomx.GetId(1500, 2000));
if (!_isWindowLoaded)
return;
while (!CefWebBrowser.Address?.StartsWith(buyerLoginUrl) ?? false)
{
await Task.Delay(1000);
if (!_isWindowLoaded)
return;
}
}
});
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
{
}
private void CefWebBrowser_AddressChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (Application.Current?.Dispatcher != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
currentUrl = e.NewValue.ParseToString();
Address = e.NewValue.ParseToString();
}));
}
}
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
{
//js绑定C#对象 html页面内声明绑定的C#对象
StringBuilder sb = new StringBuilder();
sb.Append("(function(){");
sb.Append("CefSharp.BindObjectAsync('shopObj');");
sb.Append("})();");
CefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
return false;
}
private async void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
await DoResourceLoadComplete(url, responseData);
}
private async Task DoResourceLoadComplete(string url, string responseData)
{
//if (url.Contains(buyerLoginUrl) && OpenType == EnumOpenType.login)
//{
// Task.Run(() => { CefWebBrowser.Load(buyerLoginUrl); });
//}
var data = responseData;
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
//{"api":"mtop.user.getUserSimple","v":"1.0","ret":["SUCCESS::调用成功"],"data":{"nick":"jtt_fan","userNumId":440631048,"displayNick":"jtt_fan"}}
}
if (url.Contains(buyerMainUrl) || (data.Contains("\"displayNick\"") && data.Contains("\"nick\"") && data.Contains("\"userNumId\"")))
{
if (OpenType == EnumOpenType.login)
{
await Task.Run(async () =>
{
if (data.Contains("\"ret\":[\"SUCCESS::调用成功\"]"))
{
var uid = BaseRegex.GetStringJson(ref data, "userNumId");
var nickname = BaseRegex.GetStringJson(ref data, "displayNick");
var username = nickname;
if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(uid) && !isAddOrUpdateBuyer)
{
isAddOrUpdateBuyer = true;
try
{
AddOrUpdateBuyer(uid, username, nickname);
}
catch
{
}
isAddOrUpdateBuyer = false;
}
}
});
}
}
}
bool isAddOrUpdateBuyer = false;
void AddOrUpdateBuyer(string uid, string username, string nickname)
{
Thread.Sleep(2000);
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
var buyerUrl = BaseClass.Build29WxObjString("user/add_taobao_buyer");
if (this.buyer == null || this.buyer.buyer_id != uid)
this.buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(b => b.buyer_id == uid);
if (this.buyer != null)
{
this.buyer.user_name = username;
this.buyer.buyer_nick = nickname;
this.buyer.cookie = JsonHelper.SerializeObject(cookieList);
buyerUrl = BaseClass.Build29WxObjString("user/mdy_taobao_buyer");
}
var buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&buyer_name=" + username
+ "&buyer_nick=" + nickname;
var result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
buyerUrl = BaseClass.Build29WxObjString("user/mdy_taobao_buyer_cookie");
buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&status=" + "在线"
+ "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
try
{
if (IsCloseAfterLogin)
RequestClose?.Invoke();
}
catch (Exception ex)
{ }
}));
}
private void StopButton()
{
}
private void CopyUserName()
{
if (!string.IsNullOrEmpty(UserName))
Clipboard.SetDataObject(UserName);
}
private void CopyPassword()
{
if (!string.IsNullOrEmpty(PassWord))
Clipboard.SetDataObject(PassWord);
}
private void Reload()
{
if (CefWebBrowser != null)
{
if (Address != "about:blank")
CefWebBrowser.Load(Address);
else
CefWebBrowser.Load(buyerMainUrl);
}
}
private void LoginAgain()
{
if (this.currentUrl != buyerLoginUrl)
this.CefWebBrowser?.Load(buyerLoginUrl);
}
#region 静态方法(检测/更新买手登录状态)
public static void CheckBuyerLogin(List<BuyerLoginInfo> checkBuyers, bool isShowProgress = true)
{
for (int i = 0; i < checkBuyers.Count; i++)
{
var buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(v => v.buyer_id == checkBuyers[i].buyer_id);
var buys = GlobalConfig.TaobaoBuyerLoginList.Where(v => v.buyer_id == checkBuyers[i].buyer_id).ToList();
if (buyer == null)
continue;
// 先从服务端取最新cookie
var url = BaseClass.Build29WxObjString("user/get_taobao_buyer");
var data = UserLogin.GetSignaturex();
data += "&buyer_ids=" + buyer.buyer_id;
data += "&page_size=1";
var result = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
continue;
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
var serverBuyer = loginInfoLst.FirstOrDefault();
if (buyer != null && serverBuyer != null)
{
buyer.cookie = serverBuyer.cookie;
foreach (var buy in buys)
{
buy.cookie = serverBuyer.cookie;
}
}
if (buyer != null)
{
return;
var loginResult = CheckBuyerLogin(buyer);
if (!loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true") && !loginResult.Contains("\"nickname\""))
{
buyer.cookie = "[]";
foreach (var buy in buys)
{
buy.status = "掉线";
buy.cookie = "[]";
}
}
else
{
foreach (var buy in buys)
{
buy.status = "在线";
}
}
UpdateServerBuyerCookies(buyer); // 店铺cookie和状态写入服务端
}
}
}
public static string CheckBuyerLogin(BuyerLoginInfo buyer, string refere = "https://mobile.yangkeduo.com/goods.html")
{
string url = "https://mobile.yangkeduo.com/proxy/api/api/apollo/v3/user/me?pdduid=" + buyer.buyer_id;
return HttpResponseYkdBLL.YangkeduoGetResponse(buyer, url, refere);
}
public static string UpdateServerBuyerCookies(BuyerLoginInfo buyer, string fromTool = null)
{
var url = BaseClass.Build29WxObjString("user/mdy_taobao_buyer_cookie");
var data = UserLogin.GetSignaturex()
+ "&status=" + buyer.status
+ "&cookie=" + GetHtml.UrlEncodeUtf8(buyer.cookie)
+ "&buyer_id=" + buyer.buyer_id;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
return result;
}
/// <summary>
/// 设置淘宝店铺掉线
/// </summary>
/// <param name="buyer"></param>
/// <param name="fromTool"></param>
/// <returns></returns>
public static string UpdateServerBuyerDisconnect(BuyerLoginInfo buyer, string fromTool = null)
{
//buyer.status = "掉线";
//buyer.cookie = "[]";
//var url = BaseClass.Build29WxObjString("user/mdy_taobao_buyer_cookie");
//var data = UserLogin.GetSignaturex()
// + "&status=" + "掉线"
// + "&cookie=" + "[]"
// + "&buyer_id=" + buyer.buyer_id;
//var result = GetHtml.PostUtf8(url, data);
//if (!result.Contains("\"code\":200"))
// result = GetHtml.PostUtf8(url, data);
//return result;
return "";
}
#endregion
}
internal class CefKeyboardHandler : IKeyboardHandler
{
public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey)
{
if (type == KeyType.KeyUp && Enum.IsDefined(typeof(System.Windows.Forms.Keys), windowsKeyCode))
{
var key = (System.Windows.Forms.Keys)windowsKeyCode;
switch (key)
{
case System.Windows.Forms.Keys.F12:
browser.ShowDevTools();
break;
case System.Windows.Forms.Keys.F5:
if (modifiers == CefEventFlags.ControlDown)
{
//MessageBox.Show("ctrl+f5");
browser.Reload(true); //强制忽略缓存
}
else
{
//MessageBox.Show("f5");
browser.Reload();
}
break;
}
}
return false;
}
public bool OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
{
return false;
}
}
}
@@ -1,171 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using AllBase;
using AllBase.Helper;
using AllBase.Model.Config;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 更改运单号ViewModel
/// </summary>
public class TransitExtraPackagesViewModel : PropertyNotifyObject
{
public oms_wei_order_info Order
{
get { return this.GetValue(x => x.Order); }
set { this.SetValue(x => x.Order, value); }
}
public oms_wei_order_item_info OrderItem
{
get { return this.GetValue(x => x.OrderItem); }
set { this.SetValue(x => x.OrderItem, value); }
}
public string purchaserNote
{
get { return this.GetValue(x => x.purchaserNote); }
set { this.SetValue(x => x.purchaserNote, value); }
}
public string WaybillId
{
get { return this.GetValue(x => x.WaybillId); }
set { this.SetValue(x => x.WaybillId, value); }
}
public bool IsChangeingWaybill
{
get { return this.GetValue(x => x.IsChangeingWaybill); }
set { this.SetValue(x => x.IsChangeingWaybill, value); }
}
public bool ChangeWaybillSuccess
{
get { return this.GetValue(x => x.ChangeWaybillSuccess); }
set { this.SetValue(x => x.ChangeWaybillSuccess, value); }
}
/// <summary>
/// 请求关闭窗口
/// </summary>
public event Action RequestClose;
#region 命令
public ICommand AddExtraPackagesCommand { get; }
#endregion
private volatile bool _isWindowLoaded = false;
public TransitExtraPackagesViewModel(oms_wei_order_info _order, oms_wei_order_item_info _orderItem)
{
Order = _order;
OrderItem = _orderItem;
AddExtraPackagesCommand = new DelegateCommand(AddExtraPackages);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
_isWindowLoaded = true;
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
public void AddExtraPackages()
{
var transitOrder = OrderItem.ItemTransitOrder ?? OrderItem.ItemTransitOrderWithVoid;
var transitExtraOrder = OrderItem.ItemTransitExtraOrders.FirstOrDefault(t => t.order_void_status != 1);
if (transitExtraOrder != null)
{
BaseMsgWindow.ShowError("有尚未作废的补发订单,请作废后再创建");
return;
}
string basePostageKey = WarehousePostageInfo.DicWarehousePostage.Keys.FirstOrDefault(pk => (OrderItem.ItemOrder?.province_name).ParseToString().Contains(pk));
decimal basePostage = basePostageKey.IsNullOrEmpty() ? WarehousePostageInfo.DicWarehousePostage.Values.Min() : WarehousePostageInfo.DicWarehousePostage[basePostageKey];
JObject body = new JObject();
body["oemAmount"] = (BaseClass.PostagePerOrderDiff * 100).ParseToInt().ParseToString();
body["postage"] = ((basePostage + BaseClass.PostagePerOrderDiff) * 100).ParseToInt().ParseToString();
body["packType"] = "2";
body["batchId"] = transitOrder.order_code + "-" + ((OrderItem.ItemTransitExtraOrders?.Count).ParseToInt() + 1);
body["orderNo"] = OrderItem.order_id;
body["orderCode"] = transitOrder.order_code;
// 未出库填上游物流,已出库填下游物流
if (transitOrder.warehouse_status != 2)
{
body["logisticsCode"] = transitOrder.express_1_company;
body["logisticsExpressCode"] = transitOrder.express_1_waybill;
}
else
{
body["logisticsCode"] = transitOrder.express_2_company;
body["logisticsExpressCode"] = transitOrder.express_2_waybill;
}
body["accountUser"] = BaseClass.UserName;
body["purchaserNote"] = purchaserNote.ParseToString(); // 采购人备注
body["orderPlatformCode"] = "WEISHOP";
var url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/extra-packages/save";
var dataStr = JsonHelper.SerializeObject(body);
//<AjaxResult><msg>parentOrderCode不能为空</msg><code>2</code></AjaxResult>
//<AjaxResult><msg>创建额外包裹异常: Cannot invoke "cn.qihangerp.oms.domain.SecondUser.getBalance()" because "secondUser" is null</msg><code>2</code></AjaxResult>
var rst = HttpResponseWXBLL.e57PostResponse(url, dataStr, "");
//3739278903964250368
// <AjaxResult><msg>创建额外包裹异常: 用户账户余额不足,需至少 2.20 元用于中转仓取号, userId:17333276316, balance:0.85</msg><code>2</code></AjaxResult>
if (BaseRegex.GetStringXml(ref rst, "code") != "0" && BaseRegex.GetStringXml(ref rst, "code") != "200")
{
BaseMsgWindow.ShowError(BaseRegex.GetStringXml(ref rst, "msg"));
return;
}
var data = new JObject();
data["batchId"] = body["batchId"];
data["orderCode"] = body["orderCode"];
dataStr = JsonHelper.SerializeObject(data);
url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/thirdparty/extraPackages";
rst = HttpResponseWXBLL.e57PostResponse(url, dataStr, "");
// <AjaxResult><msg>额外信息已保存</msg><code>200</code></AjaxResult>
if (BaseRegex.GetStringXml(ref rst, "code") != "0" && BaseRegex.GetStringXml(ref rst, "code") != "200")
{
BaseMsgWindow.ShowError(BaseRegex.GetStringXml(ref rst, "msg"));
return;
}
Task.Run(() =>
{
StartUp.UpdateBalance();
MainWindow.Instance.orderListCtrl.GetOrder(OrderItem.order_id);
});
RequestClose?.Invoke();
}
}
}
@@ -1,136 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.AutoBuyIntroductionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:UserControls="clr-namespace:_29WxOrderWpf.UserControls"
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="AutoBuyInstructionView"
Width="800"
Height="450"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.ShowMinButton="False"
d:DesignHeight="450"
d:DesignWidth="800"
Loaded="AutoBuyInstructionView_Loaded"
mc:Ignorable="d">
<Grid Background="White">
<TextBlock
Margin="70,83,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Text="请输入支付宝支付密码:"
TextWrapping="Wrap" />
<PasswordBox
x:Name="pbxPassWord"
Width="169"
Height="24"
Margin="198,79,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
PasswordChanged="pbxPassWord_PasswordChanged" />
<TextBox
x:Name="txtPassWord"
Width="149"
Height="24"
Margin="198,79,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
d:IsHitTestVisible="True"
d:Opacity="0.3"
d:Text="明文密码"
d:Visibility="Visible"
BorderBrush="Transparent"
IsHitTestVisible="True"
TextChanged="txtPassWord_TextChanged"
Visibility="Collapsed" />
<Button
x:Name="btnSee"
Width="18"
Height="18"
Margin="347,82,0,0"
Padding="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Click="btnSee_Click"
Content="👁"
Cursor="Hand"
Foreground="{StaticResource PageLinkBrush}" />
<Button
x:Name="btnSaveAliPass"
Width="Auto"
Height="22"
MinWidth="48"
Margin="372,80,0,0"
Padding="4,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="btnSaveAliPass_Click"
Content="保存密码"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}"
Visibility="Visible" />
<Button
x:Name="btnClear"
Width="Auto"
Height="22"
MinWidth="48"
Margin="433,80,0,0"
Padding="4,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="btnClear_Click"
Content="清空密码"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="Visible" />
<WrapPanel Margin="70,120,70,70" VerticalAlignment="Top">
<CheckBox
x:Name="chkMinProfitAutoBuy"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkMinProfitAutoBuy_Click"
Content="当利润低于如下金额时跳过自动拍单:"
FontSize="12" />
<TextBox
x:Name="txtMinProfitAutoBuy"
Width="54"
Height="22"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
d:Text="0.0"
d:Visibility="Visible"
TextChanged="txtMinProfitAutoBuy_TextChanged" />
<TextBlock Margin="3,0,0,0" VerticalAlignment="Center">
元
</TextBlock>
<Button
x:Name="btnSaveMinProfitAutoBuy"
Width="Auto"
Height="22"
MinWidth="48"
Margin="5,0"
Padding="4,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="btnSaveMinProfitAutoBuy_Click"
Content="确定修改"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}"
Visibility="Visible" />
</WrapPanel>
<TextBlock Margin="70,160,70,70" TextWrapping="Wrap"><Run Text="说明:" /><Run Text="自动拍单支持已创建sku关联的商品" /><Run Language="zh-cn" Text="。" /><LineBreak /><Run Text=" " /><Run Text="请保存支付宝支付密码(仅记录在本地)供自动拍单支付,首次自动拍单前请手动拍单一次以缓存支付宝Cookie。" /></TextBlock>
</Grid>
</UserControl>
@@ -1,95 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using AllBase.Helper;
using AllBase.Model.DBModel;
using NaiBa.Util;
using NaiBa.Util.Extension;
using NaiBa.Util.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Work.Pinduoduo;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// AutoBuyInstructionView_.xaml 的交互逻辑
/// </summary>
public partial class AutoBuyIntroductionView : UserControl
{
public AutoBuyIntroductionView()
{
InitializeComponent();
}
private void AutoBuyInstructionView_Loaded(object sender, RoutedEventArgs e)
{
this.pbxPassWord.Password = DataOpenSSL.DecryptString(GlobalConfig.AutoBuyConfig.AlipayPassword);
this.chkMinProfitAutoBuy.IsChecked = GlobalConfig.AutoBuyConfig.IsLimitMinProfit;
this.txtMinProfitAutoBuy.Text = "" + GlobalConfig.AutoBuyConfig.MinProfit * 0.01m;
}
private void btnSaveAliPass_Click(object sender, RoutedEventArgs e)
{
GlobalConfig.AutoBuyConfig.AlipayPassword = DataOpenSSL.EncryptString(this.pbxPassWord.Password);
ConfigHelper.SaveConfig("auto_buy_config", GlobalConfig.AutoBuyConfig);
BaseMsgWindow.ShowInfo("密码保存成功!");
}
private void btnClear_Click(object sender, RoutedEventArgs e)
{
this.pbxPassWord.Password = "";
GlobalConfig.AutoBuyConfig.AlipayPassword = "";
ConfigHelper.SaveConfig("auto_buy_config", GlobalConfig.AutoBuyConfig);
BaseMsgWindow.ShowInfo("密码已清除!");
}
private void btnSee_Click(object sender, RoutedEventArgs e)
{
if (txtPassWord.Visibility == Visibility.Visible)
txtPassWord.Visibility = Visibility.Collapsed;
else
txtPassWord.Visibility = Visibility.Visible;
}
private void pbxPassWord_PasswordChanged(object sender, RoutedEventArgs e)
{
if (txtPassWord.Text != pbxPassWord.Password)
txtPassWord.Text = pbxPassWord.Password;
}
private void txtPassWord_TextChanged(object sender, TextChangedEventArgs e)
{
if (txtPassWord.Text != pbxPassWord.Password)
pbxPassWord.Password = txtPassWord.Text;
}
private void txtMinProfitAutoBuy_TextChanged(object sender, TextChangedEventArgs e)
{
}
private void chkMinProfitAutoBuy_Click(object sender, RoutedEventArgs e)
{
}
private void btnSaveMinProfitAutoBuy_Click(object sender, RoutedEventArgs e)
{
GlobalConfig.AutoBuyConfig.IsLimitMinProfit = chkMinProfitAutoBuy.IsChecked ?? false;
GlobalConfig.AutoBuyConfig.MinProfit = (txtMinProfitAutoBuy.Text.ParseToDecimal() * 100).ParseToInt();
ConfigHelper.SaveConfig("auto_buy_config", GlobalConfig.AutoBuyConfig);
BaseMsgWindow.ShowInfo("自动拍单最低利润配置成功!");
}
}
}
@@ -1,110 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.BaiduGetWaybillInfoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
x:Name="baiduGetWaybillInfoView"
Width="1200"
Height="600"
MinWidth="800"
MinHeight="600"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.ShowMinButton="False"
comn:DialogWindowProperty.Width="1200"
Loaded="BaiduGetWaybillInfoView_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</UserControl.Resources>
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Height="420" VerticalAlignment="Center">
<Image
x:Name="imgLoading"
Width="20"
Height="20"
Margin="10"
HorizontalAlignment="Left"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsLoading, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0"
To="360"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<TextBlock
Margin="50,0"
VerticalAlignment="Center"
FontSize="18"
Text="{Binding LatestWaybillStr}"
TextWrapping="Wrap" />
</Grid>
<GridSplitter
Grid.Row="1"
Height="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#d0d0d0"
ResizeBehavior="PreviousAndNext"
ShowsPreview="True" />
<!-- 地址栏 -->
<Border
Grid.Row="2"
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="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True" />
</Grid>
</Grid>
</UserControl>
@@ -1,63 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// 百度获取物流信息窗口
/// </summary>
public partial class BaiduGetWaybillInfoView : UserControl
{
/// <summary>视图模型</summary>
public BaiduGetWaybillInfoViewModel ViewModel { get; }
public BaiduGetWaybillInfoView(oms_wei_order_item_info orderItem)
{
InitializeComponent();
ViewModel = new BaiduGetWaybillInfoViewModel(orderItem);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private async void BaiduGetWaybillInfoView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void BaiduGetWaybillInfoView_Closed(object sender, System.EventArgs e)
{
ViewModel.Stop();
}
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);
}
}
}
}
-84
View File
@@ -1,84 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.ChangePickNoView"
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.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="changePickNoView"
Width="450"
Height="300"
d:DesignHeight="300"
d:DesignWidth="450"
Loaded="ChangeWaybillView_Loaded"
mc:Ignorable="d">
<Grid Background="White">
<StackPanel Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="添加/更改取件码" />
<StackPanel>
<TextBlock
Margin="0,0,0,8"
Foreground="#555555"
Text="填写取件码:" />
<TextBox
x:Name="txtPickNo"
Height="38"
VerticalContentAlignment="Center"
d:Text="1111"
BorderBrush="#D0D0D0"
BorderThickness="1"
FontSize="18"
Text="{Binding PickNo, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<WrapPanel Margin="0,10,0,0" FlowDirection="RightToLeft">
<Button
Width="72"
Height="26"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Click="Button_Click_1"
Command="{Binding ChangePickNoCommand}"
Content="修改取件码"
Style="{StaticResource BasePageButtonStyle}" />
<Image
x:Name="imgLoading"
Width="20"
Height="20"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsChangeingPickNo, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="360"
To="0"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</WrapPanel>
<TextBlock
d:Text="如有需要,显示消息"
Text=""
TextWrapping="Wrap" />
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
@@ -1,63 +0,0 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Helper;
using AllBase.Model.DBModel;
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.Views;
/// <summary>
/// ChangeWaybillView.xaml 的交互逻辑
/// </summary>
public partial class ChangePickNoView : UserControl
{
/// <summary>
/// 视图模型
/// </summary>
public ChangePickNoViewModel ViewModel { get; }
public ChangePickNoView(oms_wei_order_item_info _orderItem)
{
InitializeComponent();
ViewModel = new ChangePickNoViewModel(_orderItem);
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void ChangeWaybillView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void ChangeWaybillView_Closed(object sender, RoutedEventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
MainWindow.Instance.orderListCtrl.FilterOneOrder(ViewModel.OrderItem.ItemOrder);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
}
-132
View File
@@ -1,132 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.ChangeWaybillView"
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.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="ChangeWaybillCtrl"
Width="450"
Height="350"
d:DesignHeight="350"
d:DesignWidth="450"
Loaded="ChangeWaybillView_Loaded"
mc:Ignorable="d">
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Image
x:Name="imgLoading"
Width="20"
Height="20"
Margin="0,30,30,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsChangeingWaybill, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="360"
To="0"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<StackPanel Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,10"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="更改运单号" />
<StackPanel>
<TextBlock
Margin="0,0,0,8"
Foreground="#555555"
Text="填写运单号:" />
<TextBox
x:Name="txtWaybillId"
Height="38"
VerticalContentAlignment="Center"
d:Text="1111"
BorderBrush="#D0D0D0"
BorderThickness="1"
FontSize="18"
Text="{Binding WaybillId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<WrapPanel Margin="0,10,0,0" FlowDirection="RightToLeft">
<Button
Width="64"
Height="26"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Command="{Binding ChangeWaybillCommand}"
Content="确定更改"
Style="{StaticResource BasePageButtonStyle}" />
</WrapPanel>
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="1" Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,10"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="订单补寄" />
<StackPanel>
<TextBlock
Margin="0,0,0,8"
Foreground="#555555"
Text="填写补寄运单号:" />
<TextBox
x:Name="txtCompensationWaybillId"
Height="38"
VerticalContentAlignment="Center"
d:Text="1111"
BorderBrush="#D0D0D0"
BorderThickness="1"
FontSize="18"
Text="{Binding CompensationWaybillId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<WrapPanel Margin="0,10,0,0" FlowDirection="RightToLeft">
<Button
Width="64"
Height="26"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Command="{Binding SendCompensationDeliveryCommand}"
Content="确定补寄"
Style="{StaticResource BasePageButtonStyle}" />
</WrapPanel>
<TextBlock
d:Text="textBlock"
Foreground="Red"
Text=""
TextWrapping="Wrap" />
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
@@ -1,63 +0,0 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Helper;
using AllBase.Model.DBModel;
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.Views;
/// <summary>
/// ChangeWaybillView.xaml 的交互逻辑
/// </summary>
public partial class ChangeWaybillView : UserControl
{
/// <summary>
/// 视图模型
/// </summary>
public ChangeWaybillViewModel ViewModel { get; }
public ChangeWaybillView(oms_wei_order_item_info _orderItem)
{
InitializeComponent();
ViewModel = new ChangeWaybillViewModel(_orderItem);
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void ChangeWaybillView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void ChangeWaybillView_Closed(object sender, RoutedEventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
MainWindow.Instance.orderListCtrl.FilterOneOrder(ViewModel.OrderItem?.ItemOrder);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
}
@@ -1,115 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.EWaybillPathListView"
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.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="auto"
d:DesignHeight="80"
d:DesignWidth="600"
mc:Ignorable="d">
<Grid>
<Border
Margin="4"
BorderBrush="LightGray"
BorderThickness="0,0,0,1"
CornerRadius="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
x:Name="imgSku"
Grid.Row="0"
Grid.Column="0"
Width="20"
Height="20"
Margin="8"
Cursor="Hand"
MouseDown="imgSku_MouseDown"
MouseEnter="imgSku_MouseEnter"
MouseLeave="imgSku_MouseLeave" />
<Grid
Grid.Column="1"
Margin="0,8"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Visibility="{Binding node_desc, Converter={StaticResource HasTextVisibility}}">
<TextBox
VerticalAlignment="Top"
d:Opacity="0.5"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
IsReadOnly="True"
Text="物流信息:"
TextWrapping="Wrap"
Visibility="Collapsed" />
<TextBox
Grid.Row="0"
VerticalAlignment="Top"
d:Opacity="0.5"
d:Text="已送达"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
IsReadOnly="True"
Text="{Binding node_desc}"
TextWrapping="Wrap" />
</WrapPanel>
<WrapPanel Grid.Row="1" Visibility="{Binding UpdateTimeStr, Converter={StaticResource HasTextVisibility}}" Margin="4">
<TextBox
VerticalAlignment="Top"
d:Opacity="0.5"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="更新时间:"
TextWrapping="Wrap"
Visibility="Collapsed" />
<TextBox
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
d:Opacity="0.5"
d:Text="2000/1/1 0:0:0"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding UpdateTimeStr}"
TextWrapping="Wrap" />
</WrapPanel>
</Grid>
<Button
x:Name="btnAdd"
Grid.Column="100"
MinWidth="18"
MinHeight="28"
Margin="8"
Padding="4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content=""
Style="{StaticResource BasePageButtonStyle}"
Visibility="Hidden" />
</Grid>
</Border>
</Grid>
</UserControl>
-138
View File
@@ -1,138 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.EWaybillPathView"
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.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="EWaybillPathCtrl"
d:DesignHeight="450"
d:DesignWidth="800" Loaded="EWaybillPathCtrl_Loaded"
Background="White"
mc:Ignorable="d">
<Grid Margin="24,24,24,24">
<WrapPanel
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="top">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="15"
Foreground="#333333"
Text="订单 " />
<TextBox
x:Name="txtOrderId"
VerticalContentAlignment="Center"
d:Text="1111111"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding OrderId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="15"
Foreground="#333333"
Text=" 物流明细" />
</WrapPanel>
<Grid Margin="24,24,24,24">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Margin="24,24,24,24">
<Grid>
<WrapPanel>
<TextBlock FontSize="14" Text="物流公司:" />
<TextBox
x:Name="txtExpressName"
VerticalContentAlignment="Center"
d:Text="物流公司:"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding ExpressName, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
</WrapPanel>
<Image
x:Name="imgLoading"
Width="20"
Height="20"
HorizontalAlignment="Right"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsGetWaybillPath, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0"
To="360"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</Grid>
<WrapPanel>
<TextBlock FontSize="14" Text="物流编码:" />
<TextBox
x:Name="txtWaybillId"
VerticalContentAlignment="Center"
d:Text="物流编码:"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding WaybillId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
</WrapPanel>
</StackPanel>
<ListBox
x:Name="lbxSku"
Grid.Row="1"
Grid.Column="1"
Margin="7,0,7,0"
HorizontalContentAlignment="Stretch"
BorderThickness="0"
ItemsSource="{Binding WaybillPathInfos}"
ScrollViewer.CanContentScroll="True"
VirtualizingPanel.ScrollUnit="Pixel">
<!-- 使用自定义属性模板去除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>
<!-- 此处绑定将数据源传递给子自定义控件OrderListRowCtrl -->
<local:EWaybillPathListView
VerticalAlignment="Center"
VerticalContentAlignment="Center"
DataContext="{Binding}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>
@@ -1,42 +0,0 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
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.Views;
/// <summary>
/// EWaybillPathView.xaml 的交互逻辑
/// </summary>
public partial class EWaybillPathView : UserControl
{
/// <summary>
/// 视图模型
/// </summary>
public EWaybillPathViewModel ViewModel { get; }
public EWaybillPathView(oms_wei_order_info _order, string _waybillId, string _expressName)
{
InitializeComponent();
ViewModel = new EWaybillPathViewModel(_order, _waybillId, _expressName);
DataContext = ViewModel;
}
private void EWaybillPathCtrl_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
}
@@ -104,7 +104,6 @@
Command="{Binding SaveCookieCommand}"
Content="保存"
Style="{StaticResource BasePageButtonStyle}" />
<TextBlock Text="TextBlock" TextWrapping="Wrap" />
</StackPanel>
</StackPanel>
</Border>
+39 -41
View File
@@ -5,59 +5,57 @@ using CefSharp.Wpf;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// 拼多多买手移动版登录窗口(WPF 版 PddMobileLoginForm)
/// </summary>
public partial class PddMobileLoginView : UserControl
{
/// <summary>视图模型</summary>
public PddMobileLoginViewModel ViewModel { get; }
/// <summary>
/// 拼多多买手移动版登录窗口(WPF 版 PddMobileLoginForm)
/// </summary>
public partial class PddMobileLoginView : UserControl
{
/// <summary>视图模型</summary>
public PddMobileLoginViewModel ViewModel { get; }
public PddMobileLoginView(BuyerLoginInfo buyerInfo)
{
{
InitializeComponent();
ViewModel = new PddMobileLoginViewModel(buyerInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
ViewModel = new PddMobileLoginViewModel(buyerInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
//ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void PddMobileLoginView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void PddMobileLoginView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void PddMobileLoginView_Closed(object sender, System.EventArgs e)
{
ViewModel.Stop();
}
private void PddMobileLoginView_Closed(object sender, System.EventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{
Grid.SetRow(browser, 0);
Grid.SetColumn(browser, 0);
BrowserHost.Children.Add(browser);
}
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 ViewModel_RequestClose()
//{
// if (this.IsLoaded)
// this.Close();
//}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
}
}
-67
View File
@@ -1,67 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.TaobaoLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
x:Name="taobaoLoginView"
Width="1300"
Height="768"
MinWidth="800"
MinHeight="600"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.ShowMinButton="False"
comn:DialogWindowProperty.Width="1300"
Loaded="TaobaoLoginView_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</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="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True" />
<Grid Grid.Row="1" Height="5">
<!--<TextBlock Text="{Binding}" />-->
</Grid>
</Grid>
</Grid>
</UserControl>
@@ -1,69 +0,0 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// 淘宝买手登录窗口(WPF 版 TaobaoLoginView)
/// </summary>
public partial class TaobaoLoginView : UserControl
{
/// <summary>视图模型</summary>
public TaobaoLoginViewModel ViewModel { get; }
public TaobaoLoginView(BuyerLoginInfo buyerInfo)
{
InitializeComponent();
ViewModel = new TaobaoLoginViewModel(buyerInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void TaobaoLoginView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
{
parentWindow.Closed += TaobaoLoginView_ParentWindow_Closed;
}
}
private void TaobaoLoginView_ParentWindow_Closed(object sender, System.EventArgs e)
{
ViewModel.Stop();
}
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);
}
}
}
}
@@ -1,89 +0,0 @@
<UserControl
x:Class="_29WxOrderWpf.Views.TransitExtraPackagesView"
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.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="TransitExtraPackagesCtrl"
Width="450"
Height="300"
d:DesignHeight="300"
d:DesignWidth="450"
Loaded="View_Loaded"
mc:Ignorable="d">
<Grid Background="White">
<StackPanel Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="滞留补发买家" />
<StackPanel>
<TextBlock Margin="0,0,0,20">
<Run Text="    说  明:总店未在90小时到仓导致快递停滞退回, 货物" />
<LineBreak /><Run Text="         滞留云仓,可用补发继续发给买家。" />
<LineBreak /><Run Text="    收  费:(与云仓发货价格一样)" /><LineBreak />
</TextBlock>
<TextBlock
Margin="0,0,0,8"
d:Opacity="0.3"
d:Visibility="Visible"
Foreground="#555555"
Text="如需备注请在下面填写:"
Visibility="Hidden" />
<TextBox
x:Name="txtPurchaserNote"
Height="38"
VerticalContentAlignment="Center"
d:Opacity="0.3"
d:Text="测试订单13017678999"
d:Visibility="Visible"
BorderBrush="#D0D0D0"
BorderThickness="1"
FontSize="18"
Text="{Binding purchaserNote, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto"
Visibility="Collapsed" />
<WrapPanel Margin="0,10,0,0" FlowDirection="RightToLeft">
<Button
Width="64"
Height="26"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Command="{Binding AddExtraPackagesCommand}"
Content="确定补发"
Style="{StaticResource BasePageButtonStyle}" />
<Image
x:Name="imgLoading"
Width="20"
Height="20"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsChangeingWaybill, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="360"
To="0"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</WrapPanel>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
@@ -1,58 +0,0 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Helper;
using AllBase.Model.DBModel;
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.Views;
/// <summary>
/// TransitExtraPackagesView.xaml 的交互逻辑
/// </summary>
public partial class TransitExtraPackagesView : UserControl
{
/// <summary>
/// 视图模型
/// </summary>
public TransitExtraPackagesViewModel ViewModel { get; }
public TransitExtraPackagesView(oms_wei_order_info _order, oms_wei_order_item_info _orderItem)
{
InitializeComponent();
ViewModel = new TransitExtraPackagesViewModel(_order, _orderItem);
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void View_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void View_Closed(object sender, RoutedEventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
MainWindow.Instance.orderListCtrl.FilterOneOrder(ViewModel.Order);
}
}
@@ -1,71 +1,163 @@
<basewindows:BaseWindow x:Class="_29WxOrderWpf.Windows.LoginWindows.LoginWindow" xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf.Windows.LoginWindows"
xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Style="{StaticResource BaseNoneBorderWindowStyle}"
x:Name="loginWindow" Title="登录" Height="300" Width="400" ResizeMode="NoResize" Loaded="loginWindow_Loaded" Closing="BaseWindow_Closing">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Background="{StaticResource mainLinearColorBrush}"></Border>
<Grid Grid.Row="1" Margin="2,0,2,2" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="180"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<Grid>
<ComboBox x:Name="cmbUserNameMobile" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseComboBoxStyle}"
SelectionChanged="cmbUserNameMobile_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<Grid HorizontalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}, Path=Width}">
<basewindows:BaseWindow
x:Class="_29WxOrderWpf.Windows.LoginWindows.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Windows.LoginWindows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
x:Name="loginWindow"
Title="登录"
Width="400"
Height="300"
Closing="BaseWindow_Closing"
Loaded="loginWindow_Loaded"
ResizeMode="NoResize"
Style="{StaticResource BaseNoneBorderWindowStyle}"
mc:Ignorable="d">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Background="{StaticResource mainLinearColorBrush}" />
<Grid
Grid.Row="1"
Margin="2,0,2,2"
Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="180" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="auto" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Border
Grid.Row="1"
Height="26"
BorderBrush="{StaticResource mainColorBrush}"
BorderThickness="1"
CornerRadius="4">
<Grid>
<ComboBox
x:Name="cmbUserNameMobile"
Margin="3,0"
VerticalContentAlignment="Center"
SelectionChanged="cmbUserNameMobile_SelectionChanged"
Style="{StaticResource BaseComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<Grid HorizontalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}, Path=Width}">
<TextBlock Text="{Binding}"/>
<Button x:Name="btnDeleteItem" HorizontalAlignment="Right" Content="X" Click="btnDeleteItem_Click"/>
</Grid>-->
<Grid HorizontalAlignment="Stretch" Width="140">
<TextBlock x:Name="txtName" Text="{Binding}" Padding="0" VerticalAlignment="Center"/>
<userctrls:UcImageButton Width="17" Height="17" ButtonImage="{StaticResource imgCloseGray}" BorderThickness="0" Cursor="Hand"
MouseOverButtonImage="{StaticResource imgCloseGray}" MousePressButtonImage="{StaticResource imgCloseGray}" Background="Transparent"
x:Name="btnDeleteItem" Tag="{Binding ElementName=txtName, Path=Text}" HorizontalAlignment="Right" Click="btnDeleteItem_Click"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</Border>
<Border Grid.Row="2" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<PasswordBox x:Name="txtPassword" Margin="6,0" VerticalContentAlignment="Center" Style="{StaticResource BasePasswordBoxStyle}"></PasswordBox>
</Border>
<CheckBox Content="记住密码" x:Name="chkRemember" BorderBrush="{StaticResource mainColorBrush}" FontSize="12" HorizontalAlignment="Left" Grid.Row="3" VerticalAlignment="Center" Checked="chkRemember_Checked"/>
<Button x:Name="btnLogin" Style="{StaticResource BaseButtonStyle}" Grid.Row="4" Content="安 全 登 录" Height="26" Click="btnLogin_Click"></Button>
<CheckBox Content="调试模式" Height="24" Visibility="Collapsed" x:Name="chkDebug" BorderBrush="{StaticResource mainColorBrush}"
FontSize="12" VerticalContentAlignment="Center" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Center" Checked="chkDebug_Checked" Unchecked="chkDebug_Checked"/>
<Grid Width="140" HorizontalAlignment="Stretch">
<TextBlock
x:Name="txtName"
Padding="0"
VerticalAlignment="Center"
Text="{Binding}" />
<userctrls:UcImageButton
x:Name="btnDeleteItem"
Width="17"
Height="17"
HorizontalAlignment="Right"
Background="Transparent"
BorderThickness="0"
ButtonImage="{StaticResource imgCloseGray}"
Click="btnDeleteItem_Click"
Cursor="Hand"
MouseOverButtonImage="{StaticResource imgCloseGray}"
MousePressButtonImage="{StaticResource imgCloseGray}"
Tag="{Binding ElementName=txtName, Path=Text}" />
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</Border>
<Border
Grid.Row="2"
Height="26"
BorderBrush="{StaticResource mainColorBrush}"
BorderThickness="1"
CornerRadius="4">
<PasswordBox
x:Name="txtPassword"
Margin="6,0"
VerticalContentAlignment="Center"
Style="{StaticResource BasePasswordBoxStyle}" />
</Border>
<CheckBox
x:Name="chkRemember"
Grid.Row="3"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Checked="chkRemember_Checked"
Content="记住密码"
FontSize="12" />
<Button
x:Name="btnLogin"
Grid.Row="4"
Height="26"
Click="btnLogin_Click"
Content="安 全 登 录"
Style="{StaticResource BaseButtonStyle}" />
<CheckBox
x:Name="chkDebug"
Grid.Row="5"
Height="24"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Checked="chkDebug_Checked"
Content="调试模式"
FontSize="12"
Unchecked="chkDebug_Checked"
Visibility="Collapsed" />
</Grid>
</Grid>
</Grid>
</Grid>
<Image Source="{StaticResource main29WeixinIcon}" Height="24" Width="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4"></Image>
<Label x:Name="lblAppName" FontSize="28" Margin="0,14,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" Content="拍单软件"></Label>
<Label x:Name="lblTitle" Margin="30,2" Foreground="White" Content="{Binding ElementName=loginWindow, Path=Title}"></Label>
<userctrls:UcWindowBoxes VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Collapsed" MinBoxVisibility="Collapsed"/>
</Grid>
<Image
Width="24"
Height="24"
Margin="4"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="{StaticResource main29WeixinIcon}" />
<Label
x:Name="lblAppName"
Margin="0,14,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Content="拍单软件"
FontSize="28"
Foreground="{StaticResource mainColorLightBrush}"
Style="{x:Null}" />
<Label
x:Name="lblTitle"
Margin="30,2"
Content="{Binding ElementName=loginWindow, Path=Title}"
Foreground="White" />
<userctrls:UcWindowBoxes
Margin="4"
HorizontalAlignment="Right"
VerticalAlignment="Top"
MaxBoxVisibility="Collapsed"
MinBoxVisibility="Collapsed" />
</Grid>
</basewindows:BaseWindow>
@@ -72,7 +72,6 @@ namespace _29WxOrderWpf.Windows.OrderWindows
}
else
{
// 需要手动申请售后的,先去申请售后再提交拦截退回总店
if (!string.IsNullOrEmpty(OrderItem.ItemTransitOrderWithVoid?.out_order_no) && OrderItem.PddBuyerAfterSaleAddressStr.IsNullOrEmpty() &&
OrderItem.TransitRefundStatusStr.Contains("需手动申请售后") || OrderItem.TransitRefundStatusStr.Contains("待用户发货"))
{
@@ -97,7 +96,6 @@ namespace _29WxOrderWpf.Windows.OrderWindows
}
imgLoading.Visibility = Visibility.Collapsed;
// 如果提交过工单,则显示已提交工单及提交时间。
var workOrderInfo = await GetWorkOrder();
var issueType = BaseRegex.GetStringJson(ref workOrderInfo, "issueType");
var createTime = BaseRegex.GetStringJson(ref workOrderInfo, "createdAt").ParseToString().ParseToDateTime();
@@ -118,13 +116,18 @@ namespace _29WxOrderWpf.Windows.OrderWindows
if ((OrderItem?.ItemTransitOrder?.warehouse_status).ParseToInt() < 1)
{
//btnAdd.IsEnabled = false;
lblMsg.Content = "当前订单仓库状态不支持拦截退回总店,建议联系买家直接退回总店!";
lblMsg.Content = "当前订单仓库状态不支持售后!";
}
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
if ((OrderItem?.ItemTransitOrder?.warehouse_status).ParseToInt() < 1)
{
BaseMsgWindow.ShowError("当前订单仓库状态不支持售后,请联系买家直接退回总店!");
return;
}
if (string.IsNullOrEmpty(lblWorkOrderMsg.Content.ParseToString()))
{
var workOrder = AddWorkOrder();
@@ -102,31 +102,16 @@ namespace _29WxOrderWpf.Windows.OrderWindows
{
// 回填库内信息
btnAdd.Content = "创 建";
if (OrderItem.DistribReturnOrderInfo != null)
{
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
}
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
}
if (OrderItem.AddEditTransitWarehouseReturnOrderStr == "已创建未到仓" || OrderItem.AddEditTransitWarehouseReturnOrderStr == "已到仓" ||
OrderItem.AddEditTransitWarehouseReturnOrderStr == "已发回")
{
btnAdd.IsEnabled = btnAddressAnalysis.IsEnabled = false;
if (OrderItem.DistribReturnOrderInfo != null)
{
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
}
}
if (OrderItem.AddEditTransitWarehouseReturnOrderStr == "已创建" || OrderItem.AddEditTransitWarehouseReturnOrderStr == "处理中")
btnAdd.IsEnabled = false;
}
}
@@ -148,11 +133,6 @@ namespace _29WxOrderWpf.Windows.OrderWindows
BaseMsgWindow.ShowError("缺少收货人信息!");
return;
}
if (txtUser.Text.Trim().Length > 15)
{
BaseMsgWindow.ShowError("收货人姓名长度不能超过15!");
return;
}
JObject jObj = new JObject();
@@ -274,7 +254,7 @@ namespace _29WxOrderWpf.Windows.OrderWindows
if (wxExpressName.IsNullOrEmpty() || OrderItem.ItemRefund.return_waybill_id.IsNullOrEmpty() || receiver.receiver_name.IsNullOrEmpty() || receiver.receiver_phone.IsNullOrEmpty() ||
receiver.receiver_province.IsNullOrEmpty() || receiver.receiver_city.IsNullOrEmpty() || receiver.receiver_area.IsNullOrEmpty() || receiver.receiver_address.IsNullOrEmpty())
{
if (!string.IsNullOrWhiteSpace(aftersaleAddress) || receiver.receiver_name?.Length > 15)
if (!string.IsNullOrWhiteSpace(aftersaleAddress))
{
// todo 提示地址解析失败请手动提交
OrderItem.AddEditTransitWarehouseReturnOrderStr = "解析失败请手动添加";
+2 -3
View File
@@ -4,7 +4,6 @@
* 2012-5-9
*/
using AllBase.DouYinModel.Result;
using AllBase.Model.Config;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -37,7 +36,7 @@ namespace AllBase
/// 版本ID
/// </summary>
public static int VersionCount = 309;
public static int VersionCount = 276;
public static string ServerUrl { get; set; } = "http://1.13.195.131:9000";
public static string DebugUrl { get; set; } = "http://localhost:9000";
@@ -601,7 +600,7 @@ namespace AllBase
public static string MainUserName { get { return string.IsNullOrEmpty(ParentUserName) ? UserName : ParentUserName; } }
public static int SaLevel { get; set; }
public static bool IsLoginSuccess { get; set; }
public static SettingConfig Setting { get; set; }
/// <summary>
/// CPU使用率更新线程
/// </summary>
+5 -31
View File
@@ -9,7 +9,6 @@ using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Services.Description;
namespace AllBase
{
@@ -705,20 +704,10 @@ namespace AllBase
return temp;
}
/// <summary>
///
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <param name="sortType">max_length 返回最长的字符串,否则返回第一个匹配的</param>
/// <returns></returns>
public static string GetOneJsonObjStrJson(ref string html, string reg, string sortType = "max_length")
{
if (sortType == "max_length")
return GetJsonObjStrJson(ref html, reg).OrderByDescending(s => s.Length).FirstOrDefault();
else
return GetJsonObjStrJson(ref html, reg).FirstOrDefault();
}
public static string GetOneJsonObjStrJson(ref string html, string reg)
{
return GetJsonObjStrJson(ref html, reg).FirstOrDefault();
}
public static System.Collections.Generic.List<string> GetJsonObjStrJson(ref string html, string reg, int level = 0)
{
@@ -783,22 +772,7 @@ namespace AllBase
return rstLst;
}
/// <summary>
///
/// </summary>
/// <param name="html"></param>
/// <param name="reg">要查找的关键字</param>
/// <param name="sortType">max_length 返回最长的字符串,否则返回第一个匹配的</param>
/// <returns></returns>
public static string GetOneJsonArrStrJson(ref string html, string reg, string sortType = "max_length")
{
if (sortType == "max_length")
return GetJsonArrStrJson(ref html, reg).OrderByDescending(s => s.Length).FirstOrDefault();
else
return GetJsonArrStrJson(ref html, reg).FirstOrDefault();
}
public static System.Collections.Generic.List<string> GetJsonArrStrJson(ref string html, string reg)
public static System.Collections.Generic.List<string> GetJsonArrStrJson(ref string html, string reg)
{
var startTime = DateTime.Now;
System.Collections.Generic.List<string> rstLst = new System.Collections.Generic.List<string>();
+2 -22
View File
@@ -1147,22 +1147,7 @@ Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
public static async Task<string> PostJsonAsync(string url, object postData, int timeOut = 0)
{
return await PostUtf8Async(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut);
}
public static async Task<string> PostJsonAsync(string url, string postData, int timeOut = 0)
{
return await PostUtf8Async(url, postData, contentType: "application/json", timeOut: timeOut);
}
public static string PostJson(string url, object postData, int timeOut = -1)
{
return PostUtf8(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut);
}
public static string PostJson(string url, string postData, int timeOut = -1)
{
return PostUtf8(url, postData, contentType: "application/json", timeOut: timeOut);
}
/// <summary>
/// post 数据
/// </summary>
@@ -1180,8 +1165,6 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
request.KeepAlive = true;
request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
if (!string.IsNullOrEmpty(contentType))
request.ContentType = contentType;
//request.Headers.Add("sec-ch-ua", @"""Not(A:Brand"";v=""8"", ""Chromium"";v=""144"", ""Google Chrome"";v=""144""");
//request.Headers.Add("sec-ch-ua-mobile", @"?0");
//request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
@@ -1326,10 +1309,7 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
if (!string.IsNullOrEmpty(contentType))
{
request.ContentType = contentType;
}
string body = postData;
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
+4 -25
View File
@@ -33,36 +33,15 @@ namespace AllBase.Helper
/// 拼多多买手列表
/// </summary>
public static ObservableCollectionThreadSafe<BuyerLoginInfo> PDDBuyerLoginList { get; set; } = new ObservableCollectionThreadSafe<BuyerLoginInfo>();
/// <summary>
/// 淘宝买手列表
/// </summary>
public static ObservableCollectionThreadSafe<BuyerLoginInfo> TaobaoBuyerLoginList { get; set; } = new ObservableCollectionThreadSafe<BuyerLoginInfo>();
/// <summary>
/// 当前拼多多买手
/// </summary>
public static BuyerLoginInfo CurrentPddBuyer { get; set; }
/// <summary>
/// 当前淘宝买手
/// </summary>
public static BuyerLoginInfo CurrentTaobaoBuyer { get; set; }
/// <summary>
/// 当前买手采购平台
/// </summary>
public static string CurrentBuyPlatform { get; set; } = "pdd";
/// <summary>
/// 支付宝密码
/// </summary>
//public static string AlipayPassword { get; set; }
public static AutoBuyConfig AutoBuyConfig { get; set; }
/// <summary>
/// 当前拼多多买手
/// </summary>
public static BuyerLoginInfo CurrentPddBuyer { get; set; }
/// <summary>
/// 默认退货详细地址
/// </summary>
public static string TransitReturnOrderReturnAddress { get; set; } = "真如镇街道真北路2653弄F区808号楼";
/// <summary>
/// 默认退货详细地址路和区(用于包含判断)
/// </summary>
public static string TransitReturnOrderReturnAddressLite { get; set; } = "真北路2653弄F区808号楼";
/// <summary>
/// 订单列表
/// </summary>
public static ConcurrentList<oms_wei_order_info> lstOrder { get; set; } = new ConcurrentList<oms_wei_order_info>();
-20
View File
@@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Config
{
public class AutoBuyConfig
{
public string AlipayPassword { get; set; } = "";
/// <summary>
/// 是否限制自动拍单最小利润
/// </summary>
public bool IsLimitMinProfit { get; set; }
public int MinProfit { get; set; }
}
}
-5
View File
@@ -16,10 +16,5 @@ namespace AllBase.Model.Config
/// 自动修改下单地址到仓库
/// </summary>
public bool IsAutoChangeWarehouseAddress { get; set; } = true;
/// <summary>
/// 是否使用同步单
/// </summary>
public bool IsSyncDirectBuyOrderWaybill { get; set; } = false;
}
}
-18
View File
@@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Config;
public class SettingConfig
{
#region 发货
/// <summary>
/// 自动切换礼物类型
/// 超出6元
/// </summary>
public bool AutoSwitchGiftType { get; set; } = true;
#endregion
}
@@ -41,8 +41,8 @@ namespace AllBase.Model.DBModel
{
public static string TransitWarehouseDataStr = @"
XDYBJC ;北京仓 ;胡萍 ;18565773752 ;北京市顺义区光明街道滨河小区七区1号楼 ;2 ;52 ;511 ;北京市 ;北京市
XDYGZC ;广州仓 ;何外华 ;13826339849 ;广州市增城区朱村街道育山一路68号国际物流园 ;6 ;76 ;702 ;广东省 ;广州市
XDYWHC ;武汉2仓 ;杨先生 ;13044121071 ;湖北省武汉市江汉区民族街道沿江大道轮渡龙王庙码头 ;13 ;180 ;1546 ;湖北省 ;武汉市
XDYGZC ;广州仓 ;何外华 ;13826339849 ;广州市从化区太平镇高埔细埔街99号东门4栋3楼 ;6 ;76 ;692 ;广东省 ;广州市
XDYWHC ;武汉2仓 ;杨先生 ;13044121071 ;湖北省武汉市汉阳区洲头街道汉新大道2号3栋17楼 ;13 ;180 ;1548 ;湖北省 ;武汉市
XDYSHANDC ;山东2仓 ;鸿鹄小申 ;13044121239 ;山东省临沂市费县南外环东转盘往东200米顺通快递有限公司(仓库二楼) ;22 ;292 ;2415 ;山东省 ;临沂市
XDYSHC ;上海新仓 ;纪先生 ;13044121150 ;上海市上海市普陀区真如镇街道真北路2653弄T区 ;25 ;321 ;2709 ;上海市 ;上海市
XDYSZC ;深圳仓 ;峰峰 ;15343351331 ;广东省东莞市凤岗镇浸校塘东良巷逸乐轩E栋5号楼 ;6 ;79 ;732 ;广东省 ;东莞市
@@ -57,8 +57,6 @@ XDYYWC ;义乌仓 ;小田 ;19058117371 ;浙江省金华市义乌市北
//XDYSSC ;河北仓 ;田女士 ;13382898026 ;河北省衡水市安平县兴安大道灿达创业基地韵达库房A-1 ;10 ;143 ;1180
//XDYZZC ;郑州仓 ;朱红艳 ;13044121247 ;河南省郑州市经济开发区祥云办公处润之新物流园韵达速递 ;11 ;149 ;1259
//XDYWHC ;武汉2仓 ;杨先生 ;13044121071 ;湖北省武汉市汉阳区洲头街道汉新大道2号3栋17楼 ;13 ;180 ;1548 ;湖北省 ;武汉市
//XDYGZC ;广州仓 ;何外华 ;13826339849 ;广州市从化区太平镇高埔细埔街99号东门4栋3楼 ;6 ;76 ;692 ;广东省 ;广州市
// 广州仓 广州市从化区太平镇高埔细埔街99号东门***栋***楼
// 深圳仓 广东省东莞市凤岗镇浸校塘东良巷逸乐轩E栋***楼
// 武汉2仓 湖北省武汉市汉阳区洲头街道汉新大道2号***栋 * **楼
-2
View File
@@ -32,7 +32,6 @@ namespace AllBase.Model.DBModel
public string transit_warehouse_id { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string platform { get; set; } = "pdd";
}
public class WXBuyMapSkusInfo : PropertyNotifyObject
{
@@ -87,6 +86,5 @@ namespace AllBase.Model.DBModel
public string transit_warehouse_id { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string platform { get; set; } = "pdd";
}
}
@@ -1,75 +0,0 @@
using AllBase.Model.MvvmBaseClasses;
using NaiBa.Util.Extension;
using NaiBa.Util.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.DBModel
{
public class oms_wei_ewaybill_path : PropertyNotifyObject
{
public long id { get; set; }
public long? shop_id { get; set; }
public long? order_id { get; set; }
public string ewaybill_order_id { get; set; }
public string waybill_id { get; set; }
public long update_time
{
get { return this.GetValue(x => x.update_time); }
set
{
this.SetValue(x => x.update_time, value);
this.UpdateTimeStr = BaseClass.StampToDateTime(value.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss");
}
}
public string UpdateTimeStr
{
get { return this.GetValue(x => x.UpdateTimeStr); }
set { this.SetValue(x => x.UpdateTimeStr, value); }
}
//0待揽件 1揽收 2运输中 3派件 4入柜 5签收 6退回 7转寄 8异常 9出柜 99其他未知
public int status
{
get { return this.GetValue(x => x.status); }
set
{
this.SetValue(x => x.status, value);
try
{
StatusStr = ((oms_wei_ewaybill_path_status_emum)value).ParseToString();
}
catch
{
StatusStr = "其他未知";
}
}
}
public string StatusStr
{
get { return this.GetValue(x => x.StatusStr); }
set { this.SetValue(x => x.StatusStr, value); }
}
public string node_desc { get; set; }
public DateTime create_time { get; set; }
}
public enum oms_wei_ewaybill_path_status_emum
{
待揽件 = 0,
揽收 = 1,
运输中 = 2,
派件 = 3,
入柜 = 4,
签收 = 5,
退回 = 6,
转寄 = 7,
异常 = 8,
出柜 = 9,
其他未知 = 99
}
}
@@ -1,5 +1,4 @@
using AllBase.Model.MvvmBaseClasses;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,8 +6,8 @@ using System.Threading.Tasks;
namespace AllBase.Model.DBModel
{
public class oms_wei_external_procurement_log_info : PropertyNotifyObject
{
public class oms_wei_external_procurement_log_info
{
public string OutOrderNumStr
{
get { return out_order_no; }
@@ -96,7 +95,7 @@ namespace AllBase.Model.DBModel
/// </summary>
public int? over_weight_fee { get; set; }
/// <summary>
/// 0未申请拒收 1已申请拒收 2申请拒收失败 3申请拒收成功 5取消拒收
/// 0未申请拒收 1已申请拒收 2申请拒收失败 3已拒收成功 5取消拒收
/// </summary>
public int has_reject { get; set; }
/// <summary>
+11 -79
View File
@@ -1,6 +1,5 @@
using AllBase.Helper;
using AllBase.Model.MvvmBaseClasses;
using NaiBa.Util;
using NaiBa.Util.Extension;
using NPOI.OpenXmlFormats.Dml.Diagram;
using NPOI.OpenXmlFormats.Spreadsheet;
@@ -44,12 +43,10 @@ namespace AllBase.Model.DBModel
public ObservableCollection<oms_wei_refund_info> refundItems { get; set; } = new ObservableCollection<oms_wei_refund_info>();
public ConcurrentList<oms_wei_ewaybill_path> latestEWaybills { get; set; } = new ConcurrentList<oms_wei_ewaybill_path>();
/// <summary>
/// 待采购
/// </summary>
public bool IsWaitBuy
/// <summary>
/// 待采购
/// </summary>
public bool IsWaitBuy
{
get { return this.GetValue(x => x.IsWaitBuy); }
set { this.SetValue(x => x.IsWaitBuy, value); }
@@ -139,28 +136,17 @@ namespace AllBase.Model.DBModel
{
//return this.orderItems.All(oi => !string.IsNullOrEmpty(oi.ItemRefund?.return_waybill_id)) && this.orderItems.All(oi => oi.ItemRefund?.return_detail == GlobalConfig.TransitReturnOrderReturnAddress);
//return this.orderItems.All(oi => oi.ItemRefund?.return_detail == GlobalConfig.TransitReturnOrderReturnAddress);
return this.orderItems.All(oi => oi.ItemRefund?.return_detail?.ToUpper().Contains(GlobalConfig.TransitReturnOrderReturnAddressLite) == true);
return this.orderItems.All(oi => oi.ItemRefund?.return_detail.StartsWith(GlobalConfig.TransitReturnOrderReturnAddress) == true);
}
set { }
}
/// <summary>
/// 异常单(买手异常退货)异常需重拍
/// </summary>
public bool IsAbnormal
public bool isAbnormal
{
get { return this.GetValue(x => x.IsAbnormal); }
set { this.SetValue(x => x.IsAbnormal, value); }
}
public bool IsShowChangeWaybillBtn
{
get { return this.GetValue(x => x.IsShowChangeWaybillBtn); }
set { this.SetValue(x => x.IsShowChangeWaybillBtn, value); }
}
public bool IsShowTransitExtraPackagesBtn
{
get { return this.GetValue(x => x.IsShowTransitExtraPackagesBtn); }
set { this.SetValue(x => x.IsShowTransitExtraPackagesBtn, value); }
get { return this.GetValue(x => x.isAbnormal); }
set { this.SetValue(x => x.isAbnormal, value); }
}
public string orderStatusStr
@@ -221,7 +207,7 @@ namespace AllBase.Model.DBModel
/// </summary>
public string ship_done_time_str
{
get { return BaseClass.StampToDateTime(this.ship_done_time.ParseToInt()).ToString("yy-MM-dd HH:mm:ss"); }
get { return BaseClass.StampToDateTime(this.ship_done_time.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"); }
set { }
}
/// <summary>
@@ -370,33 +356,6 @@ namespace AllBase.Model.DBModel
set { this.SetValue(x => x.GiftErrorMsg, value); }
}
public ConcurrentList<yh_sync_logistics> SyncLogisticsList
{
get { return this.GetValue(x => x.SyncLogisticsList); }
set
{
this.SetValue(x => x.SyncLogisticsList, value);
RealSyncWaybillId = SyncLogisticsList.FirstOrDefault()?.tracking_number;
SyncWaybillIdInfo = SyncLogisticsList.FirstOrDefault()?.tracking_number;
SyncWaybillPickNo = SyncLogisticsList.FirstOrDefault()?.pickup_code;
}
}
public string RealSyncWaybillId
{
get { return this.GetValue(x => x.RealSyncWaybillId); }
set { this.SetValue(x => x.RealSyncWaybillId, value); }
}
public string SyncWaybillIdInfo
{
get { return this.GetValue(x => x.SyncWaybillIdInfo); }
set { this.SetValue(x => x.SyncWaybillIdInfo, value); }
}
public string SyncWaybillPickNo
{
get { return this.GetValue(x => x.SyncWaybillPickNo); }
set { this.SetValue(x => x.SyncWaybillPickNo, value); }
}
/// <summary>
/// 是否被选中
/// </summary>
@@ -707,10 +666,6 @@ namespace AllBase.Model.DBModel
/// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号
/// </summary>
public decimal? transfer_warehouse_status { get; set; }
/// <summary>
/// 店铺运费
/// </summary>
public int? postage_price { get; set; }
public void SetOrderTextProperty()
{
@@ -744,22 +699,7 @@ namespace AllBase.Model.DBModel
IsWaitBuy = GetIsWaitBuy();
IsWaitSend = GetIsWaitSend();
IsWaitReceive = GetIsWaitReceive();
if (order_id == "3739089000222605568")
{
}
IsAbnormal = GetIsAbnormal();
if (IsWaitBuy/* || IsWaitSend*/)
IsShowChangeWaybillBtn = false;
else
IsShowChangeWaybillBtn = true;
if (IsWaitBuy)
IsShowTransitExtraPackagesBtn = false;
else
IsShowTransitExtraPackagesBtn = true;
isAbnormal = GetIsAbnormal();
}
public bool GetIsWaitBuy()
@@ -833,15 +773,6 @@ namespace AllBase.Model.DBModel
public bool GetIsAbnormal()
{
// 三退或者两退,为退款完成单
//if (orderItems.All(oi => (oi.refund_status == 4 || oi.refund_status == 11) && (oi.ItemTransitOrder != null || string.IsNullOrWhiteSpace(out_order_no)) &&
// (oi.ItemTransitOrder == null || oi.ItemTransitOrder?.refund_status == "买手退款成功") && (string.IsNullOrWhiteSpace(out_order_no) || out_after_sale_status == "退款成功")))
// return false;
// 订单完成而非退货,肯定不是异常单
if (status == 100)
return false;
// 如果有售后,直接作为售后单处理
if (orderItems.All(oi => oi.refund_status > 1))
return false;
@@ -850,6 +781,7 @@ namespace AllBase.Model.DBModel
return false;
if (gift_order_status == 1 || gift_order_status == 2)
return false;
if (orderItems.Any(oi => !(oi.OrderItemExt?.abnormal_text).IsNullOrEmpty()))
return true;
+134 -370
View File
@@ -33,43 +33,30 @@ namespace AllBase.Model.DBModel
/// <summary>
/// 采购关联
/// </summary>
public WXBuyMapInfo PddBuyMap
public WXBuyMapInfo BuyMap
{
get { return this.GetValue(x => x.PddBuyMap); }
set { this.SetValue(x => x.PddBuyMap, value); }
}
/// <summary>
/// 淘宝采购关联
/// </summary>
public WXBuyMapInfo TbBuyMap
{
get { return this.GetValue(x => x.TbBuyMap); }
set { this.SetValue(x => x.TbBuyMap, value); }
}
get { return this.GetValue(x => x.BuyMap); }
set { this.SetValue(x => x.BuyMap, value); }
}
public Visibility MapSkusBtnVisibility
{
get { return this.GetValue(x => x.MapSkusBtnVisibility); }
set { this.SetValue(x => x.MapSkusBtnVisibility, value); }
}
public List<WXBuyMapSkusInfo> PddBuyMapSkus
public List<WXBuyMapSkusInfo> BuyMapSkus
{
get { return this.GetValue(x => x.PddBuyMapSkus); }
get { return this.GetValue(x => x.BuyMapSkus); }
set
{
this.SetValue(x => x.PddBuyMapSkus, value);
this.SetValue(x => x.BuyMapSkus, value);
if (value != null && value.Count > 0) MapSkusBtnVisibility = Visibility.Visible;
else MapSkusBtnVisibility = Visibility.Collapsed;
}
}
public List<WXBuyMapSkusInfo> TbBuyMapSkus
{
get { return this.GetValue(x => x.TbBuyMapSkus); }
set { this.SetValue(x => x.TbBuyMapSkus, value); }
}
/// <summary>
/// 采购按钮文字
/// </summary>
public string BuyGoodsBtnTxt
/// <summary>
/// 采购按钮文字
/// </summary>
public string BuyGoodsBtnTxt
{
get { return this.GetValue(x => x.BuyGoodsBtnTxt); }
set { this.SetValue(x => x.BuyGoodsBtnTxt, value); }
@@ -155,7 +142,7 @@ namespace AllBase.Model.DBModel
if (ItemOrder != null)
ItemOrder.RefundDatetime = this.RefundDatetime;
this.RefundDateTimeStr = RefundDatetime.ToString("yy-MM-dd HH:mm:ss");
this.RefundDateTimeStr = RefundDatetime.ToString("yyyy-MM-dd HH:mm:ss");
this.RefundTimeVisibility = RefundDatetime == DateTime.MinValue ? Visibility.Collapsed : Visibility.Visible;
RefundAddressStr = "";
@@ -231,44 +218,8 @@ namespace AllBase.Model.DBModel
{
get { return this.GetValue(x => x.ItemTransitOrderAfterSale); }
set { this.SetValue(x => x.ItemTransitOrderAfterSale, value); }
}
public List<oms_wei_transfer_extra_package> ItemTransitExtraOrders
{
get { return this.GetValue(x => x.ItemTransitExtraOrders); }
set { this.SetValue(x => x.ItemTransitExtraOrders, value); }
}
public oms_wei_transfer_extra_package ItemTransitExtraOrder
{
get { return this.GetValue(x => x.ItemTransitExtraOrder); }
set
{
if (order_id == "3739278903964250368")
{
}
this.SetValue(x => x.ItemTransitExtraOrder, value);
if (ItemTransitExtraOrder != null)
{
if (ItemTransitExtraOrder.real_logistics_code.IsNullOrEmpty())
{
ItemTransitExtraOrder.real_logistics_code = "滞留补发处理中";
}
}
TransitExtraPackageWaybillStr = (ItemTransitExtraOrder?.real_logistics_code + "-" + ItemTransitExtraOrder?.real_logistics_express_code).Trim('-');
TransitExtraPackageWaybillBtnStr = ItemTransitExtraOrder?.order_void_status == 1 ? "已作废" : "作废";
}
}
public string TransitExtraPackageWaybillStr
{
get { return this.GetValue(x => x.TransitExtraPackageWaybillStr); }
set { this.SetValue(x => x.TransitExtraPackageWaybillStr, value); }
}
public string TransitExtraPackageWaybillBtnStr
{
get { return this.GetValue(x => x.TransitExtraPackageWaybillBtnStr); }
set { this.SetValue(x => x.TransitExtraPackageWaybillBtnStr, value); }
}
public List<order_pdd_buyer_order> PddBuyerOrders { get; set; } = new List<order_pdd_buyer_order>();
}
public List<order_pdd_buyer_order> PddBuyerOrders { get; set; } = new List<order_pdd_buyer_order>();
public order_pdd_buyer_order PddBuyerOrder
{
get { return this.GetValue(x => x.PddBuyerOrder); }
@@ -276,40 +227,29 @@ namespace AllBase.Model.DBModel
}
public List<order_pdd_buyer_after_sale> PddBuyerAfterSales { get; set; } = new List<order_pdd_buyer_after_sale>();
public order_pdd_buyer_after_sale PddBuyerAfterSale
{
get { return this.GetValue(x => x.PddBuyerAfterSale); }
set
{
this.SetValue(x => x.PddBuyerAfterSale, value);
// 云仓买手退货地址
this.PddBuyerAfterSaleAddressStr = this.PddBuyerAfterSale?.afterSaleAddress;
}
{
get { return this.GetValue(x => x.PddBuyerAfterSale); }
set { this.SetValue(x => x.PddBuyerAfterSale, value); }
}
public string PddBuyerAfterSaleAddressStr
{
get { return this.GetValue(x => x.PddBuyerAfterSaleAddressStr); }
set { this.SetValue(x => x.PddBuyerAfterSaleAddressStr, value); }
}
public Visibility RejectOrReturnPackageBtnVisibility
public string DirectPddBuyerAfterSaleAddressStr
{
get { return this.GetValue(x => x.RejectOrReturnPackageBtnVisibility); }
set { this.SetValue(x => x.RejectOrReturnPackageBtnVisibility, value); }
get { return this.GetValue(x => x.DirectPddBuyerAfterSaleAddressStr); }
set { this.SetValue(x => x.DirectPddBuyerAfterSaleAddressStr, value); }
}
public void SetTransitOrder()
{
if (order_id == "3739241588056569856")
if (order_id == "3738552208766960384")
{
}
this.ItemTransitOrder = ItemTransitOrders?.FirstOrDefault(t => t.order_void_status != 1);
this.ItemTransitOrderWithVoid = ItemTransitOrders?.FirstOrDefault();
this.ItemTransitExtraOrder = ItemTransitExtraOrders?.FirstOrDefault(t => t.order_void_status != 1) ?? ItemTransitExtraOrders.FirstOrDefault();
this.ItemTransitOrderAfterSale = ItemTransitOrderAfterSales?.FirstOrDefault();
this.PddBuyerOrder = PddBuyerOrders?.FirstOrDefault();
// 优先找非撤销买手退款单
@@ -336,28 +276,25 @@ namespace AllBase.Model.DBModel
else
TransitOrderWaybillFromWareHouseStr = ItemTransitOrder.express_2_company + "-" + ItemTransitOrder.express_2_waybill;
if (order_id == "3739043283864307968")
if (order_id == "3738461463336072960")
{
var xx = ShopWaybillExceptionStr;
}
TransitWarehouseRejectSuccessTimeStr = this.ItemTransitOrderWithVoid?.rejected_time == null ? "" : this.ItemTransitOrderWithVoid.rejected_time.Value.ToString("yy-MM-dd HH:mm");
AddEditTransitWarehouseRejectStr = "申请";
if (this.ItemTransitOrderWithVoid?.has_reject == 1)
AddEditTransitWarehouseRejectStr = "已申请拒收";
if (this.ItemTransitOrderWithVoid?.has_reject == 2)
AddEditTransitWarehouseRejectStr = "申请失败";
AddEditTransitWarehouseRejectStr = "申请拒收失败";
if (this.ItemTransitOrderWithVoid?.has_reject == 3)
AddEditTransitWarehouseRejectStr = "申请成功";
AddEditTransitWarehouseRejectStr = "申请拒收成功";
if (this.ItemTransitOrderWithVoid?.has_reject == 5)
AddEditTransitWarehouseRejectStr = "已取消拒收";
if (this.ItemTransitOrderWithVoid?.has_reject == 99)
AddEditTransitWarehouseRejectStr = "拒收成功";
if (this.ItemTransitOrderWithVoid == null || (this.ItemRefund?.type != "REFUND" && !this.ItemOrder.IsAbnormal) || // 仅退款
TransitRefundStatusStr.Contains("退款成功") ||
if (this.ItemTransitOrderWithVoid == null || this.ItemRefund?.type != "REFUND" || // 仅退款
!(this.ItemRefund?.return_waybill_id).IsNullOrEmpty() || !(this.ItemRefund?.return_detail).IsNullOrEmpty() ||
(!this.ItemOrder.IsEmergency && !this.ItemOrder.IsAbnormal && !this.ItemOrder.IsRefund) ||
(!this.ItemOrder.IsEmergency && !this.ItemOrder.isAbnormal && !this.ItemOrder.IsRefund) ||
(this.ItemTransitOrderWithVoid.warehouse_status != 0 && this.ItemTransitOrderWithVoid.warehouse_status != 1) ||
/*this.ItemTransitOrderWithVoid.platform == "XDYYWC" ||*/ // 义务仓不能申请拒收
string.IsNullOrEmpty(PddBuyerOrder?.order_sn))
{
if (AddEditTransitWarehouseRejectStr == "申请")
@@ -365,33 +302,23 @@ namespace AllBase.Model.DBModel
//else if (this.ItemTransitOrderWithVoid.platform == "XDYYWC") // 义务仓已申请拒收的全部显示失败
// AddEditTransitWarehouseRejectStr = "申请拒收失败*";
}
if (AddEditTransitWarehouseRejectStr == "申请")
AddEditTransitWarehouseRejectStr = "未申请";
RejectOrReturnPackageBtnVisibility = ItemTransitOrderWithVoid != null ? Visibility.Visible : Visibility.Collapsed;
// 拦截退回操作信息
InterceptReturnInfoStr = "";
if (this.ItemTransitOrderWithVoid != null)
InterceptReturnInfoStr = this.ItemTransitOrderWithVoid.intercept_return_info;
// 仓库物流售后拦截包裹按钮上的文字,仓库作废单不存在仓库物流,所以此处必须是有效的仓库单(含作废失败)
AddEditTransitWarehouseAfterSaleStr = "添加";
if (order_id == "3739241588056569856")
if (order_id == "3738396781943865344")
{
}
// 仓库物流售后拦截包裹按钮上的文字,仓库作废单不存在仓库物流,所以此处必须是有效的仓库单(含作废失败)
AddEditTransitWarehouseAfterSaleStr = "添加";
if (this.ItemTransitOrderAfterSale != null)
AddEditTransitWarehouseAfterSaleStr = "已添加";
if (this.ItemTransitOrderAfterSale != null && (ItemTransitOrderWithVoid.intercept_return_status == 1 || !string.IsNullOrEmpty(ItemTransitOrderAfterSale.downstream_waybill)))
AddEditTransitWarehouseAfterSaleStr = "拦截成功";
else if (this.ItemTransitOrderAfterSale != null && ItemTransitOrderWithVoid.intercept_return_status == 2)
AddEditTransitWarehouseAfterSaleStr = "拦截失败";
if (this.ItemTransitOrderWithVoid == null || (this.ItemRefund?.type != "REFUND" && !this.ItemOrder.IsAbnormal) ||
TransitRefundStatusStr.Contains("退款成功") ||
//if (this.ItemTransitOrderAfterSale != null && ItemTransitOrderWithVoid.intercept_return_status == 2)
// AddEditTransitWarehouseAfterSaleStr = "拦截失败";
if (this.ItemTransitOrderWithVoid == null || this.ItemRefund?.type != "REFUND" ||
!(this.ItemRefund?.return_waybill_id).IsNullOrEmpty() || !(this.ItemRefund?.return_detail).IsNullOrEmpty() ||
(!this.ItemOrder.IsEmergency && !this.ItemOrder.IsAbnormal && !this.ItemOrder.IsRefund) ||
(!this.ItemOrder.IsEmergency && !this.ItemOrder.isAbnormal && !this.ItemOrder.IsRefund) ||
this.ItemTransitOrderWithVoid.warehouse_status == 0 ||
(this.ItemTransitOrderWithVoid.warehouse_status == 1 && !AddEditTransitWarehouseRejectStr.IsNullOrEmpty() && !AddEditTransitWarehouseRejectStr.StartsWith("申请拒收失败")))
{
@@ -399,45 +326,38 @@ namespace AllBase.Model.DBModel
AddEditTransitWarehouseAfterSaleStr = "";
}
// 退货退款的,不能拦截退回总店。如果是退到退货仓,则退货仓流程,否则店家自行收货退回总店。
if (!RefundAddressStr.ParseToString().Trim().IsNullOrEmpty() || (this.ItemRefund?.type != "REFUND" && !this.ItemOrder.IsAbnormal))
if (!RefundAddressStr.ParseToString().Trim().IsNullOrEmpty() || this.ItemRefund?.type != "REFUND")
{
if (AddEditTransitWarehouseAfterSaleStr == "添加")
AddEditTransitWarehouseAfterSaleStr = "";
}
if (AddEditTransitWarehouseAfterSaleStr == "添加")
AddEditTransitWarehouseAfterSaleStr = "未添加";
// 拦截退回物流单号
if (this.ItemTransitOrderAfterSale != null)
TransitWarehouseAfterSaleWayBillStr = (this.ItemTransitOrderAfterSale?.downstream_express_code + "-" + this.ItemTransitOrderAfterSale?.downstream_waybill).Trim('-');
// 拦截退回操作信息,如果实际拦截成功,则不显示中间报错信息
InterceptReturnInfoStr = "";
if (this.ItemTransitOrderWithVoid != null && AddEditTransitWarehouseAfterSaleStr != "拦截成功")
InterceptReturnInfoStr = this.ItemTransitOrderWithVoid.intercept_return_info;
// 退货仓退货
AddEditTransitWarehouseReturnOrderStr = "";
if (ItemRefund?.return_detail?.ToUpper().Contains(GlobalConfig.TransitReturnOrderReturnAddressLite) == true)
if (ItemRefund?.return_detail.StartsWith(GlobalConfig.TransitReturnOrderReturnAddress) == true)
{
AddEditTransitWarehouseReturnOrderStr = DistribReturnOrderInfo == null ? "未创建" : "已创建";
if (order_id == "3738272473468804864")
{
}
// 关闭中转包裹退回,改为中转分销退货
if (AddEditTransitWarehouseAfterSaleStr == "添加")
AddEditTransitWarehouseAfterSaleStr = "";
AddEditTransitWarehouseReturnOrderStr = DistribReturnOrderInfo == null ? "添加" : "已添加";
if (DistribReturnOrderInfo?.warehouse_status == 1)
{
if ((DistribReturnOrderInfo?.real_logistics_express_code).IsNullOrEmpty())
AddEditTransitWarehouseReturnOrderStr = "已到仓";
else
AddEditTransitWarehouseReturnOrderStr = "已发回";
}
AddEditTransitWarehouseReturnOrderStr = "已创建";
if (DistribReturnOrderInfo?.warehouse_status == 2)
AddEditTransitWarehouseReturnOrderStr = "创建失败";
AddEditTransitWarehouseReturnOrderStr = "创建异常";
if (DistribReturnOrderInfo?.warehouse_status == 3)
AddEditTransitWarehouseReturnOrderStr = "已创建未到仓";
if (TransitRefundStatusStr.Contains("退款成功"))
{
if (AddEditTransitWarehouseReturnOrderStr == "未创建")
AddEditTransitWarehouseReturnOrderStr = "";
}
AddEditTransitWarehouseReturnOrderStr = "处理中";
}
// 云仓买手退货地址
this.PddBuyerAfterSaleAddressStr = this.PddBuyerAfterSale?.afterSaleAddress;
// 直发买手退货地址
this.DirectPddBuyerAfterSaleAddressStr = this.DirectPddBuyerAfterSale?.afterSaleAddress;
}
/// <summary>
/// 仓库拒收按钮文本参数
@@ -462,14 +382,6 @@ namespace AllBase.Model.DBModel
set { this.SetValue(x => x.AddEditTransitWarehouseAfterSaleStr, value); }
}
/// <summary>
/// 拦截退回操作信息/回调信息 文本
/// </summary>
public string InterceptReturnInfoStr
{
get { return this.GetValue(x => x.InterceptReturnInfoStr); }
set { this.SetValue(x => x.InterceptReturnInfoStr, value); }
}
/// <summary>
/// 仓库分销退货按钮显示文本参数
/// </summary>
public string AddEditTransitWarehouseReturnOrderStr
@@ -926,58 +838,16 @@ namespace AllBase.Model.DBModel
public order_pdd_buyer_order DirectPddBuyerOrder
{
get { return this.GetValue(x => x.DirectPddBuyerOrder); }
set
{
if (order_id == "3739364384891083264")
{
set { this.SetValue(x => x.DirectPddBuyerOrder, value); }
}
}
this.SetValue(x => x.DirectPddBuyerOrder, value);
SyncLogisticsMsg = DirectPddBuyerOrder?.sync_logistics_msg;
// 有单号就不显示错误,否则单号字段显示错误信息
if (ItemOrder.SyncWaybillIdInfo.IsNullOrEmpty())
{
ItemOrder.SyncWaybillIdInfo = SyncLogisticsMsg;
SyncLogisticsMsg = "";
}
else
SyncLogisticsMsg = "";
}
}
public string SyncLogisticsMsg
{
get { return this.GetValue(x => x.SyncLogisticsMsg); }
set { this.SetValue(x => x.SyncLogisticsMsg, value); }
}
public string DirectOrderBuyTimeStr
{
get { return this.GetValue(x => x.DirectOrderBuyTimeStr); }
set { this.SetValue(x => x.DirectOrderBuyTimeStr, value); }
}
public List<order_pdd_buyer_after_sale> DirectPddBuyerAfterSales { get; set; } = new List<order_pdd_buyer_after_sale>();
public List<order_pdd_buyer_after_sale> DirectPddBuyerAfterSales { get; set; } = new List<order_pdd_buyer_after_sale>();
public order_pdd_buyer_after_sale DirectPddBuyerAfterSale
{
get { return this.GetValue(x => x.DirectPddBuyerAfterSale); }
set
{
if (order_id == "3738766466298321152")
{
}
this.SetValue(x => x.DirectPddBuyerAfterSale, value);
// 直发买手退货地址
this.DirectPddBuyerAfterSaleAddressStr = DirectPddBuyerAfterSale?.afterSaleAddress;
}
}
public string DirectPddBuyerAfterSaleAddressStr
{
get { return this.GetValue(x => x.DirectPddBuyerAfterSaleAddressStr); }
set { this.SetValue(x => x.DirectPddBuyerAfterSaleAddressStr, value); }
}
public string DirectRefundStatusStr
{
get { return this.GetValue(x => x.DirectPddBuyerAfterSale); }
set { this.SetValue(x => x.DirectPddBuyerAfterSale, value); }
}
public string DirectRefundStatusStr
{
get { return this.GetValue(x => x.DirectRefundStatusStr); }
set { this.SetValue(x => x.DirectRefundStatusStr, value); }
@@ -993,17 +863,13 @@ namespace AllBase.Model.DBModel
public void SetDirectOrder()
{
this.DirectPddBuyerOrder = DirectPddBuyerOrders.FirstOrDefault(p => OrderItemExt?.out_order_id == p.order_sn);
if (DirectPddBuyerOrder != null)
{
}
this.DirectPddBuyerAfterSale = DirectPddBuyerAfterSales?.FirstOrDefault(p => p.statusText == "退款成功") ?? DirectPddBuyerAfterSales?.FirstOrDefault(p => p.statusText != "申请已撤销");
if (DirectPddBuyerAfterSale == null)
DirectPddBuyerAfterSale = DirectPddBuyerAfterSales?.FirstOrDefault();
//this.DirectPddBuyerAfterSale = DirectPddBuyerAfterSales.FirstOrDefault(p => OrderItemExt?.out_order_id == p.orderSn);
// 服务端这个值不会在拍新单后覆盖,在此处使用扩展订单绑定的买手单信息修改掉,后续在拍单的时候覆盖掉
if (ItemOrder.order_id == "3738859887048176128")
//this.DirectPddBuyerAfterSale = DirectPddBuyerAfterSales?.FirstOrDefault(p => p.statusText == "退款成功") ?? DirectPddBuyerAfterSales?.FirstOrDefault(p => p.statusText != "申请已撤销");
//if (DirectPddBuyerAfterSale == null)
// DirectPddBuyerAfterSale = DirectPddBuyerAfterSales?.FirstOrDefault();
this.DirectPddBuyerAfterSale = DirectPddBuyerAfterSales.FirstOrDefault(p => OrderItemExt?.out_order_id == p.orderSn);
// 服务端这个值不会在拍新单后覆盖,在此处使用扩展订单绑定的买手单信息修改掉,后续在拍单的时候覆盖掉
if (ItemOrder.order_id == "3738598656037525761")
{
}
@@ -1019,32 +885,12 @@ namespace AllBase.Model.DBModel
DirectRefundStatusBackColor = GlobalConfig.GreenBrush;
else if (DirectRefundStatusStr.ParseToString().Contains("需手动申请售后") || DirectRefundStatusStr.ParseToString().Contains("已超过可申请售后的时间"))
DirectRefundStatusBackColor = GlobalConfig.RedBrush;
}
if (order_id == "3739065927020471040")
{
}
DirectOrderBuyTimeStr = DirectPddBuyerOrder != null ? DirectPddBuyerOrder.add_time.ToString("yyyy-MM-dd HH:mm:ss") : "";
}
/// <summary> 直发最后一条物流信息 </summary>
public oms_wei_ewaybill_path LatestDirectEWaybill
{
get { return this.GetValue(x => x.LatestDirectEWaybill); }
set { this.SetValue(x => x.LatestDirectEWaybill, value); }
}
/// <summary> 中转仓最后一条物流信息 </summary>
public oms_wei_ewaybill_path LatestTransitEWaybill
{
get { return this.GetValue(x => x.LatestTransitEWaybill); }
set { this.SetValue(x => x.LatestTransitEWaybill, value); }
}
/// <summary>
/// 订单中所有商品加起来的总售价文本
/// </summary>
public string RealPriceStr
/// <summary>
/// 订单中所有商品加起来的总售价文本
/// </summary>
public string RealPriceStr
{
//get { return "¥" + (order_items.Sum(oi => oi.real_price) * 0.01m).ParseToDecimal().ToString("0.00"); }
get { return "¥" + (real_price * 0.01m).ParseToDecimal().ToString("0.00"); }
@@ -1061,18 +907,11 @@ namespace AllBase.Model.DBModel
set { }
}
public string PostagePriceStr
{
get { return "¥" + (ItemOrder?.postage_price * 0.01m / ItemOrder?.orderItems.Count).ParseToDecimal().ToString("0.00"); }
set { }
}
/// <summary>
/// 采购价文本
/// </summary>
public string PurchasePriceStr
{
public string purchase_price_str
{
//get { return "¥" + (order_items.Sum(oi => oi.purchase_price.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
get { return "¥" + (purchase_price * 0.01m).ParseToDecimal().ToString("0.00"); }
set { }
@@ -1080,20 +919,16 @@ namespace AllBase.Model.DBModel
/// <summary>
/// 采购价文本是否可见
/// </summary>
public Visibility PurchasePriceVisibility
public Visibility purchase_price_visibility
{
get
{
//if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible;
return Visibility.Collapsed;
}
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
set { }
}
/// <summary>
/// 运费文本
/// </summary>
public string FreightStr
public string freight_str
{
//get { return "¥" + (order_items.Sum(oi => oi.freight.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
get { return "¥" + (freight * 0.01m).ParseToDecimal().ToString("0.00"); }
@@ -1103,10 +938,10 @@ namespace AllBase.Model.DBModel
/// 运费文本是否可见
/// </summary>
public Visibility FreightVisibility
{
//get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
get { return Visibility.Collapsed; }
set { }
{
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
//get { if (ItemOrder.freight > 0) return Visibility.Visible; return Visibility.Collapsed; }
set { }
}
/// <summary>
@@ -1161,9 +996,7 @@ namespace AllBase.Model.DBModel
{
//ItemOrder.out_amount ItemTransitOrder.out_amount 只有一个有值
var out_amount = ItemTransitOrder?.out_amount ?? ItemOrder.out_amount / ItemOrder.orderItems.Count;
var postage_price = ItemOrder?.postage_price ?? ItemOrder.postage_price / ItemOrder.orderItems.Count;
profitCount = ((real_price.ParseToInt() + cash_coupon_discounted_price.ParseToInt() + postage_price -
purchase_price.ParseToInt() - freight.ParseToInt() - predict_commission_fee.ParseToInt() -
profitCount = ((real_price.ParseToInt() + cash_coupon_discounted_price.ParseToInt() - purchase_price.ParseToInt() - freight.ParseToInt() - predict_commission_fee.ParseToInt() -
commission_amount.ParseToInt() - out_amount.ParseToInt()) * 0.01m).ParseToDecimal();
}
return profitCount;
@@ -1264,7 +1097,7 @@ namespace AllBase.Model.DBModel
// 买手秒退异常重拍
BtnAbnormalBtnVisibility = Visibility.Visible;
// 不是异常单的不可异常重拍
if (this.ItemOrder?.IsAbnormal != true)
if (this.ItemOrder?.isAbnormal != true)
BtnAbnormalBtnVisibility = Visibility.Collapsed;
// 买手未退款的,中转正式取号以后的,不可异常重拍
else if (this.ItemTransitOrder?.refund_status != "买手退款成功" ||
@@ -1296,13 +1129,6 @@ namespace AllBase.Model.DBModel
}
}
public string RefundStatusStr
{
get { return this.GetValue(x => x.RefundStatusStr); }
set { this.SetValue(x => x.RefundStatusStr, value); }
}
/// <summary>
/// 订单商品表数据库id
/// </summary>
@@ -1444,30 +1270,13 @@ namespace AllBase.Model.DBModel
/// <summary>
/// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4:退款成功,11:已取消(售后完成订单取消)
/// </summary>
public int? refund_status
{
get { return this.GetValue(x => x.refund_status); }
set
{
this.SetValue(x => x.refund_status, value);
if (value == 1)
RefundStatusStr = "无售后/售后关闭";
else if (value == 2)
RefundStatusStr = "售后处理中";
else if (value == 3)
RefundStatusStr = "退款中";
else if (value == 4)
RefundStatusStr = "退款成功";
else if (value == 11)
RefundStatusStr = "售后完成订单取消";
}
}
public int? refund_status { get; set; }
public void SetOrderItemTextProperty()
{
CreateDateTime = BaseClass.StampToDateTime((ItemOrder?.create_time).ParseToInt());
CreateDateTimeStr = CreateDateTime.ToString("yy-MM-dd HH:mm:ss");
UpdateTimeStr = BaseClass.StampToDateTime((ItemOrder?.update_time).ParseToInt()).ToString("yy-MM-dd HH:mm:ss");
CreateDateTimeStr = CreateDateTime.ToString("yyyy-MM-dd HH:mm:ss");
UpdateTimeStr = BaseClass.StampToDateTime((ItemOrder?.update_time).ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss");
//if (PurpleBrush == null && GlobalConfig.Dispatcher != null)
//{
@@ -1487,101 +1296,56 @@ namespace AllBase.Model.DBModel
// 拍单、代发等信息判断并控制拍单按钮
this.UpdateOrderItemBuyButton();
this.SetAbnormalAndDirectBtnVisibility();
SetEWaybillInfo();
}
/// <summary> 初始化物流明细信息 </summary>
public void SetEWaybillInfo()
{
if(order_id == "3738794693820307200")
{
}
if (this.ItemOrder?.latestEWaybills?.Count > 0 && !string.IsNullOrEmpty(ItemTransitOrderWithVoid?.express_2_waybill))
LatestTransitEWaybill = ItemOrder.latestEWaybills.FirstOrDefault(ew => ew.waybill_id == ItemTransitOrderWithVoid.express_2_waybill);
else
LatestTransitEWaybill = null;
if (this.ItemOrder?.latestEWaybills?.Count > 0 && !string.IsNullOrEmpty(this.ItemOrder?.out_express_no))
LatestDirectEWaybill = ItemOrder.latestEWaybills.FirstOrDefault(ew => ew.waybill_id == this.ItemOrder?.out_express_no);
else
LatestDirectEWaybill = null;
}
}
public void UpdateOrderItemBuyButton()
{
var order_item = this;
order_item.Shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == order_item.shop_id.ParseToString());
// 关联商品sku
if (GlobalConfig.CurrentBuyPlatform == "pdd")
{
if (PddBuyMapSkus != null && PddBuyMapSkus.Count > 0)
MapSkusBtnVisibility = Visibility.Visible;
else
MapSkusBtnVisibility = Visibility.Collapsed;
}
else if (GlobalConfig.CurrentBuyPlatform == "tb")
{
if (TbBuyMapSkus != null && TbBuyMapSkus.Count > 0)
MapSkusBtnVisibility = Visibility.Visible;
else
MapSkusBtnVisibility = Visibility.Collapsed;
}
else
MapSkusBtnVisibility = Visibility.Collapsed;
order_item.IsBuyGoodsBtnEnabled = false;
if (GlobalConfig.CurrentBuyPlatform == "pdd" && order_item.PddBuyMap == null)
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnTxt = "关联拍单";
order_item.BuyGoodsBtnBackColor = GlobalConfig.PurpleBrush100;
order_item.BuyGoodsBtnColor = GlobalConfig.PurpleBrush;
}
else if (GlobalConfig.CurrentBuyPlatform == "tb" && order_item.TbBuyMap == null)
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnTxt = "关联拍单";
order_item.BuyGoodsBtnBackColor = GlobalConfig.PurpleBrush100;
order_item.BuyGoodsBtnColor = GlobalConfig.PurpleBrush;
}
else if (GlobalConfig.lstDangerItemWord.Any(d => order_item.title.Contains(d)))
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "危险品不支持中转拍单";
}
else if (Shop == null || (Shop?.LoginStatus != "登录成功" /*&& Shop?.Is29Supplier == null*/))
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "请登录店铺";
}
else if (Shop?.LoginStatus == "登录成功" && Shop?.Is29Supplier == null)
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.OrangeBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.OrangeBrush;
order_item.BuyGoodsBtnTxt = "代发状态读取中请稍候";
}
else if (Shop?.Is29Supplier == false)
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "去店铺后台绑定代发";
}
else
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnTxt = "云仓拍单";
order_item.BuyGoodsBtnBackColor = GlobalConfig.PurpleBrush35;
order_item.BuyGoodsBtnColor = GlobalConfig.PurpleBrush;
}
order_item.IsBuyGoodsBtnEnabled = false;
if (order_item.BuyMap == null)
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnTxt = "关联拍单";
order_item.BuyGoodsBtnBackColor = GlobalConfig.PurpleBrush100;
order_item.BuyGoodsBtnColor = GlobalConfig.PurpleBrush;
}
else if (GlobalConfig.lstDangerItemWord.Any(d => order_item.title.Contains(d)))
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "危险品不支持中转拍单";
}
else if (Shop == null || (Shop?.LoginStatus != "登录成功" /*&& Shop?.Is29Supplier == null*/))
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "请登录店铺";
}
else if (Shop?.LoginStatus == "登录成功" && Shop?.Is29Supplier == null)
{
order_item.IsBuyGoodsBtnEnabled = false;
order_item.BuyGoodsBtnBackColor = GlobalConfig.OrangeBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.OrangeBrush;
order_item.BuyGoodsBtnTxt = "代发状态读取中请稍候";
}
else if (Shop?.Is29Supplier == false)
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnBackColor = GlobalConfig.RedTextBrush50;
order_item.BuyGoodsBtnColor = GlobalConfig.RedTextBrush;
order_item.BuyGoodsBtnTxt = "去店铺后台绑定代发";
}
else
{
order_item.IsBuyGoodsBtnEnabled = true;
order_item.BuyGoodsBtnTxt = "云仓拍单";
order_item.BuyGoodsBtnBackColor = GlobalConfig.PurpleBrush35;
order_item.BuyGoodsBtnColor = GlobalConfig.PurpleBrush;
}
}
}
}
@@ -1,51 +0,0 @@
using AllBase.Model.MvvmBaseClasses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.DBModel;
public class oms_wei_transfer_extra_package : PropertyNotifyObject
{
public long id { get; set; } // 主键ID
public string batchId { get; set; } // 新订单号
public string order_no { get; set; } // 平台订单号
public string buyer_account { get; set; } // '买家账号',
public int? out_amount { get; set; } // '外部金额(分)',
public string purchaser_note { get; set; } // '采购人备注'
public string logistics_code { get; set; } // '快递公司',
public string logistics_express_code { get; set; } // '快递单号',
public string real_logistics_code // '出库快递公司',
{
get { return this.GetValue(x => x.real_logistics_code); }
set { this.SetValue(x => x.real_logistics_code, value); }
}
public string real_logistics_express_code // '出库单号',
{
get { return this.GetValue(x => x.real_logistics_express_code); }
set { this.SetValue(x => x.real_logistics_express_code, value); }
}
public string refund_status { get; set; } // '买手退款状态',
public DateTime? pickup_time { get; set; } // '取号时间',
public int? transfer_warehouse_status { get; set; } // '中转仓状态:0 未使用,1 已创建,2 创建失败',
public string raw_message { get; set; } // '原始消息/请求体',
public DateTime? created_time { get; set; } // '创建时间',
public DateTime? updated_time { get; set; } // '更新时间',
public string platform { get; set; } // '中转仓库编码',
public string order_platform_code { get; set; } // '订单平台',
public string order_code { get; set; } // '唯一值编码',
public string random_code { get; set; } // '溯源码',
public int? warehouse_status { get; set; } // '0: 未使用, 1: 已入库, 2: 未入库',
public DateTime? inbound_time { get; set; } // '入库时间',
public DateTime? outbound_time { get; set; } // '出库时间',
public int? order_void_status { get; set; } // '订单作废状态:0=正常,1=已作废,2=作废失败',
public int? postage { get; set; } // '订单初始费用(分)',
public int? retry_acquire_success { get; set; } // '重试取号是否成功 0=未尝试/未重试 1=成功 2=失败',
public int? over_weight_fee { get; set; } // '超重费用',
public string pack_type { get; set; } // '中转仓额外包裹类型 1商品2额外3礼品4退货',
public DateTime? rejected_time { get; set; } // '拒收时间',
public int? has_reject { get; set; } // DEFAULT NULL,
public DateTime? blocked_arrival_time { get; set; }
}
@@ -33,7 +33,5 @@ namespace AllBase.Model.DBModel
public string order_detail { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string sync_logistics_msg { get; set; }
}
}
}
@@ -84,9 +84,6 @@ namespace AllBase.Model.DBModel
支付宝在线充值 = 30,
云仓退货支出 = 31,
礼物单退费 = 34,
额外订单创建 = 35,
额外订单作废 = 36,
同步物流 = 55,
}
/*
@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.DBModel
{
public class yh_sync_logistics
{
public long id { get; set; }
public string order_id { get; set; }
public string tracking_number { get; set; }
public string source_tracking_number { get; set; }
public string pickup_code { get; set; }
public int? upload_pickup_status { get; set; }
public DateTime? create_time { get; set; }
public DateTime? upload_pickup_Time { get; set; }
public string remark { get; set; }
}
}
+1 -7
View File
@@ -1,5 +1,4 @@
using AllBase.Model.MvvmBaseClasses;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -174,7 +173,6 @@ namespace AllBase.Model.Result
{
public long? skuId { get; set; } // 28790184768,
public long? goodsId { get; set; } // 1661424397,
[JsonIgnore]
public string GoodsNameStr
{
get { return this.GetValue(x => x.GoodsNameStr); }
@@ -193,7 +191,6 @@ namespace AllBase.Model.Result
public int? defaultQuantity { get; set; } // 100,
public int? isOnsale { get; set; } // 1,
public string spec { get; set; } // "677094835",
[JsonIgnore]
public string SpecNameStr
{
get { return this.GetValue(x => x.SpecNameStr) == null ? string.Join(",", specs?.Select(s => s.spec_value)) : this.GetValue(x => x.SpecNameStr); }
@@ -206,10 +203,7 @@ namespace AllBase.Model.Result
set
{
_specs = value;
if (value != null)
SpecNameStr = string.Join(",", value.Select(s => s.spec_value));
else
SpecNameStr = "";
SpecNameStr = string.Join(",", value.Select(s => s.spec_value));
}
}
public int? price { get; set; } // 0,
@@ -44,13 +44,7 @@ namespace AllBase.Model.Result
get { return this.GetValue(x => x.ShopOrderRefundStr); }
set { this.SetValue(x => x.ShopOrderRefundStr, value); }
}
// 店铺直发订单售后状态
public string ShopOrderOutAfterSaleStatusStr
{
get { return this.GetValue(x => x.ShopOrderOutAfterSaleStatusStr); }
set { this.SetValue(x => x.ShopOrderOutAfterSaleStatusStr, value); }
}
public string TransitBuyerOrderRefundStatus
public string TransitBuyerOrderRefundStatus
{
get { return this.GetValue(x => x.TransitBuyerOrderRefundStatus); }
set { this.SetValue(x => x.TransitBuyerOrderRefundStatus, value); }
+24 -34
View File
@@ -22,23 +22,23 @@ namespace AllBase.Model.Result
public static string GetPddToTransitWarehouseExpressCompanyCode(string expressCompanyName)
{
if (expressCompanyName == null || expressCompanyName == "") return "";
if (expressCompanyName.Contains("顺丰速运") || expressCompanyName == "SF") return "SF";
if (expressCompanyName.Contains("邮政快递包裹") || expressCompanyName == "EMS") return "EMS";
if (expressCompanyName.Contains("邮政电商标快") || expressCompanyName == "EMS") return "EMS";
if (expressCompanyName.Contains("邮政EMS") || expressCompanyName == "EMS") return "EMS";
if (expressCompanyName.Contains("圆通快递") || expressCompanyName == "YTO") return "YTO";
if (expressCompanyName.Contains("圆通速递") || expressCompanyName == "YTO") return "YTO";
if (expressCompanyName.Contains("中通快递") || expressCompanyName == "ZTO") return "ZTO";
if (expressCompanyName.Contains("百世快递") || expressCompanyName == "HTKY") return "HTKY";
if (expressCompanyName.Contains("百世快运") || expressCompanyName == "HTKY") return "HTKY";
if (expressCompanyName.Contains("申通快递") || expressCompanyName == "STO") return "STO";
if (expressCompanyName.Contains("韵达快递") || expressCompanyName == "YUNDA") return "YUNDA";
if (expressCompanyName.Contains("韵达速递") || expressCompanyName == "YUNDA") return "YUNDA";
if (expressCompanyName.Contains("京东快递") || expressCompanyName == "JDKD") return "JDKD";
if (expressCompanyName.Contains("京东快运") || expressCompanyName == "JDKD") return "JDKD";
if (expressCompanyName.Contains("京东大件物流") || expressCompanyName == "JDKD") return "JDKD";
if (expressCompanyName.Contains("极兔速递") || expressCompanyName == "JTSD") return "JTSD";
if (expressCompanyName.Contains("极兔快递") || expressCompanyName == "JTSD") return "JTSD";
if (expressCompanyName.Contains("顺丰速运")) return "SF";
if (expressCompanyName.Contains("邮政快递包裹")) return "EMS";
if (expressCompanyName.Contains("邮政电商标快")) return "EMS";
if (expressCompanyName.Contains("邮政EMS")) return "EMS";
if (expressCompanyName.Contains("圆通快递")) return "YTO";
if (expressCompanyName.Contains("圆通速递")) return "YTO";
if (expressCompanyName.Contains("中通快递")) return "ZTO";
if (expressCompanyName.Contains("百世快递")) return "HTKY";
if (expressCompanyName.Contains("百世快运")) return "HTKY";
if (expressCompanyName.Contains("申通快递")) return "STO";
if (expressCompanyName.Contains("韵达快递")) return "YUNDA";
if (expressCompanyName.Contains("韵达速递")) return "YUNDA";
if (expressCompanyName.Contains("京东快递")) return "JDKD";
if (expressCompanyName.Contains("京东快运")) return "JDKD";
if (expressCompanyName.Contains("京东大件物流")) return "JDKD";
if (expressCompanyName.Contains("极兔速递")) return "JTSD";
if (expressCompanyName.Contains("极兔快递")) return "JTSD";
return "OTHER";
//SF 顺丰 //EMS 邮政快递 //YTO 圆通 //ZTO 中通 //HTKY 百世 //STO 申通 //YUNDA 韵达 //JDKD 京东快递 //JTSD 极兔
}
@@ -122,21 +122,13 @@ namespace AllBase.Model.Result
{
get { return this.GetValue(x => x.WxSendTypeStr); }
set { this.SetValue(x => x.WxSendTypeStr, value); }
}
public string ShopIdStr
{
get { return this.GetValue(x => x.ShopIdStr); }
set { this.SetValue(x => x.ShopIdStr, value); }
}
/// <summary>
/// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
/// </summary>
public int? WxOrderStatus
{
get { return this.GetValue(x => x.WxOrderStatus); }
set { this.SetValue(x => x.WxOrderStatus, value); }
}
public string ShopOrderIdStr
}
public string ShopIdStr
{
get { return this.GetValue(x => x.ShopIdStr); }
set { this.SetValue(x => x.ShopIdStr, value); }
}
public string ShopOrderIdStr
{
get { return this.GetValue(x => x.ShopOrderIdStr); }
set { this.SetValue(x => x.ShopOrderIdStr, value); }
@@ -442,8 +434,6 @@ namespace AllBase.Model.Result
if (outExpressCompanyMsg.Contains("京东快运")) return "京东快运";
if (outExpressCompanyMsg.Contains("京东大件物流")) return "京东大件物流";
if (outExpressCompanyMsg.Contains("其他快递")) return "其他快递";
if (outExpressCompanyMsg.Length < 10)
return outExpressCompanyMsg;
return "物流名称获取失败";
}
}
-46
View File
@@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result
{
public class PddPickInfo
{
public string station_name {get;set;} // ""
public int count { get; set; } // 73
public List<combine_info> combine_list { get; set; }
}
public class combine_info
{
public string address { get; set; } // "兔喜快递超市(浸校塘东良巷店)",
public string company_name { get; set; } // "喵站代收点",
public string station_code { get; set; } // "8004974987501568",
public string contact_phone { get; set; } // "13556614729",
public string contact_phone_type { get; set; } // "OTHER",
public List<combine_track_info> combine_track_list { get; set; }
public string latest_operate_time { get; set; } // "2026-09-23 19:06:03",
public string company_code { get; set; } // "MIGSTATION",
public bool? display_nav_entry { get; set; } // false,
public bool? all_selected { get; set; } // true
}
public class combine_track_info
{
public string order_sn { get; set; } // "260922-106514399573137",
public int? shipping_id { get; set; } // 115,
public string shipping_name { get; set; } // 中通快递,
public string tracking_number { get; set; } // 79143307021657,
public string pic_url { get; set; } // "https:\u002F\u002Fimg.pddpic.com\u002Fmms-goods-image\u002F2026-08-24\u002F8acb431a-2489-4611-ba84-c85b5bb61401.jpeg",
public string pick_code { get; set; } // "取件码 23-2234",
public string jump_url { get; set; } // "\u002Fgoods_express.html?thumb_url=https%3A%2F%2Fimg.pddpic.com%2Fmms-goods-image%2F2026-08-24%2F8acb431a-2489-4611-ba84-c85b5bb61401.jpeg&order_sn=260922-106514399573137",
public string operation_time { get; set; } // "2026-09-23 19:06:03",
public int? order_count { get; set; } // 1,
public object order_list { get; set; } // [ { "order_sn": "260922-106514399573137", "pic_url": "https:\u002F\u002Fimg.pddpic.com\u002Fmms-goods-image\u002F2026-08-24\u002F8acb431a-2489-4611-ba84-c85b5bb61401.jpeg","jump_url": "\u002Fgoods_express.html?thumb_url=https%3A%2F%2Fimg.pddpic.com%2Fmms-goods-image%2F2026-08-24%2F8acb431a-2489-4611-ba84-c85b5bb61401.jpeg&order_sn=260922-106514399573137"}],
public int? source_type { get; set; } // 6,
public bool? selectd { get; set; } // true,
public int? pickup_status { get; set; } // 0
}
}
@@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result
{
public class WxOrderExpressInfo
{
public int? deliverType { get; set; } // 5,
public string phone { get; set; } // "3859",
public List<WxDeliveryProductInfo> deliveryProductInfo { get; set; } //
public int? orderProductCnt { get; set; } // 1,
public int? deliveryCnt { get; set; } // 1,
public bool? isIntracityOrder { get; set; } // false,
public object intracityTracking { get; set; } // null,
public List<object> formatUnshippedProductList { get; set; } // [ ],
public Dictionary<string, string> product2Img { get; set; } // "15197350020": "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/6a080c080007548c0abba40bffc31715000000a100004f50"
}
public class WxDeliveryProductInfo
{
public string waybillId { get; set; } // "772064086780390",
public string deliveryId { get; set; } // "STO",
public List<WxDeliveryProductInfoInfo> productInfos { get; set; }
public string deliveryName { get; set; } // "申通快递",
public string deliveryTime { get; set; } // "1779537701",
public int? deliverType { get; set; } // 5,
public int? waybillStatus { get; set; } // 0
}
public class WxDeliveryProductInfoInfo
{
public string productId { get; set; } // "10000859462312",
public string skuId { get; set; } // "15197350020",
public int? productCnt { get; set; } // 1,
public string supplyProductId { get; set; } // "0",
public string supplySkuId { get; set; } // "0"
}
}
+24
View File
@@ -0,0 +1,24 @@
<Project>
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
<PropertyGroup>
<DefaultTargetFramework>net8.0</DefaultTargetFramework>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
<LangVersion>12.0</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<Nullable>annotations</Nullable>
<NoWarn>CS1591</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PolySharp" Version="1.16.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
+19
View File
@@ -0,0 +1,19 @@
<tf:FrameworkApplication
x:Class="Main.Test.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Main.Test"
xmlns:tf="Trade.Framework">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
<ResourceDictionary Source="StyledDataGrid.xaml" />
<ResourceDictionary Source="Dictionary2.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</tf:FrameworkApplication>
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff. Show more