OEM 结算和用户修改OEM归属
This commit is contained in:
1 parent
8c11794884
commit
652e7bc6e1
5 files changed
+155
-73
No files matched your search
@@ -13,6 +13,7 @@ using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@@ -39,6 +40,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
|
||||
/// <summary>收款二维码图片(base64)</summary>
|
||||
private string qrCodeBase64 = "";
|
||||
private bool isSettlement = false;
|
||||
|
||||
public WXShopOemWithdrawalForm()
|
||||
{
|
||||
@@ -93,7 +95,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
#endregion
|
||||
|
||||
#region 数据加载
|
||||
private void WXShopOemWithdrawalForm_VisibleChanged(object sender, EventArgs e)
|
||||
private async void WXShopOemWithdrawalForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Visible && first)
|
||||
{
|
||||
@@ -103,49 +105,56 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
/// <summary>
|
||||
/// 刷新账户金额 + 提现记录
|
||||
/// </summary>
|
||||
private async Task RefreshAll()
|
||||
{
|
||||
await RefreshOMEAmount();
|
||||
GetWithdrawals(ucSplitPage1.CurrentPage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新账户统计 + 提现记录
|
||||
/// 刷新OEM钱
|
||||
/// </summary>
|
||||
private void RefreshAll()
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
private async Task RefreshOMEAmount()
|
||||
{
|
||||
LoadSummary();
|
||||
GetWithdrawals(ucSplitPage1.CurrentPage);
|
||||
var url = BaseClass.BuildObjString("user/getOemAmount");
|
||||
var data = UserLogin.GetSignPostData(new { });
|
||||
var html = await GetHtml.PostJsonAsync(url, data);
|
||||
var ret = JsonConvert.DeserializeObject<Result<oemflowsStatistics>>(html);
|
||||
if (ret.Code != 200)
|
||||
{
|
||||
throw new Exception(ret.Msg);
|
||||
}
|
||||
this.lblWithdrawable.Text = (ret.Data.AvailableBalance / 100m).ToString("F2");
|
||||
this.lblTotalRebate.Text = (ret.Data.TotalRebateAmount / 100m).ToString("F2");
|
||||
this.lblTotalWithdrawn.Text = (ret.Data.TotalWithdrawAmount / 100m).ToString("F2");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载账户统计:可提现总额 / 历史累计返利 / 历史累计提现
|
||||
/// </summary>
|
||||
public void LoadSummary()
|
||||
public async Task Settlement()
|
||||
{
|
||||
this.btnRefreshBalance.Enabled = false;
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = BaseClass.BuildObjString("user/oem_settle_flows");
|
||||
var obj = UserLogin.GetSignPostData(new { });
|
||||
string data = JsonHelper.SerializeObject(obj);
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
var ret = JsonConvert.DeserializeObject<Result<oemflowsStatistics>>(html);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (ret.Code != 200)
|
||||
{
|
||||
BaseMsgForm.ShowError("刷新失败:" + ret.Msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.lblWithdrawable.Text = (ret.Data.available_balance / 100m).ToString("F2");
|
||||
this.lblTotalRebate.Text = (ret.Data.total_rebate_amount / 100m).ToString("F2");
|
||||
this.lblTotalWithdrawn.Text = (ret.Data.total_withdraw_amount / 100m).ToString("F2");
|
||||
}));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Invoke(new Action(() => this.btnRefreshBalance.Enabled = true));
|
||||
}
|
||||
});
|
||||
var url = BaseClass.BuildObjString("user/oem_settle_flows");
|
||||
var data = UserLogin.GetSignPostData(new { });
|
||||
var html = await GetHtml.PostJsonAsync(url, data);
|
||||
var ret = JsonConvert.DeserializeObject<Result<oemflowsStatistics>>(html);
|
||||
if (ret.Code != 200)
|
||||
{
|
||||
throw new Exception("结算失败:" + ret.Msg);
|
||||
}
|
||||
this.lblWithdrawable.Text = (ret.Data.AvailableBalance / 100m).ToString("F2");
|
||||
this.lblTotalRebate.Text = (ret.Data.TotalRebateAmount / 100m).ToString("F2");
|
||||
this.lblTotalWithdrawn.Text = (ret.Data.TotalWithdrawAmount / 100m).ToString("F2");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -213,10 +222,41 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
/// <summary>刷新可提现总额等账户统计</summary>
|
||||
private void btnRefreshBalance_Click(object sender, EventArgs e)
|
||||
|
||||
private async void bt_RefreshAmount_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadSummary();
|
||||
try
|
||||
{
|
||||
bt_RefreshAmount.Enabled = false;
|
||||
await RefreshOMEAmount();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
bt_RefreshAmount.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>刷新可提现总额等账户统计</summary>
|
||||
private async void btnRefreshBalance_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
btnRefreshBalance.Enabled = false;
|
||||
await Settlement();
|
||||
isSettlement = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btnRefreshBalance.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>选择收款二维码图片</summary>
|
||||
@@ -253,8 +293,13 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
}
|
||||
|
||||
/// <summary>提交提现申请</summary>
|
||||
private void btnSubmit_Click(object sender, EventArgs e)
|
||||
private async void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (isSettlement == false)
|
||||
{
|
||||
BaseMsgForm.ShowError("请先结算后再选择提现!");
|
||||
return;
|
||||
}
|
||||
decimal amountYuan = this.numAmount.Value;
|
||||
if (amountYuan <= 0)
|
||||
{
|
||||
@@ -307,7 +352,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
this.numAmount.Value = 0;
|
||||
this.qrCodeBase64 = "";
|
||||
this.pictureBoxQr.Image = Properties.Resources.nopic;
|
||||
RefreshAll();
|
||||
Refresh();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -338,6 +383,8 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
GetWithdrawals(ucSplitPage1.CurrentPage);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
class oemflowsStatistics
|
||||
@@ -345,14 +392,14 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
/// <summary>
|
||||
/// 当前可提现
|
||||
/// </summary>
|
||||
public long available_balance { get; set; }
|
||||
public long AvailableBalance { get; set; }
|
||||
/// <summary>
|
||||
/// 历史累计返利
|
||||
/// </summary>
|
||||
public long total_rebate_amount { get; set; }
|
||||
public long TotalRebateAmount { get; set; }
|
||||
/// <summary>
|
||||
/// 历史累计提现
|
||||
/// </summary>
|
||||
public long total_withdraw_amount { get; set; }
|
||||
public long TotalWithdrawAmount { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user