把绑定的数据的计算移动到线程里

This commit is contained in:
wule_5900x committed 2026-10-17 15:33:24 +08:00
1 parent 2f9c98b105
commit b827c6e118
14 files changed
+350 -144

No files matched your search

+95 -63
View File
@@ -10,9 +10,11 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using Color = System.Windows.Media.Color;
@@ -126,24 +128,26 @@ namespace AllBase.Model.DBModel
public string orderStatusStr
{
get
{
//状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
if (status == 10)
return "待付款";
if (status == 21)
return "部分发货";
if (status == 30)
return "待收货";
if (status == 100)
return "完成";
if (status == 200)
return "已取消";
if (status == 250)
return "未付款已取消";
return "未知状态";
}
set { }
get { return this.GetValue(x => x.orderStatusStr); }
set { this.SetValue(x => x.orderStatusStr, value); }
}
public void SetOrderStatusStr()
{
//状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
if (status == 10)
orderStatusStr = "待付款";
else if (status == 21)
orderStatusStr = "部分发货";
else if (status == 30)
orderStatusStr = "待收货";
else if (status == 100)
orderStatusStr = "完成";
else if (status == 200)
orderStatusStr = "已取消";
else if (status == 250)
orderStatusStr = "未付款已取消";
else
orderStatusStr = "未知状态";
}
public string RefundTypeStr
@@ -230,65 +234,67 @@ namespace AllBase.Model.DBModel
/// </summary>
public string DeliveryDeadlineStr
{
get
get { return this.GetValue(x => x.DeliveryDeadlineStr); }
set { this.SetValue(x => x.DeliveryDeadlineStr, value); }
}
public void SetDeliveryDeadlineStr()
{
if (this.status == 20 || this.status == 21)
{
if (this.status == 20 || this.status == 21)
var deadlineTime = BaseClass.StampToDateTime(delivery_deadline.ParseToInt());
var nowTime = DateTime.Now;
if (deadlineTime < nowTime)
DeliveryDeadlineStr = "已超时";
else
{
var deadlineTime = BaseClass.StampToDateTime(delivery_deadline.ParseToInt());
var nowTime = DateTime.Now;
if (deadlineTime < nowTime)
return "已超时";
var timeSpan = BaseClass.StampToDateTime(delivery_deadline.ParseToInt()) - nowTime;
var durationStr = Math.Floor(timeSpan.TotalHours).ParseToInt() + "时" + timeSpan.Minutes + "分" + timeSpan.Seconds + "秒";
return durationStr;
DeliveryDeadlineStr = durationStr;
}
if (/*this.out_shipped == 1 */this.ship_done_time.ParseToInt() > 0)
return "已发货";
else
return "未发货";
}
set { }
else if (/*this.out_shipped == 1 */this.ship_done_time.ParseToInt() > 0)
DeliveryDeadlineStr = "已发货";
else
DeliveryDeadlineStr = "未发货";
}
public SolidColorBrush StatusBoxForeColor
{
get
{
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
return new SolidColorBrush(Color.FromRgb(250, 71, 51)); // #fa4733
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
return new SolidColorBrush(Color.FromRgb(103, 194, 58)); // #67c23a
else
return new SolidColorBrush(Color.FromRgb(3, 151, 181)); // #0397b5
}
set { }
get { return this.GetValue(x => x.StatusBoxForeColor); }
set { this.SetValue(x => x.StatusBoxForeColor, value); }
}
public SolidColorBrush StatusBoxBackColor
{
get
{
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
return new SolidColorBrush(Color.FromArgb(26, 250, 71, 51)); // #fa4733 0.2
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
return new SolidColorBrush(Color.FromArgb(26, 103, 194, 58)); // #67c23a 0.2
else
return new SolidColorBrush(Color.FromArgb(26, 3, 151, 181)); // #0397b5 0.2
}
set { }
get { return this.GetValue(x => x.StatusBoxBackColor); }
set { this.SetValue(x => x.StatusBoxBackColor, value); }
}
public SolidColorBrush StatusBoxBorderColor
{
get
{
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
return new SolidColorBrush(Color.FromArgb(50, 250, 71, 51)); // #fa4733 0.2
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
return new SolidColorBrush(Color.FromArgb(50, 103, 194, 58)); // #67c23a 0.2
else
return new SolidColorBrush(Color.FromArgb(50, 3, 151, 181)); // #0397b5 0.2
}
set { }
get { return this.GetValue(x => x.StatusBoxBorderColor); }
set { this.SetValue(x => x.StatusBoxBorderColor, value); }
}
public void SetStatusBoxColor()
{
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
StatusBoxForeColor = GlobalConfig.RedTextBrush; // #fa4733 250, 71, 51
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
StatusBoxForeColor = GlobalConfig.GreenTextBrush; // #67c23a 103, 194, 58
else
StatusBoxForeColor = GlobalConfig.CyanBrush; // #0397b5 3, 151, 181
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
StatusBoxBackColor = GlobalConfig.RedTextBrush26; // #fa4733 0.2 26, 250, 71, 51
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
StatusBoxBackColor = GlobalConfig.GreenTextBrush26; // #67c23a 0.2 26, 103, 194, 58
else
StatusBoxBackColor = GlobalConfig.CyanBrush26; // #0397b5 0.2 26, 3, 151, 181
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
StatusBoxBorderColor = GlobalConfig.RedTextBrush50; // #fa4733 0.2 50, 250, 71, 51
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
StatusBoxBorderColor = GlobalConfig.GreenTextBrush50; // #67c23a 0.2 50, 103, 194, 58
else
StatusBoxBorderColor = GlobalConfig.CyanBrush50; // #0397b5 0.2 50, 3, 151, 181
}
public string AddressStr
@@ -583,6 +589,11 @@ namespace AllBase.Model.DBModel
get { return this.GetValue(x => x.colour_flag); }
set { this.SetValue(x => x.colour_flag, value); }
}
public SolidColorBrush ColourFlagBrush
{
get { return this.GetValue(x => x.ColourFlagBrush); }
set { this.SetValue(x => x.ColourFlagBrush, value); }
}
/// <summary>
/// 旗帜备注时间
/// </summary>
@@ -680,6 +691,8 @@ namespace AllBase.Model.DBModel
public void SetOrderTextProperty()
{
SetOrderStatusStr();
Shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == shop_id.ParseToString());
if (this.orderItems.Any(oi => oi.OrderItemExt?.buy_type == "直发") && this.orderItems.Any(oi => oi.ItemTransitOrderWithVoid != null))
@@ -728,9 +741,28 @@ namespace AllBase.Model.DBModel
IsShowTransitExtraPackagesBtn = true;
SetDeliveryDeadlineStatusStr();
SetOutExpressNo();
SetDeliveryDeadlineStr();
SetStatusBoxColor();
SetOutExpressNo();
SetShipDoneTimeStr();
}
SetColorBrush();
}
public void SetColorBrush()
{
if (this.colour_flag.ParseToInt() == 2)
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagRedBrush"];
else if (colour_flag.ParseToInt() == 3)
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagOrangeBrush"];
else if (colour_flag.ParseToInt() == 4)
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagGreenBrush"];
else if (colour_flag.ParseToInt() == 5)
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagBlueBrush"];
else if (colour_flag.ParseToInt() == 6)
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagPurpleBrush"];
else
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagGrayBrush"];
}
public bool GetIsWaitBuy()
{