1代理改名字 2代理管理功能 3订单流水统计功能(方便报税) 4 商品预售界面-商品改价支持加减乘除四种模式

This commit is contained in:
wule committed 2026-07-18 18:29:06 +08:00
1 parent 457a8acee6
commit ba502650ab
69 files changed
+27720 -720

No files matched your search

@@ -186,9 +186,12 @@ namespace TemuKJD.WXForms.ProductForms
this.txtPreDays.TextChanged -= txtPreDays_TextChanged;
this.txtReplaceText.TextChanged -= txtReplaceText_TextChanged;
this.txtMinPrice.TextChanged -= txtMinPrice_TextChanged;
this.txtMaxPrice.TextChanged -= txtMaxPrice_TextChanged;
this.txtWaitSeconds.TextChanged -= txtWaitSeconds_TextChanged;
this.chkHighestPriceSku.CheckedChanged -= chkHighestPriceSku_CheckedChanged;
this.chkSameSpecPrice.CheckedChanged -= chkSameSpecPrice_CheckedChanged;
this.chkLowestPriceSku.CheckedChanged -= chkLowestPriceSku_CheckedChanged;
this.chkSameSpecPriceUp.CheckedChanged -= chkSameSpecPriceUp_CheckedChanged;
this.chkSameSpecPriceDown.CheckedChanged -= chkSameSpecPriceDown_CheckedChanged;
this.chkSkipUploaded.CheckedChanged -= chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged -= chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged -= chkPreSale_CheckedChanged;
@@ -204,7 +207,9 @@ namespace TemuKJD.WXForms.ProductForms
this.txtMinPrice.Text = wxUploadRule.SkuMinPrice.ParseToString();
this.txtWaitSeconds.Text = wxUploadRule.WaitSeconds.ParseToString();
this.chkHighestPriceSku.Checked = wxUploadRule.OnlyHighestPriceSku.ParseToBool();
this.chkSameSpecPrice.Checked = wxUploadRule.SameSpecSamePrice.ParseToBool();
this.chkLowestPriceSku.Checked = wxUploadRule.OnlyLowestPriceSku.ParseToBool();
this.chkSameSpecPriceUp.Checked = wxUploadRule.SameSpecSamePriceUp.ParseToBool();
this.chkSameSpecPriceDown.Checked = wxUploadRule.SameSpecSamePriceDown.ParseToBool();
this.chkSkipUploaded.Checked = wxUploadRule.SkipUploaded.ParseToBool();
this.chkUpDraft.Checked = wxUploadRule.UpDraft.ParseToBool();
this.chkPreSale.Checked = wxUploadRule.IsPreSale.ParseToBool();
@@ -223,7 +228,9 @@ namespace TemuKJD.WXForms.ProductForms
this.txtMinPrice.TextChanged += txtMinPrice_TextChanged;
this.txtWaitSeconds.TextChanged += txtWaitSeconds_TextChanged;
this.chkHighestPriceSku.CheckedChanged += chkHighestPriceSku_CheckedChanged;
this.chkSameSpecPrice.CheckedChanged += chkSameSpecPrice_CheckedChanged;
this.chkLowestPriceSku.CheckedChanged += chkLowestPriceSku_CheckedChanged;
this.chkSameSpecPriceUp.CheckedChanged += chkSameSpecPriceUp_CheckedChanged;
this.chkSameSpecPriceDown.CheckedChanged += chkSameSpecPriceDown_CheckedChanged;
this.chkSkipUploaded.CheckedChanged += chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged += chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged += chkPreSale_CheckedChanged;
@@ -1254,9 +1261,15 @@ namespace TemuKJD.WXForms.ProductForms
if (result.Contains("今日提审次数已用尽,请明日再试") || result.Contains("如需上架请先缴纳足额保证金") || result.Contains("在架商品数已达到上限") ||
result.Contains("提审次数已达上限") || result.Contains("拥金上货失败:需要开通优选联盟") || result.Contains("本店铺近期提审失败比例较高,已被限"))
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
Invoke(new Action(() => { shopRow.Cells["colSelect"].Value = false; }));
shop.upLimitRetryCount++;
if (shop.upLimitRetryCount > 3)
{
shop.upLimitRetryCount = 0;
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
Invoke(new Action(() => { shopRow.Cells["colSelect"].Value = false; }));
}
}
// 图片重复的,修改图片缓存为空再传一次
if (result.Contains("10020225") || result.Contains("10020226"))
@@ -1828,7 +1841,8 @@ namespace TemuKJD.WXForms.ProductForms
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品数据初始化失败" + ex.Message + "\"}";
}
}
if (chkSameSpecPrice.Checked)
// 同颜色规格向上浮动同价格
if (chkSameSpecPriceUp.Checked)
{
var priceTextLst = dbProd.price_text.Split('-');
if (priceTextLst.Length != 2 || priceTextLst[0] != priceTextLst[1])
@@ -1865,6 +1879,45 @@ namespace TemuKJD.WXForms.ProductForms
}
}
}
// 同颜色规格向下浮动同价格
if (chkSameSpecPriceDown.Checked)
{
var priceTextLst = dbProd.price_text.Split('-');
if (priceTextLst.Length != 2 || priceTextLst[0] != priceTextLst[1])
{
Dictionary<string, int> specPriceDic = new Dictionary<string, int>();
Dictionary<string, int> specMultiPriceDic = new Dictionary<string, int>();
var skuJArr = prodJObj["detail"]["sku"] as JArray;
try
{
// 计算主spec的最低价
foreach (var skuJObj in skuJArr)
{
var specJArr = skuJObj["spec"] as JArray;
if (!specPriceDic.ContainsKey(specJArr[0]["spec_name"].ParseToString()) || skuJObj["price"].ParseToInt() < specPriceDic[specJArr[0]["spec_name"].ParseToString()])
{
specPriceDic[specJArr[0]["spec_name"].ParseToString()] = skuJObj["price"].ParseToInt();
}
if (!specMultiPriceDic.ContainsKey(specJArr[0]["spec_name"].ParseToString()) || skuJObj["multi_price"].ParseToInt() < specMultiPriceDic[specJArr[0]["spec_name"].ParseToString()])
{
specMultiPriceDic[specJArr[0]["spec_name"].ParseToString()] = skuJObj["multi_price"].ParseToInt();
}
}
// 统一按最低价设置
foreach (var skuJObj in skuJArr)
{
var specJArr = skuJObj["spec"] as JArray;
skuJObj["price"] = specPriceDic[specJArr[0]["spec_name"].ParseToString()];
skuJObj["multi_price"] = specMultiPriceDic[specJArr[0]["spec_name"].ParseToString()];
}
}
catch (Exception ex)
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品数据初始化失败" + ex.Message + "\"}";
}
}
}
// 只保留最高价
if (chkHighestPriceSku.Checked)
{
int price = 0;
@@ -1901,6 +1954,43 @@ namespace TemuKJD.WXForms.ProductForms
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品数据初始化失败" + ex.Message + "\"}";
}
}
// 只保留最低价
if (chkLowestPriceSku.Checked)
{
int price = 99999999;
var skuJArr = prodJObj["detail"]["sku"] as JArray;
try
{
// 计算主spec的最低价
foreach (var skuJObj in skuJArr)
{
if (price > skuJObj["multi_price"].ParseToInt())
price = skuJObj["multi_price"].ParseToInt();
}
var product_json_tmp = JsonHelper.SerializeObject(prodJObj);
// 移除第一组所有sku
skuJArr.RemoveAll();
// 序列化第二组,从组中挑选符合价格条件的sku往第一组内填写
var prodJObj2 = JObject.Parse(product_json_tmp);
var skuJArr2 = prodJObj2["detail"]["sku"] as JArray;
foreach (var skuJObj2 in skuJArr2)
{
if (skuJObj2["multi_price"].ParseToInt() <= price)
skuJArr.Add(skuJObj2);
}
if (skuJArr.Count == 0)
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品sku差价不满足上货条件,跳过\"}";
}
}
catch (Exception ex)
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品数据初始化失败" + ex.Message + "\"}";
}
}
// 过滤低价sku,如果所有sku都不达标,跳过商品
if (!string.IsNullOrEmpty(txtMinPrice.Text))
{
@@ -1915,11 +2005,11 @@ namespace TemuKJD.WXForms.ProductForms
var skuJArr2 = prodJObj2["detail"]["sku"] as JArray;
foreach (var skuJObj2 in skuJArr2)
{
var limitPrice = this.txtMinPrice.Text.Trim().ParseToDecimal() * 100;
var limitMinPrice = this.txtMinPrice.Text.Trim().ParseToDecimal() * 100;
// 供应商价加价10%(最低1元)赚取差价 先加价后过滤,过滤条件也要相应增加10%
//if (dbProd.product_get_type_text == "厂商直采")
// limitPrice += Math.Max(100m, limitPrice * 0.1m);
if (skuJObj2["multi_price"].ParseToInt() >= limitPrice)
if (skuJObj2["multi_price"].ParseToInt() >= limitMinPrice)
skuJArr.Add(skuJObj2);
}
if (skuJArr.Count == 0)
@@ -1927,6 +2017,33 @@ namespace TemuKJD.WXForms.ProductForms
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品sku价格不满足上货条件,跳过\"}";
}
}
// 过滤高价sku,如果所有sku都不达标,跳过商品
if (!string.IsNullOrEmpty(txtMaxPrice.Text))
{
var product_json_tmp = JsonHelper.SerializeObject(prodJObj);
// 移除第一组所有sku
var skuJArr = prodJObj["detail"]["sku"] as JArray;
skuJArr.RemoveAll();
// 序列化第二组,从组中挑选符合价格条件的sku往第一组内填写
var prodJObj2 = JObject.Parse(product_json_tmp);
var skuJArr2 = prodJObj2["detail"]["sku"] as JArray;
foreach (var skuJObj2 in skuJArr2)
{
var limitMaxPrice = this.txtMaxPrice.Text.Trim().ParseToDecimal() * 100;
// 供应商价加价10%(最低1元)赚取差价 先加价后过滤,过滤条件也要相应增加10%
//if (dbProd.product_get_type_text == "厂商直采")
// limitPrice += Math.Max(100m, limitPrice * 0.1m);
if (skuJObj2["multi_price"].ParseToInt() <= limitMaxPrice)
skuJArr.Add(skuJObj2);
}
if (skuJArr.Count == 0)
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品sku价格不满足上货条件,跳过\"}";
}
}
dbProd.product_json = JsonHelper.SerializeObject(prodJObj);
}
catch (Exception ex)
@@ -5937,6 +6054,12 @@ namespace TemuKJD.WXForms.ProductForms
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void txtMaxPrice_TextChanged(object sender, EventArgs e)
{
wxUploadRule.SkuMaxPrice = txtMaxPrice.Text.Trim().ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void txtWaitSeconds_TextChanged(object sender, EventArgs e)
{
wxUploadRule.WaitSeconds = txtWaitSeconds.Text.Trim().ParseToInt();
@@ -5946,12 +6069,30 @@ namespace TemuKJD.WXForms.ProductForms
private void chkHighestPriceSku_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.OnlyHighestPriceSku = chkHighestPriceSku.Checked;
if (chkHighestPriceSku.Checked)
chkLowestPriceSku.Checked = false;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkLowestPriceSku_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.OnlyLowestPriceSku = chkLowestPriceSku.Checked;
if (chkLowestPriceSku.Checked)
chkHighestPriceSku.Checked = false;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkSameSpecPrice_CheckedChanged(object sender, EventArgs e)
private void chkSameSpecPriceUp_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.SameSpecSamePrice = chkSameSpecPrice.Checked;
wxUploadRule.SameSpecSamePriceUp = chkSameSpecPriceUp.Checked;
if (chkSameSpecPriceUp.Checked)
chkSameSpecPriceDown.Checked = false;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkSameSpecPriceDown_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.SameSpecSamePriceDown = chkSameSpecPriceDown.Checked;
if (chkSameSpecPriceDown.Checked)
chkSameSpecPriceUp.Checked = false;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
@@ -6372,6 +6513,11 @@ namespace TemuKJD.WXForms.ProductForms
fillWxCate();
}
}
private void chkSameSpecPrice_CheckedChanged(object sender, EventArgs e)
{
}
}
public class WXUpload
@@ -6823,11 +6969,14 @@ Content-Type: application/octet-stream
public string FilterWords { get; set; } = "顶级,之王,二手,亏本,冲量,白菜价,跳楼价,xx,xxx,最大,最小,低价,降价,成本,赔钱,甩卖,真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草";
public int SkuMinPrice { get; set; } = 10;
public int SkuMaxPrice { get; set; } = 9999;
public int WaitSeconds { get; set; } = 10;
public bool OnlyHighestPriceSku { get; set; } = true;
public bool SameSpecSamePrice { get; set; } = true;
public bool OnlyHighestPriceSku { get; set; } = false;
public bool OnlyLowestPriceSku { get; set; } = false;
public bool SameSpecSamePriceUp { get; set; } = false;
public bool SameSpecSamePriceDown { get; set; } = false;
public bool SkipUploaded { get; set; } = true;
public bool UpDraft { get; set; } = false;
public bool IsPreSale { get; set; } = false;