修改消费记录总金额计算方法

This commit is contained in:
chfei committed 2026-09-20 18:49:33 +08:00
1 parent 107bf82f97
commit d8064b95ef
5 files changed
+626 -534

No files matched your search

@@ -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();
@@ -45,6 +45,9 @@ namespace Work._29Tools.Forms.UserForms
this.btnBalanceTopUp = new DevComponents.DotNetBar.PanelEx();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx1 = new Work.UserComponents.UcGroupBoxEx(this.components);
this.label13 = new System.Windows.Forms.Label();
this.consumptionArmt = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.rangeUsedAramt = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.exportRecord = new System.Windows.Forms.LinkLabel();
@@ -75,9 +78,6 @@ namespace Work._29Tools.Forms.UserForms
this.textBox1 = new System.Windows.Forms.TextBox();
this.statusBarUserControl1 = new Work.UserControls.StatusBarUserControl();
this.ucSplitPage1 = new Work.UserControls.UcSplitPage();
this.label11 = new System.Windows.Forms.Label();
this.consumptionArmt = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbQrcode)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
@@ -319,6 +319,32 @@ namespace Work._29Tools.Forms.UserForms
this.ucGroupBoxEx1.Text = "查询条件";
this.ucGroupBoxEx1.Enter += new System.EventHandler(this.ucGroupBoxEx1_Enter);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(614, 50);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(56, 17);
this.label13.TabIndex = 1182;
this.label13.Text = "截至时间";
//
// consumptionArmt
//
this.consumptionArmt.Location = new System.Drawing.Point(1078, 18);
this.consumptionArmt.Name = "consumptionArmt";
this.consumptionArmt.Size = new System.Drawing.Size(67, 17);
this.consumptionArmt.TabIndex = 1181;
this.consumptionArmt.Text = "xxxx.xx";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(1016, 18);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(68, 17);
this.label11.TabIndex = 1180;
this.label11.Text = "消费总额:";
//
// rangeUsedAramt
//
this.rangeUsedAramt.Location = new System.Drawing.Point(943, 64);
@@ -353,7 +379,7 @@ namespace Work._29Tools.Forms.UserForms
this.balanceArmt.Name = "balanceArmt";
this.balanceArmt.Size = new System.Drawing.Size(67, 17);
this.balanceArmt.TabIndex = 1167;
this.balanceArmt.Text = "1000.00";
this.balanceArmt.Text = "xxxx.xx";
//
// label10
//
@@ -370,7 +396,7 @@ namespace Work._29Tools.Forms.UserForms
this.rechargeArmtTotal.Name = "rechargeArmtTotal";
this.rechargeArmtTotal.Size = new System.Drawing.Size(67, 17);
this.rechargeArmtTotal.TabIndex = 1165;
this.rechargeArmtTotal.Text = "10000.00";
this.rechargeArmtTotal.Text = "xxxx.xx";
//
// label8
//
@@ -474,14 +500,14 @@ namespace Work._29Tools.Forms.UserForms
this.cmbType.FormattingEnabled = true;
this.cmbType.Items.AddRange(new object[] {
"",
"充值",
"管理员充值",
"支付宝充值",
"礼物单支出/礼物单退费",
"拍单扣除/作废返还",
"超重扣费支出",
"退货包裹扣费支出",
"云仓退货扣费支出"});
"充值",
"管理员充值",
"支付宝充值",
"礼物单支出/礼物单退费",
"拍单扣除/作废返还",
"超重扣费支出",
"退货包裹扣费支出",
"云仓退货扣费支出"});
this.cmbType.Location = new System.Drawing.Point(42, 33);
this.cmbType.Name = "cmbType";
this.cmbType.Size = new System.Drawing.Size(121, 25);
@@ -525,20 +551,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,
@@ -582,8 +608,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";
@@ -643,32 +669,6 @@ namespace Work._29Tools.Forms.UserForms
this.ucSplitPage1.PageChange += new System.Action<object>(this.ucSplitPage1_PageChange);
this.ucSplitPage1.Load += new System.EventHandler(this.ucSplitPage1_Load);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(1016, 18);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(68, 17);
this.label11.TabIndex = 1180;
this.label11.Text = "消费总额:";
//
// consumptionArmt
//
this.consumptionArmt.Location = new System.Drawing.Point(1078, 18);
this.consumptionArmt.Name = "consumptionArmt";
this.consumptionArmt.Size = new System.Drawing.Size(67, 17);
this.consumptionArmt.TabIndex = 1181;
this.consumptionArmt.Text = "1000.00";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(614, 50);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(56, 17);
this.label13.TabIndex = 1182;
this.label13.Text = "截至时间";
//
// WXGetBalanceQrCodeForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -5,6 +5,7 @@ using CefSharp.WinForms;
using DevComponents.WinForms.Drawing;
using NaiBa.CefHelper;
using NaiBa.Util.Extension;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -16,6 +17,7 @@ using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -25,6 +27,7 @@ using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
using Work.BaseForms;
using Work.Extension;
using WxOrder.Framework.Commons;
namespace Work._29Tools.Forms.UserForms
{
@@ -37,6 +40,9 @@ namespace Work._29Tools.Forms.UserForms
{
InitializeComponent();
updateBalanceAction = updateBalance;
_ = GetUserAmountSummary();
rangeUsedAramt.Visible = false;
label9.Visible = false;
}
public void refreshQrcode()
@@ -209,14 +215,14 @@ namespace Work._29Tools.Forms.UserForms
#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");
List<int> types = new List<int> { 16, 20, 23, 24, 26, 31 };
consumptionArmt.Text =
(paymentList.Where(a => types.Contains(a.type.Value)).Sum(a => a.amount)
- paymentList.Where(a => a.type == 23).Sum(a => a.amount))
.ToString("N2"); // paymentList.Sum(a => a.amount).ToString("N2");
//rechargeArmtTotal.Text = BaseClass.RechargeAmountTotal.ToString("N2");
//balanceArmt.Text = BaseClass.Balance.ToString("N2");
//rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
//List<int> types = new List<int> { 16, 20, 23, 24, 26, 31 };
//consumptionArmt.Text =
//(paymentList.Where(a => types.Contains(a.type.Value)).Sum(a => a.amount)
//- paymentList.Where(a => a.type == 23).Sum(a => a.amount))
//.ToString("N2"); // paymentList.Sum(a => a.amount).ToString("N2");
}));
}
@@ -298,5 +304,43 @@ namespace Work._29Tools.Forms.UserForms
}
}
private async Task GetUserAmountSummary()
{
var url = BaseClass.Build29WxObjString("user/GetUserAmountSummary");
var data3 = UserLogin.GetSignPostData(new { });
var html3 = await GetHtml.PostJsonAsync(url, data3);
var ret = JsonConvert.DeserializeObject<Result<UserAmountSummary>>(html3);
if (ret.Code != 200)
{
}
else
{
rechargeArmtTotal.Text = (ret.Data.RechargeTotal / 100m).ToString("N2");
balanceArmt.Text = (ret.Data.Balance / 100m).ToString("N2");
//rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
consumptionArmt.Text = (ret.Data.ConsumeTotal / 100m).ToString("N2");
}
}
private class UserAmountSummary
{
/// <summary>
/// 充值总额
/// </summary>
public long RechargeTotal { get; set; }
/// <summary>
/// 消费总额
/// </summary>
public long ConsumeTotal { get; set; }
/// <summary>
/// 剩余余额
/// </summary>
public long Balance { get; set; }
}
}
}
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->