修复 统计日期错误。

消费记录 增加新类型
This commit is contained in:
chfei committed 2026-11-20 13:50:13 +08:00
1 parent c6b8d3a83a
commit 0f70b5e37c
4 files changed
+34 -24

No files matched your search

@@ -487,7 +487,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services
return UserLogin.GetSignPostData(new
{
StartDate = query.StartDate.Date,
EndDate = query.EndDate.Date,
EndDate = query.EndDate,
ShopIds = shopIds,
GroupType = (int)groupType,
});
@@ -276,11 +276,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
/// <summary>组装查询参数(起止日期已保证先后顺序)</summary>
private ShopRevenueStatisticsQuery BuildQuery()
{
if (StartDate == EndDate)
{
EndDate = EndDate.AddDays(1).AddSeconds(-1);
}
else if (StartDate > EndDate)
if (StartDate > EndDate)
{
var temp = StartDate;
StartDate = EndDate;
@@ -291,7 +287,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels
return new ShopRevenueStatisticsQuery
{
StartDate = StartDate,
EndDate = EndDate,
EndDate = EndDate.AddDays(1).AddSeconds(-1),
ShopIds = BuildSelectedShopIds(),
StatPackages = StatPackages,
};
@@ -30,9 +30,9 @@ namespace Work._29Tools.Forms.UserForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.pbQrcode = new System.Windows.Forms.PictureBox();
this.btnRefresh = new DevComponents.DotNetBar.PanelEx();
@@ -508,6 +508,7 @@ namespace Work._29Tools.Forms.UserForms
"额外包裹扣费支出/返还",
"退货包裹扣费支出/返还",
"云仓退货扣费支出/返还",
"额外包裹退货拦截支出/返还",
"超重扣费支出",
"同步物流"});
this.cmbType.Location = new System.Drawing.Point(42, 33);
@@ -553,20 +554,20 @@ namespace Work._29Tools.Forms.UserForms
//
this.dgvPayment.AllowUserToAddRows = false;
this.dgvPayment.AllowUserToDeleteRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvPayment.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvPayment.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvPayment.AutoRowNumber = true;
this.dgvPayment.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvPayment.BackgroundColor = System.Drawing.Color.White;
this.dgvPayment.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvPayment.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvPayment.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvPayment.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPayment.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -610,8 +611,8 @@ namespace Work._29Tools.Forms.UserForms
//
// colAmount
//
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAmount.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAmount.DefaultCellStyle = dataGridViewCellStyle3;
this.colAmount.FillWeight = 60F;
this.colAmount.HeaderText = "金额";
this.colAmount.Name = "colAmount";
@@ -160,8 +160,10 @@ namespace Work._29Tools.Forms.UserForms
data3 += "&type_in=26,38";
else if (cmbType.Text == "额外包裹扣费支出/返还")
data3 += "&type_in=35,36";
else if (cmbType.Text == "云仓退货扣费支出")
else if (cmbType.Text == "云仓退货扣费支出/返还")
data3 += "&type_in=31,32";
else if (cmbType.Text == "额外包裹退货拦截支出/返还")
data3 += "&type_in=39,40";
else if (cmbType.Text == "超重扣费支出")
data3 += "&type_in=24,28,33,37,41";
else if (cmbType.Text == "同步物流")
@@ -186,7 +188,18 @@ namespace Work._29Tools.Forms.UserForms
var result = JObject.Parse(html);
count = (int)result["count"];
seconds = BaseRegex.GetDecimalJson(ref html, "seconds");
return JsonConvert.DeserializeObject<List<user_payment_record>>(result["data"]?.ToString() ?? "null") ?? throw new InvalidOperationException($"第 {page} 页缺少消费记录");
var userPaymentList = JsonConvert.DeserializeObject<List<user_payment_record>>(result["data"]?.ToString() ?? "null");
if(userPaymentList==null) throw new InvalidOperationException($"第 {page} 页缺少消费记录");
int[] negativeTypes = [34, 23, 38, 32, 36, 40];
foreach (var item in userPaymentList)
{
if (negativeTypes.Contains(item.type.Value))
{
item.amount *= -1;
}
}
return userPaymentList;
}
public void GetBalanceList()