修复订单详情 复制缺少备注

This commit is contained in:
chfei committed 2026-10-10 20:04:14 +08:00
1 parent e3c91177f6
commit 66d4d67374
1 file changed
+24 -14
@@ -263,6 +263,7 @@ class ShopOrderDetailRow : BindableBaseEx
class ShowOrderDialogViewModel : BindableBaseEx
{
private readonly ShopOrderDetailType _detailType;
private readonly IShopRevenueStatisticsService _statisticsService;
public ObservableCollection<ShopOrderDetailRow> Data { get; set; }
@@ -274,6 +275,7 @@ class ShowOrderDialogViewModel : BindableBaseEx
Data = new ObservableCollection<ShopOrderDetailRow>(ShopOrderDetailRow.Flatten(list, detailType));
DataView = CollectionViewSource.GetDefaultView(Data);
DataView.Filter = FilterRow;
_detailType = detailType;
_statisticsService = statisticsService;
}
@@ -407,26 +409,34 @@ class ShowOrderDialogViewModel : BindableBaseEx
private string BuildCopyText(IEnumerable<ShopOrderDetailRow> rows)
{
var sb = new StringBuilder();
bool includeRemark = _detailType == ShopOrderDetailType.BuyerUnrefunded;
// 表头
sb.AppendLine("店名\t订单\t创建时间\t金额\t退款金额\t平台费用\t利润\t买手单号\t外采金额\t买手退款\t退款状态");
List<string> headers = [ "店名", "订单", "创建时间", "金额", "退款金额", "平台费用", "利润", "买手单号", "外采金额", "买手退款", "退款状态" ];
if (includeRemark)
headers.Add("备注");
sb.AppendLine(string.Join("\t", headers));
// 数据行
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 platformFee = (item.PlatformFee / 100m).ToString("0.00");
string profitAmount = (item.ProfitAmount / 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{platformFee}\t{profitAmount}\t{buyerOrderSn}\t{buyerOutAmount}\t{buyerRefundAmount}\t{buyerRefundStatus}");
var cols = new List<string>
{
CsvEscape(item.ShopName),
item.OrderId,
item.CreateTime.ToString("yyyy-MM-dd HH:mm"),
(item.OrderPrice / 100m).ToString("0.00"),
(item.OrderRefundAmount / 100m).ToString("0.00"),
(item.PlatformFee / 100m).ToString("0.00"),
(item.ProfitAmount / 100m).ToString("0.00"),
CsvEscape(item.OutOrderSn),
(item.BuyerOutAmount / 100m).ToString("0.00"),
(item.BuyerRefundAmount / 100m).ToString("0.00"),
CsvEscape(item.BuyerRefundStatusText)
};
if (includeRemark)
cols.Add(CsvEscape(item.Remark));
sb.AppendLine(string.Join("\t", cols));
}
return sb.ToString();