修复 统计日期错误。

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