pdd上货逻辑继续优化 temu选品数据店铺筛选功能

This commit is contained in:
wule committed 2025-09-19 22:55:19 +08:00
1 parent 0e6a034d5f
commit b868c718f0
19 files changed
+562 -271

No files matched your search

@@ -30,11 +30,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.pnlEmpty = new DevComponents.DotNetBar.PanelEx();
@@ -98,6 +98,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.txtFilter = new System.Windows.Forms.TextBox();
this.btnFilter = new DevComponents.DotNetBar.PanelEx();
this.btnRestore = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -439,6 +442,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
| System.Windows.Forms.AnchorStyles.Left)));
this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx1.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx1.Controls.Add(this.btnRestore);
this.ucGroupBoxEx1.Controls.Add(this.btnFilter);
this.ucGroupBoxEx1.Controls.Add(this.txtFilter);
this.ucGroupBoxEx1.Controls.Add(this.btnRefreshShop);
this.ucGroupBoxEx1.Location = new System.Drawing.Point(3, 2);
this.ucGroupBoxEx1.Name = "ucGroupBoxEx1";
@@ -516,18 +522,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -644,18 +650,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -774,8 +780,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle15;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -915,14 +921,74 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(114, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(573, 26);
this.ucSplitPage1.TabIndex = 675;
this.ucSplitPage1.TotalPage = 1;
//
// txtFilter
//
this.txtFilter.Location = new System.Drawing.Point(17, 59);
this.txtFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtFilter.Name = "txtFilter";
this.txtFilter.Size = new System.Drawing.Size(110, 23);
this.txtFilter.TabIndex = 482;
//
// btnFilter
//
this.btnFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFilter.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnFilter.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnFilter.DisabledBackColor = System.Drawing.Color.Empty;
this.btnFilter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnFilter.Location = new System.Drawing.Point(17, 86);
this.btnFilter.Name = "btnFilter";
this.btnFilter.Size = new System.Drawing.Size(67, 24);
this.btnFilter.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnFilter.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnFilter.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnFilter.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnFilter.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnFilter.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnFilter.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnFilter.Style.GradientAngle = 90;
this.btnFilter.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnFilter.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnFilter.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnFilter.TabIndex = 486;
this.btnFilter.Text = "筛选店铺";
this.btnFilter.Click += new System.EventHandler(this.btnFilter_Click);
//
// btnRestore
//
this.btnRestore.CanvasColor = System.Drawing.SystemColors.Control;
this.btnRestore.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRestore.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRestore.Location = new System.Drawing.Point(86, 87);
this.btnRestore.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnRestore.Name = "btnRestore";
this.btnRestore.Size = new System.Drawing.Size(41, 23);
this.btnRestore.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRestore.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnRestore.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnRestore.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnRestore.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRestore.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnRestore.Style.GradientAngle = 90;
this.btnRestore.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnRestore.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRestore.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRestore.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRestore.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnRestore.TabIndex = 508;
this.btnRestore.Text = "还原";
this.btnRestore.Click += new System.EventHandler(this.btnRestore_Click);
//
// DbProductUserSelectForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -941,6 +1007,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.ucGroupBoxEx4.ResumeLayout(false);
this.ucGroupBoxEx4.PerformLayout();
this.ucGroupBoxEx1.ResumeLayout(false);
this.ucGroupBoxEx1.PerformLayout();
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
@@ -1025,5 +1092,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private System.Windows.Forms.TextBox txtFilter;
private DevComponents.DotNetBar.PanelEx btnRestore;
private DevComponents.DotNetBar.PanelEx btnFilter;
}
}
@@ -528,5 +528,33 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
ShowDgvImg();
}
private void btnFilter_Click(object sender, EventArgs e)
{
var filterText = txtFilter.Text.Trim();
foreach(DataGridViewRow row in this.dgvShop.Rows)
{
if (row.Cells["colShopId"].Value.ParseToString().Contains(filterText) ||
row.Cells["colShopName"].Value.ParseToString().Contains(filterText) ||
row.Cells["colShopNotes"].Value.ParseToString().Contains(filterText))
{
row.Visible = true;
}
else
{
row.Visible = false;
row.Cells["colSelect"].Value = false;
}
}
}
private void btnRestore_Click(object sender, EventArgs e)
{
txtFilter.Text = "";
foreach (DataGridViewRow row in this.dgvShop.Rows)
{
row.Visible = true;
}
}
}
}
+3 -58
View File
@@ -33,61 +33,6 @@ namespace TemuKJD.KJDForms.ShopForms
private bool isLoading { get; set; } = false;
#region 服务端店铺管理
public static string AddServerDouShop(ShopLoginInfo _shop)
{
var url = BaseClass.BuildObjString("shop/add_shop");
var data = UserLogin.GetSignaturex()
+ "&login_name=" + _shop.LoginName
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
+ "&shop_id=" + _shop.ShopId
+ "&shop_account=" + _shop.ShopAccount
+ "&cookie=" + _shop.Cookies
+ "&cookie2=" + _shop.Cookies2
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName)
+ "&notes=" + GetHtml.UrlEncodeUtf8(_shop.Notes)
+ "&login_status=" + _shop.LoginStatus;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref result, "msg");
if (string.IsNullOrEmpty(msg))
msg = "店铺保存失败!";
BaseMsgForm.ShowError(msg);
}
return result;
}
public static string MdyServerDouShop(ShopLoginInfo _shop)
{
var url = BaseClass.BuildObjString("shop/mdy_shop");
var data = UserLogin.GetSignaturex()
+ "&login_name=" + _shop.LoginName
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
+ "&sub_user_name=" + _shop.SubUserName
+ "&notes=" + GetHtml.UrlEncodeUtf8(_shop.Notes);
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref result, "msg");
if (string.IsNullOrEmpty(msg))
msg = "店铺保存失败!";
BaseMsgForm.ShowError(msg);
}
return result;
}
public static void UpdateShop()
{
// 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。
@@ -327,13 +272,13 @@ namespace TemuKJD.KJDForms.ShopForms
}
else
{
ShopListForm.AddServerDouShop(shopInfo);
ShopBLL.AddServerShop(shopInfo);
btnRefreshCookie_Click(null, null);
}
}
else
{
ShopListForm.MdyServerDouShop(shopInfo);
ShopBLL.MdyServerShopSubInfo(shopInfo);
btnRefreshCookie_Click(null, null);
}
}
@@ -417,7 +362,7 @@ namespace TemuKJD.KJDForms.ShopForms
else
GlobalConfig.ShopLoginList.Add(shop);
StartUp.SaveLocalShopLoginInfo();
ShopListForm.AddServerDouShop(shop);
ShopBLL.AddServerShop(shop);
}
}
}
+3 -2
View File
@@ -25,6 +25,7 @@ using System.Windows.Forms;
using Work;
using Work.BLL.Tools;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ShopForms
{
@@ -169,7 +170,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (oldShop == null)
{
GlobalConfig.ShopLoginList.Add(newShop);
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
ShopBLL.AddServerShop(newShop); // 店铺写入到服务端
}
else
{
@@ -276,7 +277,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (oldShop == null)
{
GlobalConfig.ShopLoginList.Add(newShop);
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
ShopBLL.AddServerShop(newShop); // 店铺写入到服务端
}
else
{
@@ -313,7 +313,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (updateFrom != SetCookieFromEnum.normal_user)
ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
else
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
ShopBLL.AddServerShop(newShop); // 店铺写入到服务端
}
}
}