抖音小店准备阶段

This commit is contained in:
wule committed 2025-12-26 09:53:29 +08:00
1 parent 9e0a3fc10c
commit 17e4dc4a3c
61 files changed
+5154 -1505

No files matched your search

@@ -21,11 +21,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
ShopLoginInfo Shop;
TemuDBProductSelect ProdSelect;
SetProductSelectNotesType SelectType;
SetProductSelectType SelectType;
//string ChangeCatId = "";
//string ChangeCatName = "";
Dictionary<string, string> cateIdNameMap = new Dictionary<string, string>();
public DbProductCategorySearch(ShopLoginInfo shop, TemuDBProductSelect prodSelect, SetProductSelectNotesType selectType = SetProductSelectNotesType.DbProduct)
public DbProductCategorySearch(ShopLoginInfo shop, TemuDBProductSelect prodSelect, SetProductSelectType selectType = SetProductSelectType.DbProduct)
{
InitializeComponent();
@@ -46,7 +46,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private void btnSave_Click(object sender, EventArgs e)
{
var url = BaseClass.BuildObjString("product/mdy_product_category");
if (this.SelectType == SetProductSelectNotesType.ThirdProduct)
if (this.SelectType == SetProductSelectType.ThirdProduct)
url = BaseClass.BuildObjString("product_third/mdy_product_category");
var data = UserLogin.GetSignaturex() +
@@ -33,13 +33,24 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.ucSkuImgListItem1 = new TemuKJD.ToolForms.UcSkuImgListItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnSave = new DevComponents.DotNetBar.PanelEx();
this.tabProduct = new PinBaoBao.UserControls.UcTabControlMetro();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.ucPropEdit1 = new TemuKJD.KJDForms.ProductSelectForms.UcPropEdit();
this.btnCancel = new DevComponents.DotNetBar.PanelEx();
this.btnSave = new DevComponents.DotNetBar.PanelEx();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabProduct.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
this.SuspendLayout();
//
// flowLayoutPanel1
@@ -48,10 +59,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.flowLayoutPanel1.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel1.Controls.Add(this.ucSkuImgListItem1);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel1.Size = new System.Drawing.Size(1198, 555);
this.flowLayoutPanel1.Size = new System.Drawing.Size(431, 292);
this.flowLayoutPanel1.TabIndex = 2;
//
// ucSkuImgListItem1
@@ -74,46 +85,82 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.flowLayoutPanel1);
this.splitContainer1.Panel1.Controls.Add(this.pbLoading);
this.splitContainer1.Panel1.Controls.Add(this.tabProduct);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.btnCancel);
this.splitContainer1.Panel2.Controls.Add(this.btnSave);
this.splitContainer1.Size = new System.Drawing.Size(1198, 606);
this.splitContainer1.SplitterDistance = 555;
this.splitContainer1.SplitterDistance = 561;
this.splitContainer1.TabIndex = 3;
//
// btnSave
// tabProduct
//
this.btnSave.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSave.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(1108, 11);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(73, 23);
this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSave.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSave.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSave.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSave.Style.GradientAngle = 90;
this.btnSave.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.TabIndex = 435;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
this.tabProduct.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
this.tabProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.tabProduct.Controls.Add(this.tabPage1);
this.tabProduct.Controls.Add(this.tabPage2);
this.tabProduct.Location = new System.Drawing.Point(0, 0);
this.tabProduct.Name = "tabProduct";
this.tabProduct.SelectedIndex = 0;
this.tabProduct.ShowCloseButton = false;
this.tabProduct.Size = new System.Drawing.Size(445, 328);
this.tabProduct.TabIndex = 3;
this.tabProduct.TabSelectColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.tabProduct.TabSelectTextColor = System.Drawing.Color.Gray;
this.tabProduct.TabUnSelectTextColor = System.Drawing.Color.White;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.flowLayoutPanel1);
this.tabPage1.Location = new System.Drawing.Point(4, 26);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(437, 298);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "商品主图";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.flowLayoutPanel2);
this.tabPage2.Location = new System.Drawing.Point(4, 26);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(437, 298);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "商品属性";
this.tabPage2.UseVisualStyleBackColor = true;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.AutoScroll = true;
this.flowLayoutPanel2.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel2.Controls.Add(this.ucPropEdit1);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel2.Size = new System.Drawing.Size(431, 292);
this.flowLayoutPanel2.TabIndex = 3;
//
// ucPropEdit1
//
this.ucPropEdit1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ucPropEdit1.Location = new System.Drawing.Point(7, 7);
this.ucPropEdit1.Name = "ucPropEdit1";
this.ucPropEdit1.Size = new System.Drawing.Size(300, 71);
this.ucPropEdit1.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
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(1031, 11);
this.btnCancel.Location = new System.Drawing.Point(1031, 5);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(73, 23);
@@ -133,12 +180,49 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSave.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(1108, 5);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(73, 23);
this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSave.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSave.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSave.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSave.Style.GradientAngle = 90;
this.btnSave.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.TabIndex = 435;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// 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(574, 255);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 189;
this.pbLoading.TabStop = false;
this.pbLoading.Visible = false;
//
// DbProductEditDetailForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1200, 640);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DbProductEditDetailForm";
this.Text = "DbProductEditDetailForm";
@@ -150,6 +234,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.tabProduct.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.flowLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
this.ResumeLayout(false);
}
@@ -161,5 +250,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.SplitContainer splitContainer1;
private DevComponents.DotNetBar.PanelEx btnSave;
private DevComponents.DotNetBar.PanelEx btnCancel;
private PinBaoBao.UserControls.UcTabControlMetro tabProduct;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private UcPropEdit ucPropEdit1;
private System.Windows.Forms.PictureBox pbLoading;
}
}
@@ -2,6 +2,7 @@
using AllBase.Model.Result;
using DevComponents.DotNetBar;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -12,6 +13,8 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.KJDForms.ProductThirdSelectForms;
using TemuKJD.ToolForms;
using Work;
@@ -19,17 +22,26 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductEditDetailForm : LRBaseForm
{
public ShopLoginInfo shop { get; set; }
public string productDraftId { get; set; }
KJDDBProduct dbProd = null;
TemuDBProductSelect dbProdSelect = null;
List<UcSkuImgListItem> lstUcSkuImgListItem = new List<UcSkuImgListItem>();
int maxIndex = 1;
int minIndex = 1;
List<TemuCategoryTemplateInfo> lstCategoryTemplate = new List<TemuCategoryTemplateInfo>();
public DbProductEditDetailForm(KJDDBProduct _dbProd)
SetProductSelectType selectType;
public DbProductEditDetailForm(KJDDBProduct _dbProd, TemuDBProductSelect _dbProdSelect = null, SetProductSelectType _selectType = SetProductSelectType.DbProduct)
{
InitializeComponent();
if (_dbProd != null)
dbProd = _dbProd;
if (_dbProdSelect != null)
dbProdSelect = _dbProdSelect;
this.selectType = _selectType;
this.Width = Math.Min(1600, Screen.PrimaryScreen.Bounds.Width);
this.Height = Math.Min(900, Screen.PrimaryScreen.Bounds.Height);
@@ -40,7 +52,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
if (string.IsNullOrWhiteSpace(dbProd.product_json))
{
var temuDBProd = DbProductSelectListManageForm.GetProductDetail(dbProd.id.ToString());
KJDDBProduct temuDBProd = null;
if (selectType == SetProductSelectType.DbProduct)
temuDBProd = DbProductSelectListManageForm.GetProductDetail(dbProd.id.ToString());
else if (selectType == SetProductSelectType.ThirdProduct)
temuDBProd = ProductThirdSelectListManageForm.GetProductDetail(dbProd.id.ToString());
if (temuDBProd == null || temuDBProd.id == 0)
{
BaseMsgForm.ShowError("商品已清除!");
@@ -49,7 +65,59 @@ namespace TemuKJD.KJDForms.ProductSelectForms
dbProd = temuDBProd;
}
var prodInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(dbProd.product_json);
pbLoading.BringToFront();
pbLoading.Visible = true;
this.tabProduct.Dock = DockStyle.Fill;
var t = Task.Run(() =>
{
var prodInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(dbProd.product_json);
Invoke(new Action(() =>
{
// 取商品主图并展示
DisplayMainImg(prodInfo);
pbLoading.Visible = false;
}));
//后面功能没写完暂时return掉
Invoke(new Action(() =>
{
this.tabProduct.TabPages.Remove(tabPage2);
}));
return;
Invoke(new Action(() =>
{
pbLoading.Visible = true;
}));
if (shop == null)
{
while (shop == null || shop.LoginStatus2 != "国际版在线")
{
var shopList = AdminForms.AdminShopListForm.lstAdminShopInfo.Where(s => s.LoginStatus2 == "国际版在线").ToList();
if (shopList.Count == 0)
{
BaseMsgForm.ShowError("店铺全部掉线,无法上传图片!");
return;
}
shop = shopList[Randomx.GetId(shopList.Count)];
AdminForms.AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
}
}
GetPropTemplate(prodInfo);
Invoke(new Action(() =>
{
// 根据类目获取商品属性模板
DisplayPropTemplate(prodInfo);
pbLoading.Visible = false;
}));
});
}
private void DisplayMainImg(TemuDetailProductInfo prodInfo)
{
var mainImgUrls = prodInfo.carouselImageUrls;
flowLayoutPanel1.Controls.Clear();
lstUcSkuImgListItem.Clear();
@@ -65,14 +133,187 @@ namespace TemuKJD.KJDForms.ProductSelectForms
imgListItem.txtUseCount.Text = index.ToString();
imgListItem.txtUseCount.Tag = index;
imgListItem.txtUseCount.ReadOnly = false;
imgListItem.btnDel.Text = "交换";
imgListItem.txtUseCount.Width -= imgListItem.btnEdit.Width + 2;
imgListItem.btnEdit.Visible = true;
imgListItem.btnEdit.Text = "交换";
imgListItem.btnEdit.Tag = imgListItem;
imgListItem.btnEdit.Click += BtnEdit_Click;
imgListItem.btnDel.Tag = imgListItem;
imgListItem.btnDel.Click += BtnDel_Click;
this.flowLayoutPanel1.Controls.Add(imgListItem);
lstUcSkuImgListItem.Add(imgListItem);
}
}
private void GetPropTemplate(TemuDetailProductInfo prodInfo)
{
long catId = (this.dbProdSelect?.change_cat_id).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat10?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat9?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat8?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat7?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat6?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat5?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat4?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat3?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat2?.catId).ParseToLong();
if (catId == 0) catId = (prodInfo?.categories?.cat1?.catId).ParseToLong();
var propTemplateRst = DbProductSelectListManageForm.QueryCategoryTemplate(shop, productDraftId, catId.ParseToString());
if (propTemplateRst.Contains("\"success\":true"))
{
try
{
JObject jObj = JObject.Parse(propTemplateRst);
var PropLstStr = JsonHelper.SerializeObject(jObj["result"]["properties"]);
lstCategoryTemplate.Clear();
lstCategoryTemplate.AddRange(JsonHelper.DeserializeJsonToList<TemuCategoryTemplateInfo>(PropLstStr).OrderBy(p => p.templatePid));
}
catch (Exception ex)
{
}
}
else
{
var error = BaseRegex.GetStringJson(ref propTemplateRst, "errorMsg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref propTemplateRst, "error_msg");
AdminForms.AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 != "国际版在线")
{
BaseMsgForm.ShowError("因掉线导致商品属性模板获取失败,请登录后再试。");
return;
}
else
{
BaseMsgForm.ShowError("商品属性模板获取失败,请重试:" + error);
return;
}
}
}
private void DisplayPropTemplate(TemuDetailProductInfo prodInfo)
{
this.flowLayoutPanel2.Controls.Clear();
foreach (var propCatTempInfo in this.lstCategoryTemplate)
{
if (propCatTempInfo.controlType != 1 && propCatTempInfo.controlType != 3 && propCatTempInfo.controlType != 1)
{
// 3 多选
// 1 单选
// 0 填写
}
if (propCatTempInfo.name == "品牌名")
{
}
var propEditItem = new UcPropEdit();
propEditItem.Tag = propCatTempInfo;
propEditItem.Anchor = AnchorStyles.None;
propEditItem.lblRequired.Visible = propCatTempInfo.required.ParseToBool()|| propCatTempInfo.isImportant.ParseToBool(); //propCatTempInfo.required.ParseToBool();
propEditItem.lblPropName.Text = propCatTempInfo.name + " " + propCatTempInfo.lang2Name["en"];
propEditItem.cmbPropValues.TextChanged += CmbPropValues_TextChanged;
propEditItem.cmbPropValues.Tag = propCatTempInfo;
if (propCatTempInfo.values != null)
{
foreach (var v in propCatTempInfo.values)
{
propEditItem.cmbPropValues.Items.Add(v.value);
}
}
this.flowLayoutPanel2.Controls.Add(propEditItem);
// 0为主属性 1为附庸属性,当主属性选择了某个值以后,附庸属性才显示
if (propCatTempInfo.showType != 0)
propEditItem.Visible = false;
}
foreach (var propCatTempInfo in this.lstCategoryTemplate)
{
var propEditItem = flowLayoutPanel2.Controls.Cast<Control>().FirstOrDefault(c => c.Tag == propCatTempInfo) as UcPropEdit;
if (propEditItem == null)
continue;
var currentValue = prodInfo.productPropertyList.FirstOrDefault(p => p.refPid == propCatTempInfo.refPid);
if (currentValue != null)
{
propEditItem.cmbPropValues.Text = currentValue.propValue;
if (string.IsNullOrEmpty(propEditItem.cmbPropValues.Text))
propEditItem.cmbPropValues.Text = currentValue.numberInputValue;
}
}
SetSubPropEditVisible();
}
private void SetSubPropEditVisible()
{
foreach (var propCatTempInfo in this.lstCategoryTemplate)
{
var propEditItem = flowLayoutPanel2.Controls.Cast<Control>().FirstOrDefault(c => c.Tag == propCatTempInfo) as UcPropEdit;
if (propEditItem == null)
continue;
if (propCatTempInfo.showType == 1)
{
propEditItem.Visible = false;
var parentPropCatTempInfo = this.lstCategoryTemplate.FirstOrDefault(p => p.templatePid == propCatTempInfo.parentTemplatePid);
var parentPropEditItem = flowLayoutPanel2.Controls.Cast<Control>().FirstOrDefault(c => c.Tag == parentPropCatTempInfo) as UcPropEdit;
if (parentPropCatTempInfo == null || parentPropEditItem == null)
continue;
var parentValue = parentPropEditItem.cmbPropValues.Text;
var parentId = parentPropCatTempInfo.values.FirstOrDefault(v => v.value == parentValue)?.vid;
if (string.IsNullOrEmpty(parentValue) || parentId == 0)
continue;
var templatePropertyValueParent =
propCatTempInfo.templatePropertyValueParentList.FirstOrDefault(p => p.parentVidList.Contains(parentId.ParseToLong()));
if (templatePropertyValueParent != null)
{
propEditItem.Visible = true;
propEditItem.cmbPropValues.Items.Clear();
foreach (var vid in templatePropertyValueParent.vidList)
{
var valueItem = propCatTempInfo.values.FirstOrDefault(v => v.vid == vid);
if (valueItem != null)
{
propEditItem.cmbPropValues.Items.Add(valueItem.value);
}
}
}
}
}
}
private void CmbPropValues_TextChanged(object sender, EventArgs e)
{
var cmbPropValues = sender as ComboBox;
if (cmbPropValues == null)
return;
var propCatTempInfo = cmbPropValues.Tag as TemuCategoryTemplateInfo;
if (propCatTempInfo == null)
return;
SetSubPropEditVisible();
cmbPropValues.ForeColor = Color.Red;
if (cmbPropValues.Items.Count == 0)
{
cmbPropValues.ForeColor = Color.Black;
return;
}
var propValues = cmbPropValues.Text.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (propValues.Count <= propCatTempInfo.chooseMaxNum.ParseToInt())
{
if (propValues.All(p => cmbPropValues.Items.Cast<Object>().Any(i => i.ParseToString() == p)))
cmbPropValues.ForeColor = Color.Black;
}
}
private void BtnDel_Click(object sender, EventArgs e)
{
PanelEx btnDel = sender as PanelEx;
@@ -82,6 +323,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (imgListItem == null)
return;
flowLayoutPanel1.Controls.Remove(imgListItem);
}
private void BtnEdit_Click(object sender, EventArgs e)
{
PanelEx btnEdit = sender as PanelEx;
if (btnEdit == null)
return;
UcSkuImgListItem imgListItem = btnEdit.Tag as UcSkuImgListItem;
if (imgListItem == null)
return;
int newIndex = imgListItem.txtUseCount.Text.ParseToInt();
if (newIndex < minIndex || newIndex > maxIndex)
{
@@ -131,11 +384,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (dbProd != null && prodInfo != null)
{
var oldMainImgUrls = prodInfo.carouselImageUrls;
dbProd.product_json = dbProd.product_json.Replace(JsonHelper.SerializeObject(oldMainImgUrls), JsonHelper.SerializeObject(imgUrlLst));
// 尽量使用字符串替换防止序列化时破坏原json结构
var newProductJson = dbProd.product_json.Replace(JsonHelper.SerializeObject(oldMainImgUrls), JsonHelper.SerializeObject(imgUrlLst));
var url = BaseClass.BuildObjString("product/mdy_db_product");
if (selectType == SetProductSelectType.ThirdProduct)
url = BaseClass.BuildObjString("product_third/mdy_db_product");
var data = UserLogin.GetSignaturex() + "&db_id=" + dbProd.id;
data += "&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8);
data += "&product_json=" + HttpUtility.UrlEncode(newProductJson, Encoding.UTF8);
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
@@ -146,6 +402,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
else
{
dbProd.product_json = newProductJson;
this.Close();
}
}
@@ -165,7 +165,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
Task.Run(() =>
{
int pageCount;
var list = GetProductList(out pageCount, page);
decimal seconds;
var list = GetProductList(out pageCount, out seconds, page);
lstTemuDbProduct.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
@@ -215,6 +216,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "商品查询完毕";
#if DEBUG
this.statusBar.lblTaskStatus.Text += ",耗时:" + seconds;
#endif
}));
});
}
@@ -261,10 +266,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
}
public List<KJDDBProduct> GetProductList(out int pageCount, int page = 1, int pageSize = 200)
public List<KJDDBProduct> GetProductList(out int pageCount, out decimal seconds, int page = 1, int pageSize = 200)
{
List<KJDDBProduct> list = new List<KJDDBProduct>();
pageCount = 1;
seconds = 0;
var url = BaseClass.BuildObjString("product/get_product_list");
var data = "";
@@ -278,7 +284,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
"&search_skc=" + txtSKC.Text.Trim() +
"&search_notes=" + txtNotes.Text.Trim() +
"&search_cat=" + txtCat.Text.Trim() +
"&search_ext_code=" + txtExtCode.Text.Trim() +
"&search_ext_code=" + string.Join(",", txtExtCode.Text.Trim().Split(new string[] { ",", ",", " "}, StringSplitOptions.RemoveEmptyEntries)) +
"&search_prod_name=" + txtProdName.Text.Trim();
if (!IsClientJit)
data += "&search_group=" + cmbGroup.Text.Trim();
@@ -293,6 +299,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
data += "&product_get_type=all";
}
if (BaseClass.SaLevel == 1 && !IsClientJit)
{
#if DEBUG
//data += "&sa_level=" + BaseClass.SaLevel;
#endif
}
if (this.cmbSort.Text == "认领总数")
{
@@ -301,8 +313,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -314,6 +324,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return list;
}
seconds = BaseRegex.GetDecimalJson(ref html, "seconds");
int count = BaseRegex.GetIntJson(ref html, "count");
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
@@ -1150,10 +1161,16 @@ namespace TemuKJD.KJDForms.ProductSelectForms
decimal GetExchangeRate(string inputStr)
{
if (inputStr.StartsWith("CA$"))
return 5.1m;
return 5.1m * 1.5m;
if (inputStr.StartsWith("US$"))
return 7.1m;
return 1;
return 7.1m * 1.5m;
if (inputStr.StartsWith("AU$"))
return 4.7m * 1.5m;
if (inputStr.StartsWith("EU$") || inputStr.StartsWith("EUR$") || inputStr.StartsWith("EU€") || inputStr.StartsWith("EUR€"))
return 8.3m * 1.5m;
if (inputStr.StartsWith("CNY") || inputStr.StartsWith("CN$"))
return 1m * 1.5m;
return 10m;
}
private void dgvSelectShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
@@ -50,13 +50,17 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label8 = new System.Windows.Forms.Label();
this.txtNotes = new DevComponents.DotNetBar.Controls.TextBoxX();
this.btnEditDbProd = new DevComponents.DotNetBar.PanelEx();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.flowLayoutPanel1);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Controls.Add(this.cmbUserNotes);
@@ -64,7 +68,6 @@
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.txtDraftId);
this.panel2.Controls.Add(this.label5);
this.panel2.Controls.Add(this.btnFission);
this.panel2.Controls.Add(this.lblTextCount);
this.panel2.Controls.Add(this.txtSkc);
this.panel2.Controls.Add(this.txtSpu);
@@ -176,7 +179,8 @@
this.btnFission.CanvasColor = System.Drawing.SystemColors.Control;
this.btnFission.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnFission.DisabledBackColor = System.Drawing.Color.Empty;
this.btnFission.Location = new System.Drawing.Point(88, 490);
this.btnFission.Location = new System.Drawing.Point(0, 0);
this.btnFission.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.btnFission.Name = "btnFission";
this.btnFission.Size = new System.Drawing.Size(56, 26);
this.btnFission.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -325,6 +329,41 @@
this.txtNotes.Size = new System.Drawing.Size(265, 44);
this.txtNotes.TabIndex = 385;
//
// btnEditDbProd
//
this.btnEditDbProd.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnEditDbProd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnEditDbProd.DisabledBackColor = System.Drawing.Color.Empty;
this.btnEditDbProd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnEditDbProd.Location = new System.Drawing.Point(59, 0);
this.btnEditDbProd.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.btnEditDbProd.Name = "btnEditDbProd";
this.btnEditDbProd.Size = new System.Drawing.Size(72, 26);
this.btnEditDbProd.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnEditDbProd.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnEditDbProd.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnEditDbProd.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnEditDbProd.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnEditDbProd.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnEditDbProd.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnEditDbProd.Style.GradientAngle = 90;
this.btnEditDbProd.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnEditDbProd.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnEditDbProd.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnEditDbProd.TabIndex = 504;
this.btnEditDbProd.Text = "编辑源商品";
this.btnEditDbProd.Visible = false;
this.btnEditDbProd.Click += new System.EventHandler(this.btnEditDbProd_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.btnFission);
this.flowLayoutPanel1.Controls.Add(this.btnEditDbProd);
this.flowLayoutPanel1.Location = new System.Drawing.Point(88, 490);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(200, 28);
this.flowLayoutPanel1.TabIndex = 505;
//
// DbProductSelectEditNotesForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -340,6 +379,7 @@
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -367,5 +407,7 @@
private System.Windows.Forms.ComboBox cmbUserNotes;
private DevComponents.DotNetBar.PanelEx btnOk;
private System.Windows.Forms.Label label7;
private DevComponents.DotNetBar.PanelEx btnEditDbProd;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}
@@ -13,17 +13,19 @@ using System.Windows.Forms;
using AllBase;
using Work;
using TemuKJD.BLL;
using NaiBa.Util.Extension;
namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectEditNotesForm : LRBaseForm
{
public bool IsClientJit { get; set; } = false;
public EnumClientMode ClientMode { get; set; } = EnumClientMode.Admin;
public ShopLoginInfo shop { get; set; }
TemuDBProductSelect dbProdSelect = null;
SetProductSelectNotesType selectNotesType;
SetProductSelectType selectNotesType;
public DbProductSelectEditNotesForm(TemuDBProductSelect prod, SetProductSelectNotesType notesType= SetProductSelectNotesType.DbProduct)
public DbProductSelectEditNotesForm(TemuDBProductSelect prod, SetProductSelectType notesType= SetProductSelectType.DbProduct)
{
InitializeComponent();
@@ -46,7 +48,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbUserNotes.Text = dbProdSelect.user_notes;
}
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
{
this.txtProdName.ReadOnly = false;
this.lblTextCount.Visible = true;
@@ -58,12 +60,21 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.lblTextCount.Visible = false;
this.btnFission.Visible = false;
}
if (ClientMode == EnumClientMode.Admin && BaseClass.SaLevel == 1)
{
this.btnEditDbProd.Visible = true;
}
else
{
this.btnEditDbProd.Visible = false;
}
}
private void btnOk_Click(object sender, EventArgs e)
{
var url = "";
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
url = BaseClass.BuildObjString("product/mdy_product_select_notes");
else
url = BaseClass.BuildObjString("product_third/mdy_product_select_notes");
@@ -72,9 +83,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
data += "&select_add_time=" + dbProdSelect.add_time.ToString("yyyy-MM-dd HH:mm:ss");
data += "&notes=" + this.txtNotes.Text.Trim();
data += "&user_notes=" + this.cmbUserNotes.Text.Trim();
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
{
byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(txtProdName.Text.Trim());
if (bytes.Length > 1250)
@@ -100,7 +111,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
dbProdSelect.notes = this.txtNotes.Text.Trim();
dbProdSelect.user_notes = this.cmbUserNotes.Text.Trim();
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
{
dbProdSelect.fission_product_name = this.txtProdName.Text.Trim();
}
@@ -135,5 +146,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.txtProdName.Text = DbProductListForm.GetFissionProductName(temuDBProd);
}
private void btnEditDbProd_Click(object sender, EventArgs e)
{
var dbProd = new KJDDBProduct() { id = dbProdSelect.out_product_Id.ParseToInt() };
DbProductEditDetailForm editDetailForm = new DbProductEditDetailForm(dbProd, dbProdSelect, selectNotesType);
editDetailForm.shop = shop;
editDetailForm.productDraftId = dbProdSelect.draft_id;
editDetailForm.ShowDialog();
}
}
}
@@ -42,6 +42,7 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label12 = new System.Windows.Forms.Label();
this.numMaxWaitSecond = new System.Windows.Forms.NumericUpDown();
this.pbFissionSetting = new System.Windows.Forms.PictureBox();
this.btnForceEnable = new DevComponents.DotNetBar.PanelEx();
@@ -216,6 +217,7 @@
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.label12);
this.splitContainer1.Panel1.Controls.Add(this.numMaxWaitSecond);
this.splitContainer1.Panel1.Controls.Add(this.pbFissionSetting);
this.splitContainer1.Panel1.Controls.Add(this.btnForceEnable);
@@ -267,6 +269,16 @@
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 2;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(817, 71);
this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(56, 17);
this.label12.TabIndex = 802;
this.label12.Text = "加价配置";
//
// numMaxWaitSecond
//
this.numMaxWaitSecond.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -558,8 +570,8 @@
// chkSkuRandomPrice
//
this.chkSkuRandomPrice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.chkSkuRandomPrice.Location = new System.Drawing.Point(763, 4);
this.chkSkuRandomPrice.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.chkSkuRandomPrice.Location = new System.Drawing.Point(761, 4);
this.chkSkuRandomPrice.Margin = new System.Windows.Forms.Padding(0);
this.chkSkuRandomPrice.Name = "chkSkuRandomPrice";
this.chkSkuRandomPrice.Size = new System.Drawing.Size(110, 21);
this.chkSkuRandomPrice.TabIndex = 468;
@@ -575,7 +587,7 @@
0,
0,
131072});
this.numSkuRandomPrice.Location = new System.Drawing.Point(873, 3);
this.numSkuRandomPrice.Location = new System.Drawing.Point(871, 3);
this.numSkuRandomPrice.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.numSkuRandomPrice.Name = "numSkuRandomPrice";
this.numSkuRandomPrice.Size = new System.Drawing.Size(44, 23);
@@ -591,7 +603,7 @@
//
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(917, 6);
this.label11.Location = new System.Drawing.Point(915, 6);
this.label11.Margin = new System.Windows.Forms.Padding(0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(20, 17);
@@ -602,13 +614,14 @@
//
this.chkOriginalPriceMarkUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.chkOriginalPriceMarkUp.AutoSize = true;
this.chkOriginalPriceMarkUp.Location = new System.Drawing.Point(939, 4);
this.chkOriginalPriceMarkUp.Location = new System.Drawing.Point(937, 4);
this.chkOriginalPriceMarkUp.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.chkOriginalPriceMarkUp.Name = "chkOriginalPriceMarkUp";
this.chkOriginalPriceMarkUp.Size = new System.Drawing.Size(95, 21);
this.chkOriginalPriceMarkUp.TabIndex = 469;
this.chkOriginalPriceMarkUp.Text = "sku原价加价";
this.chkOriginalPriceMarkUp.UseVisualStyleBackColor = true;
this.chkOriginalPriceMarkUp.CheckedChanged += new System.EventHandler(this.chkOriginalPriceMarkUp_CheckedChanged);
//
// btnSetSubSa
//
@@ -1000,7 +1013,7 @@
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(933, 71);
this.label17.Location = new System.Drawing.Point(1007, 71);
this.label17.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(20, 17);
@@ -1015,7 +1028,7 @@
0,
0,
131072});
this.numAddPrice.Location = new System.Drawing.Point(889, 68);
this.numAddPrice.Location = new System.Drawing.Point(963, 68);
this.numAddPrice.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.numAddPrice.Name = "numAddPrice";
this.numAddPrice.Size = new System.Drawing.Size(44, 23);
@@ -1029,7 +1042,7 @@
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(843, 71);
this.label16.Location = new System.Drawing.Point(917, 71);
this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(48, 17);
@@ -1044,7 +1057,7 @@
0,
0,
131072});
this.numAddPriceTimes.Location = new System.Drawing.Point(799, 68);
this.numAddPriceTimes.Location = new System.Drawing.Point(873, 68);
this.numAddPriceTimes.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.numAddPriceTimes.Name = "numAddPriceTimes";
this.numAddPriceTimes.Size = new System.Drawing.Size(44, 23);
@@ -1395,13 +1408,14 @@
// chkAddPrice
//
this.chkAddPrice.AutoSize = true;
this.chkAddPrice.Location = new System.Drawing.Point(755, 69);
this.chkAddPrice.Location = new System.Drawing.Point(750, 69);
this.chkAddPrice.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.chkAddPrice.Name = "chkAddPrice";
this.chkAddPrice.Size = new System.Drawing.Size(51, 21);
this.chkAddPrice.Size = new System.Drawing.Size(75, 21);
this.chkAddPrice.TabIndex = 550;
this.chkAddPrice.Text = "加价";
this.chkAddPrice.Text = "额外加价";
this.chkAddPrice.UseVisualStyleBackColor = true;
this.chkAddPrice.CheckedChanged += new System.EventHandler(this.chkAddPrice_CheckedChanged);
//
// flowLayoutPanel2
//
@@ -2238,5 +2252,6 @@
private System.Windows.Forms.DataGridViewLinkColumn colEditNotes;
private System.Windows.Forms.DataGridViewLinkColumn colDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.Label label12;
}
}
@@ -34,13 +34,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectListManageForm : LRBaseForm
{
public enum EnumClientMode
{
Admin,
Client,
ClientJit,
}
public EnumClientMode ClientMode { get; set; } = EnumClientMode.Admin;
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
@@ -494,7 +487,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
break;
case "编辑备注":
DbProductSelectEditNotesForm editForm = new DbProductSelectEditNotesForm(dbSelectProduct);
editForm.IsClientJit = (ClientMode == EnumClientMode.ClientJit);
editForm.ClientMode = ClientMode;
editForm.shop = GetShop(shopId);
editForm.ShowDialog();
dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes;
dgvSelectProduct.Rows[e.RowIndex].Cells["colUserNotes"].Value = dbSelectProduct.user_notes;
@@ -980,6 +974,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
string opRst = prod.status == "已上传" ? "已成功上传" : "已上传草稿箱";
row.Cells["colOpResult"].Value = opRst + "但保存到服务端失败:" + BaseRegex.GetStringJson(ref html, "msg") + (" " + error).Trim(' ');
row.Cells["colStatus"].Value = prod.status;
row.Cells["colSelect"].Value = false;
}));
}
else
@@ -989,6 +984,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
row.Cells["colDraftId"].Value = productDraftId; // 草稿箱id
row.Cells["colOpResult"].Value = prod.status == "已上传" ? "已成功上传" : "已上传草稿箱" + (" " + error).TrimEnd(' ');
row.Cells["colStatus"].Value = prod.status;
row.Cells["colSelect"].Value = false;
}));
}
}
@@ -1207,13 +1203,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
prodParam.carouselImageI18nReqs = prodInfo.carouselImageI18nVOList;
prodParam.carouselImageUrls = prodInfo.carouselImageUrls;
prodParam.carouselImageUrls = prodInfo.carouselImageUrls.Take(10).ToList();
List<ProductSkuReqsItem> realSkuItems = new List<ProductSkuReqsItem>();
Dictionary<string, AiSkuImgInfo> aiImgInfoDic = new Dictionary<string, AiSkuImgInfo>();
List<AiSkuImgInfo> aiImgInfoList = new List<AiSkuImgInfo>();
List<string> realCarouselImageUrls = new List<string>();
realCarouselImageUrls.AddRange(prodInfo.carouselImageUrls);
realCarouselImageUrls.AddRange(prodInfo.carouselImageUrls.Take(10));
if (chkCustomPic.Checked) // 上传自定义图片 自定义主图
{
@@ -2057,9 +2053,19 @@ namespace TemuKJD.KJDForms.ProductSelectForms
// 按照批号原价取商品原价和加价规则并修改商品上传价格
if (chkOriginalPriceMarkUp.Checked)
{
var dbPrice = lstDbPrice.FirstOrDefault(p => p.ext_code == dbProd.ext_code);
if (dbPrice != null)
skuItem.supplierPrice = dbPrice.original_price * dbPrice.markup_times + dbPrice.extra_price;
if (dbProd.cost_price != null && dbProd.cost_price.ParseToInt() > 0)
{
skuItem.supplierPrice = (dbProd.cost_price.ParseToDecimal() * 100).ParseToInt();
skuItem.supplierPrice = (skuItem.supplierPrice * numAddPriceTimes.Value + numAddPrice.Value * 100).ParseToInt();
}
else
{
var dbPrice = lstDbPrice.FirstOrDefault(p => p.ext_code == dbProd.ext_code);
if (dbPrice != null)
skuItem.supplierPrice = dbPrice.original_price * dbPrice.markup_times + dbPrice.extra_price;
else
skuItem.supplierPrice = (skuInfo.supplierPrice * numAddPriceTimes.Value + numAddPrice.Value * 100).ParseToInt();
}
}
if (chkAddPrice.Checked) //自定义加价
{
@@ -3126,7 +3132,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return HttpResponseBLL.PostResponse2(shop, url, body, refere);
}
private string QueryCategoryTemplate(ShopLoginInfo shop, string draftId, string catId)
public static string QueryCategoryTemplate(ShopLoginInfo shop, string draftId, string catId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/category/template/query";
string body = @"{""catId"":" + catId + @",""langList"":[""en""]}";
@@ -3746,5 +3752,17 @@ Content-Disposition: form-data; name=""sign""
ProductThirdSelectForms.ProductThirdTitleForm titleForm = new ProductThirdSelectForms.ProductThirdTitleForm();
titleForm.ShowDialog();
}
private void chkAddPrice_CheckedChanged(object sender, EventArgs e)
{
if (chkAddPrice.Checked)
chkOriginalPriceMarkUp.Checked = false;
}
private void chkOriginalPriceMarkUp_CheckedChanged(object sender, EventArgs e)
{
if (chkOriginalPriceMarkUp.Checked)
chkAddPrice.Checked = false;
}
}
}
@@ -19,9 +19,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
public partial class DbProductUserSelectEditNotesForm : LRBaseForm
{
TemuDBProductSelect dbProdSelect = null;
SetProductSelectNotesType selectNotesType;
SetProductSelectType selectNotesType;
public DbProductUserSelectEditNotesForm(TemuDBProductSelect prod, SetProductSelectNotesType notesType= SetProductSelectNotesType.DbProduct)
public DbProductUserSelectEditNotesForm(TemuDBProductSelect prod, SetProductSelectType notesType= SetProductSelectType.DbProduct)
{
InitializeComponent();
@@ -41,7 +41,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbUserNotes.Text = dbProdSelect.user_notes;
}
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
{
this.txtProdName.ReadOnly = true;
this.lblTextCount.Visible = false;
@@ -59,7 +59,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbUserNotes.Text = "已买";
var url = "";
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
url = BaseClass.BuildObjString("product/mdy_product_select_notes");
else
url = BaseClass.BuildObjString("product_third/mdy_product_select_notes");
@@ -80,7 +80,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
else
{
dbProdSelect.user_notes = this.cmbUserNotes.Text.Trim();
if (selectNotesType == SetProductSelectNotesType.DbProduct)
if (selectNotesType == SetProductSelectType.DbProduct)
{
dbProdSelect.fission_product_name = this.txtProdName.Text.Trim();
}
+100
View File
@@ -0,0 +1,100 @@
namespace TemuKJD.KJDForms.ProductSelectForms
{
partial class UcPropEdit
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.cmbPropValues = new System.Windows.Forms.ComboBox();
this.lblPropName = new System.Windows.Forms.Label();
this.lblNotes = new System.Windows.Forms.Label();
this.lblRequired = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cmbPropValues
//
this.cmbPropValues.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmbPropValues.FormattingEnabled = true;
this.cmbPropValues.Location = new System.Drawing.Point(24, 32);
this.cmbPropValues.Name = "cmbPropValues";
this.cmbPropValues.Size = new System.Drawing.Size(273, 25);
this.cmbPropValues.TabIndex = 0;
//
// lblPropName
//
this.lblPropName.AutoSize = true;
this.lblPropName.Location = new System.Drawing.Point(29, 11);
this.lblPropName.Name = "lblPropName";
this.lblPropName.Size = new System.Drawing.Size(85, 17);
this.lblPropName.TabIndex = 1;
this.lblPropName.Text = "lblPropName";
//
// lblNotes
//
this.lblNotes.Location = new System.Drawing.Point(173, 11);
this.lblNotes.Name = "lblNotes";
this.lblNotes.Size = new System.Drawing.Size(124, 17);
this.lblNotes.TabIndex = 2;
this.lblNotes.Text = "lblNotes";
this.lblNotes.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblNotes.Visible = false;
//
// lblRequired
//
this.lblRequired.AutoSize = true;
this.lblRequired.ForeColor = System.Drawing.Color.Red;
this.lblRequired.Location = new System.Drawing.Point(21, 11);
this.lblRequired.Name = "lblRequired";
this.lblRequired.Size = new System.Drawing.Size(13, 17);
this.lblRequired.TabIndex = 3;
this.lblRequired.Text = "*";
//
// UcPropEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.lblPropName);
this.Controls.Add(this.lblRequired);
this.Controls.Add(this.lblNotes);
this.Controls.Add(this.cmbPropValues);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "UcPropEdit";
this.Size = new System.Drawing.Size(323, 71);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.ComboBox cmbPropValues;
public System.Windows.Forms.Label lblPropName;
public System.Windows.Forms.Label lblNotes;
public System.Windows.Forms.Label lblRequired;
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class UcPropEdit : UserControl
{
public UcPropEdit()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>