From 62465769fe33a1f587eab34c49afac687f899830 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 12 Dec 2025 19:34:16 +0800 Subject: [PATCH] =?UTF-8?q?temu=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8A=9F=E8=83=BD=20=202.=E6=8B=BC=E5=A4=9A=E5=A4=9A?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=8F=90=E5=8F=96=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=8825%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 2 +- TEMUKJD/KJDForms/AdminForms/AdminForm.cs | 2 +- TEMUKJD/KJDForms/JITForms/JITForm.cs | 2 +- .../ProductForms/ProductForm.Designer.cs | 24 ++- TEMUKJD/KJDForms/ProductForms/ProductForm.cs | 78 ++++---- .../DbProductSelectListManageForm.cs | 63 ++++--- ...oductThirdSelectListManageForm.Designer.cs | 24 +-- .../ProductThirdSelectListManageForm.cs | 166 ++++++++++++++---- .../PDDDBProdEditDetailForm.Designer.cs | 84 ++++++--- .../PDDDBProdEditDetailForm.cs | 17 +- .../PDDDBProdEditForm.Designer.cs | 27 --- .../ProductSelectForms/PDDDBProdEditForm.cs | 43 ----- .../ShopForms/PDDShopBrowserObject.cs | 80 ++++++++- 13 files changed, 402 insertions(+), 210 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 553085b..05af92a 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 723; + public static int VersionCount = 725; //public static int VersionCount = 613; /// diff --git a/TEMUKJD/KJDForms/AdminForms/AdminForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminForm.cs index c714320..2d1de10 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminForm.cs @@ -109,7 +109,7 @@ namespace TemuKJD.KJDForms.AdminForms SetForm(dbPriceMarkUpForm.Value); break; case "认领待上传": - dbProductSelectListManageForm.Value.IsClientJit = false; + dbProductSelectListManageForm.Value.ClientMode = DbProductSelectListManageForm.EnumClientMode.Admin; SetForm(dbProductSelectListManageForm.Value); break; case "库存上传": diff --git a/TEMUKJD/KJDForms/JITForms/JITForm.cs b/TEMUKJD/KJDForms/JITForms/JITForm.cs index c2f7143..0be1bf0 100644 --- a/TEMUKJD/KJDForms/JITForms/JITForm.cs +++ b/TEMUKJD/KJDForms/JITForms/JITForm.cs @@ -62,7 +62,7 @@ namespace TemuKJD.KJDForms.JITForms SetForm(dbProductListForm.Value); break; case "JIT商品上传": - dDbProductSelectListManageForm.Value.IsClientJit = true; + dDbProductSelectListManageForm.Value.ClientMode = DbProductSelectListManageForm.EnumClientMode.ClientJit; SetForm(dDbProductSelectListManageForm.Value); break; case "JIT商品核价": diff --git a/TEMUKJD/KJDForms/ProductForms/ProductForm.Designer.cs b/TEMUKJD/KJDForms/ProductForms/ProductForm.Designer.cs index ea5606f..9f7d031 100644 --- a/TEMUKJD/KJDForms/ProductForms/ProductForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductForms/ProductForm.Designer.cs @@ -35,8 +35,10 @@ System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("加入发货台"); System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("设置进货价"); System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("商品认领"); - System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("库存上传"); - System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("商品管理", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("库存记录"); + System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("商品上传"); + System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("库存上传"); + System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("商品管理", new System.Windows.Forms.TreeNode[] { treeNode1, treeNode2, treeNode3, @@ -44,7 +46,9 @@ treeNode5, treeNode6, treeNode7, - treeNode8}); + treeNode8, + treeNode9, + treeNode10}); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); @@ -149,12 +153,16 @@ treeNode6.Text = "设置进货价"; treeNode7.Name = "商品认领"; treeNode7.Text = "商品认领"; - treeNode8.Name = "库存上传"; - treeNode8.Text = "库存上传"; - treeNode9.Name = "商品管理"; - treeNode9.Text = "商品管理"; + treeNode8.Name = "库存记录"; + treeNode8.Text = "库存记录"; + treeNode9.Name = "商品上传"; + treeNode9.Text = "商品上传"; + treeNode10.Name = "库存上传"; + treeNode10.Text = "库存上传"; + treeNode11.Name = "商品管理"; + treeNode11.Text = "商品管理"; this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode9}); + treeNode11}); this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.tv.Size = new System.Drawing.Size(140, 521); this.tv.TabIndex = 1; diff --git a/TEMUKJD/KJDForms/ProductForms/ProductForm.cs b/TEMUKJD/KJDForms/ProductForms/ProductForm.cs index a2c9fc0..35e741a 100644 --- a/TEMUKJD/KJDForms/ProductForms/ProductForm.cs +++ b/TEMUKJD/KJDForms/ProductForms/ProductForm.cs @@ -29,6 +29,9 @@ namespace TemuKJD.KJDForms.ProductForms public Lazy temuAdsForm = new Lazy(); public Lazy joinDeliveryFrom = new Lazy(); + public Lazy productSelectListManageForm = new Lazy(); + public Lazy productThirdSelectListManageForm = new Lazy(); + public ProductForm() { InitializeComponent(); @@ -75,40 +78,49 @@ namespace TemuKJD.KJDForms.ProductForms //如果是一级菜单,不做任何动作 if (e.Node.Parent == null) return; - new Thread(() => + //new Thread(() => + //{ + //Thread.Sleep(200); + //Invoke(new Action(() => + //{ + switch (e.Node.Name) { - Thread.Sleep(200); - Invoke(new Action(() => - { - switch (e.Node.Name) - { - case "备货管理": - SetForm(saleStockUpForm.Value); - break; - case "调价管理": - SetForm(priceManageForm.Value); - break; - case "活动报名": - SetForm(marketingActivityForm.Value); - break; - case "推广直通车": - SetForm(temuAdsForm.Value); - break; - case "加入发货台": - SetForm(joinDeliveryFrom.Value); - break; - case "设置进货价": - SetForm(purchasePriceForm.Value); - break; - case "商品认领": - SetForm(userSelectDbProductForm.Value); - break; - case "库存上传": - SetForm(userSelectThirdProductForm.Value); - break; - } - })); - }).Start(); + case "备货管理": + SetForm(saleStockUpForm.Value); + break; + case "调价管理": + SetForm(priceManageForm.Value); + break; + case "活动报名": + SetForm(marketingActivityForm.Value); + break; + case "推广直通车": + SetForm(temuAdsForm.Value); + break; + case "加入发货台": + SetForm(joinDeliveryFrom.Value); + break; + case "设置进货价": + SetForm(purchasePriceForm.Value); + break; + case "商品认领": + SetForm(userSelectDbProductForm.Value); + break; + case "库存记录": + SetForm(userSelectThirdProductForm.Value); + break; + + case "商品上传": + productSelectListManageForm.Value.ClientMode = DbProductSelectListManageForm.EnumClientMode.Client; + SetForm(productSelectListManageForm.Value); + break; + case "库存上传": + productThirdSelectListManageForm.Value.ClientMode = ProductThirdSelectListManageForm.EnumClientMode.Client; + SetForm(productThirdSelectListManageForm.Value); + break; + } + //})); + //}).Start(); } public void SetTvSelect(string name) diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs index 19517c5..c172de9 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs @@ -34,7 +34,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms { public partial class DbProductSelectListManageForm : LRBaseForm { - public bool IsClientJit { get; set; } = false; + public enum EnumClientMode + { + Admin, + Client, + ClientJit, + } + + public EnumClientMode ClientMode { get; set; } = EnumClientMode.Admin; public CancellationTokenSource cancellationTokenSource { get; set; } = null; List skuRandomLetterArr = new List { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" }; @@ -154,7 +161,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms //ucSplitPage1.cmbPageSize.Items.Remove("1000"); } - if (BaseClass.SaLevel == 1 && !IsClientJit) + if (BaseClass.SaLevel == 1 && ClientMode == EnumClientMode.Admin) { dgvSelectProduct.Columns["colSubSaNick"].Visible = true; chkShowDel.Visible = true; @@ -168,7 +175,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms //chkSkuRandomPrice.Checked = true; } - if (IsClientJit) + if (ClientMode != EnumClientMode.Admin) { chkShowDel.Visible = true; btnReFission.Visible = true; @@ -210,7 +217,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms } else { - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) { foreach (DataGridViewRow row in dgvSelectProduct.Rows) { @@ -330,7 +337,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms dgvSelectProduct.Rows[rowIndex].Height = 60; displayLoginStatusColor(dgvSelectProduct.Rows[rowIndex].Cells["colLogin"], dgvSelectProduct.Rows[rowIndex].Cells["colLogin"].Value.ParseToString()); - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) { var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == prodSelect.shop_id); if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date) @@ -358,6 +365,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms pageCount = 1; var url = BaseClass.BuildObjString("product/admin_get_user_select_product_list"); + if (ClientMode != EnumClientMode.Admin) + url = BaseClass.BuildObjString("product/get_user_select_product_list"); + var data = ""; Invoke(new Action(() => { @@ -378,8 +388,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms data += "&operate_sub_sa_name=" + BaseClass.UserName; if (chkNoSubSa.Checked) data += "&no_sub_sa=true"; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) data += "&is_client_jit=true"; + if (ClientMode != EnumClientMode.Admin) + { + string shopIds = string.Join(",", GlobalConfig.ShopLoginList.Where(s => !s.ShopId.IsNullOrEmpty()).Select(s => s.ShopId).Distinct()) ?? "default"; + data += "&shop_ids=" + shopIds; + } })); var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -440,7 +455,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString(); var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString(); - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) { var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date) @@ -463,7 +478,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms break; case "编辑备注": DbProductSelectEditNotesForm editForm = new DbProductSelectEditNotesForm(dbSelectProduct); - editForm.IsClientJit = this.IsClientJit; + editForm.IsClientJit = (ClientMode == EnumClientMode.ClientJit); editForm.ShowDialog(); dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes; dgvSelectProduct.Rows[e.RowIndex].Cells["colUserNotes"].Value = dbSelectProduct.user_notes; @@ -483,7 +498,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms // 查看map映射列表 var url = BaseClass.BuildObjString("product/get_select_prod_db_id_map_draft_id_list"); var data = UserLogin.GetSignaturex() + "&select_db_id=" + dbId; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) data += "&is_client_jit=true"; var html = GetHtml.PostUtf8(url, data); @@ -522,7 +537,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms if (flag) { - if (!IsClientJit) + if (ClientMode == EnumClientMode.Admin) { var shop = GetShop(shopId); AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); @@ -550,7 +565,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms case "进店": { var shop = GetShop(shopId); - if (!IsClientJit) + if (ClientMode == EnumClientMode.Admin) { AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft"; @@ -574,7 +589,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms { var shop = GetShop(shopId); // 登录店铺 - if (!IsClientJit) + if (ClientMode == EnumClientMode.Admin) { AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop); shopLoginForm.openType = EnumOpenType.login; @@ -673,7 +688,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms var url = BaseClass.BuildObjString("product/del_select_product"); var data = UserLogin.GetSignaturex() + "&db_id=" + dbId; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) data += "&is_client_jit=true"; var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -696,11 +711,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms ShopLoginInfo GetShop(string shopId) { ShopLoginInfo shop; - if (IsClientJit) - { - shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); - } - else + if (ClientMode == EnumClientMode.Admin) { shop = shopLst.FirstOrDefault(s => s.ShopId == shopId); if (shop == null) @@ -708,6 +719,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms shop = AdminGetServerShop(shopId); } } + else + { + shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + } if (shop == null) { shop = new ShopLoginInfo() { ShopId = shopId }; @@ -867,7 +882,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms var empty_data = UserLogin.GetSignaturex() + "&db_id=" + prod.id + "&status=已清除"; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) empty_data += "&is_client_jit=true"; GetHtml.PostUtf8(empty_url, empty_data); } @@ -890,7 +905,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms if (result.Contains("登录过期") || result.Contains("Invalid Login State")) { - if (!IsClientJit) + if (ClientMode == EnumClientMode.Admin) AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false); else ShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false); @@ -929,7 +944,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms "&up_spu_id=" + prod.spu_id + "&shop_id=" + prod.shop_id + "&status=" + prod.status; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) data += "&is_client_jit=true"; var html = GetHtml.PostUtf8(url, data); @@ -3375,7 +3390,7 @@ Content-Disposition: form-data; name=""sign"" var empty_data = UserLogin.GetSignaturex() + "&db_id=" + prod.id + "&status=已清除"; - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) empty_data += "&is_client_jit=true"; GetHtml.PostUtf8(empty_url, empty_data); } @@ -3397,7 +3412,7 @@ Content-Disposition: form-data; name=""sign"" var data = UserLogin.GetSignaturex() + "&db_id=" + prod.id; data += "&fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName.Trim()); - if (IsClientJit) + if (ClientMode == EnumClientMode.ClientJit) data += "&is_client_jit=true"; var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -3641,7 +3656,7 @@ Content-Disposition: form-data; name=""sign"" case "已上传商品ID": { var shop = GetShop(shopId); - if (!IsClientJit) + if (ClientMode == EnumClientMode.Admin) { AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs index 3f3d130..fcac091 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs @@ -110,7 +110,7 @@ this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.txtProdName = new System.Windows.Forms.TextBox(); - this.label12 = new System.Windows.Forms.Label(); + this.lblUserNotes = new System.Windows.Forms.Label(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.panel2 = new System.Windows.Forms.Panel(); @@ -1035,7 +1035,7 @@ this.tableLayoutPanel1.Controls.Add(this.label3, 10, 0); this.tableLayoutPanel1.Controls.Add(this.label4, 12, 0); this.tableLayoutPanel1.Controls.Add(this.txtProdName, 11, 0); - this.tableLayoutPanel1.Controls.Add(this.label12, 18, 0); + this.tableLayoutPanel1.Controls.Add(this.lblUserNotes, 18, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(2, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; @@ -1254,16 +1254,16 @@ this.txtProdName.Size = new System.Drawing.Size(61, 23); this.txtProdName.TabIndex = 427; // - // label12 + // lblUserNotes // - this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(952, 12); - this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(56, 17); - this.label12.TabIndex = 460; - this.label12.Text = "用户备注"; + this.lblUserNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.lblUserNotes.AutoSize = true; + this.lblUserNotes.Location = new System.Drawing.Point(952, 12); + this.lblUserNotes.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.lblUserNotes.Name = "lblUserNotes"; + this.lblUserNotes.Size = new System.Drawing.Size(56, 17); + this.lblUserNotes.TabIndex = 460; + this.lblUserNotes.Text = "用户备注"; // // splitContainer2 // @@ -1809,7 +1809,7 @@ private System.Windows.Forms.NumericUpDown numSkuRandomPrice; private System.Windows.Forms.Label label11; private UserComponent.UcCheckBox chkUploadProd; - private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label lblUserNotes; private System.Windows.Forms.Label label13; private System.Windows.Forms.ComboBox cmbUserNotes; private System.Windows.Forms.ComboBox cmbNotes; diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs index e44f44b..ba41760 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs @@ -36,6 +36,15 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms /// public partial class ProductThirdSelectListManageForm : LRBaseForm { + public enum EnumClientMode + { + Admin, + Client, + ClientJit, + } + + public EnumClientMode ClientMode { get; set; } = EnumClientMode.Admin; + public CancellationTokenSource cancellationTokenSource { get; set; } = null; List skuRandomLetterArr = new List { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" }; @@ -80,6 +89,34 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms ucSplitPage1.IsShowPageSize = true; // 可调整分页 tableLayoutPanel1.Width -= 86; } + + if (ClientMode != EnumClientMode.Admin) + { + chkShowDel.Visible = true; + pbFissionSetting.Visible = true; + btnReFission.Visible = true; + cmbUserNotes.Visible = false; + lblUserNotes.Visible = false; + colUserNotes.Visible = false; + ucSplitPage1.IsShowPageSize = true; + var columnStyles = tableLayoutPanel1.ColumnStyles.Cast().ToList(); + columnStyles[columnStyles.Count - 1].SizeType = SizeType.Absolute; + columnStyles[columnStyles.Count - 1].Width = 0; + columnStyles[columnStyles.Count - 2].SizeType = SizeType.Absolute; + columnStyles[columnStyles.Count - 2].Width = 0; + int colsWidth = 0; + foreach (DataGridViewColumn col in dgvSelectProduct.Columns) + { + if (col.Visible) + { + colsWidth += col.Width; + } + } + if (dgvSelectProduct.Width - colsWidth - dgvSelectProduct.RowHeadersWidth > 0) + { + colOpResult.Width += dgvSelectProduct.Width - colsWidth - dgvSelectProduct.RowHeadersWidth; + } + } } bool isFirst = true; @@ -249,6 +286,9 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms pageCount = 1; var url = BaseClass.BuildObjString("product_third/admin_get_user_select_product_list"); + if (ClientMode != EnumClientMode.Admin) + url = BaseClass.BuildObjString("product_third/get_user_select_product_list"); + var data = ""; Invoke(new Action(() => { @@ -269,6 +309,11 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms data += "&operate_sub_sa_name=" + BaseClass.UserName; if (chkNoSubSa.Checked) data += "&no_sub_sa=true"; + if (ClientMode != EnumClientMode.Admin) + { + string shopIds = string.Join(",", GlobalConfig.ShopLoginList.Where(s => !s.ShopId.IsNullOrEmpty()).Select(s => s.ShopId).Distinct()) ?? "default"; + data += "&shop_ids=" + shopIds; + } })); var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -405,35 +450,70 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms if (flag) { var shop = GetShop(shopId); - AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); - //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + - adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + - draftId + "&from=productDraftList"; - adminLoginForm.openType = EnumOpenType.manage; - adminLoginForm.WindowState = FormWindowState.Maximized; - adminLoginForm.ShowDialog(); + if (ClientMode == EnumClientMode.Admin) + { + AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + + draftId + "&from=productDraftList"; + adminLoginForm.openType = EnumOpenType.manage; + adminLoginForm.WindowState = FormWindowState.Maximized; + adminLoginForm.ShowDialog(); + } + else + { + ShopLoginForm loginForm = new ShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + loginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + + draftId + "&from=productDraftList"; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.ShowDialog(); + } } } break; case "进店": { var shop = GetShop(shopId); - AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); - //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft"; - adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft"; - adminLoginForm.openType = EnumOpenType.manage; - adminLoginForm.WindowState = FormWindowState.Maximized; - adminLoginForm.ShowDialog(); + if (ClientMode == EnumClientMode.Admin) + { + AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft"; + adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft"; + adminLoginForm.openType = EnumOpenType.manage; + adminLoginForm.WindowState = FormWindowState.Maximized; + adminLoginForm.ShowDialog(); + } + else + { + ShopLoginForm loginForm = new ShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft"; + loginForm.InitUrl = "https://agentseller.temu.com/goods/draft"; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.ShowDialog(); + } } break; case "登录": { var shop = GetShop(shopId); // 登录店铺 - AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.login; - shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete; - shopLoginForm.ShowDialog(); + if (ClientMode == EnumClientMode.Admin) + { + AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete; + shopLoginForm.ShowDialog(); + } + else + { + ShopLoginForm shopLoginForm = new ShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete; + shopLoginForm.ShowDialog(); + } foreach (DataGridViewRow row in this.dgvSelectProduct.Rows) { if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId) @@ -552,17 +632,25 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms ShopLoginInfo GetShop(string shopId) { - var shop = shopLst.FirstOrDefault(s => s.ShopId == shopId); - if (shop == null) + ShopLoginInfo shop; + if (ClientMode == EnumClientMode.Admin) { - shop = GetServerShopById(shopId); + shop = shopLst.FirstOrDefault(s => s.ShopId == shopId); if (shop == null) { - shop = new ShopLoginInfo() { ShopId = shopId }; - shop.LoginStatus = "不存在"; + shop = GetServerShopById(shopId); } - shopLst.Add(shop); } + else + { + shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + } + if (shop == null) + { + shop = new ShopLoginInfo() { ShopId = shopId }; + shop.LoginStatus = "不存在"; + } + shopLst.Add(shop); return shop; } @@ -732,7 +820,10 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms if (result.Contains("登录过期") || result.Contains("Invalid Login State")) { - AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false); + if (ClientMode == EnumClientMode.Admin) + AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false); + else + ShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false); } } catch (Exception ex) @@ -2041,13 +2132,26 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms case "已上传商品ID": { var shop = GetShop(shopId); - AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); - //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + - adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + - draftId + "&from=productDraftList"; - adminLoginForm.openType = EnumOpenType.manage; - adminLoginForm.WindowState = FormWindowState.Maximized; - adminLoginForm.ShowDialog(); + if (ClientMode == EnumClientMode.Admin) + { + AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + + draftId + "&from=productDraftList"; + adminLoginForm.openType = EnumOpenType.manage; + adminLoginForm.WindowState = FormWindowState.Maximized; + adminLoginForm.ShowDialog(); + } + else + { + ShopLoginForm loginForm = new ShopLoginForm(shop); + //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + loginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" + + draftId + "&from=productDraftList"; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.ShowDialog(); + } } break; default: diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.Designer.cs index 73ed75d..373784e 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.Designer.cs @@ -34,6 +34,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdEditDetailForm)); this.panel2 = new System.Windows.Forms.Panel(); + this.pnlCef = new System.Windows.Forms.Panel(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); @@ -47,6 +48,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.label2 = new System.Windows.Forms.Label(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.ucPddSpecEdit2 = new TemuKJD.PDDForms.ProductSelectForms.UcPddSpecEdit(); + this.panel4 = new System.Windows.Forms.Panel(); this.label3 = new System.Windows.Forms.Label(); this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); this.cmbSpec1 = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); @@ -70,10 +72,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colSkuImg = new System.Windows.Forms.DataGridViewImageColumn(); this.colEditSkuImg = new System.Windows.Forms.DataGridViewLinkColumn(); this.colSkuSn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.panel5 = new System.Windows.Forms.Panel(); this.btnRestoreAll = new DevComponents.DotNetBar.PanelEx(); this.btnCancel = new DevComponents.DotNetBar.PanelEx(); this.btnSaveSkuLst = new DevComponents.DotNetBar.PanelEx(); - this.pnlCef = new System.Windows.Forms.Panel(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -85,6 +87,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.flowLayoutPanel1.SuspendLayout(); this.pnlSpec2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); + this.panel4.SuspendLayout(); this.flowLayoutPanel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvDbProduct)).BeginInit(); @@ -99,14 +102,21 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(1, 33); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1278, 666); + this.panel2.Size = new System.Drawing.Size(1278, 686); this.panel2.TabIndex = 1; // + // pnlCef + // + this.pnlCef.Location = new System.Drawing.Point(5, 7); + this.pnlCef.Name = "pnlCef"; + this.pnlCef.Size = new System.Drawing.Size(78, 49); + this.pnlCef.TabIndex = 9; + // // pbLoading // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(614, 6); + this.pbLoading.Location = new System.Drawing.Point(614, 16); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -118,7 +128,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this.splitContainer1.Location = new System.Drawing.Point(0, 62); + this.splitContainer1.Location = new System.Drawing.Point(0, 82); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; // @@ -142,9 +152,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.flowLayoutPanel3.Controls.Add(this.flowLayoutPanel1); this.flowLayoutPanel3.Controls.Add(this.pnlSpec2); this.flowLayoutPanel3.Controls.Add(this.flowLayoutPanel2); - this.flowLayoutPanel3.Controls.Add(this.label3); + this.flowLayoutPanel3.Controls.Add(this.panel4); this.flowLayoutPanel3.Controls.Add(this.flowLayoutPanel4); this.flowLayoutPanel3.Controls.Add(this.dgvDbProduct); + this.flowLayoutPanel3.Controls.Add(this.panel5); this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 0); @@ -158,8 +169,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pnlSpec1.Controls.Add(this.btnAddSpec1); this.pnlSpec1.Controls.Add(this.label1); this.pnlSpec1.Location = new System.Drawing.Point(3, 3); + this.pnlSpec1.MinimumSize = new System.Drawing.Size(1250, 10); this.pnlSpec1.Name = "pnlSpec1"; - this.pnlSpec1.Size = new System.Drawing.Size(204, 23); + this.pnlSpec1.Size = new System.Drawing.Size(1250, 23); this.pnlSpec1.TabIndex = 11; // // btnAddSpec1 @@ -203,12 +215,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.flowLayoutPanel1.AutoSize = true; this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.flowLayoutPanel1.Controls.Add(this.ucPddSpecEdit1); - this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 29); + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 29); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); this.flowLayoutPanel1.MaximumSize = new System.Drawing.Size(1240, 9999); - this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(1240, 10); + this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(1250, 10); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1240, 55); + this.flowLayoutPanel1.Size = new System.Drawing.Size(1250, 55); this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.Tag = ""; // @@ -227,8 +239,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pnlSpec2.Controls.Add(this.btnAddSpec2); this.pnlSpec2.Controls.Add(this.label2); this.pnlSpec2.Location = new System.Drawing.Point(3, 90); + this.pnlSpec2.MinimumSize = new System.Drawing.Size(1250, 10); this.pnlSpec2.Name = "pnlSpec2"; - this.pnlSpec2.Size = new System.Drawing.Size(204, 23); + this.pnlSpec2.Size = new System.Drawing.Size(1250, 23); this.pnlSpec2.TabIndex = 12; // // btnAddSpec2 @@ -272,12 +285,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.flowLayoutPanel2.AutoSize = true; this.flowLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.flowLayoutPanel2.Controls.Add(this.ucPddSpecEdit2); - this.flowLayoutPanel2.Location = new System.Drawing.Point(4, 116); + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 116); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); this.flowLayoutPanel2.MaximumSize = new System.Drawing.Size(1240, 9999); - this.flowLayoutPanel2.MinimumSize = new System.Drawing.Size(1240, 10); + this.flowLayoutPanel2.MinimumSize = new System.Drawing.Size(1250, 10); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(1240, 55); + this.flowLayoutPanel2.Size = new System.Drawing.Size(1250, 55); this.flowLayoutPanel2.TabIndex = 1; // // ucPddSpecEdit2 @@ -290,10 +303,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.ucPddSpecEdit2.Size = new System.Drawing.Size(295, 49); this.ucPddSpecEdit2.TabIndex = 0; // + // panel4 + // + this.panel4.Controls.Add(this.label3); + this.panel4.Location = new System.Drawing.Point(3, 177); + this.panel4.MinimumSize = new System.Drawing.Size(1250, 10); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(1250, 23); + this.panel4.TabIndex = 14; + // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(5, 179); + this.label3.Location = new System.Drawing.Point(1, 3); this.label3.Margin = new System.Windows.Forms.Padding(5, 5, 3, 3); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(68, 17); @@ -305,9 +327,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.flowLayoutPanel4.Controls.Add(this.cmbSpec1); this.flowLayoutPanel4.Controls.Add(this.cmbSpec2); this.flowLayoutPanel4.Controls.Add(this.panel3); - this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 202); + this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 203); + this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); + this.flowLayoutPanel4.MinimumSize = new System.Drawing.Size(1250, 10); this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(1242, 31); + this.flowLayoutPanel4.Size = new System.Drawing.Size(1250, 31); this.flowLayoutPanel4.TabIndex = 13; // // cmbSpec1 @@ -454,11 +478,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colSkuImg, this.colEditSkuImg, this.colSkuSn}); - this.dgvDbProduct.Location = new System.Drawing.Point(5, 239); - this.dgvDbProduct.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3); + this.dgvDbProduct.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dgvDbProduct.Location = new System.Drawing.Point(5, 237); + this.dgvDbProduct.Margin = new System.Windows.Forms.Padding(5, 0, 3, 3); this.dgvDbProduct.Name = "dgvDbProduct"; this.dgvDbProduct.RowTemplate.Height = 23; - this.dgvDbProduct.Size = new System.Drawing.Size(1230, 586); + this.dgvDbProduct.Size = new System.Drawing.Size(1230, 600); this.dgvDbProduct.TabIndex = 7; this.dgvDbProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick); this.dgvDbProduct.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellValueChanged); @@ -535,6 +560,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colSkuSn.Name = "colSkuSn"; this.colSkuSn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // + // panel5 + // + this.panel5.Location = new System.Drawing.Point(3, 843); + this.panel5.MinimumSize = new System.Drawing.Size(1250, 10); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(1250, 10); + this.panel5.TabIndex = 15; + // // btnRestoreAll // this.btnRestoreAll.CanvasColor = System.Drawing.SystemColors.Control; @@ -609,17 +642,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSaveSkuLst.Text = "保存"; this.btnSaveSkuLst.Click += new System.EventHandler(this.btnSaveSkuLst_Click); // - // pnlCef - // - this.pnlCef.Location = new System.Drawing.Point(5, 7); - this.pnlCef.Name = "pnlCef"; - this.pnlCef.Size = new System.Drawing.Size(78, 49); - this.pnlCef.TabIndex = 9; - // // PDDDBProdEditDetailForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(1280, 700); + this.ClientSize = new System.Drawing.Size(1280, 720); this.Controls.Add(this.panel2); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -644,6 +670,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pnlSpec2.PerformLayout(); this.flowLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.PerformLayout(); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); this.flowLayoutPanel4.ResumeLayout(false); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); @@ -695,5 +723,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.DataGridViewTextBoxColumn colSkuSn; private DevComponents.DotNetBar.PanelEx btnRestoreAll; private System.Windows.Forms.Panel pnlCef; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Panel panel5; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs index 81f86a9..b7217bf 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs @@ -46,7 +46,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pbLoading.BringToFront(); this.pbLoading.Location = new Point(this.pbLoading.Location.X, 300); - this.ActiveControl = dgvDbProduct; + this.ActiveControl = btnAddSpec1; // dgvDbProduct; this.dgvDbProduct.AddImgColumn("colSkuImg", "colSkuImgUrl"); flowLayoutPanel1.Controls.Clear(); flowLayoutPanel2.Controls.Clear(); @@ -351,6 +351,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms return; var newSpec1 = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(spec)); + // 防止spec名称重复 + while (lstSkuEditItem.Any(s => s.spec.Any(sp => sp.spec_name == newSpec1.parent_name + this.addSpecIndex1))) + this.addSpecIndex1++; newSpec1.spec_id = null; newSpec1.spec_name = newSpec1.parent_name + this.addSpecIndex1; AddSpec1(newSpec1); @@ -377,6 +380,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms newSku.price = null; newSku.thumb_url = null; newSku.thumb_url_file_id = null; + newSku.thumb_md5 = null; newSku.multi_price = null; newSku.out_sku_sn = ""; if (this.lstSkuEditItem.All(s => s.spec.Count == 1)) @@ -396,6 +400,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms return; var newSpec2 = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(spec)); + // 防止spec名称重复 + while (lstSkuEditItem.Any(s => s.spec.Any(sp => sp.spec_name == newSpec2.parent_name + this.addSpecIndex1))) + this.addSpecIndex1++; newSpec2.spec_id = null; newSpec2.spec_name = newSpec2.parent_name + this.addSpecIndex2; AddSpec2(newSpec2); @@ -698,6 +705,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms private void btnSaveSkuLst_Click(object sender, EventArgs e) { + // 焦点移动到别的控件上自动更新表格内的数值 + this.ActiveControl = btnSaveSkuLst; + if (this.lstSkuEditItem.Any(s => s.multi_price.ParseToDecimal() == 0 || s.price.ParseToDecimal() == 0)) { BaseMsgForm.ShowError("价格不能为 0"); @@ -708,6 +718,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms BaseMsgForm.ShowError("单买价低于拼单价加 1 元"); return; } + if (this.lstSkuEditItem.Any(s => s.thumb_url.IsNullOrEmpty() && s.thumb_md5.IsNullOrEmpty())) + { + BaseMsgForm.ShowError("sku图片不能为空"); + return; + } var url = BaseClass.BuildObjString("product/mdy_db_product"); var data = UserLogin.GetSignaturex() + diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.Designer.cs index 2b4223c..527a43b 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.Designer.cs @@ -53,7 +53,6 @@ this.label8 = new System.Windows.Forms.Label(); this.txtNotes = new DevComponents.DotNetBar.Controls.TextBoxX(); this.btnOk = new TemuKJD.UserControls.ButtonEx(); - this.btnTest = new DevComponents.DotNetBar.PanelEx(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -62,7 +61,6 @@ // panel2 // this.panel2.BackColor = System.Drawing.Color.White; - this.panel2.Controls.Add(this.btnTest); this.panel2.Controls.Add(this.btnEditDetail); this.panel2.Controls.Add(this.btnSelect); this.panel2.Controls.Add(this.buttonEx1); @@ -371,30 +369,6 @@ this.btnOk.UseVisualStyleBackColor = false; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); // - // btnTest - // - this.btnTest.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnTest.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnTest.DisabledBackColor = System.Drawing.Color.Empty; - this.btnTest.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnTest.Location = new System.Drawing.Point(317, 18); - this.btnTest.Name = "btnTest"; - this.btnTest.Size = new System.Drawing.Size(85, 26); - this.btnTest.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnTest.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTest.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTest.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnTest.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnTest.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnTest.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnTest.Style.GradientAngle = 90; - this.btnTest.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnTest.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnTest.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnTest.TabIndex = 654; - this.btnTest.Text = "测试"; - this.btnTest.Click += new System.EventHandler(this.btnTest_Click); - // // PDDDBProdEditForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -441,6 +415,5 @@ private UserControls.ButtonEx buttonEx1; private UserControls.ButtonEx btnSelect; private DevComponents.DotNetBar.PanelEx btnEditDetail; - private DevComponents.DotNetBar.PanelEx btnTest; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.cs index 1fcbbf4..efba97b 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditForm.cs @@ -234,48 +234,5 @@ namespace TemuKJD.PDDForms.ProductSelectForms PDDDBProdEditDetailForm editDetailForm = new PDDDBProdEditDetailForm(this.dbProd); editDetailForm.ShowDialog(); } - - private void btnTest_Click(object sender, EventArgs e) - { - string text = ""; - OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.Multiselect = false; - // 设置过滤条件,只显示文本文件 - openFileDialog.Filter = "图片文件 (*.jpeg;*.jpg;*.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*"; - // 显示对话框并获取结果 - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - try - { - string filePath = openFileDialog.FileName; - //using (Image image = Image.FromFile(filePath)) - //{ - // // 现在你可以使用image对象进行各种操作,比如绘制、保存等 - // //Console.WriteLine("Image loaded successfully."); - // this.pictureBox2.Image = image; - //} - Image image = Image.FromFile(filePath); - this.pictureBox2.Image = image; - - string imgBase64 = ""; - using (MemoryStream memoryStream = new MemoryStream()) - { - image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png); - byte[] imageBytes = memoryStream.ToArray(); - imgBase64 = Convert.ToBase64String(imageBytes); - //imgBase64 = Convert.ToBase64String(imageBytes, Base64FormattingOptions.InsertLineBreaks); - } - string img_md5 = BaseClass.GetMd5(imgBase64); - - - } - catch (Exception ex) - { - //Console.WriteLine("An error occurred: " + ex.Message); - BaseMsgForm.ShowError("打开自定义图片失败 " + ex.Message); - return; - } - } - } } } diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs index 7c00ef7..aa3b268 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs @@ -1,5 +1,6 @@ using AllBase; using AllBase.Helper; +using AllBase.Model.Param.PDDProdParam; using AllBase.Model.Result; using AllBase.Model.Result.PDDResult; using NaiBa.Util.Extension; @@ -182,7 +183,21 @@ namespace TemuKJD.PDDForms.ShopForms OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); return; } - if (decoration == null) + //if (decoration != null && decoration_json.ParseToString().Length < 20) + //{ + // try + // { + // var prod_detail_decoration_rst = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId); + // } + // catch (Exception ex) + // { + // OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); + // return; + // } + //} + + + if (decoration == null || decoration_json.ParseToString().Length < 20) { OnInfoReceived("商品获取失败!商品详情图获取失败!"); return; @@ -607,6 +622,68 @@ namespace TemuKJD.PDDForms.ShopForms } return result; } + + + private string GetPddProdOnShopDetail(ShopLoginInfo shop, string prodId, string commitId) + { + var anti = shop.AntiContents.LastOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail"; //获取详情图 + //string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/detail"; + //string body = @"{""goods_id"":" + prodId + "}"; + string body = @"{""goods_commit_id"":""" + commitId + @""",""goods_id"":""" + prodId + @"""}"; + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit"; + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(300, 500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + /// + /// 保存商品详情图装修列表 + /// gorse/mms/goods/decoration/commit/save + /// + /// + /// + /// + /// + /// + private string save_decoration(ShopLoginInfo shop, PDDProdDecorationCommitParam decoration, string goodsId, string commitId) + { + var anti = shop.AntiContents.LastOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + string url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/save"; + string body = @"{""goods_id"":" + goodsId + "}"; + body = JsonHelper.SerializeObject(decoration); + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + goodsId + "&type=edit"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(300, 500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + private string GetPddProdSizeSpec(ShopLoginInfo shop, string prodId, string commitId, string sizeSpecId) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); @@ -658,6 +735,7 @@ namespace TemuKJD.PDDForms.ShopForms if (shop.AntiContents.Count > 0) anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; string url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/query/V2"; + url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/query/V2"; string body = @"{""goods_commit_id"":" + commitId + @",""goods_id"":" + prodId + @"}"; string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit"; var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);