消费记录 增加 显示 充值总额,可用余额,范围内使用金额

消费数据导出
This commit is contained in:
chfei committed 2026-08-10 18:56:23 +08:00
1 parent 0cad71b5be
commit ec9a856bc5
4 files changed
+149 -14

No files matched your search

+1
View File
@@ -196,6 +196,7 @@ namespace AllBase
/// 店铺充值月费 /// 店铺充值月费
/// </summary> /// </summary>
public static int ShopPointsPerMonth { get; set; } = 30; public static int ShopPointsPerMonth { get; set; } = 30;
public static decimal RechargeAmountTotal { get; set; } = 0;
public static decimal Balance { get; set; } = 0; public static decimal Balance { get; set; } = 0;
public static decimal PostagePerOrder { get; set; } = 2.2m; public static decimal PostagePerOrder { get; set; } = 2.2m;
public static decimal PostagePerOrderDiff { get { return PostagePerOrder - 2.2m; } } public static decimal PostagePerOrderDiff { get { return PostagePerOrder - 2.2m; } }
@@ -45,6 +45,11 @@ namespace Work._29Tools.Forms.UserForms
this.btnBalanceTopUp = new DevComponents.DotNetBar.PanelEx(); this.btnBalanceTopUp = new DevComponents.DotNetBar.PanelEx();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx1 = new Work.UserComponents.UcGroupBoxEx(this.components); this.ucGroupBoxEx1 = new Work.UserComponents.UcGroupBoxEx(this.components);
this.exportRecord = new System.Windows.Forms.LinkLabel();
this.balanceArmt = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.rechargeArmtTotal = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.txtOutOrderId = new System.Windows.Forms.TextBox(); this.txtOutOrderId = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
@@ -68,6 +73,8 @@ namespace Work._29Tools.Forms.UserForms
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.statusBarUserControl1 = new Work.UserControls.StatusBarUserControl(); this.statusBarUserControl1 = new Work.UserControls.StatusBarUserControl();
this.ucSplitPage1 = new Work.UserControls.UcSplitPage(); this.ucSplitPage1 = new Work.UserControls.UcSplitPage();
this.label9 = new System.Windows.Forms.Label();
this.rangeUsedAramt = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbQrcode)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbQrcode)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
@@ -93,7 +100,7 @@ namespace Work._29Tools.Forms.UserForms
// pbCloseBase // pbCloseBase
// //
this.pbCloseBase.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.pbCloseBase.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pbCloseBase.Location = new System.Drawing.Point(1189, 0); this.pbCloseBase.Location = new System.Drawing.Point(1389, 0);
// //
// label1 // label1
// //
@@ -160,7 +167,7 @@ namespace Work._29Tools.Forms.UserForms
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(2, 34); this.panel1.Location = new System.Drawing.Point(2, 34);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1221, 529); this.panel1.Size = new System.Drawing.Size(1421, 529);
this.panel1.TabIndex = 1140; this.panel1.TabIndex = 1140;
// //
// splitContainer1 // splitContainer1
@@ -176,15 +183,15 @@ namespace Work._29Tools.Forms.UserForms
this.splitContainer1.Panel1.Controls.Add(this.pbLoading); this.splitContainer1.Panel1.Controls.Add(this.pbLoading);
this.splitContainer1.Panel1.Controls.Add(this.label2); this.splitContainer1.Panel1.Controls.Add(this.label2);
this.splitContainer1.Panel1.Controls.Add(this.numTopUpAmount); this.splitContainer1.Panel1.Controls.Add(this.numTopUpAmount);
this.splitContainer1.Panel1.Controls.Add(this.btnRefresh);
this.splitContainer1.Panel1.Controls.Add(this.btnBalanceTopUp); this.splitContainer1.Panel1.Controls.Add(this.btnBalanceTopUp);
this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.label1);
this.splitContainer1.Panel1.Controls.Add(this.pbQrcode); this.splitContainer1.Panel1.Controls.Add(this.pbQrcode);
this.splitContainer1.Panel1.Controls.Add(this.btnRefresh);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1221, 529); this.splitContainer1.Size = new System.Drawing.Size(1421, 529);
this.splitContainer1.SplitterDistance = 253; this.splitContainer1.SplitterDistance = 253;
this.splitContainer1.TabIndex = 1139; this.splitContainer1.TabIndex = 1139;
// //
@@ -270,7 +277,7 @@ namespace Work._29Tools.Forms.UserForms
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.splitContainer3); this.splitContainer2.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer2.Size = new System.Drawing.Size(964, 529); this.splitContainer2.Size = new System.Drawing.Size(1164, 529);
this.splitContainer2.SplitterDistance = 86; this.splitContainer2.SplitterDistance = 86;
this.splitContainer2.TabIndex = 1163; this.splitContainer2.TabIndex = 1163;
// //
@@ -281,6 +288,13 @@ namespace Work._29Tools.Forms.UserForms
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx1.BorderStyle = Work.UserComponents.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; this.ucGroupBoxEx1.BorderStyle = Work.UserComponents.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx1.Controls.Add(this.rangeUsedAramt);
this.ucGroupBoxEx1.Controls.Add(this.label9);
this.ucGroupBoxEx1.Controls.Add(this.exportRecord);
this.ucGroupBoxEx1.Controls.Add(this.balanceArmt);
this.ucGroupBoxEx1.Controls.Add(this.label10);
this.ucGroupBoxEx1.Controls.Add(this.rechargeArmtTotal);
this.ucGroupBoxEx1.Controls.Add(this.label8);
this.ucGroupBoxEx1.Controls.Add(this.label7); this.ucGroupBoxEx1.Controls.Add(this.label7);
this.ucGroupBoxEx1.Controls.Add(this.txtOutOrderId); this.ucGroupBoxEx1.Controls.Add(this.txtOutOrderId);
this.ucGroupBoxEx1.Controls.Add(this.label6); this.ucGroupBoxEx1.Controls.Add(this.label6);
@@ -293,12 +307,57 @@ namespace Work._29Tools.Forms.UserForms
this.ucGroupBoxEx1.Controls.Add(this.cmbType); this.ucGroupBoxEx1.Controls.Add(this.cmbType);
this.ucGroupBoxEx1.Location = new System.Drawing.Point(-2, 2); this.ucGroupBoxEx1.Location = new System.Drawing.Point(-2, 2);
this.ucGroupBoxEx1.Name = "ucGroupBoxEx1"; this.ucGroupBoxEx1.Name = "ucGroupBoxEx1";
this.ucGroupBoxEx1.Size = new System.Drawing.Size(966, 84); this.ucGroupBoxEx1.Size = new System.Drawing.Size(1166, 84);
this.ucGroupBoxEx1.TabIndex = 0; this.ucGroupBoxEx1.TabIndex = 0;
this.ucGroupBoxEx1.TabStop = false; this.ucGroupBoxEx1.TabStop = false;
this.ucGroupBoxEx1.Text = "查询条件"; this.ucGroupBoxEx1.Text = "查询条件";
this.ucGroupBoxEx1.Enter += new System.EventHandler(this.ucGroupBoxEx1_Enter); this.ucGroupBoxEx1.Enter += new System.EventHandler(this.ucGroupBoxEx1_Enter);
// //
// exportRecord
//
this.exportRecord.AutoSize = true;
this.exportRecord.Location = new System.Drawing.Point(1093, 47);
this.exportRecord.Name = "exportRecord";
this.exportRecord.Size = new System.Drawing.Size(56, 17);
this.exportRecord.TabIndex = 1171;
this.exportRecord.TabStop = true;
this.exportRecord.Text = "导出记录";
this.exportRecord.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.exportRecord_LinkClicked);
//
// balanceArmt
//
this.balanceArmt.Location = new System.Drawing.Point(1020, 36);
this.balanceArmt.Name = "balanceArmt";
this.balanceArmt.Size = new System.Drawing.Size(67, 17);
this.balanceArmt.TabIndex = 1167;
this.balanceArmt.Text = "1000.00";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(959, 36);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(68, 17);
this.label10.TabIndex = 1166;
this.label10.Text = "可用余额:";
//
// rechargeArmtTotal
//
this.rechargeArmtTotal.Location = new System.Drawing.Point(1020, 14);
this.rechargeArmtTotal.Name = "rechargeArmtTotal";
this.rechargeArmtTotal.Size = new System.Drawing.Size(67, 17);
this.rechargeArmtTotal.TabIndex = 1165;
this.rechargeArmtTotal.Text = "10000.00";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(959, 14);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(68, 17);
this.label8.TabIndex = 1164;
this.label8.Text = "充值总额:";
//
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
@@ -421,7 +480,7 @@ namespace Work._29Tools.Forms.UserForms
// //
this.splitContainer3.Panel2.Controls.Add(this.statusBarUserControl1); this.splitContainer3.Panel2.Controls.Add(this.statusBarUserControl1);
this.splitContainer3.Panel2.Controls.Add(this.ucSplitPage1); this.splitContainer3.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer3.Size = new System.Drawing.Size(964, 439); this.splitContainer3.Size = new System.Drawing.Size(1164, 439);
this.splitContainer3.SplitterDistance = 410; this.splitContainer3.SplitterDistance = 410;
this.splitContainer3.TabIndex = 1163; this.splitContainer3.TabIndex = 1163;
// //
@@ -469,7 +528,7 @@ namespace Work._29Tools.Forms.UserForms
this.dgvPayment.Name = "dgvPayment"; this.dgvPayment.Name = "dgvPayment";
this.dgvPayment.ReadOnly = true; this.dgvPayment.ReadOnly = true;
this.dgvPayment.RowTemplate.Height = 23; this.dgvPayment.RowTemplate.Height = 23;
this.dgvPayment.Size = new System.Drawing.Size(962, 406); this.dgvPayment.Size = new System.Drawing.Size(1162, 406);
this.dgvPayment.TabIndex = 1162; this.dgvPayment.TabIndex = 1162;
this.dgvPayment.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPayment_CellContentClick); this.dgvPayment.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPayment_CellContentClick);
// //
@@ -548,7 +607,7 @@ namespace Work._29Tools.Forms.UserForms
this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true; this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(550, 0); this.ucSplitPage1.Location = new System.Drawing.Point(750, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1"; this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.PageSize = 50; this.ucSplitPage1.PageSize = 50;
@@ -558,11 +617,28 @@ namespace Work._29Tools.Forms.UserForms
this.ucSplitPage1.PageChange += new System.Action<object>(this.ucSplitPage1_PageChange); this.ucSplitPage1.PageChange += new System.Action<object>(this.ucSplitPage1_PageChange);
this.ucSplitPage1.Load += new System.EventHandler(this.ucSplitPage1_Load); this.ucSplitPage1.Load += new System.EventHandler(this.ucSplitPage1_Load);
// //
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(959, 59);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(68, 17);
this.label9.TabIndex = 1175;
this.label9.Text = "使用余额:";
//
// rangeUsedAramt
//
this.rangeUsedAramt.Location = new System.Drawing.Point(1020, 59);
this.rangeUsedAramt.Name = "rangeUsedAramt";
this.rangeUsedAramt.Size = new System.Drawing.Size(67, 17);
this.rangeUsedAramt.TabIndex = 1176;
this.rangeUsedAramt.Text = "1000.00";
//
// WXGetBalanceQrCodeForm // WXGetBalanceQrCodeForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.ClientSize = new System.Drawing.Size(1225, 565); this.ClientSize = new System.Drawing.Size(1425, 565);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.KeyPreview = true; this.KeyPreview = true;
@@ -635,5 +711,12 @@ namespace Work._29Tools.Forms.UserForms
private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtOutOrderId; private System.Windows.Forms.TextBox txtOutOrderId;
private UserControls.StatusBarUserControl statusBarUserControl1; private UserControls.StatusBarUserControl statusBarUserControl1;
private System.Windows.Forms.Label rechargeArmtTotal;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label balanceArmt;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.LinkLabel exportRecord;
private System.Windows.Forms.Label rangeUsedAramt;
private System.Windows.Forms.Label label9;
} }
} }
@@ -134,7 +134,7 @@ namespace Work._29Tools.Forms.UserForms
} }
} }
private List<user_payment_record> paymentList;
public async void GetBalanceList() public async void GetBalanceList()
{ {
int pageCount = 1; int pageCount = 1;
@@ -176,9 +176,9 @@ namespace Work._29Tools.Forms.UserForms
BaseMsgForm.ShowError("查询失败:" + BaseRegex.GetStringJsonByRegs(ref html3, html3, "msg")); BaseMsgForm.ShowError("查询失败:" + BaseRegex.GetStringJsonByRegs(ref html3, html3, "msg"));
return; return;
} }
List<user_payment_record> paymentList = new List<user_payment_record>(); paymentList = new List<user_payment_record>();
paymentList = JsonHelper.DeserializeJsonToList<user_payment_record>(JsonHelper.JObjectParse(html3)["data"].ParseToString()); paymentList = JsonHelper.DeserializeJsonToList<user_payment_record>(JsonHelper.JObjectParse(html3)["data"].ParseToString());
foreach(var payment in paymentList) foreach (var payment in paymentList)
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
@@ -201,11 +201,17 @@ namespace Work._29Tools.Forms.UserForms
#if DEBUG #if DEBUG
Invoke(new Action(() => { statusBarUserControl1.lblTaskStatus.Text = BaseRegex.GetDecimalJson(ref html3, "seconds") + "秒"; })); Invoke(new Action(() => { statusBarUserControl1.lblTaskStatus.Text = BaseRegex.GetDecimalJson(ref html3, "seconds") + "秒"; }));
#endif #endif
Invoke(new Action(() =>
{
rechargeArmtTotal.Text = BaseClass.RechargeAmountTotal.ToString("N2");
balanceArmt.Text = BaseClass.Balance.ToString("N2");
rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
}));
} }
private async void btnSearch_Click(object sender, EventArgs e) private async void btnSearch_Click(object sender, EventArgs e)
{ {
if(this.ucSplitPage1.CurrentPage!=1) if (this.ucSplitPage1.CurrentPage != 1)
{ this.ucSplitPage1.CurrentPage = 1; } { this.ucSplitPage1.CurrentPage = 1; }
pictureBox2.Visible = true; pictureBox2.Visible = true;
@@ -245,5 +251,41 @@ namespace Work._29Tools.Forms.UserForms
break; break;
} }
} }
private void exportRecord_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (paymentList != null)
{
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
{
saveFileDialog.Filter = "CSV 文件 (*.csv)|*.csv|Excel 文件 (*.xlsx)|*.xlsx";
saveFileDialog.FilterIndex = 1;
saveFileDialog.FileName = $"消费记录_{dtpTimeBegin.Value:yyyyMMdd}_{dtpTimeEnd.Value:yyyyMMdd}.csv";
saveFileDialog.RestoreDirectory = true;
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("类型,订单ID,金额,余额,创建时间,备注");
foreach (var item in paymentList)
{
//var rowIndex = this.dgvPayment.Rows.Add(
// false,
// ((EnumOrderPaymentType)payment.type.ParseToInt()).ParseToString(),
// item.order_id,
// item.amount,
// item.balance,
// item.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
// item.remark
//);
sb.AppendLine($"{item.type.ParseToInt()},{item.order_id},{item.amount},{item.balance},{item.create_time.ToString("yyyy-MM-dd HH:mm:ss")},{item.remark}");
}
File.WriteAllText(saveFileDialog.FileName, sb.ToString(), Encoding.UTF8);
MessageBox.Show("导出成功");
}
}
}
}
} }
} }
@@ -117,6 +117,15 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="btnRefresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>289, 17</value>
</metadata>
<metadata name="btnBalanceTopUp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>130, 17</value>
</metadata>
<metadata name="btnSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>