拼多多买手直接退款 其他订单逻辑优化

This commit is contained in:
wule committed 2026-07-09 20:08:27 +08:00
1 parent 1669305479
commit b877695e4b
42 files changed
+1958 -1980

No files matched your search

+157 -40
View File
@@ -4,6 +4,7 @@ using AllBase.Model;
using AllBase.Model.Local;
using AllBase.Model.Result;
using CefSharp;
using CefSharp.DevTools.IO;
using CefSharp.WinForms;
using DevComponents.WinForms.Drawing;
@@ -21,6 +22,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -37,6 +39,7 @@ namespace TemuKJD.ToolForms
public partial class PddMobileBuyOrderForm : BaseGeneralForm
{
public bool IsAutoBuy { get; set; } = true;
public bool IsFormLoad { get; set; } = false;
public int CloseAfterSecond { get; set; }
public string InitUrl = "";
@@ -70,12 +73,18 @@ namespace TemuKJD.ToolForms
filterOrderAction = filterOrder;
}
private void ShopLoginForm_Load(object sender, EventArgs e)
private void PddBuyOrderForm_Load(object sender, EventArgs e)
{
//splitContainer1.Dock = DockStyle.Fill;
this.Height = SystemInformation.WorkingArea.Height - 80;
this.CenterToScreen();
//splitContainer1.Dock = DockStyle.Fill;
chkAutoChangeWarehouseAddress.Checked = GlobalConfig.BuyConfig.IsAutoChangeWarehouseAddress;
chkUseAppBalance.Checked = GlobalConfig.BuyConfig.IsUseAppBalance;
//chkUseAppBalance.Checked = false;
//chkUseAppBalance.Visible = false;
//GlobalConfig.BuyConfig.IsUseAppBalance = false;
if (CloseAfterSecond > 0)
{
@@ -133,6 +142,7 @@ namespace TemuKJD.ToolForms
LoadCef();
}));
});
IsFormLoad = true;
}
private void Rb_CheckedChanged(object sender, EventArgs e)
@@ -251,14 +261,14 @@ namespace TemuKJD.ToolForms
//public Func<object, string, string, request, bool> BeforeResourceLoadEvent; // sender, requestUrl, postData, request, true(表示取消执行)
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
if (url.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/origenes/address_info") && chkChangeWarehouseAddress.Checked && transitWarehouse != null)
if (url.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/origenes/address_info") && chkAutoChangeWarehouseAddress.Checked && transitWarehouse != null)
{
//var address = BaseRegex.GetStringJson(ref postData, "address");
JObject jObj = JsonHelper.JObjectParse(postData);
jObj["province_id"] = transitWarehouse.province_id;
jObj["city_id"] = transitWarehouse.city_id;
jObj["district_id"] = transitWarehouse.district_id;
jObj["address"] = transitWarehouse.TransDetailAddress + Randomx.GetId(1, 35) + Randomx.GetId(1, 9).ToString().PadLeft(2, '0') + "室";
jObj["address"] = transitWarehouse.TransDetailAddress + Randomx.GetId(1, 35) + Randomx.GetId(1, 9).ToString().PadLeft(2, '0') + "室" + txtSourceCode.Text;
jObj["mobile"] = WaybillHelper.MobileHead[Randomx.GetId(WaybillHelper.MobileHead.Count)] + Randomx.GetNumber(8);
jObj["name"] = WaybillHelper.LastName[Randomx.GetId(WaybillHelper.LastName.Count)] + (Randomx.GetId(2) == 1 ? "先生" : "女士");
postData = JsonHelper.SerializeObject(jObj);
@@ -402,6 +412,16 @@ namespace TemuKJD.ToolForms
{
IsChangeAddress = true;
Thread.Sleep(1000);
var sourceCodeRst = GetSourceCode(transit);
if (sourceCodeRst.Contains("失败"))
{
Invoke(new Action(() =>
{
this.cefWebBrowser.Visible = false;
BaseMsgForm.ShowError(sourceCodeRst);
}));
return;
}
ChangeAddress(transit);
IsChangeAddress = false;
@@ -438,6 +458,32 @@ namespace TemuKJD.ToolForms
}
}
/// <summary>
/// 获取溯源码
/// </summary>
/// <returns></returns>
public string GetSourceCode(TransitWarehouseParam transit)
{
JObject body = new JObject();
body["province"] = transit.province_name;
body["city"] = transit.city_name;
body["warehouseCode"] = transit.TransId;
body["matchType"] = 1;
var url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/getRandomTraceCode";
var dataStr = JsonHelper.SerializeObject(body);
var sourceCodeRst = HttpResponseWXBLL.e57PostResponse(url, dataStr, "");
var randomCode = BaseRegex.GetStringXml(ref sourceCodeRst, "randomCode");
if (!string.IsNullOrEmpty(randomCode))
{
Invoke(new Action(() => { txtSourceCode.Text = randomCode; }));
return randomCode;
}
else
{
return "获取失败,请关闭拍单窗口重试 " + BaseRegex.GetStringXml(ref sourceCodeRst, "msg", sourceCodeRst);
}
}
bool IsChangeAddress = false;
bool HasChangeAddress = false;
/// <summary>
@@ -674,8 +720,40 @@ namespace TemuKJD.ToolForms
}
private void btnManualUpdateBuyOrder_Click(object sender, EventArgs e)
private async void btnManualUpdateBuyOrder_Click(object sender, EventArgs e)
{
if (txtSourceCode.Text.Trim().Length != 6)
{
BaseMsgForm.ShowError("溯源码长度错误!");
return;
}
var client = cefWebBrowser.GetDevToolsClient();
if (client == null)
{
BaseMsgForm.ShowError("页面未加载!");
return;
}
var sourceCode = txtSourceCode.Text.Trim();
var jsStr1 = @"(function() { var elements = document.getElementsByTagName('div');
for (i = elements.length - 1; i >= 0; i--){
var element = elements[i];
if (element.innerHTML.indexOf('" + sourceCode + @"') >= 0) {
return 'success';
}
}
return '';
})();";
var ts1 = client.Runtime.EvaluateAsync(jsStr1, null, true, null, null, true, null, true);
await ts1;
// 付款页面没法匹配,暂时注释
//if (ts1.Result?.Result?.Value.ParseToString() != "success")
//{
// BaseMsgForm.ShowError("溯源码不匹配!");
// return;
//}
if (string.IsNullOrEmpty(txtBuyTransitWarehouse.Text.Trim()))
{
BaseMsgForm.ShowError("缺少中转地址,请重新绑定商品并选择仓库地址");
@@ -705,12 +783,18 @@ namespace TemuKJD.ToolForms
body["orderSkuId"] = orderItem.sku_id;
body["outOrderNo"] = txtBuyOrderId.Text.Trim();
body["outAmount"] = (txtBuyPrice.Text.ParseToDecimal() * 100).ParseToInt() + "";
body["buyerAccount"] = buyer.buyer_nick;
body["purchaserNote"] = BaseClass.NickName;
body["buyerAccount"] = buyer.buyer_nick; // 买手昵称
body["purchaserNote"] = BaseClass.NickName; // 购买软件账户备注
body["express1Company"] = ""; // 物流公司编号
body["express1Waybill"] = ""; // 物流编号
body["platform"] = transit.TransId; // 中转仓ID
body["orderPlatformCode"] = "WEISHOP";
body["randomCode"] = txtSourceCode.Text.Trim();
if (GlobalConfig.BuyConfig.IsUseAppBalance)
{
body["userName"] = BaseClass.UserName; // 软件端用户名
body["purchaserNote"] = BaseClass.UserName + "-" + BaseClass.NickName; // 购买软件账户备注
}
var url = "https://po.e57.cn/prod-api/api/oms-api/externalProcurement/saveOrUpdate";
var dataStr = JsonHelper.SerializeObject(body);
//dataStr = "{\"orderNo\":\"3737339733954942720\",\"outOrderNo\":\"2606846854564\",\"buyerAccount\":\"测试\",\"outAmount\":\"2000\",\"purchaserNote\":\"测试\",\"express1Company\":\"\"" +
@@ -733,11 +817,20 @@ namespace TemuKJD.ToolForms
{
msg = exportRst.ParseToString();
}
BaseMsgForm.ShowError("接收到erp服务端传递的错误消息:" + msg, "拍单信息保存失败");
BaseMsgForm.ShowError("拍单保存失败,服务端返回 " + msg, "拍单信息保存失败");
btnManualUpdateBuyOrder.Enabled = true;
return;
}
url = BaseClass.Build29WxObjString("user/get_all_user");
var data = UserLogin.GetSignaturex();
data += "&search_user_name=" + BaseClass.UserName;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (html.Contains("\"code\":200"))
BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance");
orderItem.ItemTransitOrders.Insert(0, new oms_wei_external_procurement_log()
{
buyer_account = buyer.buyer_nick,
@@ -746,7 +839,7 @@ namespace TemuKJD.ToolForms
order_sku_id = orderItem.sku_id,
out_amount = (txtBuyPrice.Text.ParseToDecimal() * 100).ParseToInt(),
out_order_no = txtBuyOrderId.Text.Trim(),
purchaser_note = BaseClass.NickName,
purchaser_note = body["purchaserNote"].ParseToString(),
});
// 利润计算重置为最小值,控件Resource更新时将计算利润
orderItem.ProfitCount = decimal.MinValue;
@@ -757,38 +850,38 @@ namespace TemuKJD.ToolForms
filterOrderAction(order, true);
}
// 提前取号
if (DateTime.Now.Date > BaseClass.StampToDateTime(order.create_time).Date)
{
JObject data = new JObject();
data["outOrderNo"] = txtBuyOrderId.Text.Trim();
data["warehouseCode"] = transit.TransId; // 中转仓仓库对应编码
//data["warehouseCode"] = txtBuyOrderId.Text.Trim(); // 中转仓仓库对应编码
data["platform"] = "WEISHOP";
var getVirtualTicketUrl = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/order/virtual/create";
var getVirtualTicketDataStr = JsonHelper.SerializeObject(data);
//// 前一天的订单直接提前取号
//if (DateTime.Now.Date > BaseClass.StampToDateTime(order.create_time).Date)
//{
// JObject data = new JObject();
// data["outOrderNo"] = txtBuyOrderId.Text.Trim();
// data["warehouseCode"] = transit.TransId; // 中转仓仓库对应编码 XDYSZC XDYYWC ...
// //data["warehouseCode"] = txtBuyOrderId.Text.Trim(); // 中转仓仓库对应编码
// data["platform"] = "WEISHOP";
// var getVirtualTicketUrl = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/order/virtual/create";
// var getVirtualTicketDataStr = JsonHelper.SerializeObject(data);
var getVirtualTicketRst = HttpResponseWXBLL.e57PostResponse(getVirtualTicketUrl, getVirtualTicketDataStr, "");
if (!getVirtualTicketRst.ParseToString().Contains("<code>200</code>") && !getVirtualTicketRst.ParseToString().Contains("<code>0</code>"))
{
string msg = "";
string code = "";
try
{
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(getVirtualTicketRst);
code = xmlDoc["AjaxResult"]["code"].InnerText;
msg = xmlDoc["AjaxResult"]["msg"].InnerText;
}
catch
{
msg = getVirtualTicketRst.ParseToString();
}
BaseMsgForm.ShowError("拍单信息保存成功,接收到erp服务端传递的错误消息:" + msg, "订单提前取号失败");
btnManualUpdateBuyOrder.Enabled = true;
return;
}
}
// var getVirtualTicketRst = HttpResponseWXBLL.e57PostResponse(getVirtualTicketUrl, getVirtualTicketDataStr, "");
// if (!getVirtualTicketRst.ParseToString().Contains("<code>200</code>") && !getVirtualTicketRst.ParseToString().Contains("<code>0</code>"))
// {
// string msg = "";
// string code = "";
// try
// {
// System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
// xmlDoc.LoadXml(getVirtualTicketRst);
// code = xmlDoc["AjaxResult"]["code"].InnerText;
// msg = xmlDoc["AjaxResult"]["msg"].InnerText;
// }
// catch
// {
// msg = getVirtualTicketRst.ParseToString();
// }
// BaseMsgForm.ShowError("拍单信息保存成功,接收到服务端传递的错误消息:" + msg, "订单提前取号失败");
// btnManualUpdateBuyOrder.Enabled = true;
// return;
// }
//}
BaseMsgForm.ShowInfo("拍单信息保存成功");
this.Close();
@@ -814,7 +907,31 @@ namespace TemuKJD.ToolForms
private void btnReMap_Click(object sender, EventArgs e)
{
transitWarehouse = null;
pnlMap.Visible = true;
}
private void cmbTransitWarehouse_SelectedIndexChanged(object sender, EventArgs e)
{
transitWarehouse = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransName + " " + t.TransDetailAddress == cmbTransitWarehouse.Text);
}
private void chkAutoChangeWarehouseAddress_CheckedChanged(object sender, EventArgs e)
{
if (IsFormLoad)
{
GlobalConfig.BuyConfig.IsAutoChangeWarehouseAddress = chkAutoChangeWarehouseAddress.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("buy_config_260708", GlobalConfig.BuyConfig);
}
}
private void chkUseAppBalance_CheckedChanged(object sender, EventArgs e)
{
if (IsFormLoad)
{
GlobalConfig.BuyConfig.IsUseAppBalance = chkUseAppBalance.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("buy_config_260708", GlobalConfig.BuyConfig);
}
}
}
}
+58 -15
View File
@@ -83,6 +83,7 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.txtAddress = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.chkUseAppBalance = new Work.UserComponents.UcCheckBox(this.components);
this.txtShopName = new System.Windows.Forms.TextBox();
this.label27 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
@@ -92,8 +93,10 @@
this.label25 = new System.Windows.Forms.Label();
this.txtBuyTransitWarehouse = new System.Windows.Forms.TextBox();
this.pnlMap = new System.Windows.Forms.Panel();
this.chkChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label28 = new System.Windows.Forms.Label();
this.txtSourceCode = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel2.SuspendLayout();
@@ -264,6 +267,7 @@
this.cmbTransitWarehouse.Name = "cmbTransitWarehouse";
this.cmbTransitWarehouse.Size = new System.Drawing.Size(388, 25);
this.cmbTransitWarehouse.TabIndex = 838;
this.cmbTransitWarehouse.SelectedIndexChanged += new System.EventHandler(this.cmbTransitWarehouse_SelectedIndexChanged);
//
// txtBuyPrice
//
@@ -344,7 +348,7 @@
this.txtBuyOrderId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtBuyOrderId.Location = new System.Drawing.Point(74, 139);
this.txtBuyOrderId.Name = "txtBuyOrderId";
this.txtBuyOrderId.Size = new System.Drawing.Size(388, 23);
this.txtBuyOrderId.Size = new System.Drawing.Size(152, 23);
this.txtBuyOrderId.TabIndex = 829;
//
// label15
@@ -698,13 +702,14 @@
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.chkUseAppBalance);
this.panel1.Controls.Add(this.txtShopName);
this.panel1.Controls.Add(this.label27);
this.panel1.Controls.Add(this.label26);
this.panel1.Controls.Add(this.txtOrderId);
this.panel1.Controls.Add(this.pnlBuy);
this.panel1.Controls.Add(this.pnlMap);
this.panel1.Controls.Add(this.chkChangeWarehouseAddress);
this.panel1.Controls.Add(this.chkAutoChangeWarehouseAddress);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.txtShopOrderItemPrice);
this.panel1.Controls.Add(this.txtShopOrderItemCnt);
@@ -728,6 +733,19 @@
this.panel1.Size = new System.Drawing.Size(487, 730);
this.panel1.TabIndex = 0;
//
// chkUseAppBalance
//
this.chkUseAppBalance.AutoSize = true;
this.chkUseAppBalance.Checked = true;
this.chkUseAppBalance.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUseAppBalance.Location = new System.Drawing.Point(172, 11);
this.chkUseAppBalance.Name = "chkUseAppBalance";
this.chkUseAppBalance.Size = new System.Drawing.Size(123, 21);
this.chkUseAppBalance.TabIndex = 877;
this.chkUseAppBalance.Text = "使用快递余额拍单";
this.chkUseAppBalance.UseVisualStyleBackColor = true;
this.chkUseAppBalance.CheckedChanged += new System.EventHandler(this.chkUseAppBalance_CheckedChanged);
//
// txtShopName
//
this.txtShopName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -772,6 +790,8 @@
//
this.pnlBuy.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlBuy.Controls.Add(this.label28);
this.pnlBuy.Controls.Add(this.txtSourceCode);
this.pnlBuy.Controls.Add(this.btnReMap);
this.pnlBuy.Controls.Add(this.label25);
this.pnlBuy.Controls.Add(this.txtBuyTransitWarehouse);
@@ -864,17 +884,18 @@
this.pnlMap.Size = new System.Drawing.Size(468, 203);
this.pnlMap.TabIndex = 871;
//
// chkChangeWarehouseAddress
// chkAutoChangeWarehouseAddress
//
this.chkChangeWarehouseAddress.AutoSize = true;
this.chkChangeWarehouseAddress.Checked = true;
this.chkChangeWarehouseAddress.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkChangeWarehouseAddress.Location = new System.Drawing.Point(309, 11);
this.chkChangeWarehouseAddress.Name = "chkChangeWarehouseAddress";
this.chkChangeWarehouseAddress.Size = new System.Drawing.Size(171, 21);
this.chkChangeWarehouseAddress.TabIndex = 859;
this.chkChangeWarehouseAddress.Text = "保存地址时替换为云仓地址";
this.chkChangeWarehouseAddress.UseVisualStyleBackColor = true;
this.chkAutoChangeWarehouseAddress.AutoSize = true;
this.chkAutoChangeWarehouseAddress.Checked = true;
this.chkAutoChangeWarehouseAddress.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkAutoChangeWarehouseAddress.Location = new System.Drawing.Point(309, 11);
this.chkAutoChangeWarehouseAddress.Name = "chkAutoChangeWarehouseAddress";
this.chkAutoChangeWarehouseAddress.Size = new System.Drawing.Size(171, 21);
this.chkAutoChangeWarehouseAddress.TabIndex = 859;
this.chkAutoChangeWarehouseAddress.Text = "保存地址时替换为云仓地址";
this.chkAutoChangeWarehouseAddress.UseVisualStyleBackColor = true;
this.chkAutoChangeWarehouseAddress.CheckedChanged += new System.EventHandler(this.chkAutoChangeWarehouseAddress_CheckedChanged);
//
// pictureBox1
//
@@ -887,6 +908,25 @@
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// label28
//
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(266, 142);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(44, 17);
this.label28.TabIndex = 884;
this.label28.Text = "溯源码";
//
// txtSourceCode
//
this.txtSourceCode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSourceCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtSourceCode.Location = new System.Drawing.Point(310, 139);
this.txtSourceCode.Name = "txtSourceCode";
this.txtSourceCode.Size = new System.Drawing.Size(152, 23);
this.txtSourceCode.TabIndex = 885;
//
// PddMobileBuyOrderForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -900,7 +940,7 @@
this.Text = "买手拍单";
this.TitleText = "买手拍单";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ShopLoginForm_FormClosed);
this.Load += new System.EventHandler(this.ShopLoginForm_Load);
this.Load += new System.EventHandler(this.PddBuyOrderForm_Load);
this.Controls.SetChildIndex(this.splitContainer2, 0);
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
this.splitContainer1.Panel2.ResumeLayout(false);
@@ -976,7 +1016,7 @@
private System.Windows.Forms.Label label20;
private System.Windows.Forms.ComboBox cmbTransitWarehouse;
private System.Windows.Forms.PictureBox pictureBox1;
private Work.UserComponents.UcCheckBox chkChangeWarehouseAddress;
private Work.UserComponents.UcCheckBox chkAutoChangeWarehouseAddress;
private System.Windows.Forms.Panel panel1;
private DevComponents.DotNetBar.PanelEx btnJumpOrderList;
private System.Windows.Forms.Label label25;
@@ -988,5 +1028,8 @@
private System.Windows.Forms.TextBox txtOrderId;
private System.Windows.Forms.TextBox txtShopName;
private System.Windows.Forms.Label label27;
private Work.UserComponents.UcCheckBox chkUseAppBalance;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.TextBox txtSourceCode;
}
}
@@ -0,0 +1,143 @@
namespace Work._29Tools.Forms.UserForms
{
partial class WXGetBalanceQrCodeForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btnRefresh = new DevComponents.DotNetBar.PanelEx();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// pbCloseBase
//
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(412, 0);
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 11F);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.label1.Location = new System.Drawing.Point(29, 409);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(384, 44);
this.label1.TabIndex = 1;
this.label1.Text = "支付宝扫码充值,备注软件登录账户。如忘记备注,请联系购买方充值。";
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(29, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(384, 384);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
//
// btnRefresh
//
this.btnRefresh.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRefresh.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRefresh.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRefresh.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRefresh.Location = new System.Drawing.Point(329, 450);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(84, 23);
this.btnRefresh.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRefresh.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRefresh.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRefresh.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnRefresh.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnRefresh.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnRefresh.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnRefresh.Style.GradientAngle = 90;
this.btnRefresh.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRefresh.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefresh.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefresh.TabIndex = 1135;
this.btnRefresh.Text = "刷新";
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
// pbLoading
//
this.pbLoading.Image = global::Work.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(196, 186);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 1136;
this.pbLoading.TabStop = false;
this.pbLoading.Visible = false;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.btnRefresh);
this.panel1.Controls.Add(this.pbLoading);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(1, 33);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(444, 488);
this.panel1.TabIndex = 1140;
//
// WXGetBalanceQrCodeForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.ClientSize = new System.Drawing.Size(446, 522);
this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "WXGetBalanceQrCodeForm";
this.Padding = new System.Windows.Forms.Padding(1);
this.Text = "二维码充值";
this.TitleText = "二维码充值";
this.Load += new System.EventHandler(this.WXGetTopUpQrCode_Load);
this.Controls.SetChildIndex(this.panel1, 0);
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private DevComponents.DotNetBar.PanelEx btnRefresh;
private System.Windows.Forms.PictureBox pbLoading;
private System.Windows.Forms.Panel panel1;
}
}
@@ -0,0 +1,64 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Work;
using Work.BaseForms;
namespace Work._29Tools.Forms.UserForms
{
public partial class WXGetBalanceQrCodeForm : BaseForms.BaseGeneralForm
{
public WXGetBalanceQrCodeForm()
{
InitializeComponent();
}
public void refreshQrcode()
{
Invoke(new Action(() =>
{
pbLoading.Visible = true;
}));
var url = BaseClass.Build29WxObjString("user/get_top_up_qrcode");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref html, "msg");
BaseMsgForm.ShowError(msg);
}
else
{
Invoke(new Action(() =>
{
pbLoading.Visible = false;
var base64Str = BaseRegex.GetStringJson(ref html, "qrcode_base64");
if (!string.IsNullOrEmpty(base64Str))
pictureBox1.Image = Base64ChangeImgUrl.Base64ToImage(base64Str);
else
pictureBox1.Image = Properties.Resources.errpic;
}));
}
}
private void btnRefresh_Click(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
private void WXGetTopUpQrCode_Load(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>