淘宝拍单优化

This commit is contained in:
wule committed 2026-10-15 17:36:34 +08:00
1 parent ea14ad3af4
commit e7d22984df
12 files changed
+2233 -46

No files matched your search

+3
View File
@@ -73,6 +73,9 @@
<Resource Include="gear.ico" />
</ItemGroup>
<ItemGroup>
<Compile Update="Ctrls\BuyerCtrls\PddBuyOrderCtrl.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\ChangePickNoView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -389,9 +389,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
});
}
// 读订单
if (/*(cefAddress.Contains("orders.html")) &&*/
url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
// 读订单
if (/*(cefAddress.Contains("orders.html")) &&*/ url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
//https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v4?pdduid=6766109923730
{
Task.Run(() =>
{
@@ -0,0 +1,598 @@
<UserControl
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.PddBuyOrderCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uc="clr-namespace:_29WxOrderWpf.UserControls"
xmlns:wpf="WPFCommon"
x:Name="pddBuyOrderCtrl"
Width="1360"
Height="768"
MinWidth="800"
MinHeight="600"
d:Height="800"
Loaded="pddBuyOrderCtrl_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<Style BasedOn="{StaticResource TitleContentBaseStyle}" TargetType="wpf:TitleContent">
<Setter Property="Placement" Value="Left" />
<Setter Property="TitleVerticalAlignment" Value="Center" />
<Setter Property="LeftTitlePadding" Value="0,0,0,0" />
</Style>
<Style TargetType="wpf:SpacingStackPanel">
<Setter Property="Margin" Value="3,0" />
</Style>
</UserControl.Resources>
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 地址栏 -->
<Border
Grid.Row="0"
Background="White"
BorderBrush="#E0E0E0"
BorderThickness="0,0,0,1">
<TextBox
x:Name="txtAddress"
Margin="3,2"
VerticalContentAlignment="Center"
BorderBrush="#D0D0D0"
BorderThickness="1"
KeyDown="txtAddress_KeyDown"
Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" />
</Border>
<!-- 主区域:浏览器 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True">
<TextBlock
Margin="0,-140,0,0"
Padding="30,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
d:Text="ErrorMsg"
Background="#C0FFFFFF"
FontSize="20"
Foreground="Red"
IsHitTestVisible="False"
Text="{Binding ErrorMsg}"
TextWrapping="Wrap"
Visibility="{Binding ErrorMsg, Converter={StaticResource HasTextVisibility}}" />
<TextBlock
Margin="0,0,0,0"
Padding="30,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="99"
d:Text="TransitErrorMsg"
Background="#C0FFFFFF"
FontSize="20"
Foreground="Red"
IsHitTestVisible="False"
Text="{Binding TransitErrorMsg}"
TextWrapping="Wrap"
Visibility="{Binding TransitErrorMsg, Converter={StaticResource HasTextVisibility}}" />
</Grid>
<GridSplitter
Grid.Column="1"
Width="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#d0d0d0"
ResizeBehavior="PreviousAndNext"
ShowsPreview="True" />
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<wpf:SpacingStackPanel
Grid.Row="0"
Margin="4"
Orientation="Vertical"
VerticalSpacing="4">
<Grid>
<Image
x:Name="imgOrderItem"
Grid.Row="1"
Grid.Column="0"
Width="100"
Height="100"
Margin="0,4,8,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Panel.ZIndex="1"
Cursor="Hand"
MouseDown="imgOrderItem_MouseDown"
Source="{Binding Img}" />
<wpf:SpacingStackPanel
Width="250"
Margin="4"
HorizontalAlignment="Right"
Orientation="Vertical"
VerticalSpacing="4">
<CheckBox
x:Name="chkDirectOrder"
Margin="0,0,0,8"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Content="保存地址时替换为云仓地址"
FontSize="12" />
<wpf:TitleContent
Title="店铺名称:"
HorizontalAlignment="Right"
VerticalAlignment="Top"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtShopName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="订单编号:"
HorizontalAlignment="Right"
VerticalAlignment="Top"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtOrderIdVal}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
<TextBlock FontSize="14" FontWeight="Bold">店铺商品信息:</TextBlock>
<wpf:TitleContent
x:Name="tcShopGoodsName"
Title="店铺标题:"
TitleHorizontalAlignment="Right"
TitleWidth="85">
<TextBox
x:Name="txtShopGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺规格:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopSpecName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSpecNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopSkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSkuIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台商品编码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSpuCode"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSpuCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台SKU编码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSkuCode"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSkuCodeVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:TitleContent
Title="数量:"
Grid.Column="0"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtShopOrderItemCnt"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="  总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
<TextBox
x:Name="txtShopOrderItemPrice"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemPriceVal}" />
</wpf:TitleContent>
</Grid>
<wpf:SpacingStackPanel
Grid.Row="0"
Margin="0"
Orientation="Vertical"
VerticalSpacing="4"
Visibility="{Binding BuyInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
买手拍单信息:
</TextBlock>
<wpf:TitleContent
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuIdVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:TitleContent
Title="拍单数量:"
Grid.Column="0"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyCnt"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
<TextBox
x:Name="txtBuyPrice"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyPriceVal}" />
</wpf:TitleContent>
</Grid>
<wpf:TitleContent
Title="拍单订单号:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyOrderIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="溯源码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSourceCode"
Height="20"
Background="#DDDDDD"
BorderBrush="#999999"
IsEnabled="False"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSourceCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
x:Name="tcBuyAddress"
Title="中转地址:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyTransitWarehouse"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyTransitWarehouseVal}" />
</wpf:TitleContent>
<Grid>
<Button
x:Name="btnReMap"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding ReMapCommand}"
Content="重新关联商品"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}" />
<Button
x:Name="btnCopyCurrentFullAddress"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="85,0,0,0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding CopyCurrentFullAddressCommand}"
Content="复制完整中转地址"
FontSize="12"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding CurrentFullTransitAddress, Converter={StaticResource HasTextVisibility}}" />
<Button
x:Name="btnManualUpdateBuyOrder"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
Command="{Binding ManualUpdateBuyOrderCommand}"
Content="手动确认拍单"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</Grid>
</wpf:SpacingStackPanel>
</wpf:SpacingStackPanel>
<wpf:SpacingStackPanel
Grid.Row="2"
Margin="4"
Orientation="Vertical"
VerticalSpacing="4"
Visibility="{Binding MapInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
关联商品信息:
</TextBlock>
<wpf:TitleContent
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapSkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapSkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="关联商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="关联SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtMapSkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtMapSkuIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="发货地:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="txtSendProvince"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSendProvinceVal}" />
<Button
x:Name="btnManualUpdateSendProvince"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="3,0,0,0"
Padding="4,0"
HorizontalAlignment="Right"
d:Opacity="0.5"
Content="手动更新发货地"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</Grid>
</wpf:TitleContent>
<wpf:TitleContent
Title="中转仓:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<ComboBox
x:Name="cmbTransitWarehouse"
Height="22"
SelectedIndex="0"
SelectedValue="{Binding cmbTransitWarehouseVal}"
SelectionChanged="cmbTransitWarehouse_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<!--<ComboBoxItem Content="仓库地址" />-->
</ComboBox>
</wpf:TitleContent>
<wpf:TitleContent
Title=""
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Button
x:Name="btnManualUpdateTransitWarehouse"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
Command="{Binding UpdateTransitWarehouseCommand}"
Content="确认商品关联"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,95 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.BuyerCtrls;
/// <summary>
/// PddBuyOrderCtrl.xaml 的交互逻辑
/// </summary>
public partial class PddBuyOrderCtrl : UserControl
{
/// <summary>视图模型</summary>
public PddBuyOrderViewModel ViewModel { get; }
public PddBuyOrderCtrl(BuyerLoginInfo buyerInfo, oms_wei_order_item_info orderItemInfo)
{
InitializeComponent();
foreach (var warehouse in TransitWarehouseData.TransitWarehouseList)
{
this.cmbTransitWarehouse.Items.Add(warehouse.TransName + " " + warehouse.TransFullAddress);
}
ViewModel = new PddBuyOrderViewModel(buyerInfo, orderItemInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private async void pddBuyOrderCtrl_Loaded(object sender, RoutedEventArgs e)
{
//btnManualUpdateSendProvince.Visibility = Visibility.Collapsed;
if (this.ViewModel.BuyType == "direct")
{
this.tcBuyAddress.Title = "拍单地址:";
}
await ViewModel.Start();
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{
Grid.SetRow(browser, 0);
Grid.SetColumn(browser, 0);
BrowserHost.Children.Add(browser);
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
private void cmbTransitWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void imgOrderItem_MouseDown(object sender, MouseButtonEventArgs e)
{
if (imgOrderItem.Width == 100)
{
imgOrderItem.Width = 500;
imgOrderItem.Height = 500;
}
else
{
imgOrderItem.Width = 100;
imgOrderItem.Height = 100;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -49,9 +49,32 @@ public partial class TaobaoBuyOrderCtrl : UserControl
{
this.tcBuyAddress.Title = "拍单地址:";
}
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
{
parentWindow.Closed += ParentWindow_Closed;
}
await ViewModel.Start();
}
private void ParentWindow_Closed(object sender, EventArgs e)
{
// 1. 解除 JS 绑定
this.ViewModel?.CefWebBrowser?.JavascriptObjectRepository?.UnRegisterAll();
//this.ViewModel.CefWebBrowser?.CloseDevTools();
// 2. 优雅关闭浏览器
this.ViewModel?.CefWebBrowser?.GetBrowser()?.CloseBrowser(false);
// 3. 清理残留子进程(按路径判断,避免误杀)
//CleanupBrowserSubprocesses();
// 4. 释放控件
this.ViewModel?.CefWebBrowser?.Dispose();
//this.ViewModel.CefWebBrowser = null;
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{
Grid.SetRow(browser, 0);
@@ -149,6 +149,16 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
set { this.SetValue(x => x.Address, value); }
}
public string txtShopNameVal
{
get { return this.GetValue(x => x.txtShopNameVal); }
set { this.SetValue(x => x.txtShopNameVal, value); }
}
public string txtOrderIdVal
{
get { return this.GetValue(x => x.txtOrderIdVal); }
set { this.SetValue(x => x.txtOrderIdVal, value); }
}
public string txtShopGoodsNameVal
{
get { return this.GetValue(x => x.txtShopGoodsNameVal); }
@@ -326,6 +336,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
ManualUpdateBuyOrderCommand = new DelegateCommand(ManualUpdateBuyOrder);
UpdateTransitWarehouseCommand = new DelegateCommand(UpdateTransitWarehouse);
this.txtShopNameVal = orderItem.Shop.ShopAccount;
this.txtOrderIdVal = orderItem.order_id;
this.txtShopSkuIdVal = orderItem.sku_id;
this.txtShopGoodsIdVal = orderItem.product_id;
this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id;
@@ -472,21 +484,20 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
cookieLst = new List<Cookie>();
}
}
catch
catch (Exception ex)
{
}
// cef138必须init后方可设置或删除cookie
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
await Task.Delay(20);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null));
await Task.Delay(50);
await WPFCEFBrowser.DeleteCookieAsync(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
@@ -583,6 +594,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
// 点击 立即购买/领券购买
Thread.Sleep(Randomx.GetId(500, 1000));
await AutoClickBuyButton();
// 点击 管理地址(必出验证,暂时url直接跳转)
@@ -590,12 +602,13 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 自动修改地址 进入地址页面
Thread.Sleep(Randomx.GetId(500, 1000));
CefWebBrowser.Load("https://i.taobao.com/my_itaobao/receiver-address-pc");
CefWebBrowser.Load("https://i.taobao.com/my_itaobao/receiver-address-pc");
await AutoChangeAddress();
}
catch (Exception ex)
{
BaseMsgWindow.ShowError(ex.Message);
if (!ex.Message.ParseToString().Contains("无法访问已释放的对象"))
BaseMsgWindow.ShowError(ex.Message);
}
}
});
@@ -778,7 +791,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (jsRst != "success")
throw new Exception("管理地址按钮不存在!");
for (int i = 0; i < 10 && !Address.StartsWith("https://i.taobao.com/my_itaobao/receiver-address-pc"); i++)
for (int i = 0; i < 25 && !Address.StartsWith("https://i.taobao.com/my_itaobao/receiver-address-pc"); i++)
{
Thread.Sleep(500);
}
@@ -1189,7 +1202,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (jsRst == "success")
TransitErrorMsg = "";
}
catch
catch (Exception ex)
{
}
});
@@ -1224,7 +1237,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
catch (Exception ex)
{
}
});
}
@@ -1630,7 +1642,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
}
}
catch
catch (Exception ex)
{
}
}
@@ -1667,7 +1679,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
GlobalConfig.BuyMapList.RemoveAll(b => buyMapList.Any(map => b.spu_code == map.spu_code && b.sku_code == map.sku_code));
GlobalConfig.BuyMapList.AddRange(buyMapList);
}
catch
catch (Exception ex)
{
}
var tbBuyMap = buyMapList.FirstOrDefault(b => b.spu_code == upSpuCode && b.sku_code == upSkuCode && b.platform == "tb");
@@ -1820,7 +1832,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
code = xmlDoc["AjaxResult"]["code"].InnerText;
msg = xmlDoc["AjaxResult"]["msg"].InnerText;
}
catch
catch (Exception ex)
{
msg = exportRst.ParseToString();
}
@@ -3130,6 +3130,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public static bool GetNeedBuyerAfterSale(string buyerAfterSaleStatus)
{
if (buyerAfterSaleStatus == null)
return false;
if (buyerAfterSaleStatus.Contains("待用户发货") || GetNeedBuyerNewAfterSale(buyerAfterSaleStatus))
return true;
return false;
@@ -3137,6 +3140,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public static bool GetNeedBuyerNewAfterSale(string buyerAfterSaleStatus)
{
if (buyerAfterSaleStatus == null)
return false;
if (buyerAfterSaleStatus.Contains("需手动申请售后") || buyerAfterSaleStatus.Contains("已申请售后 退款失败") || buyerAfterSaleStatus.Contains("已取消申请") || string.IsNullOrEmpty(buyerAfterSaleStatus))
return true;
return false;
@@ -517,14 +517,15 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
MainWindow.Instance.Dispatcher.Invoke(new Action(() =>
{
if (GlobalConfig.CurrentBuyPlatform == "pdd")
PddBuyOrder(orderItem, isAbnormalOrder, isAutoBuy);
//PddBuyOrder(orderItem, isAbnormalOrder, isAutoBuy);
PddBuyOrderWpf(orderItem, isAbnormalOrder, isAutoBuy);
else if (GlobalConfig.CurrentBuyPlatform == "tb")
TbBuyOrder(orderItem, isAbnormalOrder, isAutoBuy);
TbBuyOrderWpf(orderItem, isAbnormalOrder, isAutoBuy);
}));
});
}
public static void TbBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
public static void TbBuyOrderWpf(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{
if (GlobalConfig.CurrentTaobaoBuyer == null)
{
@@ -578,6 +579,61 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
}
public static void PddBuyOrderWpf(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{
if (GlobalConfig.CurrentPddBuyer == null)
{
BaseMsgWindow.ShowError("未选择买手!");
return;
}
PddBuyOrderCtrl pddBuyView = new PddBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
if (orderItem.PddBuyMap != null)
{
pddBuyView.ViewModel.InitUrl = "https://mobile.yangkeduo.com/order_checkout.html?sku_id=" + orderItem.PddBuyMap.map_sku_id +
"&group_id=1" + Randomx.GetNumber(11) + "&goods_id=" + orderItem.PddBuyMap.map_goods_id + "&goods_number=" + orderItem.sku_cnt +
"&page_from=101";
pddBuyView.ViewModel.IsAutoBuy = isAutoBuy;
}
else
{
pddBuyView.ViewModel.InitUrl = "https://mobile.yangkeduo.com/orders.html"; //"?type=0&comment_tab=1&combine_orders=1&main_orders=1&refer_page_name=personal&refer_page_id=10001_1782219035613_a9ulipk4k3&refer_page_sn=10001";
pddBuyView.ViewModel.IsMappingGoods = true;
}
if (isAbnormalOrder)
pddBuyView.ViewModel.AbnormalTransitWarehouseOrderInfo = orderItem.ItemTransitOrder;
new DialogWindow()
{
Title = "买手拍单 - 当前买手 " + GlobalConfig.CurrentPddBuyer.buyer_nick,
Content = pddBuyView,
//Height = System.Windows.Forms.SystemInformation.WorkingArea.Height - 80,
//Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 80,
Width = SystemParameters.PrimaryScreenWidth < 1920 ? SystemParameters.PrimaryScreenWidth : SystemParameters.PrimaryScreenWidth * 90 / 100,
Height = SystemParameters.PrimaryScreenHeight * 90 / 100,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
}.ShowDialog();
// 记录窗口内传出的是否继续自动拍单属性
OrderListCtrl.IsAutoBuy = pddBuyView.ViewModel.IsAutoBuy;
// 如果购买成功,修改供应商信息
if (pddBuyView.ViewModel.IsBuySuccess)
{
Task.Run(async () =>
{
if (orderItem.BuyGoodsBtnTxt == "云仓拍单" && !isAbnormalOrder) // 异常拍单不改变订单供应商
{
try
{
await SetSendOrderSupplier(orderItem, "wxfc630d60a1af6c6f", "29供货商");
}
catch (Exception ex)
{
BaseMsgWindow.ShowError(ex.Message);
}
}
});
}
}
public static void PddBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance, orderItem, GlobalConfig.CurrentPddBuyer, orderItem.PddBuyMap);
@@ -223,7 +223,7 @@ namespace _29WxOrderWpf.ViewModels
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
await Task.Delay(20);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null));
await WPFCEFBrowser.DeleteCookieAsync(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
@@ -272,7 +272,8 @@ namespace _29WxOrderWpf.ViewModels
}
}
});
}
);
}
@@ -321,7 +322,7 @@ namespace _29WxOrderWpf.ViewModels
// Task.Run(() => { CefWebBrowser.Load(buyerLoginUrl); });
//}
var data = responseData;
if (data.Contains("karl_malone_32") || data.Contains("jtt_fan"))
//if (data.Contains("karl_malone_32") || data.Contains("jtt_fan"))
{
//https://h5api.m.taobao.com/h5/mtop.user.getusersimple/1.0/?jsv=2.7.2&appKey=12574478&t=1789984970076&sign=6bb7d3b5cd8bd3ab32bd97c1a0df1c0f&jsonpIncPrefix=tbnavnew&api=mtop.user.getUserSimple&v=1.0&dataType=json&type=originaljson&data=%7B%7D
@@ -364,7 +365,8 @@ namespace _29WxOrderWpf.ViewModels
{
Thread.Sleep(2000);
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
//List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList("", CefWebBrowser.GetCookieManager(null));
var buyerUrl = BaseClass.Build29WxObjString("user/add_taobao_buyer");
+29 -23
View File
@@ -66,7 +66,7 @@ namespace TemuKJD.ToolForms
/// </summary>
public string BuyType { get; set; } = "transit";
public int MaxCloseAfterSecond { get; set; }
public int CloseAfterSecond { get; set; }
public string InitUrl = "";
public string BuyMapUrl = "";
@@ -135,12 +135,12 @@ namespace TemuKJD.ToolForms
GlobalConfig.BuyConfig.IsUseAppBalance = true;
if (IsAutoBuy)
MaxCloseAfterSecond = 60;
if (MaxCloseAfterSecond > 0)
CloseAfterSecond = 60;
if (CloseAfterSecond > 0)
{
Task.Run(() =>
{
Thread.Sleep(1000 * MaxCloseAfterSecond);
Thread.Sleep(1000 * CloseAfterSecond);
if (this.Created && IsAutoBuy)
{
Invoke(new Action(() =>
@@ -248,12 +248,7 @@ namespace TemuKJD.ToolForms
IsFormLoad = true;
}
private void Rb_CheckedChanged(object sender, EventArgs e)
{
transitWarehouse = (sender as RadioButton)?.Tag as TransitWarehouseParam;
}
/// <summary>
/// 自动登录店铺后台
/// </summary>
@@ -385,20 +380,26 @@ namespace TemuKJD.ToolForms
}
else if (BuyType == "direct" && orderItem?.ItemOrder?.AddressStr.Contains("******") == false)
{
var dvProvince = GlobalConfig.PddDivisions.FirstOrDefault(d => d.name == orderItem.ItemOrder.province_name);
var dvCity = dvProvince.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.city_name);
var dvCounty = dvCity.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.county_name);
try
{
var dvProvince = GlobalConfig.PddDivisions.FirstOrDefault(d => d.name == orderItem.ItemOrder.province_name);
var dvCity = dvProvince.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.city_name);
var dvCounty = dvCity.children.FirstOrDefault(d => d.name == orderItem.ItemOrder.county_name);
JObject jObj = JsonHelper.JObjectParse(postData);
jObj["province_id"] = dvProvince.pdd_region_id;
jObj["city_id"] = dvCity.pdd_region_id;
jObj["district_id"] = dvCounty.pdd_region_id;
jObj["address"] = orderItem.ItemOrder.detail_info;
jObj["mobile"] = orderItem.ItemOrder.tel_number;
jObj["name"] = orderItem.ItemOrder.user_name;
postData = JsonHelper.SerializeObject(jObj);
request.PostData.Elements[0].Bytes = System.Text.Encoding.UTF8.GetBytes(postData);
Invoke(() => { this.pnlMask.Visible = false; });
JObject jObj = JsonHelper.JObjectParse(postData);
jObj["province_id"] = dvProvince.pdd_region_id;
jObj["city_id"] = dvCity.pdd_region_id;
jObj["district_id"] = dvCounty.pdd_region_id;
jObj["address"] = orderItem.ItemOrder.detail_info;
jObj["mobile"] = orderItem.ItemOrder.tel_number;
jObj["name"] = orderItem.ItemOrder.user_name;
postData = JsonHelper.SerializeObject(jObj);
request.PostData.Elements[0].Bytes = System.Text.Encoding.UTF8.GetBytes(postData);
Invoke(() => { this.pnlMask.Visible = false; });
}
catch
{
}
}
HasChangeAddress = true;
@@ -1891,5 +1892,10 @@ namespace TemuKJD.ToolForms
//System.Diagnostics.Debug.WriteLine($"清理子进程时发生异常: {ex}");
}
}
private void pictureBox5_Click(object sender, EventArgs e)
{
pnlMask.Visible = false;
}
}
}
+21 -1
View File
@@ -113,6 +113,7 @@
this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pnlMap = new System.Windows.Forms.Panel();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@@ -120,6 +121,7 @@
this.splitContainer1.SuspendLayout();
this.pnlMsg.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.pnlMask.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
@@ -131,6 +133,7 @@
this.pnlBuy.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.pnlMap.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.SuspendLayout();
//
// pbCloseBase
@@ -171,7 +174,7 @@
this.pnlMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.pnlMsg.Controls.Add(this.pictureBox4);
this.pnlMsg.Controls.Add(this.lblErrMsg);
this.pnlMsg.Location = new System.Drawing.Point(47, 537);
this.pnlMsg.Location = new System.Drawing.Point(47, 538);
this.pnlMsg.Name = "pnlMsg";
this.pnlMsg.Size = new System.Drawing.Size(771, 100);
this.pnlMsg.TabIndex = 898;
@@ -208,6 +211,7 @@
// pnlMask
//
this.pnlMask.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlMask.Controls.Add(this.pictureBox5);
this.pnlMask.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlMask.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlMask.Dock = System.Windows.Forms.DockStyle.Top;
@@ -1210,6 +1214,19 @@
this.pnlMap.Size = new System.Drawing.Size(468, 203);
this.pnlMap.TabIndex = 871;
//
// pictureBox5
//
this.pictureBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pictureBox5.Image = global::Work.Properties.Resources.close;
this.pictureBox5.Location = new System.Drawing.Point(829, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(32, 32);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox5.TabIndex = 898;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
//
// PddMobileBuyOrderForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1231,6 +1248,7 @@
this.splitContainer1.ResumeLayout(false);
this.pnlMsg.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.pnlMask.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
@@ -1248,6 +1266,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.pnlMap.ResumeLayout(false);
this.pnlMap.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.ResumeLayout(false);
}
@@ -1338,5 +1357,6 @@
private System.Windows.Forms.Label lblErrMsg;
protected System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Panel pnlMsg;
protected System.Windows.Forms.PictureBox pictureBox5;
}
}