产品库搜索无分组商品 页面模拟上传优化
This commit is contained in:
1 parent
ec559bd6cc
commit
2cc12d96c9
20 files changed
+1160
-878
No files matched your search
@@ -88,7 +88,7 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
false, // !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
@@ -102,7 +102,7 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
|
||||
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId) && canUse;
|
||||
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colShopNotes"].Value = shopEntity.Notes;
|
||||
@@ -111,6 +111,24 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
|
||||
}
|
||||
displayShopStatus(shopEntity);
|
||||
}
|
||||
|
||||
void displayShopStatus(ShopLoginInfo shop)
|
||||
{
|
||||
bool canUse = shop.LoginStatus == "登录成功";
|
||||
//bool apiAuth = shop.AuthExpiresTime > DateTime.Now;
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightBlue : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkBlue : Color.DarkRed;
|
||||
//row.Cells["colApiStatus"].Style.ForeColor = apiAuth ? Color.Green : Color.OrangeRed;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
@@ -279,6 +297,12 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
else if (cmbStatus.Text == "下架")
|
||||
isOnsale = 0;
|
||||
}));
|
||||
int? isSoldOut = null;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (cmbStatus.Text == "售罄")
|
||||
isSoldOut = 1;
|
||||
}));
|
||||
//,"goods_id_list":["819969337632","819963304053"],"
|
||||
List<string> goods_id_list = null;
|
||||
if (!string.IsNullOrWhiteSpace(txtSPU.Text))
|
||||
@@ -294,7 +318,7 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
minPrice = (txtMinPrice.Text.Trim().ParseToDecimal() * 100).ParseToLong();
|
||||
if (!string.IsNullOrWhiteSpace(txtMaxPrice.Text))
|
||||
maxPrice = (txtMaxPrice.Text.Trim().ParseToDecimal() * 100).ParseToLong();
|
||||
string jsonStr = shop_goods_search(shop, goods_id_list, txtGoodsName.Text.Trim(), out_goods_sn_list, skuSns, isOnsale, minPrice, maxPrice, page, pageSize);
|
||||
string jsonStr = shop_goods_search(shop, goods_id_list, txtGoodsName.Text.Trim(), out_goods_sn_list, skuSns, isOnsale, isSoldOut, minPrice, maxPrice, page, pageSize);
|
||||
if (jsonStr.Contains("繁忙") && tryCount < 5)
|
||||
{
|
||||
tryCount++;
|
||||
@@ -343,29 +367,38 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
url = pInfo.hd_thumb_url;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = pInfo.thumb_url;
|
||||
var activityPrice = pInfo.sku_group_price;
|
||||
string activityPriceStr = "";
|
||||
if (pInfo.sku_group_price.FirstOrDefault() != pInfo.origin_sku_group_price.FirstOrDefault())
|
||||
activityPriceStr = "\r\n活动价:\r\n" + string.Join("~", pInfo.sku_group_price.Select(s => s / 100m));
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowId = this.dgvProduct.Rows.Add(
|
||||
true,
|
||||
false,
|
||||
shop.ShopId,
|
||||
shop.ShopAccount,
|
||||
url.Replace("https", "http"),
|
||||
null, // 列表图片
|
||||
Extension.DataGridViewExtension.defaultBitmap, // 列表图片
|
||||
pInfo.id,
|
||||
pInfo.out_goods_sn,
|
||||
pInfo.goods_name,
|
||||
string.Join("~", pInfo.sku_group_price.Select(s => s / 100m)),
|
||||
pInfo.resource.Replace(",", " "),
|
||||
string.Join("~", pInfo.origin_sku_group_price.Select(s => s / 100m)) + activityPriceStr,
|
||||
pInfo.quantity,
|
||||
"", //收藏
|
||||
"", //总销量
|
||||
"", //30日销量
|
||||
BaseClass.StampToDateTime(pInfo.created_at.ParseToInt()),
|
||||
BaseClass.StampToDateTime(pInfo.created_at.ParseToInt()).ToString("yy-MM-dd HH:mm:ss"),
|
||||
pInfo.is_onsale == true ? "在售" : "下架",
|
||||
(pInfo.edit_check == null || pInfo.edit_check.check_status != 3)? "" : "商品修改被驳回",
|
||||
"" // 操作结果,状态
|
||||
);
|
||||
|
||||
dgvProduct.Rows[rowId].Height = 60;
|
||||
if (!string.IsNullOrEmpty(activityPriceStr))
|
||||
{
|
||||
dgvProduct.Rows[rowId].Cells["colPrice"].Style.ForeColor = Color.DarkOrange;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -416,13 +449,16 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
|
||||
|
||||
public static string shop_goods_search(ShopLoginInfo shop, List<string> goods_id_list, string goods_name,
|
||||
List<string> out_goods_sn_list = null, List<string> out_sku_sns = null, int? isOnsale = null, long? minPrice=null, long? maxPrice=null, int page=1, int pageSize = 100)
|
||||
List<string> out_goods_sn_list = null, List<string> out_sku_sns = null, int? isOnsale = null, int? isSoldOut = null, long? minPrice = null, long? maxPrice = null, int page = 1, int pageSize = 100)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
||||
Dictionary<string, object> dicParam = new Dictionary<string, object>();
|
||||
// 查询售罄商品
|
||||
// {"page":1,"order_by":"sold_out_time:desc,id:desc","out_goods_sn_gray_flag":true,"pre_sale_type":4,"shipment_time_type":3,"sold_out":1,"size":10}
|
||||
|
||||
dicParam["out_goods_sn_gray_flag"] = true;
|
||||
dicParam["pre_sale_type"] = 4;
|
||||
dicParam["page"] = page;
|
||||
@@ -437,8 +473,15 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
dicParam["goods_name"] = goods_name;
|
||||
if (out_sku_sns != null)
|
||||
dicParam["out_sku_sns"] = out_sku_sns;
|
||||
dicParam["sold_out"] = 0;
|
||||
if (isOnsale != null)
|
||||
dicParam["sold_out"] = 0;
|
||||
else if (isSoldOut == 1)
|
||||
{
|
||||
dicParam["order_by"] = "sold_out_time:desc,id:desc";
|
||||
dicParam["sold_out"] = 1;
|
||||
}
|
||||
dicParam["size"] = pageSize;
|
||||
|
||||
if (minPrice != null || maxPrice != null)
|
||||
{
|
||||
long[] nArr = new long[] { 0, 1000000000 };
|
||||
@@ -997,5 +1040,53 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
cmbStatus.Text = "在售";
|
||||
txtSPU.Text = txtGoodsName.Text = txtExtCode.Text = txtSkuSns.Text = txtMinPrice.Text = txtMaxPrice.Text = "";
|
||||
}
|
||||
|
||||
private void btnSelectNotActivity_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow r in dgvProduct.Rows)
|
||||
{
|
||||
if (r.Cells["colResource"].Value.ParseToString().Contains("大促活动"))
|
||||
r.Cells["colCheck"].Value = false;
|
||||
else
|
||||
|
||||
r.Cells["colCheck"].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelectLowStock_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow r in dgvProduct.Rows)
|
||||
{
|
||||
if (r.Cells["colStock"].Value.ParseToInt() > txtLowStock.Text.ParseToInt())
|
||||
r.Cells["colCheck"].Value = false;
|
||||
else
|
||||
|
||||
r.Cells["colCheck"].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow r in dgvShop.Rows)
|
||||
{
|
||||
r.Visible = true;
|
||||
if (!string.IsNullOrWhiteSpace(txtShopNameFilter.Text))
|
||||
{
|
||||
if (!r.Cells["colShopName"].Value.ParseToString().Contains(txtShopNameFilter.Text.Trim()))
|
||||
r.Visible = false;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(txtShopGroupFilter.Text))
|
||||
{
|
||||
if (!r.Cells["colShopNotes"].Value.ParseToString().Contains(txtShopGroupFilter.Text.Trim()))
|
||||
r.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClearShopFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtShopGroupFilter.Text = "";
|
||||
txtShopNameFilter.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user