优化订单读取卡顿问题

This commit is contained in:
wule committed 2026-10-17 07:13:38 +08:00
1 parent c83521f36d
commit 1509e0a11d
15 files changed
+718 -542

No files matched your search

@@ -299,7 +299,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
var cookie1 = request.Headers["Cookie"];
Task.Run(() =>
Task.Run(async() =>
{
var url1 = url;
var data1 = responseData;
@@ -342,7 +342,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 已发货 第一页
if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=3")) //https://mobile.yangkeduo.com/orders.html?type=3
{
Task.Run(() =>
await Task.Run(() =>
{
if (data1.Contains("display_amount"))
{
@@ -367,7 +367,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 待发货 第一页
if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=2"))
{
Task.Run(() =>
await Task.Run(() =>
{
if (data1.Contains("display_amount"))
{
@@ -394,7 +394,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
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(() =>
await Task.Run(() =>
{
CefReadBuyerOrder(url1, data1);
});
@@ -403,7 +403,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 售后 第一页
if (url1.StartsWith("https://mobile.yangkeduo.com/complaint_list.html"))
{
Task.Run(() =>
await Task.Run(() =>
{
if (data1.Contains("listItemStatusVo") && data1.Contains("afterSalesId") && data1.Contains("statusText"))
{
@@ -432,7 +432,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
// 读取售后
if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/blade/after_sales_list"))
{
Task.Run(() =>
await Task.Run(() =>
{
CefReadBuyerAfterSale(url1, data1);
});
@@ -590,7 +590,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
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;
pdd_order.ShopOrderSkuNameStr = wx_order_item?.SkuAttrStr;
pdd_order.WxOrderCreateTime = wx_order_item?.ItemOrder?.create_time == null ? DateTime.MinValue : BaseClass.StampToDateTime((wx_order_item?.ItemOrder?.create_time).ParseToInt());
pdd_order.ShopOrderRefundStr = ""; // (/*refund_item?.count > 0 &&*/ wx_order_item.refund_status > 1) ? "店铺售后" : "";
if (wx_order_item?.refund_status > 1)
@@ -625,7 +625,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
pdd_afterSale.ShopIdStr = (wx_order?.shop_id).ParseToString();
pdd_afterSale.ShopOrderIdStr = wx_order_item?.order_id ?? wx_transit_order?.order_no;
pdd_afterSale.ShopOrderSkuIdStr = wx_order_item?.sku_id ?? wx_transit_order?.order_sku_id;
pdd_afterSale.ShopOrderSkuNameStr = wx_order_item?.sku_attr_str;
pdd_afterSale.ShopOrderSkuNameStr = wx_order_item?.SkuAttrStr;
pdd_afterSale.WxOrderCreateTime = wx_order_item?.ItemOrder?.create_time == null ? DateTime.MinValue : BaseClass.StampToDateTime((wx_order_item?.ItemOrder?.create_time).ParseToInt());
pdd_afterSale.ShopOrderRefundStr = ""; // (/*refund_item?.count > 0 &&*/ wx_order_item?.refund_status > 1) ? "店铺售后" : "";
if (wx_order_item?.refund_status > 1)
@@ -758,7 +758,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var wxOrderItem = wxOrder.orderItems.FirstOrDefault(oi => oi.sku_id == o.ShopOrderSkuIdStr);
if (wxOrderItem != null)
{
o.ShopOrderSkuNameStr = wxOrderItem.sku_attr_str;
o.ShopOrderSkuNameStr = wxOrderItem.SkuAttrStr;
if (wxOrderItem?.refund_status > 1)
{
o.ShopOrderRefundStr = "店铺售后";
@@ -1107,7 +1107,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var wxOrderItem = wxOrder.orderItems.FirstOrDefault(oi => oi.sku_id == af.ShopOrderSkuIdStr);
if (wxOrderItem != null)
{
af.ShopOrderSkuNameStr = wxOrderItem.sku_attr_str;
af.ShopOrderSkuNameStr = wxOrderItem.SkuAttrStr;
af.ShopOrderOutAfterSaleStatusStr = wxOrder.out_after_sale_status;
}
}
@@ -343,9 +343,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
this.txtShopSkuIdVal = orderItem.sku_id;
this.txtShopGoodsIdVal = orderItem.product_id;
this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id;
this.txtSkuCodeVal = orderItem.out_sku_id.IsNullOrEmpty() ? orderItem.sku_attr_str : orderItem.out_sku_id;
this.txtSkuCodeVal = orderItem.out_sku_id.IsNullOrEmpty() ? orderItem.SkuAttrStr : orderItem.out_sku_id;
this.txtShopGoodsNameVal = orderItem.title;
this.txtShopSpecNameVal = orderItem.sku_attr_str;
this.txtShopSpecNameVal = orderItem.SkuAttrStr;
this.txtShopOrderItemCntVal = orderItem.sku_cnt.ParseToString();
this.txtShopOrderItemPriceVal = (orderItem.real_price * 0.01m + orderItem.ItemOrder?.postage_price * 0.01m / orderItem.ItemOrder?.orderItems?.Count).ParseToString();
@@ -994,9 +994,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
foreach (var item in order.orderItems)
{
if ((item.out_product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.out_product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code) ||
(item.out_product_id == tbBuyMap.spu_code && item.SkuAttrStr == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code))
(item.product_id == tbBuyMap.spu_code && item.SkuAttrStr == tbBuyMap.sku_code))
{
item.TbBuyMap = tbBuyMap;
@@ -343,9 +343,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
this.txtShopSkuIdVal = orderItem.sku_id;
this.txtShopGoodsIdVal = orderItem.product_id;
this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id;
this.txtSkuCodeVal = orderItem.out_sku_id.IsNullOrEmpty() ? orderItem.sku_attr_str : orderItem.out_sku_id;
this.txtSkuCodeVal = orderItem.out_sku_id.IsNullOrEmpty() ? orderItem.SkuAttrStr : orderItem.out_sku_id;
this.txtShopGoodsNameVal = orderItem.title;
this.txtShopSpecNameVal = orderItem.sku_attr_str;
this.txtShopSpecNameVal = orderItem.SkuAttrStr;
this.txtShopOrderItemCntVal = orderItem.sku_cnt.ParseToString();
this.txtShopOrderItemPriceVal = (orderItem.real_price * 0.01m + orderItem.ItemOrder?.postage_price * 0.01m / orderItem.ItemOrder?.orderItems?.Count).ParseToString();
@@ -1708,9 +1708,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
foreach (var item in order.orderItems)
{
if ((item.out_product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.out_product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code) ||
(item.out_product_id == tbBuyMap.spu_code && item.SkuAttrStr == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code))
(item.product_id == tbBuyMap.spu_code && item.SkuAttrStr == tbBuyMap.sku_code))
{
item.TbBuyMap = tbBuyMap;
@@ -510,7 +510,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
tb_order.WxOrderStatus = wx_order?.status;
tb_order.ShopOrderIdStr = wx_order_item?.order_id ?? wx_transit_order?.order_no;
tb_order.ShopOrderSkuIdStr = wx_order_item?.sku_id ?? wx_transit_order?.order_sku_id;
tb_order.ShopOrderSkuNameStr = wx_order_item?.sku_attr_str;
tb_order.ShopOrderSkuNameStr = wx_order_item?.SkuAttrStr;
tb_order.WxOrderCreateTime = wx_order_item?.ItemOrder?.create_time == null ? DateTime.MinValue : BaseClass.StampToDateTime((wx_order_item?.ItemOrder?.create_time).ParseToInt());
tb_order.ShopOrderRefundStr = ""; // (/*refund_item?.count > 0 &&*/ wx_order_item.refund_status > 1) ? "店铺售后" : "";
if (wx_order_item?.refund_status > 1)
@@ -545,7 +545,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
tb_afterSale.ShopIdStr = (wx_order?.shop_id).ParseToString();
tb_afterSale.ShopOrderIdStr = wx_order_item?.order_id ?? wx_transit_order?.order_no;
tb_afterSale.ShopOrderSkuIdStr = wx_order_item?.sku_id ?? wx_transit_order?.order_sku_id;
tb_afterSale.ShopOrderSkuNameStr = wx_order_item?.sku_attr_str;
tb_afterSale.ShopOrderSkuNameStr = wx_order_item?.SkuAttrStr;
tb_afterSale.WxOrderCreateTime = wx_order_item?.ItemOrder?.create_time == null ? DateTime.MinValue : BaseClass.StampToDateTime((wx_order_item?.ItemOrder?.create_time).ParseToInt());
tb_afterSale.ShopOrderRefundStr = ""; // (/*refund_item?.count > 0 &&*/ wx_order_item?.refund_status > 1) ? "店铺售后" : "";
if (wx_order_item?.refund_status > 1)
@@ -789,7 +789,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var wxOrderItem = wxOrder.orderItems.FirstOrDefault(oi => oi.sku_id == o.ShopOrderSkuIdStr);
if (wxOrderItem != null)
{
o.ShopOrderSkuNameStr = wxOrderItem.sku_attr_str;
o.ShopOrderSkuNameStr = wxOrderItem.SkuAttrStr;
if (wxOrderItem?.refund_status > 1)
{
o.ShopOrderRefundStr = "店铺售后";
@@ -1145,7 +1145,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var wxOrderItem = wxOrder.orderItems.FirstOrDefault(oi => oi.sku_id == af.ShopOrderSkuIdStr);
if (wxOrderItem != null)
{
af.ShopOrderSkuNameStr = wxOrderItem.sku_attr_str;
af.ShopOrderSkuNameStr = wxOrderItem.SkuAttrStr;
af.ShopOrderOutAfterSaleStatusStr = wxOrder.out_after_sale_status;
}
}
@@ -145,6 +145,7 @@
VerticalContentAlignment="Center"
BorderBrush="Transparent"
SelectedIndex="0"
SelectionChanged="cmbTimeType_SelectionChanged"
Style="{StaticResource RoundedComboBox}"
Text="更新时间">
<ComboBoxItem>
@@ -169,7 +170,8 @@
Grid.Column="7"
Margin="0,0,14,0"
VerticalAlignment="Center"
BorderThickness="0" />
BorderThickness="0"
SelectedDate="{Binding DateStart}" />
<!-- 结束时间 -->
<Border
@@ -185,7 +187,8 @@
Grid.Column="8"
Margin="10,0,4,0"
VerticalAlignment="Center"
BorderThickness="0" />
BorderThickness="0"
SelectedDate="{Binding DateEnd}" />
<CheckBox
x:Name="chkEndDate"
Grid.Column="8"
@@ -193,6 +196,7 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkEndDate_Click"
FontSize="12" />
<Button
@@ -600,9 +604,10 @@
</TabControl.Resources>
<TabItem
MinWidth="60"
d:Header="待采购"
Background="Transparent"
BorderBrush="Transparent"
Header="待采购"
Header="{Binding WaitBuyTabTxt}"
SizeChanged="TabItem_SizeChanged">
<Border
Padding="0,10"
@@ -690,7 +695,8 @@
SizeChanged="TabItem_SizeChanged" />
<TabItem
MinWidth="60"
Header="待发货"
d:Header="待发货"
Header="{Binding WaitSendTabTxt}"
SizeChanged="TabItem_SizeChanged">
<Border
Margin="4,0,4,4"
@@ -729,9 +735,10 @@
</TabItem>
<TabItem
MinWidth="60"
d:Header="待收货"
Background="Transparent"
BorderBrush="Transparent"
Header="待收货"
Header="{Binding WaitReceiveTabTxt}"
SizeChanged="TabItem_SizeChanged">
<Border
Margin="4,0,4,4"
@@ -1487,7 +1494,9 @@
HorizontalContentAlignment="Stretch"
BorderThickness="0"
ScrollViewer.CanContentScroll="True"
VirtualizingPanel.ScrollUnit="Pixel">
VirtualizingPanel.ScrollUnit="Pixel"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<!-- 使用自定义属性模板去除ListBox高亮显示框 -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
File diff suppressed because it is too large. Load diff
@@ -45,6 +45,14 @@
<RowDefinition Height="auto" />
<RowDefinition Height="6" />
</Grid.RowDefinitions>
<ItemsControl Grid.Row="1" ItemsSource="{Binding orderItems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<!--<TextBlock Text="{Binding ProductName}" Margin="20,0,0,0"/>-->
<local:OrderListRowItemCtrl DataContext="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</Grid>
@@ -41,20 +41,22 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
private async void OrderListRowCtrl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (this.DataContext is oms_wei_order_info order)
{
int index = 0;
foreach (var orderItem in order.orderItems)
{
gridChildOrder.RowDefinitions.Insert(gridChildOrder.RowDefinitions.Count - 1, new RowDefinition() { Height = GridLength.Auto });
index++;
var rowItem = new OrderListRowItemCtrl() { DataContext = orderItem, Name = "rowItem" + index };
Grid.SetRow(rowItem, index);
this.gridChildOrder.Children.Add(rowItem);
if (index >= 5)
break;
}
}
//await Task.Run(() => { });
//
//if (this.DataContext is oms_wei_order_info order)
//{
// int index = 0;
// foreach (var orderItem in order.orderItems)
// {
// gridChildOrder.RowDefinitions.Insert(gridChildOrder.RowDefinitions.Count - 1, new RowDefinition() { Height = GridLength.Auto });
// index++;
// var rowItem = new OrderListRowItemCtrl() { DataContext = orderItem, Name = "rowItem" + index };
// Grid.SetRow(rowItem, index);
// this.gridChildOrder.Children.Add(rowItem);
// if (index >= 5)
// break;
// }
//}
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
@@ -140,7 +140,7 @@
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding sku_attr_str}"
Text="{Binding SkuAttrStr}"
TextWrapping="Wrap"
WaterMark="规格" />
</wpf:TitleContent>
@@ -298,7 +298,7 @@
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding predict_commission_fee_str}"
Text="{Binding PredictCommissionFeeStr}"
TextWrapping="Wrap"
WaterMark="平台服务费" />
</wpf:TitleContent>
@@ -308,7 +308,7 @@
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding commission_amount_str}"
Text="{Binding CommissionAmountStr}"
TextWrapping="Wrap"
WaterMark="达人佣金" />
</wpf:TitleContent>
@@ -318,7 +318,7 @@
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding out_amount_str}"
Text="{Binding OutAmountStr}"
TextWrapping="Wrap"
WaterMark="外采金额" />
</wpf:TitleContent>
@@ -1960,7 +1960,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
form.lblSpuId.Text = orderItem.product_id;
form.lblSkuId.Text = orderItem.sku_id; // skuId
form.txtGoodsName.Text = orderItem.title; // 商品名称
form.txtSkuName.Text = orderItem.sku_attr_str; // sku规格名称
form.txtSkuName.Text = orderItem.SkuAttrStr; // sku规格名称
form.txtOrderPrice.Text = "" + (orderItem.real_price.ParseToInt() / 100m / orderItem.sku_cnt); // 订单价格
//form.txtCurrentPrice.Text = row.Cells["colCurrentPrice"].Value.ParseToString(); // 当前商品价格
//form.txtCurrentStock.Text = row.Cells["colCurrentStock"].Value.ParseToString(); // 当前库存;