From 73f9fcd8bce56b91c5935ff54f72c4166c594463 Mon Sep 17 00:00:00 2001 From: wule Date: Wed, 22 Oct 2025 17:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=E5=B7=A5=E5=85=B7=E8=BF=9B?= =?UTF-8?q?=E4=B8=80=E6=AD=A5=E4=BC=98=E5=8C=96=E5=B9=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 2 +- .../PDDCouponResult/PDDCouponGoodsListInfo.cs | 6 + TEMUKJD/KJD.csproj | 9 + .../DbProductSelectListManageForm.Designer.cs | 32 +- ...ActivityToolShouJianLiJianForm.Designer.cs | 1099 ++++++++++++++++ .../PDDProdActivityToolShouJianLiJianForm.cs | 1135 +++++++++++++++++ ...PDDProdActivityToolShouJianLiJianForm.resx | 198 +++ ...tivityToolXianShiXianLiangForm.Designer.cs | 108 +- ...PDDProdActivityToolXianShiXianLiangForm.cs | 450 ++++++- ...DProdActivityToolXianShiXianLiangForm.resx | 6 + .../CouponForms/PDDProdCouponForm.cs | 5 + .../PDDProdCouponJingXiForm.Designer.cs | 290 +++-- .../CouponForms/PDDProdCouponJingXiForm.cs | 408 +++++- .../CouponForms/PDDProdCouponJingXiForm.resx | 3 + ...ProdCouponLingQuanZhongXinForm.Designer.cs | 334 ++--- .../PDDProdCouponLingQuanZhongXinForm.cs | 360 +++++- .../PDDProdCouponLingQuanZhongXinForm.resx | 3 + ...DDProdCouponShangPinLiJianForm.Designer.cs | 334 ++--- .../PDDProdCouponShangPinLiJianForm.cs | 359 +++++- .../PDDProdCouponShangPinLiJianForm.resx | 3 + 20 files changed, 4597 insertions(+), 547 deletions(-) create mode 100644 TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.Designer.cs create mode 100644 TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.cs create mode 100644 TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.resx diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 5bb2ab9..fc7224e 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 638; + public static int VersionCount = 650; //public static int VersionCount = 613; /// diff --git a/AllBase/Model/Result/PDDResult/PDDCouponResult/PDDCouponGoodsListInfo.cs b/AllBase/Model/Result/PDDResult/PDDCouponResult/PDDCouponGoodsListInfo.cs index 27cb0bd..bc7dc98 100644 --- a/AllBase/Model/Result/PDDResult/PDDCouponResult/PDDCouponGoodsListInfo.cs +++ b/AllBase/Model/Result/PDDResult/PDDCouponResult/PDDCouponGoodsListInfo.cs @@ -33,6 +33,7 @@ namespace AllBase.Model.Result.PDDResult public string thumb_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-10-11/53d910624aa2976ce40a6f86ee7c152d.jpeg", public bool? is_filtered { get; set; } // false, 如果是true则不能设置优惠券 public string filtered_reason { get; set; } // "该商品已售罄" + public extension_info extension { get; set; } public int? filtered_reason_type { get; set; } // 0, public bool? is_selected { get; set; } // false, public int? recommend_coupon_value { get; set; } // 300, @@ -45,6 +46,11 @@ namespace AllBase.Model.Result.PDDResult public string shopName { get; set; } } + public class extension_info + { + public string hasInstallmentDeliverySku { get; set; } + } + public class recommend_coupon_value_info { public int? recommend_coupon_value { get; set; } // 1100, diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index eff5c5e..bd897df 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -441,6 +441,12 @@ SystemRemoveRestrictionsForm.cs + + Form + + + PDDProdActivityToolShouJianLiJianForm.cs + Form @@ -954,6 +960,9 @@ SystemRemoveRestrictionsForm.cs + + PDDProdActivityToolShouJianLiJianForm.cs + PDDProdCouponForm.cs diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs index d343bfa..88feb28 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs @@ -39,6 +39,7 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.chkLongTitle = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkSameExtcodeRandomMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components); this.lblSkuRandomLetterNotes = new System.Windows.Forms.Label(); this.btnAdd = new DevComponents.DotNetBar.PanelEx(); @@ -145,7 +146,6 @@ this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.chkLongTitle = new TemuKJD.UserComponent.UcCheckBox(this.components); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -224,6 +224,18 @@ this.splitContainer1.SplitterDistance = 100; this.splitContainer1.TabIndex = 2; // + // chkLongTitle + // + this.chkLongTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.chkLongTitle.AutoSize = true; + this.chkLongTitle.Location = new System.Drawing.Point(1276, 71); + this.chkLongTitle.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.chkLongTitle.Name = "chkLongTitle"; + this.chkLongTitle.Size = new System.Drawing.Size(96, 21); + this.chkLongTitle.TabIndex = 660; + this.chkLongTitle.Text = "500字长标题"; + this.chkLongTitle.UseVisualStyleBackColor = true; + // // chkSameExtcodeRandomMainImg // this.chkSameExtcodeRandomMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -820,7 +832,7 @@ "核价成功", "核价成功(重复)", "重复"}); - this.cmbNotes.Location = new System.Drawing.Point(917, 5); + this.cmbNotes.Location = new System.Drawing.Point(917, 8); this.cmbNotes.Margin = new System.Windows.Forms.Padding(0); this.cmbNotes.Name = "cmbNotes"; this.cmbNotes.Size = new System.Drawing.Size(65, 25); @@ -845,7 +857,7 @@ "已上传", "草稿箱", "全部"}); - this.cmbStatus.Location = new System.Drawing.Point(814, 5); + this.cmbStatus.Location = new System.Drawing.Point(814, 8); this.cmbStatus.Margin = new System.Windows.Forms.Padding(0); this.cmbStatus.Name = "cmbStatus"; this.cmbStatus.Size = new System.Drawing.Size(65, 25); @@ -1212,7 +1224,7 @@ "全部", "重上", "已买"}); - this.cmbUserNotes.Location = new System.Drawing.Point(1044, 5); + this.cmbUserNotes.Location = new System.Drawing.Point(1044, 8); this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0); this.cmbUserNotes.Name = "cmbUserNotes"; this.cmbUserNotes.Size = new System.Drawing.Size(65, 25); @@ -1685,18 +1697,6 @@ this.statusBar.Size = new System.Drawing.Size(1558, 25); this.statusBar.TabIndex = 5; // - // chkLongTitle - // - this.chkLongTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.chkLongTitle.AutoSize = true; - this.chkLongTitle.Location = new System.Drawing.Point(1276, 71); - this.chkLongTitle.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); - this.chkLongTitle.Name = "chkLongTitle"; - this.chkLongTitle.Size = new System.Drawing.Size(96, 21); - this.chkLongTitle.TabIndex = 660; - this.chkLongTitle.Text = "500字长标题"; - this.chkLongTitle.UseVisualStyleBackColor = true; - // // DbProductSelectListManageForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.Designer.cs new file mode 100644 index 0000000..c273206 --- /dev/null +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.Designer.cs @@ -0,0 +1,1099 @@ + +namespace TemuKJD.PDDForms.ProductForms.CouponForms +{ + partial class PDDProdActivityToolShouJianLiJianForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnStopActvity = new DevComponents.DotNetBar.PanelEx(); + this.pnlTime = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.dtpActStartTime = new System.Windows.Forms.DateTimePicker(); + this.lblStartTime = new System.Windows.Forms.Label(); + this.numReducedAmount = new System.Windows.Forms.NumericUpDown(); + this.label5 = new System.Windows.Forms.Label(); + this.chkReducedAmount = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.numQuantity = new System.Windows.Forms.NumericUpDown(); + this.lblQuantity = new System.Windows.Forms.Label(); + this.numCoupon1KeepDays = new System.Windows.Forms.NumericUpDown(); + this.lblKeepDays2 = new System.Windows.Forms.Label(); + this.line2 = new DevComponents.DotNetBar.Controls.Line(); + this.chkShopFirstDiscount = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.numDiscountTenth = new System.Windows.Forms.NumericUpDown(); + this.chkDiscountTenth = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.label14 = new System.Windows.Forms.Label(); + this.chkGoodsFirstDiscount = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.line1 = new DevComponents.DotNetBar.Controls.Line(); + this.txtActName = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.btnCreate = new DevComponents.DotNetBar.PanelEx(); + this.lblKeepdays = new System.Windows.Forms.Label(); + this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx(); + this.splitContainer3 = new System.Windows.Forms.SplitContainer(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); + this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.pbLoading = new System.Windows.Forms.PictureBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); + this.btnCancel = new DevComponents.DotNetBar.PanelEx(); + this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.col_event_sn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); + this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colActivityPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colActivityStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.ucGroupBoxEx2.SuspendLayout(); + this.pnlTime.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numReducedAmount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numCoupon1KeepDays)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDiscountTenth)).BeginInit(); + this.ucGroupBoxEx1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); + this.splitContainer3.Panel1.SuspendLayout(); + this.splitContainer3.Panel2.SuspendLayout(); + this.splitContainer3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).BeginInit(); + this.splitContainer4.Panel1.SuspendLayout(); + this.splitContainer4.Panel2.SuspendLayout(); + this.splitContainer4.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx2); + this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); + this.splitContainer1.Size = new System.Drawing.Size(1184, 521); + this.splitContainer1.SplitterDistance = 140; + this.splitContainer1.TabIndex = 16; + // + // ucGroupBoxEx2 + // + this.ucGroupBoxEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnStopActvity); + this.ucGroupBoxEx2.Controls.Add(this.pnlTime); + this.ucGroupBoxEx2.Controls.Add(this.numQuantity); + this.ucGroupBoxEx2.Controls.Add(this.lblQuantity); + this.ucGroupBoxEx2.Controls.Add(this.numCoupon1KeepDays); + this.ucGroupBoxEx2.Controls.Add(this.lblKeepDays2); + this.ucGroupBoxEx2.Controls.Add(this.line2); + this.ucGroupBoxEx2.Controls.Add(this.chkShopFirstDiscount); + this.ucGroupBoxEx2.Controls.Add(this.numDiscountTenth); + this.ucGroupBoxEx2.Controls.Add(this.chkDiscountTenth); + this.ucGroupBoxEx2.Controls.Add(this.label14); + this.ucGroupBoxEx2.Controls.Add(this.chkGoodsFirstDiscount); + this.ucGroupBoxEx2.Controls.Add(this.line1); + this.ucGroupBoxEx2.Controls.Add(this.txtActName); + this.ucGroupBoxEx2.Controls.Add(this.label2); + this.ucGroupBoxEx2.Controls.Add(this.btnCreate); + this.ucGroupBoxEx2.Controls.Add(this.lblKeepdays); + this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2); + this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; + this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140); + this.ucGroupBoxEx2.TabIndex = 667; + this.ucGroupBoxEx2.TabStop = false; + this.ucGroupBoxEx2.Text = "商品查询创建"; + // + // btnStopActvity + // + this.btnStopActvity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopActvity.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopActvity.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnStopActvity.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopActvity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStopActvity.Location = new System.Drawing.Point(898, 87); + this.btnStopActvity.Name = "btnStopActvity"; + this.btnStopActvity.Size = new System.Drawing.Size(104, 23); + this.btnStopActvity.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopActvity.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopActvity.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopActvity.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnStopActvity.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnStopActvity.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnStopActvity.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnStopActvity.Style.GradientAngle = 90; + this.btnStopActvity.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopActvity.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopActvity.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopActvity.TabIndex = 750; + this.btnStopActvity.Text = "一键结束活动"; + this.btnStopActvity.Click += new System.EventHandler(this.btnStopActvity_Click); + // + // pnlTime + // + this.pnlTime.Controls.Add(this.label1); + this.pnlTime.Controls.Add(this.dtpActStartTime); + this.pnlTime.Controls.Add(this.lblStartTime); + this.pnlTime.Controls.Add(this.numReducedAmount); + this.pnlTime.Controls.Add(this.label5); + this.pnlTime.Controls.Add(this.chkReducedAmount); + this.pnlTime.Location = new System.Drawing.Point(9, 71); + this.pnlTime.Name = "pnlTime"; + this.pnlTime.Size = new System.Drawing.Size(263, 59); + this.pnlTime.TabIndex = 739; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(2, 35); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 17); + this.label1.TabIndex = 728; + this.label1.Text = "优惠金额"; + // + // dtpActStartTime + // + this.dtpActStartTime.CustomFormat = "yyyy年M月d日 HH:mm"; + this.dtpActStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dtpActStartTime.Location = new System.Drawing.Point(58, 4); + this.dtpActStartTime.Name = "dtpActStartTime"; + this.dtpActStartTime.Size = new System.Drawing.Size(167, 23); + this.dtpActStartTime.TabIndex = 726; + // + // lblStartTime + // + this.lblStartTime.AutoSize = true; + this.lblStartTime.Location = new System.Drawing.Point(2, 7); + this.lblStartTime.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.lblStartTime.Name = "lblStartTime"; + this.lblStartTime.Size = new System.Drawing.Size(56, 17); + this.lblStartTime.TabIndex = 727; + this.lblStartTime.Text = "开始时间"; + // + // numReducedAmount + // + this.numReducedAmount.Location = new System.Drawing.Point(58, 32); + this.numReducedAmount.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numReducedAmount.Name = "numReducedAmount"; + this.numReducedAmount.Size = new System.Drawing.Size(41, 23); + this.numReducedAmount.TabIndex = 720; + this.numReducedAmount.Value = new decimal(new int[] { + 2, + 0, + 0, + 0}); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(99, 35); + this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(20, 17); + this.label5.TabIndex = 721; + this.label5.Text = "元"; + // + // chkReducedAmount + // + this.chkReducedAmount.AutoSize = true; + this.chkReducedAmount.Checked = true; + this.chkReducedAmount.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkReducedAmount.Enabled = false; + this.chkReducedAmount.Location = new System.Drawing.Point(120, 33); + this.chkReducedAmount.Name = "chkReducedAmount"; + this.chkReducedAmount.Size = new System.Drawing.Size(75, 21); + this.chkReducedAmount.TabIndex = 722; + this.chkReducedAmount.Text = "优惠金额"; + this.chkReducedAmount.UseVisualStyleBackColor = true; + this.chkReducedAmount.Visible = false; + this.chkReducedAmount.CheckedChanged += new System.EventHandler(this.chkReducedAmount_CheckedChanged); + // + // numQuantity + // + this.numQuantity.Location = new System.Drawing.Point(370, 75); + this.numQuantity.Maximum = new decimal(new int[] { + 999999, + 0, + 0, + 0}); + this.numQuantity.Name = "numQuantity"; + this.numQuantity.Size = new System.Drawing.Size(41, 23); + this.numQuantity.TabIndex = 735; + this.numQuantity.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numQuantity.Visible = false; + // + // lblQuantity + // + this.lblQuantity.AutoSize = true; + this.lblQuantity.Location = new System.Drawing.Point(316, 78); + this.lblQuantity.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.lblQuantity.Name = "lblQuantity"; + this.lblQuantity.Size = new System.Drawing.Size(56, 17); + this.lblQuantity.TabIndex = 734; + this.lblQuantity.Text = "活动库存"; + this.lblQuantity.Visible = false; + // + // numCoupon1KeepDays + // + this.numCoupon1KeepDays.Location = new System.Drawing.Point(370, 103); + this.numCoupon1KeepDays.Maximum = new decimal(new int[] { + 7, + 0, + 0, + 0}); + this.numCoupon1KeepDays.Name = "numCoupon1KeepDays"; + this.numCoupon1KeepDays.Size = new System.Drawing.Size(41, 23); + this.numCoupon1KeepDays.TabIndex = 729; + this.numCoupon1KeepDays.Value = new decimal(new int[] { + 7, + 0, + 0, + 0}); + this.numCoupon1KeepDays.Visible = false; + // + // lblKeepDays2 + // + this.lblKeepDays2.AutoSize = true; + this.lblKeepDays2.Location = new System.Drawing.Point(412, 106); + this.lblKeepDays2.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.lblKeepDays2.Name = "lblKeepDays2"; + this.lblKeepDays2.Size = new System.Drawing.Size(20, 17); + this.lblKeepDays2.TabIndex = 730; + this.lblKeepDays2.Text = "天"; + this.lblKeepDays2.Visible = false; + // + // line2 + // + this.line2.ForeColor = System.Drawing.SystemColors.ScrollBar; + this.line2.Location = new System.Drawing.Point(278, 19); + this.line2.Name = "line2"; + this.line2.Size = new System.Drawing.Size(14, 109); + this.line2.TabIndex = 732; + this.line2.Text = "line2"; + this.line2.VerticalLine = true; + // + // chkShopFirstDiscount + // + this.chkShopFirstDiscount.AutoSize = true; + this.chkShopFirstDiscount.Location = new System.Drawing.Point(160, 19); + this.chkShopFirstDiscount.Name = "chkShopFirstDiscount"; + this.chkShopFirstDiscount.Size = new System.Drawing.Size(123, 21); + this.chkShopFirstDiscount.TabIndex = 731; + this.chkShopFirstDiscount.Text = "创建店铺新客立减"; + this.chkShopFirstDiscount.UseVisualStyleBackColor = true; + this.chkShopFirstDiscount.CheckedChanged += new System.EventHandler(this.chkShopFirstDiscount_CheckedChanged); + // + // numDiscountTenth + // + this.numDiscountTenth.DecimalPlaces = 1; + this.numDiscountTenth.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numDiscountTenth.Location = new System.Drawing.Point(370, 46); + this.numDiscountTenth.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numDiscountTenth.Name = "numDiscountTenth"; + this.numDiscountTenth.Size = new System.Drawing.Size(41, 23); + this.numDiscountTenth.TabIndex = 713; + this.numDiscountTenth.Value = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numDiscountTenth.Visible = false; + // + // chkDiscountTenth + // + this.chkDiscountTenth.AutoSize = true; + this.chkDiscountTenth.Location = new System.Drawing.Point(303, 47); + this.chkDiscountTenth.Name = "chkDiscountTenth"; + this.chkDiscountTenth.Size = new System.Drawing.Size(75, 21); + this.chkDiscountTenth.TabIndex = 719; + this.chkDiscountTenth.Text = "优惠折扣"; + this.chkDiscountTenth.UseVisualStyleBackColor = true; + this.chkDiscountTenth.Visible = false; + this.chkDiscountTenth.CheckedChanged += new System.EventHandler(this.chkDiscountTenth_CheckedChanged); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(411, 49); + this.label14.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(20, 17); + this.label14.TabIndex = 715; + this.label14.Text = "折"; + this.label14.Visible = false; + // + // chkGoodsFirstDiscount + // + this.chkGoodsFirstDiscount.AutoSize = true; + this.chkGoodsFirstDiscount.Checked = true; + this.chkGoodsFirstDiscount.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkGoodsFirstDiscount.Location = new System.Drawing.Point(14, 19); + this.chkGoodsFirstDiscount.Name = "chkGoodsFirstDiscount"; + this.chkGoodsFirstDiscount.Size = new System.Drawing.Size(123, 21); + this.chkGoodsFirstDiscount.TabIndex = 659; + this.chkGoodsFirstDiscount.Text = "创建商品首件立减"; + this.chkGoodsFirstDiscount.UseVisualStyleBackColor = true; + this.chkGoodsFirstDiscount.CheckedChanged += new System.EventHandler(this.chkGoodsFirstDiscount_CheckedChanged); + // + // line1 + // + this.line1.ForeColor = System.Drawing.SystemColors.ScrollBar; + this.line1.Location = new System.Drawing.Point(137, 19); + this.line1.Name = "line1"; + this.line1.Size = new System.Drawing.Size(14, 22); + this.line1.TabIndex = 658; + this.line1.Text = "line1"; + this.line1.VerticalLine = true; + // + // txtActName + // + this.txtActName.Location = new System.Drawing.Point(67, 46); + this.txtActName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); + this.txtActName.Name = "txtActName"; + this.txtActName.Size = new System.Drawing.Size(167, 23); + this.txtActName.TabIndex = 489; + this.txtActName.Text = "商品首件立减"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 49); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 17); + this.label2.TabIndex = 490; + this.label2.Text = "活动备注"; + // + // btnCreate + // + this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCreate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty; + this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCreate.Location = new System.Drawing.Point(898, 32); + this.btnCreate.Name = "btnCreate"; + this.btnCreate.Size = new System.Drawing.Size(104, 23); + this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnCreate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCreate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCreate.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnCreate.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnCreate.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnCreate.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnCreate.Style.GradientAngle = 90; + this.btnCreate.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnCreate.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnCreate.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnCreate.TabIndex = 468; + this.btnCreate.Text = "开始创建"; + this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click); + // + // lblKeepdays + // + this.lblKeepdays.AutoSize = true; + this.lblKeepdays.Location = new System.Drawing.Point(316, 106); + this.lblKeepdays.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.lblKeepdays.Name = "lblKeepdays"; + this.lblKeepdays.Size = new System.Drawing.Size(56, 17); + this.lblKeepdays.TabIndex = 728; + this.lblKeepdays.Text = "持续时间"; + this.lblKeepdays.Visible = false; + // + // ucGroupBoxEx1 + // + this.ucGroupBoxEx1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | 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.btnRefreshShop); + this.ucGroupBoxEx1.Location = new System.Drawing.Point(3, 2); + this.ucGroupBoxEx1.Name = "ucGroupBoxEx1"; + this.ucGroupBoxEx1.Size = new System.Drawing.Size(144, 140); + this.ucGroupBoxEx1.TabIndex = 399; + this.ucGroupBoxEx1.TabStop = false; + this.ucGroupBoxEx1.Text = "基础"; + // + // btnRefreshShop + // + this.btnRefreshShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnRefreshShop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRefreshShop.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefreshShop.Location = new System.Drawing.Point(17, 31); + this.btnRefreshShop.Name = "btnRefreshShop"; + this.btnRefreshShop.Size = new System.Drawing.Size(110, 24); + this.btnRefreshShop.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshShop.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRefreshShop.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRefreshShop.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRefreshShop.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRefreshShop.Style.GradientAngle = 90; + this.btnRefreshShop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshShop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshShop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshShop.TabIndex = 431; + this.btnRefreshShop.Text = "刷新店铺"; + this.btnRefreshShop.Click += new System.EventHandler(this.btnRefreshShop_Click); + // + // splitContainer3 + // + this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer3.Location = new System.Drawing.Point(0, 0); + this.splitContainer3.Name = "splitContainer3"; + this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer3.Panel1 + // + this.splitContainer3.Panel1.Controls.Add(this.splitContainer2); + // + // splitContainer3.Panel2 + // + this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); + this.splitContainer3.Size = new System.Drawing.Size(1184, 377); + this.splitContainer3.SplitterDistance = 347; + this.splitContainer3.TabIndex = 1; + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.dgvShop); + this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.pbLoading); + this.splitContainer2.Panel2.Controls.Add(this.panel1); + this.splitContainer2.Panel2.Controls.Add(this.dgvProduct); + this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); + this.splitContainer2.Size = new System.Drawing.Size(1184, 347); + this.splitContainer2.SplitterDistance = 300; + this.splitContainer2.TabIndex = 0; + // + // dgvShop + // + this.dgvShop.AllowUserToAddRows = false; + this.dgvShop.AllowUserToDeleteRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + 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; + this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colSelect, + this.colShopLoginName, + this.colShopId, + this.colShopName, + this.colShopNotes, + this.colSelectProduct, + this.colLoginStatus, + this.colCanUse, + this.colRemaining, + this.colMessage}); + this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvShop.Location = new System.Drawing.Point(4, 0); + this.dgvShop.Name = "dgvShop"; + this.dgvShop.ReadOnly = true; + this.dgvShop.RowHeadersWidth = 25; + this.dgvShop.RowTemplate.Height = 23; + this.dgvShop.Size = new System.Drawing.Size(296, 347); + this.dgvShop.TabIndex = 6; + this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); + // + // colSelect + // + this.colSelect.HeaderText = "全选"; + this.colSelect.Name = "colSelect"; + this.colSelect.ReadOnly = true; + this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSelect.Width = 28; + // + // colShopLoginName + // + this.colShopLoginName.HeaderText = "店铺登录名"; + this.colShopLoginName.Name = "colShopLoginName"; + this.colShopLoginName.ReadOnly = true; + this.colShopLoginName.Visible = false; + // + // colShopId + // + this.colShopId.HeaderText = "店铺Id"; + this.colShopId.Name = "colShopId"; + this.colShopId.ReadOnly = true; + this.colShopId.Visible = false; + this.colShopId.Width = 55; + // + // colShopName + // + this.colShopName.FillWeight = 150F; + this.colShopName.HeaderText = "店铺名称"; + this.colShopName.Name = "colShopName"; + this.colShopName.ReadOnly = true; + this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colShopName.Width = 70; + // + // colShopNotes + // + this.colShopNotes.HeaderText = "分组"; + this.colShopNotes.Name = "colShopNotes"; + this.colShopNotes.ReadOnly = true; + this.colShopNotes.Width = 70; + // + // colSelectProduct + // + this.colSelectProduct.HeaderText = "选择商品"; + this.colSelectProduct.Name = "colSelectProduct"; + this.colSelectProduct.ReadOnly = true; + this.colSelectProduct.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSelectProduct.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSelectProduct.Visible = false; + this.colSelectProduct.Width = 62; + // + // colLoginStatus + // + this.colLoginStatus.HeaderText = "状态"; + this.colLoginStatus.Name = "colLoginStatus"; + this.colLoginStatus.ReadOnly = true; + this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colLoginStatus.Width = 40; + // + // colCanUse + // + this.colCanUse.HeaderText = "可用"; + this.colCanUse.Name = "colCanUse"; + this.colCanUse.ReadOnly = true; + this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCanUse.Visible = false; + this.colCanUse.Width = 28; + // + // colRemaining + // + this.colRemaining.HeaderText = "月限额"; + this.colRemaining.Name = "colRemaining"; + this.colRemaining.ReadOnly = true; + this.colRemaining.Visible = false; + // + // colMessage + // + this.colMessage.HeaderText = "消息"; + this.colMessage.Name = "colMessage"; + this.colMessage.ReadOnly = true; + // + // 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(415, 148); + this.pbLoading.Name = "pbLoading"; + this.pbLoading.Size = new System.Drawing.Size(50, 50); + this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbLoading.TabIndex = 188; + this.pbLoading.TabStop = false; + this.pbLoading.Visible = false; + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.Controls.Add(this.ucSplitPage1); + this.panel1.Location = new System.Drawing.Point(36, 53); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(806, 261); + this.panel1.TabIndex = 189; + // + // ucSplitPage1 + // + this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.IsShowPageSize = false; + this.ucSplitPage1.Location = new System.Drawing.Point(221, 224); + 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; + this.ucSplitPage1.Visible = false; + // + // dgvProduct + // + this.dgvProduct.AllowUserToAddRows = false; + this.dgvProduct.AllowUserToDeleteRows = false; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + this.dgvProduct.BackgroundColor = System.Drawing.Color.White; + this.dgvProduct.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.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colCheck, + this.colSupplierId, + this.colSupplierName, + this.col_event_sn, + this.colImgUrl, + this.colImg, + this.colSpuId, + this.colProductName, + this.colPrice, + this.colActivityPrice, + this.colStock, + this.colActivityStock, + this.colFavorites, + this.colSales, + this.colSalesThirtyDays, + this.colIsCanSet, + this.colOpResult}); + this.dgvProduct.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvProduct.Location = new System.Drawing.Point(0, 0); + this.dgvProduct.Name = "dgvProduct"; + this.dgvProduct.ReadOnly = true; + this.dgvProduct.RowTemplate.Height = 23; + this.dgvProduct.Size = new System.Drawing.Size(876, 347); + this.dgvProduct.TabIndex = 190; + this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); + // + // splitContainer4 + // + this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer4.Location = new System.Drawing.Point(0, 0); + this.splitContainer4.Name = "splitContainer4"; + // + // splitContainer4.Panel1 + // + this.splitContainer4.Panel1.Controls.Add(this.statusBar); + // + // splitContainer4.Panel2 + // + this.splitContainer4.Panel2.Controls.Add(this.btnClear); + this.splitContainer4.Panel2.Controls.Add(this.btnCancel); + this.splitContainer4.Size = new System.Drawing.Size(1184, 26); + this.splitContainer4.SplitterDistance = 493; + this.splitContainer4.TabIndex = 3; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(493, 26); + this.statusBar.TabIndex = 2; + // + // btnClear + // + this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; + this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnClear.Location = new System.Drawing.Point(4, 1); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(90, 21); + this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.Style.GradientAngle = 90; + this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.TabIndex = 440; + this.btnClear.Text = "清空结果"; + this.btnClear.Visible = false; + // + // btnCancel + // + this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control; + this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty; + this.btnCancel.Location = new System.Drawing.Point(568, 1); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(115, 21); + this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnCancel.Style.GradientAngle = 90; + this.btnCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnCancel.TabIndex = 668; + this.btnCancel.Text = "停止当前操作"; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // colCheck + // + this.colCheck.Frozen = true; + this.colCheck.HeaderText = "选择"; + this.colCheck.Name = "colCheck"; + this.colCheck.ReadOnly = true; + this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCheck.Width = 30; + // + // colSupplierId + // + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + // + // colSupplierName + // + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + this.colSupplierName.Width = 110; + // + // col_event_sn + // + this.col_event_sn.HeaderText = "活动编码"; + this.col_event_sn.Name = "col_event_sn"; + this.col_event_sn.ReadOnly = true; + this.col_event_sn.Visible = false; + // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colImg + // + this.colImg.HeaderText = "图片"; + this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colImg.Name = "colImg"; + this.colImg.ReadOnly = true; + this.colImg.Width = 60; + // + // colSpuId + // + this.colSpuId.HeaderText = "商品ID"; + this.colSpuId.Name = "colSpuId"; + this.colSpuId.ReadOnly = true; + this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSpuId.Width = 80; + // + // colProductName + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; + this.colProductName.HeaderText = "商品标题"; + this.colProductName.Name = "colProductName"; + this.colProductName.ReadOnly = true; + this.colProductName.Width = 260; + // + // colPrice + // + this.colPrice.HeaderText = "价格"; + this.colPrice.Name = "colPrice"; + this.colPrice.ReadOnly = true; + this.colPrice.Width = 90; + // + // colActivityPrice + // + this.colActivityPrice.HeaderText = "活动价格"; + this.colActivityPrice.Name = "colActivityPrice"; + this.colActivityPrice.ReadOnly = true; + this.colActivityPrice.Visible = false; + this.colActivityPrice.Width = 90; + // + // colStock + // + this.colStock.HeaderText = "库存"; + this.colStock.Name = "colStock"; + this.colStock.ReadOnly = true; + this.colStock.Width = 70; + // + // colActivityStock + // + this.colActivityStock.HeaderText = "活动库存"; + this.colActivityStock.Name = "colActivityStock"; + this.colActivityStock.ReadOnly = true; + this.colActivityStock.Visible = false; + // + // colFavorites + // + this.colFavorites.HeaderText = "收藏"; + this.colFavorites.Name = "colFavorites"; + this.colFavorites.ReadOnly = true; + this.colFavorites.Visible = false; + this.colFavorites.Width = 50; + // + // colSales + // + this.colSales.HeaderText = "总销量"; + this.colSales.Name = "colSales"; + this.colSales.ReadOnly = true; + this.colSales.Visible = false; + this.colSales.Width = 60; + // + // colSalesThirtyDays + // + this.colSalesThirtyDays.HeaderText = "30日销量"; + this.colSalesThirtyDays.Name = "colSalesThirtyDays"; + this.colSalesThirtyDays.ReadOnly = true; + this.colSalesThirtyDays.Visible = false; + this.colSalesThirtyDays.Width = 70; + // + // colIsCanSet + // + this.colIsCanSet.HeaderText = "是否可设置"; + this.colIsCanSet.Name = "colIsCanSet"; + this.colIsCanSet.ReadOnly = true; + // + // colOpResult + // + this.colOpResult.HeaderText = "操作结果"; + this.colOpResult.Name = "colOpResult"; + this.colOpResult.ReadOnly = true; + this.colOpResult.Width = 200; + // + // PDDProdActivityToolShouJianLiJianForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1184, 521); + this.Controls.Add(this.splitContainer1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Name = "PDDProdActivityToolShouJianLiJianForm"; + this.Text = "PDDProdActivityToolShouJianLiJianForm"; + this.Load += new System.EventHandler(this.PDDProdActivityToolShouJianLiJianForm_Load); + this.VisibleChanged += new System.EventHandler(this.PDDProdActivityToolShouJianLiJianForm_VisibleChanged); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.ucGroupBoxEx2.ResumeLayout(false); + this.ucGroupBoxEx2.PerformLayout(); + this.pnlTime.ResumeLayout(false); + this.pnlTime.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numReducedAmount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numCoupon1KeepDays)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDiscountTenth)).EndInit(); + this.ucGroupBoxEx1.ResumeLayout(false); + this.splitContainer3.Panel1.ResumeLayout(false); + this.splitContainer3.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); + this.splitContainer3.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); + this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).EndInit(); + this.splitContainer4.Panel1.ResumeLayout(false); + this.splitContainer4.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).EndInit(); + this.splitContainer4.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private UserComponent.UcGroupBoxEx ucGroupBoxEx2; + private System.Windows.Forms.Panel pnlTime; + private System.Windows.Forms.DateTimePicker dtpActStartTime; + private System.Windows.Forms.Label lblStartTime; + private System.Windows.Forms.Label lblKeepdays; + private System.Windows.Forms.NumericUpDown numCoupon1KeepDays; + private System.Windows.Forms.Label lblKeepDays2; + private System.Windows.Forms.NumericUpDown numQuantity; + private System.Windows.Forms.Label lblQuantity; + private DevComponents.DotNetBar.Controls.Line line2; + private UserComponent.UcCheckBox chkShopFirstDiscount; + private System.Windows.Forms.NumericUpDown numReducedAmount; + private UserComponent.UcCheckBox chkReducedAmount; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.NumericUpDown numDiscountTenth; + private UserComponent.UcCheckBox chkDiscountTenth; + private System.Windows.Forms.Label label14; + private UserComponent.UcCheckBox chkGoodsFirstDiscount; + private DevComponents.DotNetBar.Controls.Line line1; + private System.Windows.Forms.TextBox txtActName; + private System.Windows.Forms.Label label2; + private DevComponents.DotNetBar.PanelEx btnCreate; + private UserComponent.UcGroupBoxEx ucGroupBoxEx1; + private DevComponents.DotNetBar.PanelEx btnRefreshShop; + private System.Windows.Forms.SplitContainer splitContainer3; + private System.Windows.Forms.SplitContainer splitContainer2; + private UserComponent.DataGridViewEx dgvShop; + private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopId; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopName; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes; + private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct; + private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; + private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining; + private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; + private System.Windows.Forms.PictureBox pbLoading; + private System.Windows.Forms.Panel panel1; + private UserControls.UcSplitPage ucSplitPage1; + private System.Windows.Forms.SplitContainer splitContainer4; + private UserControls.StatusBarUserControl statusBar; + private DevComponents.DotNetBar.PanelEx btnClear; + private DevComponents.DotNetBar.PanelEx btnCancel; + private System.Windows.Forms.Label label1; + private DevComponents.DotNetBar.PanelEx btnStopActvity; + private UserComponent.DataGridViewEx dgvProduct; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewTextBoxColumn col_event_sn; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colImg; + private System.Windows.Forms.DataGridViewLinkColumn colSpuId; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colActivityPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colActivityStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; + private System.Windows.Forms.DataGridViewTextBoxColumn colSales; + private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; + private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; + } +} \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.cs new file mode 100644 index 0000000..8ded6e0 --- /dev/null +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.cs @@ -0,0 +1,1135 @@ +using AllBase; +using AllBase.Helper; +using AllBase.Model.Param.PDDCouponParam; +using AllBase.Model.Result; +using AllBase.Model.Result.PDDResult; +using AllBase.Model.Result.PDDResult.PDDCouponResult; +using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using TemuKJD.BaseForms; +using TemuKJD.BLL; +using TemuKJD.Extension; +using TemuKJD.PDDForms.ShopForms; +using TemuKJD.ToolForms; + +namespace TemuKJD.PDDForms.ProductForms.CouponForms +{ + public partial class PDDProdActivityToolShouJianLiJianForm : Form + { + public CancellationTokenSource cancellationTokenSource { get; set; } = null; + + bool isInit = false; + Dictionary dicShopGetCount = new Dictionary(); + PDDCouponGoodsListInfo pddCouponGoods = new PDDCouponGoodsListInfo(); + + public PDDProdActivityToolShouJianLiJianForm() + { + InitializeComponent(); + } + + private void PDDProdActivityToolShouJianLiJianForm_Load(object sender, EventArgs e) + { + //this.dtpCoupon1StartTime.MinDate = DateTime.Now.Date.AddDays(1).AddHours(19); + + this.dgvShop.AddSelectorColumn("colSelect"); + this.dgvProduct.AddSelectorColumn("colCheck"); + dgvProduct.AddImgColumn("colImg", "colImgUrl"); + } + + private void PDDProdActivityToolShouJianLiJianForm_VisibleChanged(object sender, EventArgs e) + { + if (Visible == true) + { + RefreshShop(); + isInit = true; + } + } + + private void btnRefreshShop_Click(object sender, EventArgs e) + { + RefreshShop(); + } + private void RefreshShop() + { + // 店铺Id + var selectIds = dgvShop.Rows.Cast().Where(row + => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + // 获取被删除的店铺 + List dgvRowList = dgvShop.Rows.Cast().Where(row + => !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList(); + // 更新被删除的店铺列表 + foreach (var row in dgvRowList) + { + dgvShop.Rows.Remove(row); + } + // 绑定其他店铺(含新导入的店铺) + foreach (ShopLoginInfo shopEntity in GlobalConfig.ShopLoginList) + { + if (!string.IsNullOrEmpty(shopEntity.ShopId)) + BindShop(shopEntity, selectIds); + } + } + + private void BindShop(ShopLoginInfo shopEntity, List selectShopId = null) + { + if (shopEntity == null) + return; + if (selectShopId == null) + selectShopId = new List(); + + bool canUse = shopEntity.LoginStatus == "登录成功"; + //canUse = true; // 内部库不需要校验登录状态 + var row = dgvShop.Rows.Cast().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId); + if (row == null) + { + this.dgvShop.Rows.Add( + //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + canUse, + shopEntity.LoginName, + shopEntity.ShopId, + shopEntity.ShopAccount, + shopEntity.Notes, + "选择商品", + canUse ? "在线" : "掉线", + canUse, + shopEntity.AddProductRemaining, + string.Empty + ); + } + else + { + //row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId); + row.Cells["colShopLoginName"].Value = shopEntity.LoginName; + row.Cells["colShopName"].Value = shopEntity.ShopAccount; + row.Cells["colShopNotes"].Value = shopEntity.Notes; + row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线"; + row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red; + row.Cells["colCanUse"].Value = canUse; + row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining; + } + } + + private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0 || e.RowIndex < 0) + return; + string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText; + string columnName = dgvShop.Columns[e.ColumnIndex].Name; + string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString(); + string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopName"].Value.ToString(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString()); + var row = dgvShop.Rows[e.RowIndex]; + switch (columnName) + { + case "colSelect": + row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool(); + break; + case "colLoginStatus": + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop); + if (shop.LoginStatus != "登录成功") + { + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.ShowDialog(); + RefreshShop(); + } + else + { + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.Show(); + } + break; + } + } + + //1 首件立减 2 新客立减 + public string get_shoujianlijian_goods(ShopLoginInfo shop, DateTime startTime, int promotion_event_type = 1, int page = 1, int pageSize = 20) + { + 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/bordeaux/new_customer_discount/query_mall_goods_list"; + string body = "{\"page\":" + page + ",\"size\":" + pageSize + ",\"start_time\":\"" + // 2025-10-21T01:48:00.000Z + startTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "\",\"promotion_event_type\":" + promotion_event_type + "}"; + + string refere = "https://mms.pinduoduo.com/kit/new/create?tool_full_channel=10921_66105"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string get_shoujianlijian_goods_limit(ShopLoginInfo shop, List goodsIdLst, long startTime, long endTime, int page = 1, int pageSize = 20) + { + 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/bordeaux/new_customer_discount/query_create_promotion_event_limit"; + string body = @"{""goods_id_list"":["; + foreach (var goodsId in goodsIdLst) + { + body += goodsId + ","; + } + body = body.TrimEnd(','); + body += "],\"business_code\":500004}"; + + + string refere = "https://mms.pinduoduo.com/kit/new/create?tool_full_channel=10921_66105"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string create_shoujianlijian_goods(ShopLoginInfo shop, XinKeLiJianCreateParam activityParam) + { + 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/bordeaux/new_customer_discount/create_promotion_event"; + string body = JsonHelper.SerializeObject(activityParam); + + string refere = "https://mms.pinduoduo.com/kit/new/create?tool_full_channel=10921_66105"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + /// + /// + /// + /// + /// 1活动已开始 2活动未开始 + /// + /// + /// + public string get_shoujianlijian_product_list(ShopLoginInfo shop, int status = 1, int page = 1, int pageSize = 20) + { + 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/bordeaux/new_customer_discount/query_promotion_event_list_by_goods"; + string body = "{\"page\":" + page + ",\"page_size\":" + pageSize + ",\"status\":" + status + ",\"search_index\":\"\",\"promotion_event_types\":[1,2]}"; + + string refere = "https://mms.pinduoduo.com/kit/new?tool_full_channel=10921_66105&activeKey=" + status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string close_shoujianlijian_product_list(ShopLoginInfo shop, string eventSn, int status = 1) + { + 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/bordeaux/new_customer_discount/close_promotion_event"; + string body = @"{""promotion_event_sn"":""" + eventSn + @"""}"; + + string refere = "https://mms.pinduoduo.com/kit/new?tool_full_channel=10921_66105&activeKey=" + status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + + private void btnCreate_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddCouponGoods.goods_list.Clear(); + pddCouponGoods.remaining_create_num = 1; + pddCouponGoods.total = 1; + + dgvProduct.Rows.Clear(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colActivityStock"].Visible = false; + this.dgvProduct.Columns["colActivityPrice"].Visible = false; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + int page = 0; + int pageSize = 20; // 优惠券最大20 + int totalPage = 1; + bool isError = false; + string errMsg = ""; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page > 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + long startStamp = BaseClass.DateTimeToTimestampMilliseconds(dtpActStartTime.Value); + long endStamp = BaseClass.DateTimeToTimestampMilliseconds(dtpActStartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1; + string jsonStr = get_shoujianlijian_goods(shop, dtpActStartTime.Value, chkGoodsFirstDiscount.Checked ? 1 : 2, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + page++; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + PDDCouponGoodsListInfo pddCouponGoodsTmp = new PDDCouponGoodsListInfo(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + pddCouponGoodsTmp = JsonHelper.DeserializeJsonToObject(rstStr); + this.pddCouponGoods.remaining_create_num = pddCouponGoodsTmp.remaining_create_num; + this.pddCouponGoods.total = pddCouponGoodsTmp.total; + if (this.pddCouponGoods.total == 0) + break; + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + foreach (var pInfo in pddCouponGoodsTmp.goods_list) + { + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null && !pddCouponGoods.goods_list.Any(a => a.id == pInfo.id)) + { + this.pddCouponGoods.goods_list.Add(pInfo); + if (!string.IsNullOrEmpty(pInfo.filtered_reason)) + pInfo.is_filtered = true; + string url = pInfo.thumb_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + "", + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.id, + pInfo.goods_name, + string.Join("~", pInfo.sku_group_price.Select(s => s / 100m)), + "", + pInfo.quantity, + "", + "", //收藏 + "", //总销量 + "", //30日销量 + pInfo.is_filtered == true ? "不可设置:" + pInfo.filtered_reason : "可设置", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + int discountVal = 0; + Invoke(new Action(() => + { + discountVal = (numReducedAmount.Value * 100).ParseToInt(); + })); + + var jsonLimitStr = get_shoujianlijian_goods_limit(shop, pddCouponGoodsTmp.goods_list.Select(g => g.id.ParseToLong()).ToList(), + startStamp, endStamp, page, pageSize); + jsonLimitStr = GetHtml.Unicode2String(jsonLimitStr); + if (!jsonLimitStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonLimitStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + page++; + continue; + } + ShouJianLiJIan_create_limit_info ShouJianLiJIan_create_limit_info_tmp = new ShouJianLiJIan_create_limit_info(); + try + { + var jObj = JObject.Parse(jsonLimitStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + ShouJianLiJIan_create_limit_info_tmp = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + foreach (var pInfo in pddCouponGoodsTmp.goods_list) + { + pInfo.coupon_value_limit = new List() { 0, 999999 }; + if (ShouJianLiJIan_create_limit_info_tmp.goods_unit_create_limit_map.Keys.Contains(pInfo.id.ToString())) + { + pInfo.coupon_value_limit[0] = ShouJianLiJIan_create_limit_info_tmp.goods_unit_create_limit_map[pInfo.id.ToString()].min_discount; + pInfo.coupon_value_limit[1] = ShouJianLiJIan_create_limit_info_tmp.goods_unit_create_limit_map[pInfo.id.ToString()].max_discount; + } + if (pInfo.coupon_value_limit.FirstOrDefault() > discountVal || pInfo.coupon_value_limit.LastOrDefault() < discountVal) + { + var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id); + if (row != null) + { + row.Cells["colOpResult"].Value = "优惠金额超出范围!" + pInfo.coupon_value_limit[0] / 100 + "~" + pInfo.coupon_value_limit[1] / 100; + } + } + } + var createLst = pddCouponGoodsTmp.goods_list; + createLst = pddCouponGoodsTmp.goods_list.Where(g => g.coupon_value_limit.FirstOrDefault() <= discountVal && + g.coupon_value_limit.LastOrDefault() >= discountVal).Where(g => g.is_filtered == false).ToList(); + + XinKeLiJianCreateParam createParam = new XinKeLiJianCreateParam(); + createParam.business_code = 500004; + createParam.is_batch_create_promotion_event = true; + createParam.promotion_event_remark = txtActName.Text.Trim(); + createParam.promotion_event_name = (chkGoodsFirstDiscount.Checked ? "首件立减" : "新客立减") + + dtpActStartTime.Value.Date.ToString("yyyy-MM-dd"); + createParam.promotion_event_type = chkGoodsFirstDiscount.Checked ? 1 : 2; + createParam.start_time = startStamp; + createParam.ignore_low_price_check = false; + createParam.big_deal_check = true; + createParam.tool_full_channel = "10921_66105"; + createParam.goods_promotion_list = new List(); + foreach (var pInfo in createLst) + { + createParam.goods_promotion_list.Add(new goods_promotion_param + { + goods_id = pInfo.id, + create_discount_type = 1, + discount_param = discountVal, + }); + } + + //筛选后数量大于0则进行活动设置 + if (createLst.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + + var creatRst = create_shoujianlijian_goods(shop, createParam); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + foreach (var pInfo in createParam.goods_promotion_list) + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.goods_id); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + } + else + { + try + { + var jObj = JObject.Parse(creatRst); + var rstStr = JsonHelper.SerializeObject(jObj["result"]["invalid_goods_list"]); + var createResult = JsonHelper.DeserializeJsonToList(rstStr); + + foreach (var pInfo in createLst) + { + var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id); + if (row != null) + { + var createErr = createResult.FirstOrDefault(er => er.id == pInfo.id); + if (createErr != null) + row.Cells["colOpResult"].Value = createErr.invalid_reason; + else + row.Cells["colOpResult"].Value = "设置成功!"; + } + } + } + catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已设置"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "设置失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "设置结束!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消设置!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } + public void GetToken(ShopLoginInfo shop) + { + if (!dicShopGetCount.Keys.Contains(shop)) + dicShopGetCount[shop] = 100; + else + dicShopGetCount[shop]++; + if (dicShopGetCount[shop] > 5) + { + dicShopGetCount[shop] = 0; + + //while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) + //{ + // Thread.Sleep(500); + //} + + //Invoke(new Action(() => + //{ + // this.panel1.SendToBack(); + // PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + // loginForm.TopLevel = false; + // loginForm.openType = EnumOpenType.manage; + // loginForm.WindowState = FormWindowState.Maximized; + // loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + // loginForm.Dock = DockStyle.Fill; + // this.panel1.Controls.Add(loginForm); + // loginForm.Show(); + //})); + //int sleepTime = Randomx.GetId(2000, 3000); + //Thread.Sleep(sleepTime); + + //Invoke(new Action(() => + //{ + // if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Dispose(); + //})); + + PDDShopLoginForm loginForm = null; + Invoke(new Action(() => + { + this.panel1.SendToBack(); + loginForm = new PDDShopLoginForm(shop); + loginForm.TopLevel = false; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; + loginForm.Dock = DockStyle.Fill; + this.panel1.Controls.Add(loginForm); + loginForm.Show(); + })); + Thread.Sleep(Randomx.GetId(3000, 5000)); + + Invoke(new Action(() => + { + if (loginForm != null) + loginForm.Close(); + })); + } + } + + private void btnCancel_Click(object sender, EventArgs e) + { + if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource.Cancel(); + } + + private void dgvProduct_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0 || e.RowIndex < 0) + return; + string headerText = dgvProduct.Columns[e.ColumnIndex].HeaderText; + switch (headerText) + { + case "删除": + //if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel) + // return; + //var rst = DeleteProduct(dbId); + //if (rst) + //{ + // SearchDbProdSelect(this.ucSplitPage1.CurrentPage); + //} + break; + case "图片": + { + ShowImgForm imgFrom = new ShowImgForm(dgvProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString()); + imgFrom.ShowDialog(); + } + break; + case "": + dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value; + break; + default: + break; + } + } + + private void chkGoodsFirstDiscount_CheckedChanged(object sender, EventArgs e) + { + chkShopFirstDiscount.Checked = !chkGoodsFirstDiscount.Checked; + //lblQuantity.Visible = numQuantity.Visible = chkGoodsFirstDiscount.Checked; + if (chkGoodsFirstDiscount.Checked) + { + txtActName.Text = txtActName.Text.Replace("店铺新客", "商品首件"); + } + else + { + txtActName.Text = txtActName.Text.Replace("商品首件", "店铺新客"); + } + } + + private void chkShopFirstDiscount_CheckedChanged(object sender, EventArgs e) + { + chkGoodsFirstDiscount.Checked = !chkShopFirstDiscount.Checked; + //pnlTime.Visible = chkShopFirstDiscount.Checked; + } + + private void chkDiscountTenth_CheckedChanged(object sender, EventArgs e) + { + chkReducedAmount.Checked = !chkDiscountTenth.Checked; + } + + private void chkReducedAmount_CheckedChanged(object sender, EventArgs e) + { + chkDiscountTenth.Checked = !chkReducedAmount.Checked; + } + + private void btnStopActvity_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddCouponGoods.goods_list.Clear(); + pddCouponGoods.remaining_create_num = 1; + pddCouponGoods.total = 1; + + dgvProduct.Rows.Clear(); + List promotionGoodsInfoLst = new List(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colActivityStock"].Visible = false; + this.dgvProduct.Columns["colActivityPrice"].Visible = true; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + bool isError = false; + string errMsg = ""; + for(int status = 1; status <= 2; status++) + { + int page = 0; + int pageSize = 20; + int totalPage = 1; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (page == 0) + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page >= 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + //long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value); + //long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1; + string jsonStr = get_shoujianlijian_product_list(shop, status, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + PromotionEventRst promotionEventRst = new PromotionEventRst(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + promotionEventRst = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + promotionEventRst.promotion_event_list = promotionEventRst.promotion_event_list + .Where(p => !promotionGoodsInfoLst.Any(a => a.promotion_event_sn == p.promotion_event_sn)).ToList(); + if (promotionEventRst.promotion_event_list.Count == 0) + { + page++; + continue; + } + foreach (var pInfo in promotionEventRst.promotion_event_list) + { + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null && pInfo.goods_info != null) + { + promotionGoodsInfoLst.Add(pInfo); + string url = pInfo.goods_info?.thumb_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + pInfo.promotion_event_sn, + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.goods_info?.id, + pInfo.goods_info?.goods_name, + pInfo.goods_info?.group_price_range.min / 100m + "~" + pInfo.goods_info?.group_price_range.max / 100m, + pInfo.new_customer_price_range.min / 100m + "~" + pInfo.new_customer_price_range.max / 100m, //活动售价 + pInfo.goods_info?.quantity, + pInfo.goods_info?.quantity, // 活动库存 + "", //收藏 + "", //总销量 + "", //30日销量 + "可结束", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + + foreach (var promotionGoods in promotionEventRst.promotion_event_list) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + if (cancellationTokenSource.IsCancellationRequested) + break; + + var creatRst = close_shoujianlijian_product_list(shop, promotionGoods.promotion_event_sn, status); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_event_sn"].Value.ParseToString() == promotionGoods.promotion_event_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + else + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_event_sn"].Value.ParseToString() == promotionGoods.promotion_event_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = "结束活动成功!"; + } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已结束活动"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "结束活动失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "结束活动已完成!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消结束活动!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } + } + + public class ShouJianLiJIan_create_limit_info + { + public int? min_discount { get; set; } // 600 + public Dictionary goods_unit_create_limit_map { get; set; } + public Dictionary goods_id_to_benefits_map { get; set; } + public Dictionary benefits_map { get; set; } + } + + public class goods_id_to_benefits_info + { + public long? goods_id { get; set; } + public List enjoyed_benefit_type_list { get; set; } + public List not_enjoy_benefit_type_list { get; set; } + } + + public class goods_unit_create_limit_info + { + public int? min_discount { get; set; } //2100, + public int? max_discount { get; set; } // 8500, + public bool? limit_check { get; set; } // true, + public int? recommend_discount { get; set; } // 3400, + public int? benefit_discount { get; set; } // 2100, + public int? price_ratio_max_discount { get; set; } // 16900, + public bool? expensive_group_price_for_compare { get; set; } // false + + } + + public class XinKeLiJianCreateParam + { + public int? business_code { get; set; } = 500004; // 500004, + public bool? is_batch_create_promotion_event { get; set; } // true, + public string promotion_event_remark { get; set; } // " 商品首件立减123", + public string promotion_event_name { get; set; } // "首件优惠2025-10-21", + public int? promotion_event_type { get; set; } = 1; // 1 + public long? start_time { get; set; } // 1761010500000, + public bool? ignore_low_price_check { get; set; } = false; // false, + public bool? big_deal_check { get; set; } = true; // true, + public List goods_promotion_list { get; set; } + public string tool_full_channel { get; set; } = "10921_66105"; // 10921_66105 + } + + public class goods_promotion_param + { + public long? goods_id { get; set; } // 820277345858, + public int? create_discount_type { get; set; } // 1, + public int? discount_param { get; set; } // 3800 + + } + + public class invalid_goods_result + { + public long? id { get; set; } // 820199133267, + public string name { get; set; } // "针织紧身连衣裙女2021年春秋季新款修身内搭黑色包臀短裙辣妹裙子", + public string invalid_reason { get; set; } // "商品已经创建首件立减活动,不可重复创建", + public string goods_image { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/f493d3375d2ca3d2bc2905a5c594d3ad.jpeg", + public long? create_fail_code { get; set; } // 30001 + } + + public class PromotionEventRst + { + public List promotion_event_list { get; set; } + public int? total { get; set; } // 163 + } + + public class promotion_event_info + { + public int? total_goods_count { get; set; } // 1 + public string promotion_event_sn { get; set; } // "Z0775OM-811633098316090925" + public string promotion_event_name { get; set; } // "首件立减2025-10-21" + public long? start_time { get; set; } // 1761030547000 + public List discount_rule_list { get;set; } + public int? total_promotion_amount { get; set; } // 0, + public int? pull_mall_gmv { get; set; } // 0, + public int? order_price { get; set; } // 0, + public int? order_count { get; set; } // 0, + public long? source_mall_id { get; set; } // 492379693, + public int? promotion_event_type { get; set; } // 1, + public int? event_status { get; set; } // 1, + public int? sub_status { get; set; } // 1, + public goods_info goods_info { get; set; } + public bool? is_based_on_activity_price { get; set; } // false, + public string remark { get; set; } // "商品首件立减", + //public Dictionary new_customer_price_range { get; set; } // { "min": 27276, "max": 27276 }, + public price_range new_customer_price_range { get; set; } + public bottom_action_vo bottom_action_vo { get; set; } + + //自定义参数 + public string shopId { get; set; } + public string shopName { get; set; } + + } + + public class price_range + { + public int? min { get; set; } // 27276, + public int? max { get; set; } // 27276 + } + + public class discount_rule_info + { + public int? discount { get; set; } // 1500, + public int? min_order_amount { get; set; } // 1501 + } + + public class goods_info + { + public long? id { get; set; } // 819856256871, + public string goods_name { get; set; } // "粉色针织马甲背心女2021年春秋新款韩版宽松外搭V领毛衣坎肩上衣", + //public Dictionary group_price_range { get; set; } // { "min": 28776, "max": 28776 }, + public price_range group_price_range { get; set; } + public int? quantity { get; set; } // 99, + public string thumb_url{ get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/f01f5304ec0f8b18a75c526d23921fc9.jpeg", + public int remain_size{ get; set; } // 0 + } + + public class bottom_action_vo + { + public bool? is_can_recreate { get; set; } // false + } +} diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.resx b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.resx new file mode 100644 index 0000000..bf53fda --- /dev/null +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolShouJianLiJianForm.resx @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.Designer.cs index 573d07f..3c8d336 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.Designer.cs @@ -37,6 +37,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnStopActvity = new DevComponents.DotNetBar.PanelEx(); this.pnlTime = new System.Windows.Forms.Panel(); this.dtpCoupon1StartTime = new System.Windows.Forms.DateTimePicker(); this.lblStartTime = new System.Windows.Forms.Label(); @@ -85,7 +86,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colActivityPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colActivityStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -140,7 +143,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1208, 541); + this.splitContainer1.Size = new System.Drawing.Size(1184, 521); this.splitContainer1.SplitterDistance = 140; this.splitContainer1.TabIndex = 15; // @@ -151,6 +154,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms | System.Windows.Forms.AnchorStyles.Right))); this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnStopActvity); this.ucGroupBoxEx2.Controls.Add(this.pnlTime); this.ucGroupBoxEx2.Controls.Add(this.numQuantity); this.ucGroupBoxEx2.Controls.Add(this.lblQuantity); @@ -169,11 +173,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucGroupBoxEx2.Controls.Add(this.btnCreate); this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(1058, 140); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品查询创建"; // + // btnStopActvity + // + this.btnStopActvity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopActvity.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopActvity.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnStopActvity.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopActvity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStopActvity.Location = new System.Drawing.Point(898, 87); + this.btnStopActvity.Name = "btnStopActvity"; + this.btnStopActvity.Size = new System.Drawing.Size(104, 23); + this.btnStopActvity.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopActvity.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopActvity.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopActvity.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnStopActvity.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnStopActvity.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnStopActvity.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnStopActvity.Style.GradientAngle = 90; + this.btnStopActvity.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopActvity.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopActvity.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopActvity.TabIndex = 746; + this.btnStopActvity.Text = "一键结束活动"; + this.btnStopActvity.Click += new System.EventHandler(this.btnStopActvity_Click); + // // pnlTime // this.pnlTime.Controls.Add(this.dtpCoupon1StartTime); @@ -422,7 +451,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty; this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCreate.Location = new System.Drawing.Point(922, 32); + this.btnCreate.Location = new System.Drawing.Point(898, 32); this.btnCreate.Name = "btnCreate"; this.btnCreate.Size = new System.Drawing.Size(104, 23); this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -494,8 +523,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1208, 397); - this.splitContainer3.SplitterDistance = 367; + this.splitContainer3.Size = new System.Drawing.Size(1184, 377); + this.splitContainer3.SplitterDistance = 347; this.splitContainer3.TabIndex = 1; // // splitContainer2 @@ -516,7 +545,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.dgvProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1208, 367); + this.splitContainer2.Size = new System.Drawing.Size(1184, 347); this.splitContainer2.SplitterDistance = 300; this.splitContainer2.TabIndex = 0; // @@ -554,7 +583,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvShop.ReadOnly = true; this.dgvShop.RowHeadersWidth = 25; this.dgvShop.RowTemplate.Height = 23; - this.dgvShop.Size = new System.Drawing.Size(296, 367); + this.dgvShop.Size = new System.Drawing.Size(296, 347); this.dgvShop.TabIndex = 6; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // @@ -644,7 +673,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(427, 158); + this.pbLoading.Location = new System.Drawing.Point(415, 148); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -660,7 +689,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1.Controls.Add(this.ucSplitPage1); this.panel1.Location = new System.Drawing.Point(36, 53); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(830, 281); + this.panel1.Size = new System.Drawing.Size(806, 261); this.panel1.TabIndex = 189; // // ucSplitPage1 @@ -668,7 +697,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.IsShowPageSize = false; - this.ucSplitPage1.Location = new System.Drawing.Point(245, 244); + this.ucSplitPage1.Location = new System.Drawing.Point(221, 224); 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); @@ -704,7 +733,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colSpuId, this.colProductName, this.colPrice, + this.colActivityPrice, this.colStock, + this.colActivityStock, this.colFavorites, this.colSales, this.colSalesThirtyDays, @@ -715,7 +746,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(900, 367); + this.dgvProduct.Size = new System.Drawing.Size(876, 347); this.dgvProduct.TabIndex = 187; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // @@ -782,6 +813,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colPrice.ReadOnly = true; this.colPrice.Width = 90; // + // colActivityPrice + // + this.colActivityPrice.HeaderText = "活动价格"; + this.colActivityPrice.Name = "colActivityPrice"; + this.colActivityPrice.ReadOnly = true; + this.colActivityPrice.Visible = false; + this.colActivityPrice.Width = 90; + // // colStock // this.colStock.HeaderText = "库存"; @@ -789,6 +828,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colStock.ReadOnly = true; this.colStock.Width = 70; // + // colActivityStock + // + this.colActivityStock.HeaderText = "活动库存"; + this.colActivityStock.Name = "colActivityStock"; + this.colActivityStock.ReadOnly = true; + this.colActivityStock.Visible = false; + // // colFavorites // this.colFavorites.HeaderText = "收藏"; @@ -841,8 +887,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.splitContainer4.Panel2.Controls.Add(this.btnClear); this.splitContainer4.Panel2.Controls.Add(this.btnCancel); - this.splitContainer4.Size = new System.Drawing.Size(1208, 26); - this.splitContainer4.SplitterDistance = 517; + this.splitContainer4.Size = new System.Drawing.Size(1184, 26); + this.splitContainer4.SplitterDistance = 493; this.splitContainer4.TabIndex = 3; // // statusBar @@ -853,7 +899,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.statusBar.Location = new System.Drawing.Point(0, 0); this.statusBar.Margin = new System.Windows.Forms.Padding(0); this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(517, 26); + this.statusBar.Size = new System.Drawing.Size(493, 26); this.statusBar.TabIndex = 2; // // btnClear @@ -904,12 +950,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; this.btnCancel.TabIndex = 668; this.btnCancel.Text = "停止当前操作"; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // PDDProdActivityToolXianShiXianLiangForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1208, 541); + this.ClientSize = new System.Drawing.Size(1184, 521); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "PDDProdActivityToolXianShiXianLiangForm"; @@ -979,20 +1026,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.Panel panel1; private UserControls.UcSplitPage ucSplitPage1; private UserComponent.DataGridViewEx dgvProduct; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; - private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; - private System.Windows.Forms.DataGridViewImageColumn colImg; - private System.Windows.Forms.DataGridViewLinkColumn colSpuId; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; - private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; - private System.Windows.Forms.DataGridViewTextBoxColumn colStock; - private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; - private System.Windows.Forms.DataGridViewTextBoxColumn colSales; - private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; - private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; - private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private System.Windows.Forms.SplitContainer splitContainer4; private UserControls.StatusBarUserControl statusBar; private DevComponents.DotNetBar.PanelEx btnClear; @@ -1011,5 +1044,22 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private DevComponents.DotNetBar.Controls.Line line2; private UserComponent.UcCheckBox chkTime; private System.Windows.Forms.Panel pnlTime; + private DevComponents.DotNetBar.PanelEx btnStopActvity; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colImg; + private System.Windows.Forms.DataGridViewLinkColumn colSpuId; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colActivityPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colActivityStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; + private System.Windows.Forms.DataGridViewTextBoxColumn colSales; + private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; + private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.cs index 3920ba5..f570b1b 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.cs @@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms if (row == null) { this.dgvShop.Rows.Add( - !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + canUse, shopEntity.LoginName, shopEntity.ShopId, shopEntity.ShopAccount, @@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms } else { - row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + //row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId); row.Cells["colShopLoginName"].Value = shopEntity.LoginName; row.Cells["colShopName"].Value = shopEntity.ShopAccount; row.Cells["colShopNotes"].Value = shopEntity.Notes; @@ -178,7 +180,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms return result; } - public string get_xianshixianliang_goods_skus(ShopLoginInfo shop, List goodsIdLst, long startTime, long endTime, int page = 1, int pageSize = 20) + public string get_xianshixianliang_goods_skus(ShopLoginInfo shop, List goodsIdLst) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); if (shop.AntiContents.Count > 0) @@ -235,6 +237,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms return result; } + public string get_xianshixianliang_activity_prod_list(ShopLoginInfo shop, int page = 1, int pageSize = 20) + { + 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/libra-backend/mms/activity/marketing/query"; + string body = @"{""status_list"":[1,2],""activity_types"":[3,12],""page_no"":" + page + @",""page_size"":" + pageSize + @",""order"":1}"; + + string refere = "https://mms.pinduoduo.com/tool/promotion?tool_full_channel=10921_77271&activeKey=1"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string stop_xianshixianliang_activity(ShopLoginInfo shop, long activityId, long goodsId = 20) + { + 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/libra-backend/mms/activity/marketing/stop"; + string body = "{\"activity_id\":" + activityId + ",\"goods_id\":" + goodsId + "}"; + + string refere = "https://mms.pinduoduo.com/tool/promotion?tool_full_channel=10921_77271"; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + private void btnCreate_Click(object sender, EventArgs e) { var lstShopId = dgvShop.Rows.Cast() @@ -256,10 +308,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { row.Cells["colMessage"].Value = ""; } + this.dgvProduct.Columns["colActivityStock"].Visible = false; + this.dgvProduct.Columns["colActivityPrice"].Visible = false; - - if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true) - PDDShopLoginForm.shopLoginInstance.Dispose(); ucGroupBoxEx2.Enabled = false; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => @@ -320,24 +371,27 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms int totalPage = 1; bool isError = false; string errMsg = ""; - while (page < totalPage) + while (page <= totalPage) { if (cancellationTokenSource.IsCancellationRequested) break; - page++; + if (page == 0) + page++; + PDDActivityToolGoodsListInfo pddActivityToolGoodsTmp = new PDDActivityToolGoodsListInfo(); int tryCount = 0; + int pageSpan = 0; tryAgain: GetToken(shop); - if (page > 1) + if (page >= 1) Thread.Sleep(Randomx.GetId(3000, 7000)); long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value); long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1; - string jsonStr = get_xianshixianliang_goods(shop, startStamp, endStamp, chkQuantity.Checked ? 3 : 12, page, pageSize); + string jsonStr = get_xianshixianliang_goods(shop, startStamp, endStamp, chkQuantity.Checked ? 3 : 12, page + pageSpan, pageSize); jsonStr = GetHtml.Unicode2String(jsonStr); if (jsonStr.Contains("繁忙") && tryCount < 5) { @@ -355,25 +409,43 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) errMsg += sErr + " "; - page++; continue; } if (jsonStr.Contains("\"success\":true")) { - PDDActivityToolGoodsListInfo pddActivityToolGoodsTmp = new PDDActivityToolGoodsListInfo(); + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + try { var jObj = JObject.Parse(jsonStr); var rstStr = JsonHelper.SerializeObject(jObj["result"]); - pddActivityToolGoodsTmp = JsonHelper.DeserializeJsonToObject(rstStr); + var pddActivityToolGoodsTmp2 = JsonHelper.DeserializeJsonToObject(rstStr); + pddActivityToolGoodsTmp.remaining_create_num = pddActivityToolGoodsTmp.remaining_create_num; + pddActivityToolGoodsTmp.total = pddActivityToolGoodsTmp.total; + pddActivityToolGoodsTmp.goods_list.AddRange(pddActivityToolGoodsTmp2.goods_list); + this.pddActivityToolGoods.remaining_create_num = pddActivityToolGoodsTmp.remaining_create_num; this.pddActivityToolGoods.total = pddActivityToolGoodsTmp.total; } catch (Exception ex) { - BaseMsgForm.ShowError(ex.Message); + BaseMsgForm.ShowError(ex.Message); } + pddActivityToolGoodsTmp.goods_list = pddActivityToolGoodsTmp.goods_list.Where(g => !pddActivityToolGoods.goods_list.Any(a => a.goods_id == g.goods_id)).ToList(); + if (pddActivityToolGoodsTmp.goods_list.Count == 0) + { + page++; + continue; + } + if (page + pageSpan < totalPage && pddActivityToolGoodsTmp.goods_list.Count < 8) + { + pageSpan++; + goto tryAgain; + } + pageSpan = 0; + foreach (var pInfo in pddActivityToolGoodsTmp.goods_list) { pInfo.shopId = shop.ShopId; @@ -393,7 +465,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms pInfo.goods_id, pInfo.goods_name, string.Join("~", pInfo.sku_group_price.Select(s => s / 100m)), + "", pInfo.quantity, + "", "", //收藏 "", //总销量 "", //30日销量 @@ -405,14 +479,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms })); } } + int discountVal = 0; Invoke(new Action(() => { discountVal = (numReducedAmount.Value * 100).ParseToInt(); })); - var jsonSkusStr = get_xianshixianliang_goods_skus(shop, pddActivityToolGoodsTmp.goods_list.Select(g => g.goods_id.ParseToLong()).ToList(), - startStamp, endStamp, page, pageSize); + var jsonSkusStr = get_xianshixianliang_goods_skus(shop, pddActivityToolGoodsTmp.goods_list.Select(g => g.goods_id.ParseToLong()).ToList()); jsonSkusStr = GetHtml.Unicode2String(jsonSkusStr); if (!jsonSkusStr.Contains("\"success\":true")) { @@ -424,7 +498,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms string sErr = BaseRegex.GetStringJson(ref jsonSkusStr, "error_msg"); if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) errMsg += sErr + " "; - page++; continue; } List pddActivityToolGoodsSkuListTmp = new List(); @@ -576,9 +649,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } } } - - int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); - totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); } } @@ -624,30 +694,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { dicShopGetCount[shop] = 0; - while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) - { - Thread.Sleep(500); - } + //while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) + //{ + // Thread.Sleep(500); + //} + //Invoke(new Action(() => + //{ + // this.panel1.SendToBack(); + // PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + // loginForm.TopLevel = false; + // loginForm.openType = EnumOpenType.manage; + // loginForm.WindowState = FormWindowState.Maximized; + // loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + // loginForm.Dock = DockStyle.Fill; + // this.panel1.Controls.Add(loginForm); + // loginForm.Show(); + //})); + //int sleepTime = Randomx.GetId(2000, 3000); + //Thread.Sleep(sleepTime); + + //Invoke(new Action(() => + //{ + // if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Dispose(); + //})); + + PDDShopLoginForm loginForm = null; Invoke(new Action(() => { this.panel1.SendToBack(); - PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + loginForm = new PDDShopLoginForm(shop); loginForm.TopLevel = false; loginForm.openType = EnumOpenType.manage; loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; loginForm.Dock = DockStyle.Fill; this.panel1.Controls.Add(loginForm); loginForm.Show(); })); - int sleepTime = Randomx.GetId(2000, 3000); - Thread.Sleep(sleepTime); + Thread.Sleep(Randomx.GetId(3000, 5000)); Invoke(new Action(() => { - if (PDDShopLoginForm.shopLoginInstance != null) - PDDShopLoginForm.shopLoginInstance.Dispose(); + if (loginForm != null) + loginForm.Close(); })); } } @@ -717,5 +808,304 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { chkDiscountTenth.Checked = !chkReducedAmount.Checked; } + + private void btnStopActvity_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddActivityToolGoods.goods_list.Clear(); + pddActivityToolGoods.remaining_create_num = 1; + pddActivityToolGoods.total = 1; + + dgvProduct.Rows.Clear(); + List activityGoodsInfoLst = new List(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colActivityStock"].Visible = true; + this.dgvProduct.Columns["colActivityPrice"].Visible = true; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + int page = 0; + int pageSize = 20; + int totalPage = 1; + bool isError = false; + string errMsg = ""; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (page == 0) + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page >= 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + //long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value); + //long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1; + string jsonStr = get_xianshixianliang_activity_prod_list(shop, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + MarketingActivityResult marketingActivityRst = new MarketingActivityResult(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + marketingActivityRst = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + foreach (var pInfo in marketingActivityRst.marketing_activity_list) + { + if (pInfo.online_quantity < pInfo.online_activity_quantity) + { + } + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null && !activityGoodsInfoLst.Any(a => a.goods_id == pInfo.goods_id)) + { + activityGoodsInfoLst.Add(pInfo); + string url = pInfo.hd_thumb_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.goods_id, + pInfo.goods_name, + pInfo.min_on_sale_group_price / 100m + "~" + pInfo.max_on_sale_group_price / 100m, + pInfo.price_info.FirstOrDefault()?.min_pre_sale_price / 100m + "~" + pInfo.price_info.FirstOrDefault()?.max_pre_sale_price / 100m, //活动售价 + pInfo.online_quantity, + pInfo.online_activity_quantity == 2147483647 ? "不限" : pInfo.online_activity_quantity.ToString(), // 活动库存 + "", //收藏 + "", //总销量 + "", //30日销量 + "可结束", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + if (marketingActivityRst.marketing_activity_list.Count == 0) + { + page++; + continue; + } + + foreach (var activityGoods in marketingActivityRst.marketing_activity_list) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + if (cancellationTokenSource.IsCancellationRequested) + break; + + var creatRst = stop_xianshixianliang_activity(shop, activityGoods.activity_id.ParseToLong(), activityGoods.goods_id.ParseToLong()); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["colSpuId"].Value.ParseToLong() == activityGoods.goods_id); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + else + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["colSpuId"].Value.ParseToLong() == activityGoods.goods_id); + if (row != null) + { + row.Cells["colOpResult"].Value = "结束活动成功!"; + } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "online_sum").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已结束活动"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "结束活动失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "结束活动已完成!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消结束活动!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } + } + + public class MarketingActivityResult + { + public List marketing_activity_list { get; set; } + public int? page_no { get; set; } // 1, + public int? page_size { get; set; } // 40, + public int? order { get; set; } // 1, + public int? record_sum { get; set; } // 189, + public int? online_sum { get; set; } // 189, + public int? batch_limit { get; set; } // 50, + public int? total_limit { get; set; } // 10000, + public long? server_time { get; set; } // 1761033081 + } + + public class marketing_activity_info + { + public long? activity_id { get; set; } + public string activity_name { get; set; } + public int? activity_type { get; set; } + public string activity_type_name + { + get + { + if (activity_type == 3) + return "限量优惠"; + if (activity_type == 12) + return "限时优惠"; + return ""; + } + } + public long? goods_id { get; set; } + public string goods_name { get; set; } + public string hd_thumb_url { get; set; } + public int? min_on_sale_group_price { get; set; } + public int? max_on_sale_group_price { get; set; } + public int? online_quantity { get; set; }// 1584, + public int? online_activity_quantity { get; set; }// 100, + public int? sold_activity_quantity { get; set; }// 0, + public List price_info { get; set; } + + //自定义参数 + public string shopId { get; set; } + public string shopName { get; set; } + } + public class price_info + { + public int? max_pre_sale_price { get; set; }// 8613, + public int? min_pre_sale_price { get; set; }// 8343, } } diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.resx b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.resx index ff9031b..6b1b486 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.resx +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdActivityToolXianShiXianLiangForm.resx @@ -168,9 +168,15 @@ True + + True + True + + True + True diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponForm.cs index c9fb605..8c808e6 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponForm.cs @@ -17,6 +17,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms public Lazy prodCouponShangPinLiJianForm = new Lazy(); public Lazy prodCouponLingQuanZhongXinForm = new Lazy(); public Lazy prodActivityToolXianShiXianLiangForm = new Lazy(); + public Lazy prodActivityToolShouJianLiJianForm = new Lazy(); public PDDProdCouponForm() { @@ -30,6 +31,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucTabControl1.TabPages.Add("商品立减券"); this.ucTabControl1.TabPages.Add("领券中心券"); this.ucTabControl1.TabPages.Add("限时限量购"); + this.ucTabControl1.TabPages.Add("首件立减"); this.ucTabControl1.SelectedIndex = 0; ucTabControl1_SelectedIndexChanged(null, null); } @@ -53,6 +55,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms case "限时限量购": SetForm(prodActivityToolXianShiXianLiangForm.Value); break; + case "首件立减": + SetForm(prodActivityToolShouJianLiJianForm.Value); + break; } } diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.Designer.cs index 1e11498..1f0438a 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.Designer.cs @@ -30,13 +30,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx(); this.label14 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.numCouponValue = new System.Windows.Forms.NumericUpDown(); @@ -71,9 +72,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1 = new System.Windows.Forms.Panel(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); + this.btnCancel = new DevComponents.DotNetBar.PanelEx(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -85,10 +91,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.splitContainer4 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.btnClear = new DevComponents.DotNetBar.PanelEx(); - this.btnCancel = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -131,7 +133,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1169, 515); + this.splitContainer1.Size = new System.Drawing.Size(1184, 521); this.splitContainer1.SplitterDistance = 140; this.splitContainer1.TabIndex = 14; // @@ -142,6 +144,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms | System.Windows.Forms.AnchorStyles.Right))); this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnStopCoupon); this.ucGroupBoxEx2.Controls.Add(this.label14); this.ucGroupBoxEx2.Controls.Add(this.label11); this.ucGroupBoxEx2.Controls.Add(this.numCouponValue); @@ -159,11 +162,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucGroupBoxEx2.Controls.Add(this.label1); this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(1019, 140); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品查询"; // + // btnStopCoupon + // + this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStopCoupon.Location = new System.Drawing.Point(898, 87); + this.btnStopCoupon.Name = "btnStopCoupon"; + this.btnStopCoupon.Size = new System.Drawing.Size(104, 23); + this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnStopCoupon.Style.GradientAngle = 90; + this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.TabIndex = 750; + this.btnStopCoupon.Text = "一键结束优惠"; + this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click); + // // label14 // this.label14.AutoSize = true; @@ -310,7 +338,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty; this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCreate.Location = new System.Drawing.Point(883, 32); + this.btnCreate.Location = new System.Drawing.Point(898, 32); this.btnCreate.Name = "btnCreate"; this.btnCreate.Size = new System.Drawing.Size(104, 23); this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -392,8 +420,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1169, 371); - this.splitContainer3.SplitterDistance = 341; + this.splitContainer3.Size = new System.Drawing.Size(1184, 377); + this.splitContainer3.SplitterDistance = 347; this.splitContainer3.TabIndex = 1; // // splitContainer2 @@ -414,7 +442,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.dgvProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1169, 341); + this.splitContainer2.Size = new System.Drawing.Size(1184, 347); this.splitContainer2.SplitterDistance = 300; this.splitContainer2.TabIndex = 0; // @@ -422,18 +450,18 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; + 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; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -452,7 +480,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvShop.ReadOnly = true; this.dgvShop.RowHeadersWidth = 25; this.dgvShop.RowTemplate.Height = 23; - this.dgvShop.Size = new System.Drawing.Size(296, 341); + this.dgvShop.Size = new System.Drawing.Size(296, 347); this.dgvShop.TabIndex = 6; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // @@ -542,7 +570,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(407, 145); + this.pbLoading.Location = new System.Drawing.Point(415, 148); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -558,7 +586,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1.Controls.Add(this.ucSplitPage1); this.panel1.Location = new System.Drawing.Point(36, 53); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(791, 255); + this.panel1.Size = new System.Drawing.Size(806, 261); this.panel1.TabIndex = 189; // // ucSplitPage1 @@ -566,7 +594,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.IsShowPageSize = false; - this.ucSplitPage1.Location = new System.Drawing.Point(206, 218); + this.ucSplitPage1.Location = new System.Drawing.Point(221, 224); 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); @@ -580,23 +608,24 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.dgvProduct.AllowUserToAddRows = false; this.dgvProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; this.dgvProduct.BackgroundColor = System.Drawing.Color.White; this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9; + 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.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, this.colSupplierId, this.colSupplierName, + this.col_coupon_sn, this.colImgUrl, this.colImg, this.colSpuId, @@ -613,10 +642,90 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(861, 341); + this.dgvProduct.Size = new System.Drawing.Size(876, 347); this.dgvProduct.TabIndex = 187; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // + // splitContainer4 + // + this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer4.Location = new System.Drawing.Point(0, 0); + this.splitContainer4.Name = "splitContainer4"; + // + // splitContainer4.Panel1 + // + this.splitContainer4.Panel1.Controls.Add(this.statusBar); + // + // splitContainer4.Panel2 + // + this.splitContainer4.Panel2.Controls.Add(this.btnClear); + this.splitContainer4.Panel2.Controls.Add(this.btnCancel); + this.splitContainer4.Size = new System.Drawing.Size(1184, 26); + this.splitContainer4.SplitterDistance = 493; + this.splitContainer4.TabIndex = 3; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(493, 26); + this.statusBar.TabIndex = 2; + // + // btnClear + // + this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; + this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnClear.Location = new System.Drawing.Point(4, 1); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(90, 21); + this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.Style.GradientAngle = 90; + this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.TabIndex = 440; + this.btnClear.Text = "清空结果"; + this.btnClear.Visible = false; + // + // btnCancel + // + this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control; + this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty; + this.btnCancel.Location = new System.Drawing.Point(568, 1); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(115, 21); + this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnCancel.Style.GradientAngle = 90; + this.btnCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnCancel.TabIndex = 668; + this.btnCancel.Text = "停止当前操作"; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // // colCheck // this.colCheck.Frozen = true; @@ -640,6 +749,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colSupplierName.ReadOnly = true; this.colSupplierName.Width = 110; // + // col_coupon_sn + // + this.col_coupon_sn.HeaderText = "活动编码"; + this.col_coupon_sn.Name = "col_coupon_sn"; + this.col_coupon_sn.ReadOnly = true; + this.col_coupon_sn.Visible = false; + // // colImgUrl // this.colImgUrl.HeaderText = "图片地址"; @@ -666,8 +782,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // // colProductName // - dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; @@ -724,91 +840,11 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colOpResult.ReadOnly = true; this.colOpResult.Width = 200; // - // splitContainer4 - // - this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this.splitContainer4.Location = new System.Drawing.Point(0, 0); - this.splitContainer4.Name = "splitContainer4"; - // - // splitContainer4.Panel1 - // - this.splitContainer4.Panel1.Controls.Add(this.statusBar); - // - // splitContainer4.Panel2 - // - this.splitContainer4.Panel2.Controls.Add(this.btnClear); - this.splitContainer4.Panel2.Controls.Add(this.btnCancel); - this.splitContainer4.Size = new System.Drawing.Size(1169, 26); - this.splitContainer4.SplitterDistance = 478; - this.splitContainer4.TabIndex = 3; - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(478, 26); - this.statusBar.TabIndex = 2; - // - // btnClear - // - this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; - this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnClear.Location = new System.Drawing.Point(4, 1); - this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(90, 21); - this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.Style.GradientAngle = 90; - this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.TabIndex = 440; - this.btnClear.Text = "清空结果"; - this.btnClear.Visible = false; - // - // btnCancel - // - this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control; - this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty; - this.btnCancel.Location = new System.Drawing.Point(568, 1); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(115, 21); - this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.btnCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.btnCancel.Style.GradientAngle = 90; - this.btnCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.btnCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnCancel.TabIndex = 668; - this.btnCancel.Text = "停止当前操作"; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // // PDDProdCouponJingXiForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1169, 515); + this.ClientSize = new System.Drawing.Size(1184, 521); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "PDDProdCouponJingXiForm"; @@ -883,9 +919,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.Label label2; private DevComponents.DotNetBar.PanelEx btnCreate; private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.NumericUpDown numCouponValue; + private System.Windows.Forms.Label label14; + private DevComponents.DotNetBar.PanelEx btnStopCoupon; private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn; private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; private System.Windows.Forms.DataGridViewImageColumn colImg; private System.Windows.Forms.DataGridViewLinkColumn colSpuId; @@ -897,8 +938,5 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.NumericUpDown numCouponValue; - private System.Windows.Forms.Label label14; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.cs index e7f296e..50ca003 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.cs @@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms if (row == null) { this.dgvShop.Rows.Add( - !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + canUse, shopEntity.LoginName, shopEntity.ShopId, shopEntity.ShopAccount, @@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms } else { - row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + //row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId); row.Cells["colShopLoginName"].Value = shopEntity.LoginName; row.Cells["colShopName"].Value = shopEntity.ShopAccount; row.Cells["colShopNotes"].Value = shopEntity.Notes; @@ -201,6 +203,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms return result; } + public string get_jingxi_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20) + { + 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/madrid/query_mms_mall_batch_list"; + string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"2\",\"source_type\":1242,\"batch_status\":" + batch_status + "}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string close_jingxi_coupon(ShopLoginInfo shop, string event_sn, int batch_status) + { + 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/madrid/close_mall_batch"; + string body = @"{""batch_sn"":""" + event_sn + @"""}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + private void btnCreate_Click(object sender, EventArgs e) { var lstShopId = dgvShop.Rows.Cast() @@ -223,10 +275,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { row.Cells["colMessage"].Value = ""; } + this.dgvProduct.Columns["colPrice"].HeaderText = "价格"; + this.dgvProduct.Columns["colStock"].HeaderText = "库存"; - - if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true) - PDDShopLoginForm.shopLoginInstance.Dispose(); ucGroupBoxEx2.Enabled = false; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => @@ -352,6 +403,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms pInfo.is_filtered != true, shop.ShopId, shop.ShopAccount, + "", url.Replace("https", "http"), DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); pInfo.id, @@ -381,7 +433,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id); if (row != null) { - row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!"; + row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" + + pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" + + pInfo.coupon_value_limit.LastOrDefault() / 100m; } } } @@ -493,6 +547,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms })); }, cancellationTokenSource.Token); } + public void GetToken(ShopLoginInfo shop) { if (!dicShopGetCount.Keys.Contains(shop)) @@ -503,30 +558,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { dicShopGetCount[shop] = 0; - while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) - { - Thread.Sleep(500); - } + //while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) + //{ + // Thread.Sleep(500); + //} + //Invoke(new Action(() => + //{ + // this.panel1.SendToBack(); + // PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + // loginForm.TopLevel = false; + // loginForm.openType = EnumOpenType.manage; + // loginForm.WindowState = FormWindowState.Maximized; + // loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + // loginForm.Dock = DockStyle.Fill; + // this.panel1.Controls.Add(loginForm); + // loginForm.Show(); + //})); + //int sleepTime = Randomx.GetId(2000, 3000); + //Thread.Sleep(sleepTime); + + //Invoke(new Action(() => + //{ + // if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Dispose(); + //})); + + PDDShopLoginForm loginForm = null; Invoke(new Action(() => { this.panel1.SendToBack(); - PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + loginForm = new PDDShopLoginForm(shop); loginForm.TopLevel = false; loginForm.openType = EnumOpenType.manage; loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; loginForm.Dock = DockStyle.Fill; this.panel1.Controls.Add(loginForm); loginForm.Show(); })); - int sleepTime = Randomx.GetId(2000, 3000); - Thread.Sleep(sleepTime); + Thread.Sleep(Randomx.GetId(3000, 5000)); Invoke(new Action(() => { - if (PDDShopLoginForm.shopLoginInstance != null) - PDDShopLoginForm.shopLoginInstance.Dispose(); + if (loginForm != null) + loginForm.Close(); })); } } @@ -566,5 +642,305 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms break; } } + + private void btnStopCoupon_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddCouponGoods.goods_list.Clear(); + pddCouponGoods.remaining_create_num = 1; + pddCouponGoods.total = 1; + + dgvProduct.Rows.Clear(); + List couponGoodsInfoLst = new List(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colPrice"].HeaderText = "面额"; + this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量"; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + bool isError = false; + string errMsg = ""; + for (int status = 1; status <= 4; status++) + { + if (status != 1 && status != 4) + continue; + + int page = 0; + int pageSize = 20; + int totalPage = 1; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (page == 0) + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page >= 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + string jsonStr = get_jingxi_coupon_goods_list(shop, status, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + JingXiCouponRst couponRst = new JingXiCouponRst(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + couponRst = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + couponRst.data_list = + couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.goods_id == p.goods_id)).ToList(); + if (couponRst.data_list.Count == 0) + { + page++; + continue; + } + foreach (var pInfo in couponRst.data_list) + { + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null) + { + couponGoodsInfoLst.Add(pInfo); + string url = pInfo.image_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + pInfo.batch_sn, + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.goods_id, + pInfo.goods_name, + pInfo.discount / 100m, + pInfo.init_quantity + "/" + pInfo.taked_quantity, + "", //收藏 + "", //总销量 + "", //30日销量 + "可结束", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + + foreach (var couponGoods in couponRst.data_list) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + if (cancellationTokenSource.IsCancellationRequested) + break; + + var creatRst = close_jingxi_coupon(shop, couponGoods.batch_sn, status); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + else + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = "结束优惠券成功!"; + } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已结束优惠券"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "结束优惠券已完成!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消结束优惠券!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } + } + + public class JingXiCouponRst + { + public int? expiring_count { get; set; } + public int? total { get; set; } // 32 + public List data_list { get; set; } + public bool? in_expiring_ab_test { get; set; } // true + } + + public class jing_xi_coupon_data_info + { + public string batch_id { get; set; } // "40027325682", + public string batch_sn { get; set; } // "A1242VC-811369214315922989", + public string batch_desc { get; set; } // "惊喜券", + public string source_type_str { get; set; } // "惊喜券", + public string batch_dimension_str { get; set; } // "商品券", + public int? discount { get; set; } // 200, + public int? min_amount { get; set; } // 200, + public long? batch_start_time { get; set; } // 1760958000000, + public long? batch_end_time { get; set; } // 1768665599000, + public long? valid_start_time { get; set; } // 1761103931339, + public long? valid_end_time { get; set; } // 1761753599000, + public string init_quantity { get; set; } // "594", + public int? remain_quantity { get; set; } // 592, + public string taked_quantity { get; set; } // "2", + public string used_quantity { get; set; } // "0", + public string status_str { get; set; } // "领取中", + public int? status_code { get; set; } // 2, + public bool? is_force_close_batch { get; set; } // false, + public int? user_limit { get; set; } // 3, + public int? source_type { get; set; } // 1242, + public int? period_type { get; set; } // 0, + public int? duration { get; set; } // 7, + public long? goods_id { get; set; } // 820156693761, + public string goods_name { get; set; } // "Simwood简木男装2021秋季新款纯棉衬衣休闲百搭牛津纺长袖衬衫男", + public string image_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/61a216c8e22bf14a313b04a97172ff54.jpeg", + public List scene_codes { get; set; } // [ "全场景通用" ], + public bool? can_end { get; set; } // true, + public bool? can_add_quantity { get; set; } // true, + public bool? can_postpone_close { get; set; } // true, + public int? goods_equity_type { get; set; } // 1, + public object goods_equity_ext_info { get; set; } // { }, + public string coupon_time_str { get; set; } // "领取后7天有效" + + //自定义店铺参数 + public string shopId { get; set; } + public string shopName { get; set; } } } diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.resx b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.resx index ff9031b..71f94aa 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.resx +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponJingXiForm.resx @@ -153,6 +153,9 @@ True + + True + True diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.Designer.cs index 14a5421..c4626a5 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.Designer.cs @@ -52,20 +52,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1 = new System.Windows.Forms.Panel(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx(); - this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); - this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.splitContainer4 = new System.Windows.Forms.SplitContainer(); this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.btnClear = new DevComponents.DotNetBar.PanelEx(); @@ -85,11 +71,27 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.chkCoupon3 = new TemuKJD.UserComponent.UcCheckBox(this.components); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.numCoupon2KeepDays = new System.Windows.Forms.NumericUpDown(); this.dtpCoupon2StartTime = new System.Windows.Forms.DateTimePicker(); this.btnCreate = new DevComponents.DotNetBar.PanelEx(); + this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); + this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout(); @@ -131,7 +133,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1251, 330); + this.splitContainer3.Size = new System.Drawing.Size(1184, 330); this.splitContainer3.SplitterDistance = 300; this.splitContainer3.TabIndex = 1; // @@ -153,7 +155,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.dgvProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1251, 300); + this.splitContainer2.Size = new System.Drawing.Size(1184, 300); this.splitContainer2.SplitterDistance = 300; this.splitContainer2.TabIndex = 0; // @@ -281,7 +283,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(448, 125); + this.pbLoading.Location = new System.Drawing.Point(415, 125); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -297,7 +299,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1.Controls.Add(this.ucSplitPage1); this.panel1.Location = new System.Drawing.Point(36, 53); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(873, 214); + this.panel1.Size = new System.Drawing.Size(806, 214); this.panel1.TabIndex = 189; // // ucSplitPage1 @@ -305,7 +307,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.IsShowPageSize = false; - this.ucSplitPage1.Location = new System.Drawing.Point(288, 177); + this.ucSplitPage1.Location = new System.Drawing.Point(221, 177); 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); @@ -336,6 +338,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colCheck, this.colSupplierId, this.colSupplierName, + this.col_coupon_sn, this.colImgUrl, this.colImg, this.colSpuId, @@ -352,117 +355,10 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(943, 300); + this.dgvProduct.Size = new System.Drawing.Size(876, 300); this.dgvProduct.TabIndex = 187; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // - // colCheck - // - this.colCheck.Frozen = true; - this.colCheck.HeaderText = "选择"; - this.colCheck.Name = "colCheck"; - this.colCheck.ReadOnly = true; - this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCheck.Width = 30; - // - // colSupplierId - // - this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.Name = "colSupplierId"; - this.colSupplierId.ReadOnly = true; - // - // colSupplierName - // - this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.Name = "colSupplierName"; - this.colSupplierName.ReadOnly = true; - this.colSupplierName.Width = 110; - // - // colImgUrl - // - this.colImgUrl.HeaderText = "图片地址"; - this.colImgUrl.Name = "colImgUrl"; - this.colImgUrl.ReadOnly = true; - this.colImgUrl.Visible = false; - // - // colImg - // - this.colImg.HeaderText = "图片"; - this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colImg.Name = "colImg"; - this.colImg.ReadOnly = true; - this.colImg.Width = 60; - // - // colSpuId - // - this.colSpuId.HeaderText = "商品ID"; - this.colSpuId.Name = "colSpuId"; - this.colSpuId.ReadOnly = true; - this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSpuId.Width = 80; - // - // colProductName - // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; - this.colProductName.HeaderText = "商品标题"; - this.colProductName.Name = "colProductName"; - this.colProductName.ReadOnly = true; - this.colProductName.Width = 260; - // - // colPrice - // - this.colPrice.HeaderText = "价格"; - this.colPrice.Name = "colPrice"; - this.colPrice.ReadOnly = true; - this.colPrice.Width = 90; - // - // colStock - // - this.colStock.HeaderText = "库存"; - this.colStock.Name = "colStock"; - this.colStock.ReadOnly = true; - this.colStock.Width = 70; - // - // colFavorites - // - this.colFavorites.HeaderText = "收藏"; - this.colFavorites.Name = "colFavorites"; - this.colFavorites.ReadOnly = true; - this.colFavorites.Visible = false; - this.colFavorites.Width = 50; - // - // colSales - // - this.colSales.HeaderText = "总销量"; - this.colSales.Name = "colSales"; - this.colSales.ReadOnly = true; - this.colSales.Visible = false; - this.colSales.Width = 60; - // - // colSalesThirtyDays - // - this.colSalesThirtyDays.HeaderText = "30日销量"; - this.colSalesThirtyDays.Name = "colSalesThirtyDays"; - this.colSalesThirtyDays.ReadOnly = true; - this.colSalesThirtyDays.Visible = false; - this.colSalesThirtyDays.Width = 70; - // - // colIsCanSet - // - this.colIsCanSet.HeaderText = "是否可设置"; - this.colIsCanSet.Name = "colIsCanSet"; - this.colIsCanSet.ReadOnly = true; - // - // colOpResult - // - this.colOpResult.HeaderText = "操作结果"; - this.colOpResult.Name = "colOpResult"; - this.colOpResult.ReadOnly = true; - this.colOpResult.Width = 200; - // // splitContainer4 // this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; @@ -478,8 +374,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.splitContainer4.Panel2.Controls.Add(this.btnClear); this.splitContainer4.Panel2.Controls.Add(this.btnCancel); - this.splitContainer4.Size = new System.Drawing.Size(1251, 26); - this.splitContainer4.SplitterDistance = 560; + this.splitContainer4.Size = new System.Drawing.Size(1184, 26); + this.splitContainer4.SplitterDistance = 493; this.splitContainer4.TabIndex = 3; // // statusBar @@ -490,7 +386,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.statusBar.Location = new System.Drawing.Point(0, 0); this.statusBar.Margin = new System.Windows.Forms.Padding(0); this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(560, 26); + this.statusBar.Size = new System.Drawing.Size(493, 26); this.statusBar.TabIndex = 2; // // btnClear @@ -719,7 +615,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1251, 474); + this.splitContainer1.Size = new System.Drawing.Size(1184, 474); this.splitContainer1.SplitterDistance = 140; this.splitContainer1.TabIndex = 15; // @@ -730,6 +626,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms | System.Windows.Forms.AnchorStyles.Right))); this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnStopCoupon); this.ucGroupBoxEx2.Controls.Add(this.label5); this.ucGroupBoxEx2.Controls.Add(this.label6); this.ucGroupBoxEx2.Controls.Add(this.numCoupon2KeepDays); @@ -748,11 +645,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucGroupBoxEx2.Controls.Add(this.btnCreate); this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(1101, 140); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品查询"; // + // btnStopCoupon + // + this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStopCoupon.Location = new System.Drawing.Point(898, 87); + this.btnStopCoupon.Name = "btnStopCoupon"; + this.btnStopCoupon.Size = new System.Drawing.Size(104, 23); + this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnStopCoupon.Style.GradientAngle = 90; + this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.TabIndex = 754; + this.btnStopCoupon.Text = "一键结束优惠"; + this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click); + // // label5 // this.label5.AutoSize = true; @@ -806,7 +728,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty; this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCreate.Location = new System.Drawing.Point(965, 32); + this.btnCreate.Location = new System.Drawing.Point(898, 32); this.btnCreate.Name = "btnCreate"; this.btnCreate.Size = new System.Drawing.Size(104, 23); this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -824,11 +746,125 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCreate.Text = "开始创建"; this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click); // + // colCheck + // + this.colCheck.Frozen = true; + this.colCheck.HeaderText = "选择"; + this.colCheck.Name = "colCheck"; + this.colCheck.ReadOnly = true; + this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCheck.Width = 30; + // + // colSupplierId + // + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + // + // colSupplierName + // + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + this.colSupplierName.Width = 110; + // + // col_coupon_sn + // + this.col_coupon_sn.HeaderText = "活动编码"; + this.col_coupon_sn.Name = "col_coupon_sn"; + this.col_coupon_sn.ReadOnly = true; + this.col_coupon_sn.Visible = false; + // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colImg + // + this.colImg.HeaderText = "图片"; + this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colImg.Name = "colImg"; + this.colImg.ReadOnly = true; + this.colImg.Width = 60; + // + // colSpuId + // + this.colSpuId.HeaderText = "商品ID"; + this.colSpuId.Name = "colSpuId"; + this.colSpuId.ReadOnly = true; + this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSpuId.Width = 80; + // + // colProductName + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; + this.colProductName.HeaderText = "商品标题"; + this.colProductName.Name = "colProductName"; + this.colProductName.ReadOnly = true; + this.colProductName.Width = 260; + // + // colPrice + // + this.colPrice.HeaderText = "价格"; + this.colPrice.Name = "colPrice"; + this.colPrice.ReadOnly = true; + this.colPrice.Width = 90; + // + // colStock + // + this.colStock.HeaderText = "库存"; + this.colStock.Name = "colStock"; + this.colStock.ReadOnly = true; + this.colStock.Width = 70; + // + // colFavorites + // + this.colFavorites.HeaderText = "收藏"; + this.colFavorites.Name = "colFavorites"; + this.colFavorites.ReadOnly = true; + this.colFavorites.Visible = false; + this.colFavorites.Width = 50; + // + // colSales + // + this.colSales.HeaderText = "总销量"; + this.colSales.Name = "colSales"; + this.colSales.ReadOnly = true; + this.colSales.Visible = false; + this.colSales.Width = 60; + // + // colSalesThirtyDays + // + this.colSalesThirtyDays.HeaderText = "30日销量"; + this.colSalesThirtyDays.Name = "colSalesThirtyDays"; + this.colSalesThirtyDays.ReadOnly = true; + this.colSalesThirtyDays.Visible = false; + this.colSalesThirtyDays.Width = 70; + // + // colIsCanSet + // + this.colIsCanSet.HeaderText = "是否可设置"; + this.colIsCanSet.Name = "colIsCanSet"; + this.colIsCanSet.ReadOnly = true; + // + // colOpResult + // + this.colOpResult.HeaderText = "操作结果"; + this.colOpResult.Name = "colOpResult"; + this.colOpResult.ReadOnly = true; + this.colOpResult.Width = 200; + // // PDDProdCouponLingQuanZhongXinForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1251, 474); + this.ClientSize = new System.Drawing.Size(1184, 474); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "PDDProdCouponLingQuanZhongXinForm"; @@ -883,20 +919,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.Panel panel1; private UserControls.UcSplitPage ucSplitPage1; private UserComponent.DataGridViewEx dgvProduct; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; - private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; - private System.Windows.Forms.DataGridViewImageColumn colImg; - private System.Windows.Forms.DataGridViewLinkColumn colSpuId; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; - private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; - private System.Windows.Forms.DataGridViewTextBoxColumn colStock; - private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; - private System.Windows.Forms.DataGridViewTextBoxColumn colSales; - private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; - private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; - private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private System.Windows.Forms.SplitContainer splitContainer4; private UserControls.StatusBarUserControl statusBar; private DevComponents.DotNetBar.PanelEx btnClear; @@ -921,5 +943,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.DateTimePicker dtpCoupon2StartTime; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; + private DevComponents.DotNetBar.PanelEx btnStopCoupon; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colImg; + private System.Windows.Forms.DataGridViewLinkColumn colSpuId; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; + private System.Windows.Forms.DataGridViewTextBoxColumn colSales; + private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; + private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.cs index 4020824..5b48483 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.cs @@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms if (row == null) { this.dgvShop.Rows.Add( - !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + canUse, shopEntity.LoginName, shopEntity.ShopId, shopEntity.ShopAccount, @@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms } else { - row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + //row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId); row.Cells["colShopLoginName"].Value = shopEntity.LoginName; row.Cells["colShopName"].Value = shopEntity.ShopAccount; row.Cells["colShopNotes"].Value = shopEntity.Notes; @@ -200,6 +202,55 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms } return result; } + public string get_lingquanzhongxin_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20) + { + 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/madrid/query_mms_mall_batch_list"; + string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"\",\"source_type\":\"\",\"batch_status\":" + batch_status + "}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string close_lingquanzhongxin_coupon(ShopLoginInfo shop, string event_sn, int batch_status) + { + 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/madrid/close_mall_batch"; + string body = @"{""batch_sn"":""" + event_sn + @"""}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } private void btnCreate_Click(object sender, EventArgs e) { @@ -223,10 +274,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { row.Cells["colMessage"].Value = ""; } + this.dgvProduct.Columns["colPrice"].HeaderText = "价格"; + this.dgvProduct.Columns["colStock"].HeaderText = "库存"; - - if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true) - PDDShopLoginForm.shopLoginInstance.Dispose(); ucGroupBoxEx2.Enabled = false; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => @@ -352,6 +402,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms pInfo.is_filtered != true, shop.ShopId, shop.ShopAccount, + "", url.Replace("https", "http"), DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); pInfo.id, @@ -381,7 +432,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id); if (row != null) { - row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!"; + row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" + + pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" + + pInfo.coupon_value_limit.LastOrDefault() / 100m; } } } @@ -418,7 +471,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms duration = cmbCoupon3KeepHours.Text.Trim().Replace("小时", "").Replace("天", ""), goods_id = pInfo.id, init_quantity = 10000, //张数固定天一万 //pInfo.quantity, - period_type = 0, + period_type = cmbCoupon3KeepHours.Text.Trim().Contains("天") ? 0 : 2, status = 2, // 固定填2 user_limit = cmbCoupon3TicketNum.Text.Trim().Replace("张", "").ParseToInt(), }); @@ -512,30 +565,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { dicShopGetCount[shop] = 0; - while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) - { - Thread.Sleep(500); - } + //while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) + //{ + // Thread.Sleep(500); + //} + //Invoke(new Action(() => + //{ + // this.panel1.SendToBack(); + // PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + // loginForm.TopLevel = false; + // loginForm.openType = EnumOpenType.manage; + // loginForm.WindowState = FormWindowState.Maximized; + // loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + // loginForm.Dock = DockStyle.Fill; + // this.panel1.Controls.Add(loginForm); + // loginForm.Show(); + //})); + //int sleepTime = Randomx.GetId(2000, 3000); + //Thread.Sleep(sleepTime); + + //Invoke(new Action(() => + //{ + // if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Dispose(); + //})); + + PDDShopLoginForm loginForm = null; Invoke(new Action(() => { this.panel1.SendToBack(); - PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + loginForm = new PDDShopLoginForm(shop); loginForm.TopLevel = false; loginForm.openType = EnumOpenType.manage; loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; loginForm.Dock = DockStyle.Fill; this.panel1.Controls.Add(loginForm); loginForm.Show(); })); - int sleepTime = Randomx.GetId(2000, 3000); - Thread.Sleep(sleepTime); + Thread.Sleep(Randomx.GetId(3000, 5000)); Invoke(new Action(() => { - if (PDDShopLoginForm.shopLoginInstance != null) - PDDShopLoginForm.shopLoginInstance.Dispose(); + if (loginForm != null) + loginForm.Close(); })); } } @@ -575,5 +649,257 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms break; } } + + private void btnStopCoupon_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddCouponGoods.goods_list.Clear(); + pddCouponGoods.remaining_create_num = 1; + pddCouponGoods.total = 1; + + dgvProduct.Rows.Clear(); + List couponGoodsInfoLst = new List(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colPrice"].HeaderText = "面额"; + this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量"; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + bool isError = false; + string errMsg = ""; + for (int status = 1; status <= 4; status++) + { + if (status != 1 && status != 4) + continue; + + int page = 0; + int pageSize = 20; + int totalPage = 1; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (page == 0) + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page >= 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + string jsonStr = get_lingquanzhongxin_coupon_goods_list(shop, status, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + JingXiCouponRst couponRst = new JingXiCouponRst(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + couponRst = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + couponRst.data_list = + couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.batch_sn == p.batch_sn)).ToList(); + if (couponRst.data_list.Count == 0) + { + page++; + continue; + } + foreach (var pInfo in couponRst.data_list) + { + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null) + { + couponGoodsInfoLst.Add(pInfo); + string url = pInfo.image_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + pInfo.batch_sn, + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.goods_id, + pInfo.goods_name, + pInfo.discount / 100m, + pInfo.init_quantity + "/" + pInfo.taked_quantity, + "", //收藏 + "", //总销量 + "", //30日销量 + "可结束", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + + foreach (var couponGoods in couponRst.data_list) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + if (cancellationTokenSource.IsCancellationRequested) + break; + + var creatRst = close_lingquanzhongxin_coupon(shop, couponGoods.batch_sn, status); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + else + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = "结束优惠券成功!"; + } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已结束优惠券"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "结束优惠券已完成!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消结束优惠券!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } } } diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.resx b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.resx index ff9031b..71f94aa 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.resx +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponLingQuanZhongXinForm.resx @@ -153,6 +153,9 @@ True + + True + True diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.Designer.cs index 5dcc1c9..262c5d1 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.Designer.cs @@ -52,20 +52,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1 = new System.Windows.Forms.Panel(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx(); - this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); - this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.splitContainer4 = new System.Windows.Forms.SplitContainer(); this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.btnClear = new DevComponents.DotNetBar.PanelEx(); @@ -79,6 +65,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.label5 = new System.Windows.Forms.Label(); this.numCoupon2KeepDays = new System.Windows.Forms.NumericUpDown(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx(); this.label6 = new System.Windows.Forms.Label(); this.dtpCoupon2StartTime = new System.Windows.Forms.DateTimePicker(); this.txtCoupon2Name = new System.Windows.Forms.TextBox(); @@ -87,6 +74,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.chkCoupon2 = new TemuKJD.UserComponent.UcCheckBox(this.components); this.btnCreate = new DevComponents.DotNetBar.PanelEx(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); + this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout(); @@ -128,7 +130,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1210, 408); + this.splitContainer3.Size = new System.Drawing.Size(1184, 408); this.splitContainer3.SplitterDistance = 378; this.splitContainer3.TabIndex = 1; // @@ -150,7 +152,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.dgvProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1210, 378); + this.splitContainer2.Size = new System.Drawing.Size(1184, 378); this.splitContainer2.SplitterDistance = 300; this.splitContainer2.TabIndex = 0; // @@ -278,7 +280,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(428, 164); + this.pbLoading.Location = new System.Drawing.Point(415, 164); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -294,7 +296,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.panel1.Controls.Add(this.ucSplitPage1); this.panel1.Location = new System.Drawing.Point(36, 53); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(832, 292); + this.panel1.Size = new System.Drawing.Size(806, 292); this.panel1.TabIndex = 189; // // ucSplitPage1 @@ -302,7 +304,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.IsShowPageSize = false; - this.ucSplitPage1.Location = new System.Drawing.Point(247, 255); + this.ucSplitPage1.Location = new System.Drawing.Point(221, 255); 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); @@ -333,6 +335,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.colCheck, this.colSupplierId, this.colSupplierName, + this.col_coupon_sn, this.colImgUrl, this.colImg, this.colSpuId, @@ -349,117 +352,10 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(902, 378); + this.dgvProduct.Size = new System.Drawing.Size(876, 378); this.dgvProduct.TabIndex = 187; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // - // colCheck - // - this.colCheck.Frozen = true; - this.colCheck.HeaderText = "选择"; - this.colCheck.Name = "colCheck"; - this.colCheck.ReadOnly = true; - this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCheck.Width = 30; - // - // colSupplierId - // - this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.Name = "colSupplierId"; - this.colSupplierId.ReadOnly = true; - // - // colSupplierName - // - this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.Name = "colSupplierName"; - this.colSupplierName.ReadOnly = true; - this.colSupplierName.Width = 110; - // - // colImgUrl - // - this.colImgUrl.HeaderText = "图片地址"; - this.colImgUrl.Name = "colImgUrl"; - this.colImgUrl.ReadOnly = true; - this.colImgUrl.Visible = false; - // - // colImg - // - this.colImg.HeaderText = "图片"; - this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colImg.Name = "colImg"; - this.colImg.ReadOnly = true; - this.colImg.Width = 60; - // - // colSpuId - // - this.colSpuId.HeaderText = "商品ID"; - this.colSpuId.Name = "colSpuId"; - this.colSpuId.ReadOnly = true; - this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSpuId.Width = 80; - // - // colProductName - // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; - this.colProductName.HeaderText = "商品标题"; - this.colProductName.Name = "colProductName"; - this.colProductName.ReadOnly = true; - this.colProductName.Width = 260; - // - // colPrice - // - this.colPrice.HeaderText = "价格"; - this.colPrice.Name = "colPrice"; - this.colPrice.ReadOnly = true; - this.colPrice.Width = 90; - // - // colStock - // - this.colStock.HeaderText = "库存"; - this.colStock.Name = "colStock"; - this.colStock.ReadOnly = true; - this.colStock.Width = 70; - // - // colFavorites - // - this.colFavorites.HeaderText = "收藏"; - this.colFavorites.Name = "colFavorites"; - this.colFavorites.ReadOnly = true; - this.colFavorites.Visible = false; - this.colFavorites.Width = 50; - // - // colSales - // - this.colSales.HeaderText = "总销量"; - this.colSales.Name = "colSales"; - this.colSales.ReadOnly = true; - this.colSales.Visible = false; - this.colSales.Width = 60; - // - // colSalesThirtyDays - // - this.colSalesThirtyDays.HeaderText = "30日销量"; - this.colSalesThirtyDays.Name = "colSalesThirtyDays"; - this.colSalesThirtyDays.ReadOnly = true; - this.colSalesThirtyDays.Visible = false; - this.colSalesThirtyDays.Width = 70; - // - // colIsCanSet - // - this.colIsCanSet.HeaderText = "是否可设置"; - this.colIsCanSet.Name = "colIsCanSet"; - this.colIsCanSet.ReadOnly = true; - // - // colOpResult - // - this.colOpResult.HeaderText = "操作结果"; - this.colOpResult.Name = "colOpResult"; - this.colOpResult.ReadOnly = true; - this.colOpResult.Width = 200; - // // splitContainer4 // this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; @@ -475,8 +371,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // this.splitContainer4.Panel2.Controls.Add(this.btnClear); this.splitContainer4.Panel2.Controls.Add(this.btnCancel); - this.splitContainer4.Size = new System.Drawing.Size(1210, 26); - this.splitContainer4.SplitterDistance = 519; + this.splitContainer4.Size = new System.Drawing.Size(1184, 26); + this.splitContainer4.SplitterDistance = 493; this.splitContainer4.TabIndex = 3; // // statusBar @@ -487,7 +383,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.statusBar.Location = new System.Drawing.Point(0, 0); this.statusBar.Margin = new System.Windows.Forms.Padding(0); this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(519, 26); + this.statusBar.Size = new System.Drawing.Size(493, 26); this.statusBar.TabIndex = 2; // // btnClear @@ -655,6 +551,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms | System.Windows.Forms.AnchorStyles.Right))); this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnStopCoupon); this.ucGroupBoxEx2.Controls.Add(this.label14); this.ucGroupBoxEx2.Controls.Add(this.label11); this.ucGroupBoxEx2.Controls.Add(this.numCouponValue); @@ -670,11 +567,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.ucGroupBoxEx2.Controls.Add(this.btnCreate); this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(1060, 140); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品查询"; // + // btnStopCoupon + // + this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStopCoupon.Location = new System.Drawing.Point(898, 87); + this.btnStopCoupon.Name = "btnStopCoupon"; + this.btnStopCoupon.Size = new System.Drawing.Size(104, 23); + this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnStopCoupon.Style.GradientAngle = 90; + this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnStopCoupon.TabIndex = 758; + this.btnStopCoupon.Text = "一键结束优惠"; + this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click); + // // label6 // this.label6.AutoSize = true; @@ -740,7 +662,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty; this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCreate.Location = new System.Drawing.Point(924, 32); + this.btnCreate.Location = new System.Drawing.Point(898, 32); this.btnCreate.Name = "btnCreate"; this.btnCreate.Size = new System.Drawing.Size(104, 23); this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -774,15 +696,129 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1210, 552); + this.splitContainer1.Size = new System.Drawing.Size(1184, 552); this.splitContainer1.SplitterDistance = 140; this.splitContainer1.TabIndex = 15; // + // colCheck + // + this.colCheck.Frozen = true; + this.colCheck.HeaderText = "选择"; + this.colCheck.Name = "colCheck"; + this.colCheck.ReadOnly = true; + this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCheck.Width = 30; + // + // colSupplierId + // + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + // + // colSupplierName + // + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + this.colSupplierName.Width = 110; + // + // col_coupon_sn + // + this.col_coupon_sn.HeaderText = "活动编码"; + this.col_coupon_sn.Name = "col_coupon_sn"; + this.col_coupon_sn.ReadOnly = true; + this.col_coupon_sn.Visible = false; + // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colImg + // + this.colImg.HeaderText = "图片"; + this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colImg.Name = "colImg"; + this.colImg.ReadOnly = true; + this.colImg.Width = 60; + // + // colSpuId + // + this.colSpuId.HeaderText = "商品ID"; + this.colSpuId.Name = "colSpuId"; + this.colSpuId.ReadOnly = true; + this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSpuId.Width = 80; + // + // colProductName + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; + this.colProductName.HeaderText = "商品标题"; + this.colProductName.Name = "colProductName"; + this.colProductName.ReadOnly = true; + this.colProductName.Width = 260; + // + // colPrice + // + this.colPrice.HeaderText = "价格"; + this.colPrice.Name = "colPrice"; + this.colPrice.ReadOnly = true; + this.colPrice.Width = 90; + // + // colStock + // + this.colStock.HeaderText = "库存"; + this.colStock.Name = "colStock"; + this.colStock.ReadOnly = true; + this.colStock.Width = 70; + // + // colFavorites + // + this.colFavorites.HeaderText = "收藏"; + this.colFavorites.Name = "colFavorites"; + this.colFavorites.ReadOnly = true; + this.colFavorites.Visible = false; + this.colFavorites.Width = 50; + // + // colSales + // + this.colSales.HeaderText = "总销量"; + this.colSales.Name = "colSales"; + this.colSales.ReadOnly = true; + this.colSales.Visible = false; + this.colSales.Width = 60; + // + // colSalesThirtyDays + // + this.colSalesThirtyDays.HeaderText = "30日销量"; + this.colSalesThirtyDays.Name = "colSalesThirtyDays"; + this.colSalesThirtyDays.ReadOnly = true; + this.colSalesThirtyDays.Visible = false; + this.colSalesThirtyDays.Width = 70; + // + // colIsCanSet + // + this.colIsCanSet.HeaderText = "是否可设置"; + this.colIsCanSet.Name = "colIsCanSet"; + this.colIsCanSet.ReadOnly = true; + // + // colOpResult + // + this.colOpResult.HeaderText = "操作结果"; + this.colOpResult.Name = "colOpResult"; + this.colOpResult.ReadOnly = true; + this.colOpResult.Width = 200; + // // PDDProdCouponShangPinLiJianForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1210, 552); + this.ClientSize = new System.Drawing.Size(1184, 552); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "PDDProdCouponShangPinLiJianForm"; @@ -837,20 +873,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private System.Windows.Forms.Panel panel1; private UserControls.UcSplitPage ucSplitPage1; private UserComponent.DataGridViewEx dgvProduct; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; - private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; - private System.Windows.Forms.DataGridViewImageColumn colImg; - private System.Windows.Forms.DataGridViewLinkColumn colSpuId; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; - private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; - private System.Windows.Forms.DataGridViewTextBoxColumn colStock; - private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; - private System.Windows.Forms.DataGridViewTextBoxColumn colSales; - private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; - private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; - private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private System.Windows.Forms.SplitContainer splitContainer4; private UserControls.StatusBarUserControl statusBar; private DevComponents.DotNetBar.PanelEx btnClear; @@ -872,5 +894,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms private UserComponent.UcCheckBox chkCoupon2; private DevComponents.DotNetBar.PanelEx btnCreate; private System.Windows.Forms.SplitContainer splitContainer1; + private DevComponents.DotNetBar.PanelEx btnStopCoupon; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colImg; + private System.Windows.Forms.DataGridViewLinkColumn colSpuId; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colStock; + private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites; + private System.Windows.Forms.DataGridViewTextBoxColumn colSales; + private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays; + private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.cs b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.cs index b80f5ed..1bac1ec 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.cs @@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms if (row == null) { this.dgvShop.Rows.Add( - !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse), + canUse, shopEntity.LoginName, shopEntity.ShopId, shopEntity.ShopAccount, @@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms } else { - row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + //row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse); + row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId); row.Cells["colShopLoginName"].Value = shopEntity.LoginName; row.Cells["colShopName"].Value = shopEntity.ShopAccount; row.Cells["colShopNotes"].Value = shopEntity.Notes; @@ -201,6 +203,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms return result; } + public string get_shangpinlijian_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20) + { + 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/madrid/query_mms_mall_batch_list"; + string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"2\",\"source_type\":54,\"batch_status\":" + batch_status + "}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + + public string close_shangpinlijian_coupon(ShopLoginInfo shop, string event_sn, int batch_status) + { + 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/madrid/close_mall_batch"; + string body = @"{""batch_sn"":""" + event_sn + @"""}"; + + string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status; + + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + private void btnCreate_Click(object sender, EventArgs e) { var lstShopId = dgvShop.Rows.Cast() @@ -223,10 +275,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { row.Cells["colMessage"].Value = ""; } + this.dgvProduct.Columns["colPrice"].HeaderText = "价格"; + this.dgvProduct.Columns["colStock"].HeaderText = "库存"; - - if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true) - PDDShopLoginForm.shopLoginInstance.Dispose(); ucGroupBoxEx2.Enabled = false; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => @@ -352,6 +403,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms pInfo.is_filtered != true, shop.ShopId, shop.ShopAccount, + "", url.Replace("https", "http"), DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); pInfo.id, @@ -381,7 +433,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id); if (row != null) { - row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!"; + row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" + + pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" + + pInfo.coupon_value_limit.LastOrDefault() / 100m; } } } @@ -505,30 +559,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms { dicShopGetCount[shop] = 0; - while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) - { - Thread.Sleep(500); - } + //while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed) + //{ + // Thread.Sleep(500); + //} + //Invoke(new Action(() => + //{ + // this.panel1.SendToBack(); + // PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + // loginForm.TopLevel = false; + // loginForm.openType = EnumOpenType.manage; + // loginForm.WindowState = FormWindowState.Maximized; + // loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + // loginForm.Dock = DockStyle.Fill; + // this.panel1.Controls.Add(loginForm); + // loginForm.Show(); + //})); + //int sleepTime = Randomx.GetId(2000, 3000); + //Thread.Sleep(sleepTime); + + //Invoke(new Action(() => + //{ + // if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Dispose(); + //})); + + PDDShopLoginForm loginForm = null; Invoke(new Action(() => { this.panel1.SendToBack(); - PDDShopLoginForm loginForm = new PDDShopLoginForm(shop); + loginForm = new PDDShopLoginForm(shop); loginForm.TopLevel = false; loginForm.openType = EnumOpenType.manage; loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/"; + loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; loginForm.Dock = DockStyle.Fill; this.panel1.Controls.Add(loginForm); loginForm.Show(); })); - int sleepTime = Randomx.GetId(2000, 3000); - Thread.Sleep(sleepTime); + Thread.Sleep(Randomx.GetId(3000, 5000)); Invoke(new Action(() => { - if (PDDShopLoginForm.shopLoginInstance != null) - PDDShopLoginForm.shopLoginInstance.Dispose(); + if (loginForm != null) + loginForm.Close(); })); } } @@ -568,5 +643,257 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms break; } } + + private void btnStopCoupon_Click(object sender, EventArgs e) + { + var lstShopId = dgvShop.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线") + .Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); + if (lstShopId.Count == 0) + { + BaseMsgForm.ShowInfo("请选择登录的店铺!"); + return; + } + pddCouponGoods.goods_list.Clear(); + pddCouponGoods.remaining_create_num = 1; + pddCouponGoods.total = 1; + + dgvProduct.Rows.Clear(); + List couponGoodsInfoLst = new List(); + + var dgvRows = this.dgvShop.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + this.dgvProduct.Columns["colPrice"].HeaderText = "面额"; + this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量"; + + ucGroupBoxEx2.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + var lstShopIdTemp = new List(); + lstShopIdTemp.AddRange(lstShopId); + int i = 0; + + foreach (var shopId in lstShopIdTemp) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询..."; + this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus == "登录成功") + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "店铺掉线"; + row.Cells["colLoginStatus"].Value = "掉线"; + row.Cells["colCanUse"].Value = false; + } + })); + continue; + } + #endregion + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "正在查询"; + } + })); + + bool isError = false; + string errMsg = ""; + for (int status = 1; status <= 4; status++) + { + if (status != 1 && status != 4) + continue; + + int page = 0; + int pageSize = 20; + int totalPage = 1; + while (page < totalPage) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (page == 0) + page++; + + int tryCount = 0; + tryAgain: + + GetToken(shop); + + if (page >= 1) + Thread.Sleep(Randomx.GetId(3000, 7000)); + + string jsonStr = get_shangpinlijian_coupon_goods_list(shop, status, page, pageSize); + jsonStr = GetHtml.Unicode2String(jsonStr); + if (jsonStr.Contains("繁忙") && tryCount < 5) + { + tryCount++; + Thread.Sleep(Randomx.GetId(5000, 10000)); + goto tryAgain; + } + if (!jsonStr.Contains("\"success\":true")) + { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + break; + + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + JingXiCouponRst couponRst = new JingXiCouponRst(); + try + { + var jObj = JObject.Parse(jsonStr); + var rstStr = JsonHelper.SerializeObject(jObj["result"]); + couponRst = JsonHelper.DeserializeJsonToObject(rstStr); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + + couponRst.data_list = + couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.batch_sn == p.batch_sn)).ToList(); + if (couponRst.data_list.Count == 0) + { + page++; + continue; + } + foreach (var pInfo in couponRst.data_list) + { + pInfo.shopId = shop.ShopId; + pInfo.shopName = shop.ShopAccount; + if (pInfo != null) + { + couponGoodsInfoLst.Add(pInfo); + string url = pInfo.image_url; + Invoke(new Action(() => + { + int rowId = this.dgvProduct.Rows.Add( + /*pInfo.is_filtered !=*/ true, + shop.ShopId, + shop.ShopAccount, + pInfo.batch_sn, + url.Replace("https", "http"), + DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1); + pInfo.goods_id, + pInfo.goods_name, + pInfo.discount / 100m, + pInfo.init_quantity + "/" + pInfo.taked_quantity, + "", //收藏 + "", //总销量 + "", //30日销量 + "可结束", + "" // 操作结果,状态 + ); + + dgvProduct.Rows[rowId].Height = 60; + })); + } + } + + foreach (var couponGoods in couponRst.data_list) + { + Thread.Sleep(Randomx.GetId(500, 1500)); + if (cancellationTokenSource.IsCancellationRequested) + break; + + var creatRst = close_shangpinlijian_coupon(shop, couponGoods.batch_sn, status); + creatRst = GetHtml.Unicode2String(creatRst); + if (!creatRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref creatRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = creatRst; + + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = error; + } + } + else + { + var row = dgvProduct.Rows.Cast().FirstOrDefault( + r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn); + if (row != null) + { + row.Cells["colOpResult"].Value = "结束优惠券成功!"; + } + } + } + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt(); + } + } + } + + Invoke(new Action(() => + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + if (!isError) + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "已结束优惠券"; + } + } + else + { + foreach (var row in rows) + { + row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg; + } + } + })); + } + Invoke(new Action(() => + { + ucGroupBoxEx2.Enabled = true; + string sRst = "结束优惠券已完成!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消结束优惠券!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } } } diff --git a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.resx b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.resx index ff9031b..71f94aa 100644 --- a/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.resx +++ b/TEMUKJD/PDDForms/ProductForms/CouponForms/PDDProdCouponShangPinLiJianForm.resx @@ -153,6 +153,9 @@ True + + True + True