diff --git a/AllBase/Model/CommonItem.cs b/AllBase/Model/CommonItem.cs new file mode 100644 index 0000000..83a071a --- /dev/null +++ b/AllBase/Model/CommonItem.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model; + +public class CommonItem : IComparable +{ + /// + /// 初始化 + /// + /// 文本 + /// 值 + /// 排序号 + /// 组 + /// 禁用 + public CommonItem(string text, object value, string des = "", int? sortId = null, string group = null, bool? disabled = null) + { + Text = text; + Value = value; + Description = des; + SortId = sortId; + Group = group; + Disabled = disabled; + } + + /// + /// 文本 + /// + public string Text { get; } + + /// + /// 值 + /// + public object Value { get; } + /// + /// 描述 + /// + public string Description { get; set; } + /// + /// 排序号 + /// + public int? SortId { get; set; } + + /// + /// 组 + /// + public string Group { get; } + /// + /// 是否选中 + /// + public bool IsSelected { get; set; } + /// + /// 禁用 + /// + public bool? Disabled { get; } + + /// + /// 比较 + /// + /// 其它列表项 + public int CompareTo(CommonItem other) + { + return string.Compare(Text, other.Text, StringComparison.CurrentCulture); + } +} diff --git a/TEMUKJD/KJD.csproj.user b/TEMUKJD/KJD.csproj.user index fc2e92e..9da4563 100644 --- a/TEMUKJD/KJD.csproj.user +++ b/TEMUKJD/KJD.csproj.user @@ -10,7 +10,7 @@ zh-CN false - Production + Development false @@ -71,6 +71,9 @@ Form + + Form + UserControl diff --git a/TEMUKJD/UserComponent/InputDialog.cs b/TEMUKJD/UserComponent/InputDialog.cs new file mode 100644 index 0000000..f045e2b --- /dev/null +++ b/TEMUKJD/UserComponent/InputDialog.cs @@ -0,0 +1,81 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace TemuKJD.UserComponent; + +public class InputDialog : Form +{ + private TextBox txtInput; + private Button btnOk; + private Button btnCancel; + + /// 用户输入的内容(点确定后有效) + public string InputText { get; private set; } = string.Empty; + + public InputDialog(string prompt, string title = "输入", string defaultValue = "") + { + // 窗体基本设置 + this.Text = title; + this.FormBorderStyle = FormBorderStyle.FixedDialog; + this.StartPosition = FormStartPosition.CenterParent; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.ClientSize = new Size(360, 130); + + // 提示标签 + var lblPrompt = new Label + { + Text = prompt, + Location = new Point(15, 15), + AutoSize = true, + MaximumSize = new Size(330, 0) + }; + + // 输入框 + txtInput = new TextBox + { + Text = defaultValue, + Location = new Point(15, 45), + Width = 330 + }; + txtInput.SelectAll(); + + // 确定按钮 + btnOk = new Button + { + Text = "确定", + DialogResult = DialogResult.OK, + Location = new Point(185, 85), + Width = 75 + }; + btnOk.Click += (s, e) => + { + InputText = txtInput.Text; + this.DialogResult = DialogResult.OK; + this.Close(); + }; + + // 取消按钮 + btnCancel = new Button + { + Text = "取消", + DialogResult = DialogResult.Cancel, + Location = new Point(270, 85), + Width = 75 + }; + + this.Controls.AddRange(new Control[] { lblPrompt, txtInput, btnOk, btnCancel }); + this.AcceptButton = btnOk; + this.CancelButton = btnCancel; + } + + /// 便捷静态方法:弹出输入框并返回输入内容,取消返回 null + public static string Show(string prompt, string title = "输入", string defaultValue = "") + { + using (var dlg = new InputDialog(prompt, title, defaultValue)) + { + return dlg.ShowDialog() == DialogResult.OK ? dlg.InputText : null; + } + } +} \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.Designer.cs index 1543b12..e5ca9f1 100644 --- a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.Designer.cs @@ -29,15 +29,19 @@ namespace TemuKJD.WXForms.ProductForms /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.cm_group = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); this.cb_safe = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.num_price = new TemuKJD.UserComponent.UcNumericRange(); this.num_sold = new TemuKJD.UserComponent.UcNumericRange(); this.panel1 = new System.Windows.Forms.Panel(); + this.btn_delGroup = new DevComponents.DotNetBar.PanelEx(); this.btnSafeDetection = new DevComponents.DotNetBar.PanelEx(); + this.btn_createGroup = new DevComponents.DotNetBar.PanelEx(); this.btn_removefavorite = new DevComponents.DotNetBar.PanelEx(); this.bt_importUploadList = new DevComponents.DotNetBar.PanelEx(); this.label5r = new System.Windows.Forms.Label(); @@ -62,12 +66,14 @@ namespace TemuKJD.WXForms.ProductForms this.Column1 = new System.Windows.Forms.DataGridViewImageColumn(); this.c_goodsid = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colDetectionResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.btn_setGroup = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -93,6 +99,8 @@ namespace TemuKJD.WXForms.ProductForms // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.cm_group); + this.splitContainer1.Panel1.Controls.Add(this.label5); this.splitContainer1.Panel1.Controls.Add(this.cb_safe); this.splitContainer1.Panel1.Controls.Add(this.label4); this.splitContainer1.Panel1.Controls.Add(this.num_price); @@ -117,9 +125,28 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Panel2.Margin = new System.Windows.Forms.Padding(4); - this.splitContainer1.Size = new System.Drawing.Size(1719, 530); + this.splitContainer1.Size = new System.Drawing.Size(1388, 530); + this.splitContainer1.SplitterDistance = 87; this.splitContainer1.TabIndex = 35; // + // cm_group + // + this.cm_group.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cm_group.FormattingEnabled = true; + this.cm_group.Location = new System.Drawing.Point(678, 14); + this.cm_group.Name = "cm_group"; + this.cm_group.Size = new System.Drawing.Size(134, 25); + this.cm_group.TabIndex = 938; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(638, 17); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(44, 17); + this.label5.TabIndex = 937; + this.label5.Text = "分组:"; + // // cb_safe // this.cb_safe.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -130,15 +157,15 @@ namespace TemuKJD.WXForms.ProductForms "安全", "违规", "未检测"}); - this.cb_safe.Location = new System.Drawing.Point(1141, 13); + this.cb_safe.Location = new System.Drawing.Point(678, 43); this.cb_safe.Name = "cb_safe"; - this.cb_safe.Size = new System.Drawing.Size(97, 25); + this.cb_safe.Size = new System.Drawing.Size(134, 25); this.cb_safe.TabIndex = 930; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(1104, 17); + this.label4.Location = new System.Drawing.Point(638, 49); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(44, 17); this.label4.TabIndex = 929; @@ -146,8 +173,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_price // - this.num_price.Compact = true; - this.num_price.Location = new System.Drawing.Point(391, 15); + this.num_price.Location = new System.Drawing.Point(478, 15); this.num_price.LowerValue = new decimal(new int[] { 1, 0, @@ -165,7 +191,7 @@ namespace TemuKJD.WXForms.ProductForms 0}); this.num_price.Name = "num_price"; this.num_price.SeparatorText = ""; - this.num_price.Size = new System.Drawing.Size(108, 23); + this.num_price.Size = new System.Drawing.Size(151, 23); this.num_price.TabIndex = 922; this.num_price.UpperValue = new decimal(new int[] { 9999999, @@ -175,8 +201,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_sold // - this.num_sold.Compact = true; - this.num_sold.Location = new System.Drawing.Point(218, 15); + this.num_sold.Location = new System.Drawing.Point(247, 15); this.num_sold.LowerValue = new decimal(new int[] { 1, 0, @@ -194,7 +219,7 @@ namespace TemuKJD.WXForms.ProductForms 0}); this.num_sold.Name = "num_sold"; this.num_sold.SeparatorText = ""; - this.num_sold.Size = new System.Drawing.Size(108, 23); + this.num_sold.Size = new System.Drawing.Size(155, 23); this.num_sold.TabIndex = 921; this.num_sold.UpperValue = new decimal(new int[] { 9999999, @@ -204,22 +229,49 @@ namespace TemuKJD.WXForms.ProductForms // // panel1 // + this.panel1.Controls.Add(this.btn_setGroup); + this.panel1.Controls.Add(this.btn_delGroup); this.panel1.Controls.Add(this.btnSafeDetection); + this.panel1.Controls.Add(this.btn_createGroup); this.panel1.Controls.Add(this.btn_removefavorite); this.panel1.Controls.Add(this.bt_importUploadList); this.panel1.Dock = System.Windows.Forms.DockStyle.Right; - this.panel1.Location = new System.Drawing.Point(1509, 0); + this.panel1.Location = new System.Drawing.Point(1023, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(210, 50); + this.panel1.Size = new System.Drawing.Size(365, 87); this.panel1.TabIndex = 914; // + // btn_delGroup + // + this.btn_delGroup.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btn_delGroup.Cursor = System.Windows.Forms.Cursors.Hand; + this.btn_delGroup.DisabledBackColor = System.Drawing.Color.Empty; + this.btn_delGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btn_delGroup.Location = new System.Drawing.Point(3, 61); + this.btn_delGroup.Name = "btn_delGroup"; + this.btn_delGroup.Size = new System.Drawing.Size(58, 23); + this.btn_delGroup.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btn_delGroup.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_delGroup.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_delGroup.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btn_delGroup.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btn_delGroup.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btn_delGroup.Style.ForeColor.Color = System.Drawing.Color.White; + this.btn_delGroup.Style.GradientAngle = 90; + this.btn_delGroup.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btn_delGroup.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_delGroup.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_delGroup.TabIndex = 443; + this.btn_delGroup.Text = "删除分组"; + this.btn_delGroup.Click += new System.EventHandler(this.btn_delGroup_Click); + // // btnSafeDetection // this.btnSafeDetection.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnSafeDetection.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSafeDetection.DisabledBackColor = System.Drawing.Color.Empty; this.btnSafeDetection.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSafeDetection.Location = new System.Drawing.Point(132, 14); + this.btnSafeDetection.Location = new System.Drawing.Point(228, 11); this.btnSafeDetection.Name = "btnSafeDetection"; this.btnSafeDetection.Size = new System.Drawing.Size(58, 23); this.btnSafeDetection.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -237,13 +289,37 @@ namespace TemuKJD.WXForms.ProductForms this.btnSafeDetection.Text = "AI检测"; this.btnSafeDetection.Click += new System.EventHandler(this.btnSafeDetection_Click); // + // btn_createGroup + // + this.btn_createGroup.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btn_createGroup.Cursor = System.Windows.Forms.Cursors.Hand; + this.btn_createGroup.DisabledBackColor = System.Drawing.Color.Empty; + this.btn_createGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btn_createGroup.Location = new System.Drawing.Point(3, 3); + this.btn_createGroup.Name = "btn_createGroup"; + this.btn_createGroup.Size = new System.Drawing.Size(58, 23); + this.btn_createGroup.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btn_createGroup.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_createGroup.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_createGroup.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btn_createGroup.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btn_createGroup.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btn_createGroup.Style.ForeColor.Color = System.Drawing.Color.White; + this.btn_createGroup.Style.GradientAngle = 90; + this.btn_createGroup.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btn_createGroup.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_createGroup.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_createGroup.TabIndex = 439; + this.btn_createGroup.Text = "创建分组"; + this.btn_createGroup.Click += new System.EventHandler(this.btn_createGroup_Click); + // // btn_removefavorite // this.btn_removefavorite.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btn_removefavorite.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_removefavorite.DisabledBackColor = System.Drawing.Color.Empty; this.btn_removefavorite.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_removefavorite.Location = new System.Drawing.Point(68, 14); + this.btn_removefavorite.Location = new System.Drawing.Point(164, 46); this.btn_removefavorite.Name = "btn_removefavorite"; this.btn_removefavorite.Size = new System.Drawing.Size(58, 23); this.btn_removefavorite.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -267,7 +343,7 @@ namespace TemuKJD.WXForms.ProductForms this.bt_importUploadList.Cursor = System.Windows.Forms.Cursors.Hand; this.bt_importUploadList.DisabledBackColor = System.Drawing.Color.Empty; this.bt_importUploadList.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.bt_importUploadList.Location = new System.Drawing.Point(3, 14); + this.bt_importUploadList.Location = new System.Drawing.Point(164, 12); this.bt_importUploadList.Name = "bt_importUploadList"; this.bt_importUploadList.Size = new System.Drawing.Size(58, 23); this.bt_importUploadList.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -288,7 +364,7 @@ namespace TemuKJD.WXForms.ProductForms // label5r // this.label5r.AutoSize = true; - this.label5r.Location = new System.Drawing.Point(942, 16); + this.label5r.Location = new System.Drawing.Point(10, 46); this.label5r.Name = "label5r"; this.label5r.Size = new System.Drawing.Size(44, 17); this.label5r.TabIndex = 907; @@ -303,16 +379,16 @@ namespace TemuKJD.WXForms.ProductForms "全部", "多多", "微信"}); - this.cb_Platformr.Location = new System.Drawing.Point(992, 13); + this.cb_Platformr.Location = new System.Drawing.Point(60, 43); this.cb_Platformr.Name = "cb_Platformr"; - this.cb_Platformr.Size = new System.Drawing.Size(97, 25); + this.cb_Platformr.Size = new System.Drawing.Size(118, 25); this.cb_Platformr.TabIndex = 906; // // cmbCatSelect2 // this.cmbCatSelect2.DropDownWidth = 150; this.cmbCatSelect2.FormattingEnabled = true; - this.cmbCatSelect2.Location = new System.Drawing.Point(639, 12); + this.cmbCatSelect2.Location = new System.Drawing.Point(338, 46); this.cmbCatSelect2.Name = "cmbCatSelect2"; this.cmbCatSelect2.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect2.TabIndex = 897; @@ -321,7 +397,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect1.DropDownWidth = 150; this.cmbCatSelect1.FormattingEnabled = true; - this.cmbCatSelect1.Location = new System.Drawing.Point(542, 12); + this.cmbCatSelect1.Location = new System.Drawing.Point(241, 46); this.cmbCatSelect1.Name = "cmbCatSelect1"; this.cmbCatSelect1.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect1.TabIndex = 896; @@ -330,7 +406,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect4.DropDownWidth = 150; this.cmbCatSelect4.FormattingEnabled = true; - this.cmbCatSelect4.Location = new System.Drawing.Point(833, 12); + this.cmbCatSelect4.Location = new System.Drawing.Point(532, 46); this.cmbCatSelect4.Name = "cmbCatSelect4"; this.cmbCatSelect4.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect4.TabIndex = 899; @@ -339,7 +415,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect3.DropDownWidth = 150; this.cmbCatSelect3.FormattingEnabled = true; - this.cmbCatSelect3.Location = new System.Drawing.Point(736, 12); + this.cmbCatSelect3.Location = new System.Drawing.Point(435, 46); this.cmbCatSelect3.Name = "cmbCatSelect3"; this.cmbCatSelect3.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect3.TabIndex = 898; @@ -347,7 +423,7 @@ namespace TemuKJD.WXForms.ProductForms // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(332, 17); + this.label7.Location = new System.Drawing.Point(408, 17); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(64, 17); this.label7.TabIndex = 485; @@ -357,7 +433,7 @@ namespace TemuKJD.WXForms.ProductForms // this.label3.AutoSize = true; this.label3.ForeColor = System.Drawing.Color.Gray; - this.label3.Location = new System.Drawing.Point(294, 17); + this.label3.Location = new System.Drawing.Point(323, 17); this.label3.Margin = new System.Windows.Forms.Padding(0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(13, 17); @@ -383,7 +459,7 @@ namespace TemuKJD.WXForms.ProductForms // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(504, 17); + this.label6.Location = new System.Drawing.Point(197, 51); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(44, 17); this.label6.TabIndex = 440; @@ -395,7 +471,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty; this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSearch.Location = new System.Drawing.Point(1257, 14); + this.btnSearch.Location = new System.Drawing.Point(829, 15); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(58, 23); this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -418,7 +494,7 @@ namespace TemuKJD.WXForms.ProductForms this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.pnlEmpty.Location = new System.Drawing.Point(1321, 15); + this.pnlEmpty.Location = new System.Drawing.Point(829, 46); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(58, 23); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -440,7 +516,7 @@ namespace TemuKJD.WXForms.ProductForms // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(184, 17); + this.label2.Location = new System.Drawing.Point(197, 17); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(44, 17); this.label2.TabIndex = 373; @@ -466,15 +542,15 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1); this.splitContainer2.Panel2.Controls.Add(this.statusBar); - this.splitContainer2.Size = new System.Drawing.Size(1719, 476); - this.splitContainer2.SplitterDistance = 447; + this.splitContainer2.Size = new System.Drawing.Size(1388, 439); + this.splitContainer2.SplitterDistance = 410; this.splitContainer2.TabIndex = 0; // // 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(834, 198); + this.pbLoading.Location = new System.Drawing.Point(669, 207); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -485,20 +561,20 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvData.AllowUserToAddRows = false; this.dgvData.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; this.dgvData.AutoRowNumber = true; this.dgvData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dgvData.BackgroundColor = System.Drawing.Color.White; this.dgvData.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.dgvData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; this.dgvData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -506,6 +582,7 @@ namespace TemuKJD.WXForms.ProductForms this.Column1, this.c_goodsid, this.Column2, + this.Column5, this.Column3, this.Column4, this.colDetectionResult}); @@ -516,7 +593,7 @@ namespace TemuKJD.WXForms.ProductForms this.dgvData.ReadOnly = true; this.dgvData.RowTemplate.Height = 60; this.dgvData.ShowCellErrors = false; - this.dgvData.Size = new System.Drawing.Size(1711, 447); + this.dgvData.Size = new System.Drawing.Size(1380, 410); this.dgvData.TabIndex = 5; // // colSelect @@ -566,6 +643,13 @@ namespace TemuKJD.WXForms.ProductForms this.Column2.Name = "Column2"; this.Column2.ReadOnly = true; // + // Column5 + // + this.Column5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.Column5.HeaderText = "分组"; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + // // Column3 // this.Column3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; @@ -600,7 +684,7 @@ namespace TemuKJD.WXForms.ProductForms this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; this.ucSplitPage1.IsShowPageSize = true; this.ucSplitPage1.IsShowTotalCount = true; - this.ucSplitPage1.Location = new System.Drawing.Point(1257, 0); + this.ucSplitPage1.Location = new System.Drawing.Point(926, 0); this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); this.ucSplitPage1.MaxPageSizeValue = 2000; this.ucSplitPage1.Name = "ucSplitPage1"; @@ -618,7 +702,7 @@ namespace TemuKJD.WXForms.ProductForms 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(1719, 25); + this.statusBar.Size = new System.Drawing.Size(1388, 25); this.statusBar.TabIndex = 1; this.statusBar.Visible = false; // @@ -629,10 +713,34 @@ namespace TemuKJD.WXForms.ProductForms this.numericUpDown1.Size = new System.Drawing.Size(120, 21); this.numericUpDown1.TabIndex = 7; // + // btn_setGroup + // + this.btn_setGroup.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btn_setGroup.Cursor = System.Windows.Forms.Cursors.Hand; + this.btn_setGroup.DisabledBackColor = System.Drawing.Color.Empty; + this.btn_setGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btn_setGroup.Location = new System.Drawing.Point(3, 32); + this.btn_setGroup.Name = "btn_setGroup"; + this.btn_setGroup.Size = new System.Drawing.Size(58, 23); + this.btn_setGroup.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btn_setGroup.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_setGroup.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btn_setGroup.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btn_setGroup.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btn_setGroup.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btn_setGroup.Style.ForeColor.Color = System.Drawing.Color.White; + this.btn_setGroup.Style.GradientAngle = 90; + this.btn_setGroup.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btn_setGroup.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_setGroup.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btn_setGroup.TabIndex = 447; + this.btn_setGroup.Text = "设置分组"; + this.btn_setGroup.Click += new System.EventHandler(this.btn_setGroup_Click); + // // CloudGoodsFavoriteForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(1719, 530); + this.ClientSize = new System.Drawing.Size(1388, 530); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.KeyPreview = true; @@ -687,13 +795,19 @@ namespace TemuKJD.WXForms.ProductForms private UserComponent.UcNumericRange num_price; private System.Windows.Forms.Label label4; private System.Windows.Forms.ComboBox cb_safe; + private System.Windows.Forms.ComboBox cm_group; + private System.Windows.Forms.Label label5; + private DevComponents.DotNetBar.PanelEx btn_createGroup; + private DevComponents.DotNetBar.PanelEx btn_delGroup; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn c_Platform; private System.Windows.Forms.DataGridViewImageColumn Column1; private System.Windows.Forms.DataGridViewTextBoxColumn c_goodsid; private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; private System.Windows.Forms.DataGridViewTextBoxColumn Column3; private System.Windows.Forms.DataGridViewTextBoxColumn Column4; private System.Windows.Forms.DataGridViewTextBoxColumn colDetectionResult; + private DevComponents.DotNetBar.PanelEx btn_setGroup; } } diff --git a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.cs b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.cs index bfe3b51..ca56b4a 100644 --- a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.cs +++ b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.cs @@ -1,5 +1,4 @@ -using TemuKJD.BLL; -using AllBase; +using AllBase; using AllBase.Helper; using AllBase.Model.Result; using AllBase.Model.Result.PDDResult; @@ -24,12 +23,15 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.BaseForms; +using TemuKJD.BLL; using TemuKJD.Extension; using TemuKJD.ToolForms; +using TemuKJD.UserComponent; using TemuKJD.UserControls; using Work; using Work.GoodDetail; using Work.Services; +using static Work.GoodInfo; namespace TemuKJD.WXForms.ProductForms { @@ -68,9 +70,17 @@ namespace TemuKJD.WXForms.ProductForms { txt_title.Text = "连衣裙"; } - } + InitGroup(); + } + private void InitGroup() + { + cm_group.DataSource = new List() { new UserFavoriteGroup { Id = 0, GroupName = "全部" } }.Concat(CloudGoodsService.UserGroups).ToList(); + cm_group.ValueMember = "Id"; + cm_group.DisplayMember = "GroupName"; + } + private void InitBindingDataGridView() { this.dgvData.AutoGenerateColumns = false; @@ -80,6 +90,7 @@ namespace TemuKJD.WXForms.ProductForms this.colSelect.DataPropertyName = nameof(CloudGoods.IsSelected); this.colSelect.ReadOnly = false; this.Column2.DataPropertyName = nameof(CloudGoods.Title); + this.Column5.DataPropertyName = nameof(CloudGoods.GroupName); this.Column3.DataPropertyName = nameof(CloudGoods.Price); this.Column4.DataPropertyName = nameof(CloudGoods.SoldQuantity); this.c_goodsid.DataPropertyName = nameof(CloudGoods.GoodsId); @@ -346,7 +357,8 @@ namespace TemuKJD.WXForms.ProductForms search.PageIndex = ucSplitPage1.CurrentPage; search.PageSize = ucSplitPage1.PageSize; - + var groupId = cm_group.SelectedValue.ParseToInt(); + search.GroupId = groupId == 0 ? null : groupId; await GetGoods(search); } @@ -556,6 +568,87 @@ namespace TemuKJD.WXForms.ProductForms } } + private async void btn_createGroup_Click(object sender, EventArgs e) + { + string result = InputDialog.Show("新建分组名称:", "分组名", ""); + if (result != null) + { + bool ret = await CloudGoodsService.CreateGroup(BaseClass.UserName, result); + if (ret) + { + InitGroup(); + MessageBox.Show("分组创建成功"); + } + else + { + MessageBox.Show("分组创建失败"); + } + } + } + + private async void btn_delGroup_Click(object sender, EventArgs e) + { + try + { + if (cm_group.SelectedIndex == 0) + { + MessageBox.Show("禁止删除 全部 分组"); + return; + } + string groupName = cm_group.Text; + if (BaseMsgForm.ShowConfirm($"是否要删除 【{groupName}】分组", "提示").DialogResult != DialogResult.OK) + { + return; + } + + var ret = await CloudGoodsService.DelGroupAsync(BaseClass.UserName, groupName); + if (ret) + { + InitGroup(); + MessageBox.Show($" {groupName} 分组删除成功"); + } + else + { + MessageBox.Show($" {groupName} 分组删除失败"); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + /// + /// 设置分组 + /// + /// + /// + private async void btn_setGroup_Click(object sender, EventArgs e) + { + try + { + string groupName = cm_group.Text; + if (BaseMsgForm.ShowConfirm($"是否要把选中商品设置为 【{groupName}】分组", "提示").DialogResult != DialogResult.OK) + { + return; + } + var ids = dataList.Where(a => a.IsSelected).Select(a => a.GoodsId); + int groupId = cm_group.SelectedValue.ParseToInt(); + var ret = await CloudGoodsService.SetFavoriteGroupAsync(BaseClass.UserName, groupId, ids); + if (ret) + { + MessageBox.Show($" {groupName} 商品分组成功"); + } + else + { + MessageBox.Show($" {groupName} 商品分组失败"); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + + } } diff --git a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.resx b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.resx index 2e4c5e9..5d43feb 100644 --- a/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.resx +++ b/TEMUKJD/WXForms/ProductForms/CloudGoodsFavoriteForm.resx @@ -132,6 +132,9 @@ True + + True + True diff --git a/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.Designer.cs index 7e00a66..d73855f 100644 --- a/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.Designer.cs @@ -29,9 +29,11 @@ namespace TemuKJD.WXForms.ProductForms /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = 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(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.cm_group = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btn_favorite = new DevComponents.DotNetBar.PanelEx(); this.bt_importUploadList = new DevComponents.DotNetBar.PanelEx(); @@ -96,6 +98,7 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer1.Panel1.Controls.Add(this.panel1); this.splitContainer1.Panel1.Controls.Add(this.label5r); + this.splitContainer1.Panel1.Controls.Add(this.bt_importUploadList); this.splitContainer1.Panel1.Controls.Add(this.cb_Platform); this.splitContainer1.Panel1.Controls.Add(this.cmbCatSelect2); this.splitContainer1.Panel1.Controls.Add(this.cmbCatSelect1); @@ -119,17 +122,37 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Panel2.Margin = new System.Windows.Forms.Padding(4); - this.splitContainer1.Size = new System.Drawing.Size(1643, 530); + this.splitContainer1.Size = new System.Drawing.Size(1306, 530); + this.splitContainer1.SplitterDistance = 86; this.splitContainer1.TabIndex = 35; // + // cm_group + // + this.cm_group.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cm_group.FormattingEnabled = true; + this.cm_group.Location = new System.Drawing.Point(62, 12); + this.cm_group.Name = "cm_group"; + this.cm_group.Size = new System.Drawing.Size(106, 25); + this.cm_group.TabIndex = 929; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(12, 15); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(44, 17); + this.label5.TabIndex = 928; + this.label5.Text = "分组:"; + // // panel1 // + this.panel1.Controls.Add(this.cm_group); + this.panel1.Controls.Add(this.label5); this.panel1.Controls.Add(this.btn_favorite); - this.panel1.Controls.Add(this.bt_importUploadList); this.panel1.Dock = System.Windows.Forms.DockStyle.Right; - this.panel1.Location = new System.Drawing.Point(1507, 0); + this.panel1.Location = new System.Drawing.Point(1085, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(136, 50); + this.panel1.Size = new System.Drawing.Size(221, 86); this.panel1.TabIndex = 914; // // btn_favorite @@ -138,9 +161,9 @@ namespace TemuKJD.WXForms.ProductForms this.btn_favorite.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_favorite.DisabledBackColor = System.Drawing.Color.Empty; this.btn_favorite.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_favorite.Location = new System.Drawing.Point(67, 14); + this.btn_favorite.Location = new System.Drawing.Point(3, 50); this.btn_favorite.Name = "btn_favorite"; - this.btn_favorite.Size = new System.Drawing.Size(58, 23); + this.btn_favorite.Size = new System.Drawing.Size(165, 23); this.btn_favorite.Style.Alignment = System.Drawing.StringAlignment.Center; this.btn_favorite.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btn_favorite.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -162,9 +185,9 @@ namespace TemuKJD.WXForms.ProductForms this.bt_importUploadList.Cursor = System.Windows.Forms.Cursors.Hand; this.bt_importUploadList.DisabledBackColor = System.Drawing.Color.Empty; this.bt_importUploadList.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.bt_importUploadList.Location = new System.Drawing.Point(3, 14); + this.bt_importUploadList.Location = new System.Drawing.Point(645, 50); this.bt_importUploadList.Name = "bt_importUploadList"; - this.bt_importUploadList.Size = new System.Drawing.Size(58, 23); + this.bt_importUploadList.Size = new System.Drawing.Size(149, 23); this.bt_importUploadList.Style.Alignment = System.Drawing.StringAlignment.Center; this.bt_importUploadList.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.bt_importUploadList.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -183,7 +206,7 @@ namespace TemuKJD.WXForms.ProductForms // label5r // this.label5r.AutoSize = true; - this.label5r.Location = new System.Drawing.Point(1048, 16); + this.label5r.Location = new System.Drawing.Point(10, 50); this.label5r.Name = "label5r"; this.label5r.Size = new System.Drawing.Size(44, 17); this.label5r.TabIndex = 907; @@ -198,16 +221,16 @@ namespace TemuKJD.WXForms.ProductForms "全部", "多多", "微信"}); - this.cb_Platform.Location = new System.Drawing.Point(1098, 13); + this.cb_Platform.Location = new System.Drawing.Point(60, 47); this.cb_Platform.Name = "cb_Platform"; - this.cb_Platform.Size = new System.Drawing.Size(97, 25); + this.cb_Platform.Size = new System.Drawing.Size(116, 25); this.cb_Platform.TabIndex = 906; // // cmbCatSelect2 // this.cmbCatSelect2.DropDownWidth = 150; this.cmbCatSelect2.FormattingEnabled = true; - this.cmbCatSelect2.Location = new System.Drawing.Point(745, 12); + this.cmbCatSelect2.Location = new System.Drawing.Point(332, 47); this.cmbCatSelect2.Name = "cmbCatSelect2"; this.cmbCatSelect2.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect2.TabIndex = 897; @@ -216,7 +239,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect1.DropDownWidth = 150; this.cmbCatSelect1.FormattingEnabled = true; - this.cmbCatSelect1.Location = new System.Drawing.Point(648, 12); + this.cmbCatSelect1.Location = new System.Drawing.Point(235, 47); this.cmbCatSelect1.Name = "cmbCatSelect1"; this.cmbCatSelect1.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect1.TabIndex = 896; @@ -225,7 +248,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect4.DropDownWidth = 150; this.cmbCatSelect4.FormattingEnabled = true; - this.cmbCatSelect4.Location = new System.Drawing.Point(939, 12); + this.cmbCatSelect4.Location = new System.Drawing.Point(526, 47); this.cmbCatSelect4.Name = "cmbCatSelect4"; this.cmbCatSelect4.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect4.TabIndex = 899; @@ -234,7 +257,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbCatSelect3.DropDownWidth = 150; this.cmbCatSelect3.FormattingEnabled = true; - this.cmbCatSelect3.Location = new System.Drawing.Point(842, 12); + this.cmbCatSelect3.Location = new System.Drawing.Point(429, 47); this.cmbCatSelect3.Name = "cmbCatSelect3"; this.cmbCatSelect3.Size = new System.Drawing.Size(97, 25); this.cmbCatSelect3.TabIndex = 898; @@ -243,7 +266,7 @@ namespace TemuKJD.WXForms.ProductForms // this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.Color.Gray; - this.label4.Location = new System.Drawing.Point(518, 17); + this.label4.Location = new System.Drawing.Point(542, 18); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(13, 17); @@ -252,7 +275,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_maxprice // - this.num_maxprice.Location = new System.Drawing.Point(534, 14); + this.num_maxprice.Location = new System.Drawing.Point(553, 15); this.num_maxprice.Maximum = new decimal(new int[] { 99999, 0, @@ -264,7 +287,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_minprice // - this.num_minprice.Location = new System.Drawing.Point(447, 14); + this.num_minprice.Location = new System.Drawing.Point(471, 15); this.num_minprice.Maximum = new decimal(new int[] { 99999, 0, @@ -277,7 +300,7 @@ namespace TemuKJD.WXForms.ProductForms // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(388, 17); + this.label7.Location = new System.Drawing.Point(412, 18); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(64, 17); this.label7.TabIndex = 485; @@ -287,7 +310,7 @@ namespace TemuKJD.WXForms.ProductForms // this.label3.AutoSize = true; this.label3.ForeColor = System.Drawing.Color.Gray; - this.label3.Location = new System.Drawing.Point(294, 17); + this.label3.Location = new System.Drawing.Point(306, 18); this.label3.Margin = new System.Windows.Forms.Padding(0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(13, 17); @@ -296,7 +319,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_maxsold // - this.num_maxsold.Location = new System.Drawing.Point(310, 14); + this.num_maxsold.Location = new System.Drawing.Point(322, 15); this.num_maxsold.Maximum = new decimal(new int[] { 9999999, 0, @@ -308,7 +331,7 @@ namespace TemuKJD.WXForms.ProductForms // // num_minsold // - this.num_minsold.Location = new System.Drawing.Point(223, 14); + this.num_minsold.Location = new System.Drawing.Point(235, 15); this.num_minsold.Maximum = new decimal(new int[] { 9999999, 0, @@ -337,7 +360,7 @@ namespace TemuKJD.WXForms.ProductForms // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(610, 17); + this.label6.Location = new System.Drawing.Point(185, 50); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(44, 17); this.label6.TabIndex = 440; @@ -349,7 +372,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty; this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSearch.Location = new System.Drawing.Point(1208, 14); + this.btnSearch.Location = new System.Drawing.Point(645, 15); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(58, 23); this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -372,7 +395,7 @@ namespace TemuKJD.WXForms.ProductForms this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.pnlEmpty.Location = new System.Drawing.Point(1272, 14); + this.pnlEmpty.Location = new System.Drawing.Point(736, 15); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(58, 23); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -394,7 +417,7 @@ namespace TemuKJD.WXForms.ProductForms // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(184, 17); + this.label2.Location = new System.Drawing.Point(185, 18); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(44, 17); this.label2.TabIndex = 373; @@ -420,15 +443,15 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1); this.splitContainer2.Panel2.Controls.Add(this.statusBar); - this.splitContainer2.Size = new System.Drawing.Size(1643, 476); - this.splitContainer2.SplitterDistance = 447; + this.splitContainer2.Size = new System.Drawing.Size(1306, 440); + this.splitContainer2.SplitterDistance = 411; this.splitContainer2.TabIndex = 0; // // 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(796, 198); + this.pbLoading.Location = new System.Drawing.Point(628, 180); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -439,20 +462,20 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvData.AllowUserToAddRows = false; this.dgvData.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.dgvData.AutoRowNumber = true; this.dgvData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dgvData.BackgroundColor = System.Drawing.Color.White; this.dgvData.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.dgvData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + 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.dgvData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.dgvData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -469,7 +492,7 @@ namespace TemuKJD.WXForms.ProductForms this.dgvData.ReadOnly = true; this.dgvData.RowTemplate.Height = 60; this.dgvData.ShowCellErrors = false; - this.dgvData.Size = new System.Drawing.Size(1635, 447); + this.dgvData.Size = new System.Drawing.Size(1298, 411); this.dgvData.TabIndex = 5; // // colSelect @@ -543,7 +566,7 @@ namespace TemuKJD.WXForms.ProductForms this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; this.ucSplitPage1.IsShowPageSize = true; this.ucSplitPage1.IsShowTotalCount = true; - this.ucSplitPage1.Location = new System.Drawing.Point(1181, 0); + this.ucSplitPage1.Location = new System.Drawing.Point(844, 0); this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); this.ucSplitPage1.MaxPageSizeValue = 2000; this.ucSplitPage1.Name = "ucSplitPage1"; @@ -561,14 +584,14 @@ namespace TemuKJD.WXForms.ProductForms 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(1643, 25); + this.statusBar.Size = new System.Drawing.Size(1306, 25); this.statusBar.TabIndex = 1; this.statusBar.Visible = false; // // CloudGoodsForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(1643, 530); + this.ClientSize = new System.Drawing.Size(1306, 530); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.KeyPreview = true; @@ -581,6 +604,7 @@ namespace TemuKJD.WXForms.ProductForms ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.num_maxprice)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.num_minprice)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.num_maxsold)).EndInit(); @@ -632,5 +656,7 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.Panel panel1; private DevComponents.DotNetBar.PanelEx btn_favorite; private DevComponents.DotNetBar.PanelEx bt_importUploadList; + private System.Windows.Forms.ComboBox cm_group; + private System.Windows.Forms.Label label5; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.cs b/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.cs index 626fa97..6c7e724 100644 --- a/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.cs +++ b/TEMUKJD/WXForms/ProductForms/CloudGoodsForm.cs @@ -40,6 +40,15 @@ namespace TemuKJD.WXForms.ProductForms public CloudGoodsForm() { InitializeComponent(); + this.VisibleChanged += CloudGoodsForm_VisibleChanged; + } + + private void CloudGoodsForm_VisibleChanged(object sender, EventArgs e) + { + if (this.Visible == false) return; + cm_group.DataSource = new List() { new UserFavoriteGroup { Id = 0, GroupName = "全部" } }.Concat(CloudGoodsService.UserGroups).ToList(); + cm_group.ValueMember = "Id"; + cm_group.DisplayMember = "GroupName"; } private void AdminCardCodeForm_Load(object sender, EventArgs e) @@ -63,6 +72,8 @@ namespace TemuKJD.WXForms.ProductForms { txt_title.Text = "连衣裙"; } + + } @@ -447,16 +458,23 @@ namespace TemuKJD.WXForms.ProductForms int err = 0; try { + string groupName = cm_group.Text; + int groupId = cm_group.SelectedValue.ParseToInt(); + if (BaseMsgForm.ShowConfirm($"是否要收藏商品为 【{groupName}】分组", "提示").DialogResult != DialogResult.OK) + { + return; + } + this.pbLoading.Visible = true; btn_favorite.Enabled = false; - var goodsIds = dataList.Where(a => a.IsSelected).Select(a => a.GoodsId).ToList(); + var goodsIds = dataList.Where(a => a.IsSelected).Select(a => a.GoodsId).ToList(); if (goodsIds.Count == 0) { BaseMsgForm.ShowInfo($"请勾选商品"); return; } - var ret = await CloudGoodsService.Favorite(goodsIds); + var ret = await CloudGoodsService.Favorite(goodsIds, groupId); succ = ret; if (ret != goodsIds.Count) { diff --git a/Work/Services/CloudGoodsService.cs b/Work/Services/CloudGoodsService.cs index e304683..41152cb 100644 --- a/Work/Services/CloudGoodsService.cs +++ b/Work/Services/CloudGoodsService.cs @@ -9,6 +9,7 @@ using System.Linq; using Work.Store.Api; using System.Threading.Tasks; using Work.Api.Wx; +using AllBase.Model; namespace Work.Services { @@ -17,6 +18,23 @@ namespace Work.Services /// public class CloudGoodsService { + public static List UserGroups { get; private set; } + static CloudGoodsService() + { + GetGroups(BaseClass.UserName).ContinueWith(t => + { + if (t.IsFaulted) + { + return; + } + if (t.IsCanceled) + { + return; + } + + UserGroups = t.Result; + }); + } public static async Task> GetGoods(GoodsSearchRequest request) { return await StoreApiClient.Instance.CloudGoods.GetGoods(request); @@ -178,7 +196,10 @@ namespace Work.Services } logs.Add(new RecordViolationLogRequest { - ShopId = shopId, GoodsId = item.GoodsId, ReasonId = reasonId, Action = ViolationLogAction.Report + ShopId = shopId, + GoodsId = item.GoodsId, + ReasonId = reasonId, + Action = ViolationLogAction.Report }); } await TryRecordLogs(logs); @@ -351,7 +372,10 @@ namespace Work.Services } logs.AddRange(status.ReasonIds.Select(id => new RecordViolationLogRequest { - ShopId = shopId, GoodsId = status.GoodsId, ReasonId = id, Action = action + ShopId = shopId, + GoodsId = status.GoodsId, + ReasonId = id, + Action = action })); } await TryRecordLogs(logs).ConfigureAwait(false); @@ -409,6 +433,49 @@ namespace Work.Services } #region user + /// + /// 创建分组 + /// + /// + /// + /// + public static async Task CreateGroup(string userName, string groupName) + { + bool ret = await StoreApiClient.Instance.CloudGoods.CreateGroup(userName, groupName); + if (ret) + { + UserGroups = await GetGroups(userName); + } + return ret; + } + public static async Task DelGroupAsync(string userName, string groupName) + { + bool ret = await StoreApiClient.Instance.CloudGoods.DelGroupAsync(userName, groupName); + if (ret) + { + UserGroups = await GetGroups(userName); + } + return ret; + } + public static async Task SetFavoriteGroupAsync(string userName, int groupId, IEnumerable goodsIds) + { + bool ret = await StoreApiClient.Instance.CloudGoods.SetFavoriteGroupAsync(userName, groupId, goodsIds); + if (ret) + { + UserGroups = await GetGroups(userName); + } + return ret; + } + /// + /// 获取分组 + /// + /// + /// + public static async Task> GetGroups(string userName) + { + return await StoreApiClient.Instance.CloudGoods.GetGroups(userName); + } + /// /// 搜索收藏 /// @@ -423,7 +490,7 @@ namespace Work.Services { item.DetectionResult = item.IsSafe == null ? "未检测" : item.IsSafe.Value ? "安全" : "违规"; } - + return page; } @@ -434,9 +501,9 @@ namespace Work.Services /// /// - public static async Task Favorite(List goodsIds) + public static async Task Favorite(List goodsIds, int groupId) { - return await StoreApiClient.Instance.CloudGoods.Favorite(GetUserName(), goodsIds); + return await StoreApiClient.Instance.CloudGoods.Favorite(GetUserName(), goodsIds, groupId); } /// /// 取消收藏 @@ -537,7 +604,10 @@ namespace Work.Services /// 标题(模糊搜索) /// public string Title { get; set; } = string.Empty; - + /// + /// 分组ID + /// + public int? GroupId { get; set; } /// /// 最低价格(元) /// @@ -663,6 +733,9 @@ namespace Work.Services /// public string Title { get; set; } = string.Empty; + public int GroupId { get; set; } + public string GroupName { get; set; } + /// /// 描述 /// @@ -742,4 +815,10 @@ namespace Work.Services set => SetValue(value); } } + + public class UserFavoriteGroup + { + public long Id { get; set; } + public string GroupName { get; set; } + } } diff --git a/Work/Store.Api/ApiTransport.cs b/Work/Store.Api/ApiTransport.cs index 93c3c38..85ac6fa 100644 --- a/Work/Store.Api/ApiTransport.cs +++ b/Work/Store.Api/ApiTransport.cs @@ -131,8 +131,10 @@ public sealed class ApiTransport private HttpItem CreateRequest(string route, MethodType method, object body, IDictionary query, int timeoutMilliseconds) { - if (string.IsNullOrWhiteSpace(route) || - !Regex.IsMatch(route, @"\A[A-Za-z0-9_-]+(/[A-Za-z0-9_-]+)*\z")) + string pathOnly = route?.Split('?', '#')[0]; + + if (string.IsNullOrWhiteSpace(pathOnly) || + !Regex.IsMatch(pathOnly, @"\A[A-Za-z0-9_-]+(/[A-Za-z0-9_-]+)*\z")) throw new ArgumentException("接口必须使用相对路由,例如 Auth/Login。", nameof(route)); if (body != null) Validator.ValidateObject(body, new ValidationContext(body), true); if (timeoutMilliseconds <= 0) throw new ArgumentOutOfRangeException(nameof(timeoutMilliseconds)); diff --git a/Work/Store.Api/CloudGoodsApi.cs b/Work/Store.Api/CloudGoodsApi.cs index d36c4ca..82b55e5 100644 --- a/Work/Store.Api/CloudGoodsApi.cs +++ b/Work/Store.Api/CloudGoodsApi.cs @@ -49,14 +49,40 @@ public sealed class CloudGoodsApi public Task> SearchFavorites(UserFavoritesGoodsSearchRequest request) => _transport.GetRequiredAsync>("CloudGoods/SearchFavorites", MethodType.Post, request); - public Task Favorite(string userName, List goodsIds) + public Task Favorite(string userName, List goodsIds,int groupId) => _transport.SendAsync("CloudGoods/AddFavorite", MethodType.Post, - new { UserName = userName, GoodsIds = goodsIds }); + new { UserName = userName, GoodsIds = goodsIds, GroupId= groupId }); public Task RemoveFavorites(string userName, List goodsIds) => _transport.SendAsync("CloudGoods/RemoveFavorites", MethodType.Post, new { UserName = userName, GoodsIds = goodsIds }); + /// + /// 创建分组 + /// + /// + /// + /// + public async Task CreateGroup(string userName, string groupName) + { + return await _transport.SendAsync("CloudGoods/CreateGroup", MethodType.Post, + new { UserName = userName, GroupName = groupName }); + } + public async Task DelGroupAsync(string userName, string groupName) + { + return await _transport.SendAsync("CloudGoods/DelGroup", MethodType.Post, + new { UserName = userName, GroupName = groupName }); + } + public async Task SetFavoriteGroupAsync(string userName, int groupId, IEnumerable goodsIds) + { + return await _transport.SendAsync("CloudGoods/SetFavoriteGroup", MethodType.Post, + new { UserName = userName, GroupId = groupId, GoodsIds = goodsIds }); + } + public async Task> GetGroups(string userName) + { + return await _transport.SendAsync>($"CloudGoods/GetGroups?UserName={userName}", MethodType.Post); + } + /// 识别上传图片中的文字和品牌 Logo。 public async Task> RecognizeAsync(string urlMd5, byte[] jpeg)