1优化订单列表展示 2拍单逻辑优化调整 3自动拍单
This commit is contained in:
1 parent
b2d91563ed
commit
b03753e0cf
10 files changed
+309
-95
No files matched your search
@@ -71,5 +71,10 @@
|
||||
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
|
||||
<Resource Include="gear.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Views\AutoBuyInstructionView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -608,17 +608,29 @@
|
||||
Content="已关联拍单"
|
||||
FontSize="12" />
|
||||
<Button
|
||||
x:Name="btnAutoBuy"
|
||||
Width="Auto"
|
||||
Height="22"
|
||||
MinWidth="48"
|
||||
Margin="8,0,4,0"
|
||||
Padding="4,0"
|
||||
c:DebugVisibility.Enable="True"
|
||||
Click="Button_Click"
|
||||
Command="{Binding MultipleShipGiftCommand}"
|
||||
Click="btnAutoBuy_Click"
|
||||
Content="自动拍单"
|
||||
FontSize="12"
|
||||
Style="{StaticResource BasePageButtonStyle}" />
|
||||
<Button
|
||||
x:Name="btnAutoBuyIntorduction"
|
||||
Width="Auto"
|
||||
Height="22"
|
||||
MinWidth="48"
|
||||
Margin="0,0,4,0"
|
||||
Padding="4,0"
|
||||
c:DebugVisibility.Enable="True"
|
||||
Click="btnAutoBuyIntroduction_Click"
|
||||
Content="自动拍单说明"
|
||||
FontSize="12"
|
||||
Style="{StaticResource BasePageButtonLightStyle}" />
|
||||
<Polyline
|
||||
Grid.Column="5"
|
||||
Width="10"
|
||||
|
||||
@@ -2706,7 +2706,23 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
FilterOrders();
|
||||
}
|
||||
|
||||
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||
private async void btnAutoBuy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var buyOrders = GlobalConfig.lstFilterOrder.Where(o => o.IsWaitBuy && o.orderItems?.Count == 1 && o.orderItems.FirstOrDefault()?.BuyMap != null && o.IsSelect == true).ToList();
|
||||
if (buyOrders.Count == 0)
|
||||
{
|
||||
BaseMsgWindow.ShowError("未勾选符合条件的订单!");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var order in buyOrders)
|
||||
{
|
||||
var orderItem = order.orderItems.FirstOrDefault();
|
||||
await OrderListRowItemCtrl.BuyOrder(orderItem, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAutoBuyIntroduction_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<ColumnDefinition Width="36" />
|
||||
<ColumnDefinition Width="28" />
|
||||
<ColumnDefinition Width="200*" />
|
||||
<ColumnDefinition Width="100*" MinWidth="200" />
|
||||
<ColumnDefinition Width="100*" MinWidth="180" />
|
||||
<ColumnDefinition Width="75*" MinWidth="130" />
|
||||
<ColumnDefinition Width="170*" MinWidth="280" />
|
||||
<ColumnDefinition Width="120*" />
|
||||
@@ -196,7 +196,7 @@
|
||||
VerticalSpacing="2">
|
||||
<wpf:TitleContent Title="成交时间:">
|
||||
<uc:UcWaterMarkTextBox1
|
||||
d:Text="2000-01-01 01:01:01"
|
||||
d:Text="00-01-01 01:01:01"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
@@ -647,7 +647,8 @@
|
||||
Title="采购账户:"
|
||||
Cursor="Hand"
|
||||
Foreground="#0099ff"
|
||||
MouseLeftButtonUp="TransitOrderBuye_Click">
|
||||
MouseLeftButtonUp="TransitOrderBuye_Click"
|
||||
Visibility="{Binding ElementName=txtTransitOrderBuyerStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<uc:UcWaterMarkTextBox1
|
||||
x:Name="txtTransitOrderBuyerStr"
|
||||
@@ -692,7 +693,8 @@
|
||||
x:Name="wpBuyOrderId"
|
||||
Title="采购单号:"
|
||||
Cursor="Hand"
|
||||
Foreground="#0099ff">
|
||||
Foreground="#0099ff"
|
||||
Visibility="{Binding ElementName=txtTransitOrderNumStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<uc:UcWaterMarkTextBox1
|
||||
x:Name="txtTransitOrderNumStr"
|
||||
@@ -730,7 +732,8 @@
|
||||
<wpf:TitleContent
|
||||
x:Name="wpBuyTime"
|
||||
Title="采购时间:"
|
||||
Foreground="{Binding OutOrderTimeQualifiedBrush}">
|
||||
Foreground="{Binding OutOrderTimeQualifiedBrush}"
|
||||
Visibility="{Binding ElementName=txtOutOrderTimeQualifiedStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
|
||||
<uc:UcWaterMarkTextBox1
|
||||
x:Name="txtOutOrderTimeQualifiedStr"
|
||||
Margin="-2,2"
|
||||
@@ -869,6 +872,23 @@
|
||||
</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}}">
|
||||
@@ -956,12 +976,12 @@
|
||||
<!-- 买家留言 -->
|
||||
<wpf:TitleContent Title="买家留言:">
|
||||
<uc:UcWaterMarkTextBox1
|
||||
d:Text="留言留言"
|
||||
Background="Transparent"
|
||||
BorderThickness="1"
|
||||
IsReadOnly="True"
|
||||
Text=""
|
||||
TextWrapping="Wrap"
|
||||
WaterMark="买家留言" />
|
||||
TextWrapping="Wrap" />
|
||||
</wpf:TitleContent>
|
||||
|
||||
<!-- 店铺备注 -->
|
||||
@@ -1166,20 +1186,24 @@
|
||||
Grid.Column="8"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical"
|
||||
VerticalSpacing="5">
|
||||
VerticalSpacing="6">
|
||||
|
||||
<wpf:TitleContent>
|
||||
<Button
|
||||
x:Name="btnMapSkus"
|
||||
Height="24"
|
||||
MinWidth="38"
|
||||
Margin="4,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Click="btnMapSkus_Click"
|
||||
Content="选择SKU"
|
||||
Style="{StaticResource BasePageButtonLightStyle}"
|
||||
Visibility="{Binding MapSkusBtnVisibility}" />
|
||||
</wpf:TitleContent>
|
||||
<!-- 操作按钮行(原 Row 1) -->
|
||||
<wpf:TitleContent>
|
||||
<WrapPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<Button
|
||||
x:Name="btnMapSkus"
|
||||
Height="24"
|
||||
MinWidth="38"
|
||||
Margin="4,4,0,4"
|
||||
HorizontalAlignment="Center"
|
||||
Click="btnMapSkus_Click"
|
||||
Content="选择SKU"
|
||||
Style="{StaticResource BasePageButtonLightStyle}"
|
||||
Visibility="{Binding MapSkusBtnVisibility}" />
|
||||
|
||||
|
||||
<Button
|
||||
x:Name="btnBuyOrder"
|
||||
|
||||
@@ -309,14 +309,18 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
txtAppRemark.IsReadOnly = true;
|
||||
}
|
||||
|
||||
private void btnBuyOrder_Click(object sender, RoutedEventArgs e)
|
||||
private async void btnBuyOrder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BuyOrder();
|
||||
if (this.DataContext is oms_wei_order_item_info orderItem)
|
||||
{
|
||||
btnBuyOrder.IsEnabled = false;
|
||||
await BuyOrder(orderItem);
|
||||
btnBuyOrder.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void BuyOrder(bool isAbnormalOrder = false)
|
||||
public static async Task BuyOrder(oms_wei_order_item_info orderItem, bool isAutoBuy = false, bool isAbnormalOrder = false)
|
||||
{
|
||||
var orderItem = this.DataContext as oms_wei_order_item_info;
|
||||
if (orderItem == null)
|
||||
{
|
||||
BaseMsgWindow.ShowError("订单信息为空");
|
||||
@@ -342,14 +346,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
return;
|
||||
}
|
||||
|
||||
btnBuyOrder.Cursor = Cursors.Wait;
|
||||
btnBuyOrder.IsEnabled = false;
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
Dispatcher.Invoke(new Action(() => { btnBuyOrder.IsEnabled = true; }));
|
||||
});
|
||||
Task.Run(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// 拍单前查询订单是否退款
|
||||
var orderId = orderItem.order_id;
|
||||
@@ -387,11 +384,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
if (GlobalConfig.CurrentPddBuyer.status != "在线")
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("买手号掉线");
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
BaseMsgWindow.ShowError("买手号掉线");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -404,10 +397,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
if (BaseClass.Balance < 10)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("软件快递余额不足(剩余" + BaseClass.Balance.ToString("0.00") + "元,拍单至少需保留10元),无法中转拍单,请先充值!");
|
||||
}));
|
||||
BaseMsgWindow.ShowError("软件快递余额不足(剩余" + BaseClass.Balance.ToString("0.00") + "元,拍单至少需保留10元),无法中转拍单,请先充值!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -423,10 +413,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
GlobalConfig.BuyConfig.IsUseAppBalance = true;
|
||||
StartUp.SaveBuyConfig();
|
||||
BaseMsgWindow.ShowError("未找到店铺账户!" + BaseRegex.GetStringJson(ref html, "msg") + ",自动切换为快递余额拍单。");
|
||||
@@ -440,10 +426,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
var erpM = erpMs.FirstOrDefault();
|
||||
if (erpM == null)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
GlobalConfig.BuyConfig.IsUseAppBalance = true;
|
||||
StartUp.SaveBuyConfig();
|
||||
BaseMsgWindow.ShowError("未找到店铺账户!自动切换为快递余额拍单。");
|
||||
@@ -453,10 +435,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
var balance = erpM.balance.ParseToDecimal();
|
||||
if (balance < 10)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
GlobalConfig.BuyConfig.IsUseAppBalance = true;
|
||||
StartUp.SaveBuyConfig();
|
||||
BaseMsgWindow.ShowError("ERP账户余额不足(剩余" + balance.ToString("0.00") + "元,拍单至少需保留10元),无法中转拍单,自动切换为快递余额拍单。");
|
||||
@@ -465,11 +443,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
catch
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("拍单校验出错,请稍后重试");
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
BaseMsgWindow.ShowError("拍单校验出错,请稍后重试");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -507,10 +481,6 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
// Dispatcher.Invoke(new Action(() => { o.UpdateOrderItemBuyButton(); }));
|
||||
//}
|
||||
}
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -572,13 +542,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
// 更新代发管理情况
|
||||
foreach (var oi in ord.orderItems)
|
||||
Dispatcher.Invoke(new Action(() => { oi.UpdateOrderItemBuyButton(); }));
|
||||
MainWindow.Instance.Dispatcher.Invoke(new Action(() => { oi.UpdateOrderItemBuyButton(); }));
|
||||
}
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("请登录店铺");
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
}));
|
||||
BaseMsgWindow.ShowError("请登录店铺");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -586,12 +552,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
//return;
|
||||
|
||||
// 打开拍单窗口
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
MainWindow.Instance.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
btnBuyOrder.Cursor = Cursors.Hand;
|
||||
|
||||
PddMobileBuyOrderForm buyOrderForm = new PddMobileBuyOrderForm(MainWindow.Instance.orderListCtrl.FilterOneOrder, StartUp.UpdateBalance,
|
||||
orderItem, GlobalConfig.CurrentPddBuyer, orderItem.BuyMap);
|
||||
buyOrderForm.IsAutoBuy = isAutoBuy;
|
||||
|
||||
buyOrderForm.TitleText = "买手拍单 - 当前买手 " + GlobalConfig.CurrentPddBuyer.buyer_nick;
|
||||
|
||||
@@ -698,7 +663,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
/// </summary>
|
||||
/// <param name="order_item"></param>
|
||||
/// <returns></returns>
|
||||
bool GetIsAbnormalOrderRebuy(oms_wei_order_item_info order_item)
|
||||
static bool GetIsAbnormalOrderRebuy(oms_wei_order_item_info order_item)
|
||||
{
|
||||
// 不是异常单的不可异常重拍
|
||||
if (order_item?.ItemOrder?.isAbnormal != true)
|
||||
@@ -1126,12 +1091,12 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAbnormalOrderRebuy_Click(object sender, RoutedEventArgs e)
|
||||
private async void btnAbnormalOrderRebuy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is oms_wei_order_item_info orderItem)
|
||||
{
|
||||
if (orderItem.ItemOrder.status > 21 && orderItem.ItemTransitOrder != null && orderItem.ItemTransitOrder.refund_status == "买手退款成功")
|
||||
BuyOrder(true);
|
||||
await BuyOrder(orderItem, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1315,11 +1280,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
});
|
||||
}
|
||||
|
||||
bool CheckIsRefund(oms_wei_order_item_info orderItem)
|
||||
static bool CheckIsRefund(oms_wei_order_item_info orderItem)
|
||||
{
|
||||
if (/*orderItem?.ItemRefund?.count > 0 &&*/ orderItem.refund_status > 1)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
MainWindow.Instance.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == orderItem.shop_id.ParseToString());
|
||||
if (shop != null)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
|
||||
namespace _29WxOrderWpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AutoBuyInstructionView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AutoBuyInstructionView : Window
|
||||
{
|
||||
public AutoBuyInstructionView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<Window x:Class="_29WxOrderWpf.Views.AutoBuyInstructionView"
|
||||
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.Views"
|
||||
mc:Ignorable="d"
|
||||
Title="自动拍单详情说明及密码设定" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -142,7 +142,7 @@ namespace AllBase.Model.DBModel
|
||||
if (ItemOrder != null)
|
||||
ItemOrder.RefundDatetime = this.RefundDatetime;
|
||||
|
||||
this.RefundDateTimeStr = RefundDatetime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
this.RefundDateTimeStr = RefundDatetime.ToString("yy-MM-dd HH:mm:ss");
|
||||
this.RefundTimeVisibility = RefundDatetime == DateTime.MinValue ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
RefundAddressStr = "";
|
||||
@@ -840,8 +840,14 @@ namespace AllBase.Model.DBModel
|
||||
get { return this.GetValue(x => x.DirectPddBuyerOrder); }
|
||||
set { this.SetValue(x => x.DirectPddBuyerOrder, 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); }
|
||||
@@ -863,6 +869,10 @@ 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)
|
||||
@@ -885,7 +895,13 @@ 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>
|
||||
/// 订单中所有商品加起来的总售价文本
|
||||
@@ -1275,8 +1291,8 @@ namespace AllBase.Model.DBModel
|
||||
public void SetOrderItemTextProperty()
|
||||
{
|
||||
CreateDateTime = BaseClass.StampToDateTime((ItemOrder?.create_time).ParseToInt());
|
||||
CreateDateTimeStr = CreateDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
UpdateTimeStr = BaseClass.StampToDateTime((ItemOrder?.update_time).ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
CreateDateTimeStr = CreateDateTime.ToString("yy-MM-dd HH:mm:ss");
|
||||
UpdateTimeStr = BaseClass.StampToDateTime((ItemOrder?.update_time).ParseToInt()).ToString("yy-MM-dd HH:mm:ss");
|
||||
|
||||
//if (PurpleBrush == null && GlobalConfig.Dispatcher != null)
|
||||
//{
|
||||
|
||||
@@ -47,9 +47,10 @@ namespace TemuKJD.ToolForms
|
||||
public oms_wei_external_procurement_log_info AbnormalTransitWarehouseOrderInfo { get; set; } = null;
|
||||
public pddFrontGoods3Lite pddFrontGoodsLite = new pddFrontGoods3Lite();
|
||||
|
||||
public bool IsAutoBuy { get; set; } = true;
|
||||
public bool IsFormLoad { get; set; } = false;
|
||||
public bool IsAutoBuy { get; set; } = false;
|
||||
public bool IsFormLoad { get; set; } = false;
|
||||
public bool ShowBuyMask { get; set; } = false;
|
||||
public string BuyErrMsg { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 直发direct 中转transit
|
||||
@@ -174,7 +175,7 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
else if (orderItem.BuyMapSkus != null && orderItem.BuyMapSkus.Count > 0 && AbnormalTransitWarehouseOrderInfo == null) // 不能是异常重拍
|
||||
{
|
||||
panel2.Visible = true;
|
||||
//panel2.Visible = true;
|
||||
cmbMapSkusProd.Items.Clear();
|
||||
cmbMapSkusProd.Items.Add("");
|
||||
foreach (var mapSku in orderItem.BuyMapSkus)
|
||||
@@ -559,16 +560,21 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
}
|
||||
// 自动下单
|
||||
if (IsAutoBuy)
|
||||
if (IsAutoBuy && HasChangeAddress && url.StartsWith("https://mobile.yangkeduo.com/order_checkout.html?sku_id="))
|
||||
{
|
||||
if (!IsSoldOut)
|
||||
{
|
||||
if (HasChangeAddress == true)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await AutoBuy();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.BuyErrMsg = ex.Message;
|
||||
}
|
||||
Invoke(() => { this.Close(); });
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
@@ -612,6 +618,137 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
}
|
||||
|
||||
public async Task AutoBuy()
|
||||
{
|
||||
if (IsSoldOut)
|
||||
throw new Exception("商品已售罄");
|
||||
|
||||
//for (int i = 0; i < 50; i++)
|
||||
//{
|
||||
// if (HasChangeAddress != true)
|
||||
// Thread.Sleep(500);
|
||||
//}
|
||||
//if (!HasChangeAddress)
|
||||
//{
|
||||
// throw new Exception("订单收货地址修改失败");
|
||||
//}
|
||||
|
||||
await CheckSourceCode();
|
||||
|
||||
await SetAliPaySecret();
|
||||
}
|
||||
|
||||
public async Task SetAliPaySecret()
|
||||
{
|
||||
var host = cefWebBrowser.GetBrowser().GetHost();
|
||||
var client = cefWebBrowser.GetDevToolsClient();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
if (host == null || client == null)
|
||||
{
|
||||
host = cefWebBrowser.GetBrowser().GetHost();
|
||||
client = cefWebBrowser.GetDevToolsClient();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (host == null || client == null)
|
||||
{
|
||||
throw new Exception("页面加载异常");
|
||||
}
|
||||
|
||||
var sourceCode = txtSourceCode.Text.Trim();
|
||||
var jsStr1 = @"(function() { var elements = document.getElementsByTagName('span');
|
||||
for (i = elements.length - 1; i >= 0; i--){
|
||||
var element = elements[i];
|
||||
if (element.innerHTML.indexOf('支付宝') >= 0) {
|
||||
element.click();
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
})();";
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
var ts1 = await client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
|
||||
var jsStr2 = @"(function() { var elements = document.getElementsByTagName('span');
|
||||
for (i = elements.length - 1; i >= 0; i--){
|
||||
var element = elements[i];
|
||||
if (element.innerHTML.indexOf('立即支付') >= 0) {
|
||||
element.click();
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
})();";
|
||||
var ts2 = await client.Runtime.EvaluateAsync(jsStr2, null, true, null, null, true, null, true);
|
||||
if (ts1.Result?.Value.ParseToString() != "success" || ts2.Result?.Value.ParseToString() != "success")
|
||||
{
|
||||
throw new Exception("支付方式获取失败");
|
||||
}
|
||||
|
||||
Thread.Sleep(Randomx.GetId(1500, 2000));
|
||||
var jsStr3 = @"(function() { var elements = document.getElementsByTagName('span');
|
||||
for (i = elements.length - 1; i >= 0; i--){
|
||||
var element = elements[i];
|
||||
if (element.innerHTML.indexOf('确认付款') >= 0) {
|
||||
element.click();
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
})();";
|
||||
var ts3 = await client.Runtime.EvaluateAsync(jsStr3, null, true, null, null, true, null, true);
|
||||
if (!this.Created)
|
||||
throw new Exception("窗口已关闭");
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
if (ts3.Result?.Value is string rstStr)
|
||||
{
|
||||
if (rstStr == "success")
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(200);
|
||||
ts3 = await client.Runtime.EvaluateAsync(jsStr3, null, true, null, null, true, null, true);
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(10000, 12500));
|
||||
}
|
||||
|
||||
public async Task CheckSourceCode()
|
||||
{
|
||||
var host = cefWebBrowser.GetBrowser().GetHost();
|
||||
var client = cefWebBrowser.GetDevToolsClient();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
if (host == null || client == null)
|
||||
{
|
||||
host = cefWebBrowser.GetBrowser().GetHost();
|
||||
client = cefWebBrowser.GetDevToolsClient();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (host == null || client == null)
|
||||
{
|
||||
throw new Exception("页面加载异常");
|
||||
}
|
||||
|
||||
var sourceCode = txtSourceCode.Text.Trim();
|
||||
var jsStr1 = @"(function() { var elements = document.getElementsByTagName('div');
|
||||
for (i = elements.length - 1; i >= 0; i--){
|
||||
var element = elements[i];
|
||||
if (element.innerHTML.indexOf('" + sourceCode + @"') >= 0) {
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
})();";
|
||||
var ts1 = await client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
|
||||
if (ts1.Result?.Value.ParseToString() != "success")
|
||||
{
|
||||
throw new Exception("溯源码不匹配");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取溯源码
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user