1代理改名字 2代理管理功能 3订单流水统计功能(方便报税) 4 商品预售界面-商品改价支持加减乘除四种模式
This commit is contained in:
1 parent
457a8acee6
commit
ba502650ab
69 files changed
+27720
-720
No files matched your search
@@ -0,0 +1,850 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Config;
|
||||
using AllBase.Model.Param.WXParam;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Result.PDDResult;
|
||||
using AllBase.Model.Result.WXResult;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using NaiBa.CefHelper;
|
||||
using NaiBa.CefHelper.Handler;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.Helper;
|
||||
using TemuKJD.PDDForms.ProductSelectForms;
|
||||
using TemuKJD.ToolForms;
|
||||
using TemuKJD.WXForms.ShopForms;
|
||||
using Work;
|
||||
using static TemuKJD.WXForms.ShopForms.WXTaxManage;
|
||||
|
||||
namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
public partial class WXTaxManage : BaseForm
|
||||
{
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
public bool IsLoadComplate { get; set; } = false;
|
||||
CheckBox chkSelectAll = null;
|
||||
|
||||
ConcurrentList<WxTaxMoneyInfo> lstWxTaxMoneyInfo = new ConcurrentList<WxTaxMoneyInfo>();
|
||||
|
||||
public WXTaxManage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void UserSelectDbProductForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.splitContainer1.Dock = DockStyle.Fill;
|
||||
|
||||
chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false);
|
||||
dgvShop.Columns["colSelect"].HeaderText = "";
|
||||
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
|
||||
this.dgvTaxMoney.AddSelectorColumn("colCheck");
|
||||
//dgvTaxMoney.AddImgColumn("colLiveObjectImg", "colLiveObjectImgUrl");
|
||||
//dgvTaxMoney.AddImgColumn("colDgvProdImg", "colDgvProdImgUrl");
|
||||
|
||||
dtpTimeBegin.Value = DateTime.Now.Date.AddDays(-7);
|
||||
dtpTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
|
||||
IsLoadComplate = true;
|
||||
}
|
||||
|
||||
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!chkSelectAll.Checked)
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//var list = GlobalConfig.ValidShopLoginList.Where(s => s.LoginStatus == "登录成功").Select(ss => ss.ShopId);
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
//if (list.Any(l => l == row.Cells["colShopId"]?.Value?.ToString()))
|
||||
if (row.Visible == true)
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRefreshShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
pbLoadingShop.Visible = true;
|
||||
RefreshShopLogin();
|
||||
}
|
||||
|
||||
private void UserSelectDbProductForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible == true)
|
||||
{
|
||||
RefreshShopLogin();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshShopLogin()
|
||||
{
|
||||
// 店铺Id
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
// 获取被删除的店铺
|
||||
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> !GlobalConfig.ValidShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
// 更新被删除的店铺列表
|
||||
foreach (var row in dgvRowList)
|
||||
{
|
||||
dgvShop.Rows.Remove(row);
|
||||
}
|
||||
// 绑定其他店铺(含新导入的店铺)
|
||||
foreach (ShopLoginInfo shopEntity in GlobalConfig.ValidShopLoginList)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(shopEntity.ShopId))
|
||||
BindShop(shopEntity, selectIds);
|
||||
}
|
||||
cmbFilterShopNotes.Items.Clear();
|
||||
foreach (var note in GlobalConfig.ValidShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||||
{
|
||||
cmbFilterShopNotes.Items.Add(note);
|
||||
}
|
||||
cmbFilterShopGroup.Items.Clear();
|
||||
foreach (var group in GlobalConfig.ValidShopLoginList.Select(s => s.GroupName).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||||
{
|
||||
cmbFilterShopGroup.Items.Add(group);
|
||||
}
|
||||
pbLoadingShop.Visible = false;
|
||||
}
|
||||
|
||||
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null, string msg = "")
|
||||
{
|
||||
if (shopEntity == null)
|
||||
return;
|
||||
if (shopEntity.is_point_shop_expire)
|
||||
return;
|
||||
if (selectShopId == null)
|
||||
selectShopId = new List<string>();
|
||||
|
||||
bool canUse = shopEntity.LoginStatus == "登录成功";
|
||||
//canUse = true; // 内部库不需要校验登录状态
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
var day = DateTime.Now.ToString("yyyyMMdd").ParseToInt();
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
false, //dgvShop.Rows.Count == 0 ? true : (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
shopEntity.GroupName,
|
||||
"选择商品",
|
||||
canUse ? "在线" : "掉线",
|
||||
GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
|
||||
canUse,
|
||||
GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].DicDayUploadCount[day] : 0,
|
||||
GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].OnSaleCount : 0,
|
||||
shopEntity.AddProductRemaining,
|
||||
msg
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colApi"].Value = GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期";
|
||||
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
|
||||
row.Cells["colUploadCount"].Value = GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].DicDayUploadCount[day] : 0;
|
||||
row.Cells["colOnSaleNum"].Value = GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].OnSaleCount : 0;
|
||||
row.Cells["colMessage"].Value = msg;
|
||||
}
|
||||
|
||||
displayAuthStatus(shopEntity);
|
||||
}
|
||||
|
||||
void displayAuthStatus(ShopLoginInfo shop)
|
||||
{
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
bool canUse = row.Cells["colLoginStatus"].Value.ParseToString() == "在线";
|
||||
(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;
|
||||
canUse = row.Cells["colApi"].Value.ParseToString() == "可用";
|
||||
(row.Cells["colApi"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colApi"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colApi"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightBlue : Color.OrangeRed;
|
||||
(row.Cells["colApi"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkBlue : Color.DarkRed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void dgvShop_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
//if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
// return;
|
||||
//string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
//string columnName = dgvShop.Columns[e.ColumnIndex].Name;
|
||||
//string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
|
||||
//string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopName"].Value.ToString();
|
||||
//var shop = GlobalConfig.ValidShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
//var row = dgvShop.Rows[e.RowIndex];
|
||||
//foreach(DataGridViewRow r in dgvShop.Rows)
|
||||
//{
|
||||
// if (r == row)
|
||||
// continue;
|
||||
// if (r.Cells["colSelect"].Value.ParseToBool() == true)
|
||||
// r.Cells["colSelect"].Value = false;
|
||||
//}
|
||||
//row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
string columnName = dgvShop.Columns[e.ColumnIndex].Name;
|
||||
string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
|
||||
string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopName"].Value.ToString();
|
||||
var shop = GlobalConfig.ValidShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
var row = dgvShop.Rows[e.RowIndex];
|
||||
|
||||
switch (columnName)
|
||||
{
|
||||
case "colSelect":
|
||||
////if (row.Cells["colCanUse"].Value.ParseToBool())
|
||||
//{
|
||||
// row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
|
||||
// chkSelectAll.CheckedChanged -= chkSelectAll_CheckedChanged;
|
||||
// if (dgvShop.Rows.Cast<DataGridViewRow>().All(r => r.Cells["colSelect"].Value.ParseToBool()))
|
||||
// chkSelectAll.Checked = true;
|
||||
// else
|
||||
// chkSelectAll.Checked = false;
|
||||
// chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
//}
|
||||
////else
|
||||
////{
|
||||
//// //BaseMsgForm.ShowInfo("店铺未登录!");
|
||||
////}
|
||||
|
||||
//dicCheckedShopId[row.Cells["colShopId"].Value.ParseToString()] = row.Cells["colSelect"].Value.ParseToBool();
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
break;
|
||||
case "colLoginStatus":
|
||||
{
|
||||
if (WXShopListForm.Instance == null)
|
||||
WXShopListForm.Instance = new WXShopListForm();
|
||||
WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
//shopLoginForm.prodUserSelectForm = this;
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.ShowDialog();
|
||||
RefreshShopLogin();
|
||||
}
|
||||
else
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "colApi":
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139";
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStop_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.cancellationTokenSource != null)
|
||||
this.cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
private void btnSearchOrderLst_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectRows = dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).ToList();
|
||||
if (selectRows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("请选择店铺");
|
||||
return;
|
||||
}
|
||||
pictureBox1.Visible = true;
|
||||
|
||||
this.btnExport.Enabled = false;
|
||||
this.btnSearch.Enabled = false;
|
||||
Task.Run(() => {
|
||||
Thread.Sleep(5000);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.btnExport.Enabled = true;
|
||||
this.btnSearch.Enabled = true;
|
||||
}));
|
||||
});
|
||||
|
||||
dgvTaxMoney.Rows.Clear();
|
||||
lstWxTaxMoneyInfo.Clear();
|
||||
|
||||
var createTimeBegin = 0;
|
||||
if (chkTimeBegin.Checked)
|
||||
createTimeBegin = BaseClass.DateTimeToTimestampSeconds(dtpTimeBegin.Value.Date);
|
||||
var createTimeEnd = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(1).AddSeconds(-1));
|
||||
if (chkTimeEnd.Checked)
|
||||
createTimeEnd = BaseClass.DateTimeToTimestampSeconds(dtpTimeEnd.Value.Date.AddDays(1).AddSeconds(-1));
|
||||
|
||||
enumOrderSettleState orderSettleState = enumOrderSettleState.全部;
|
||||
if (cmbOrderSettleState.Text == "无需结算")
|
||||
orderSettleState = enumOrderSettleState.无需结算;
|
||||
if (cmbOrderSettleState.Text == "已结算")
|
||||
orderSettleState = enumOrderSettleState.已结算;
|
||||
if (cmbOrderSettleState.Text == "待结算")
|
||||
orderSettleState = enumOrderSettleState.待结算;
|
||||
if (cmbOrderSettleState.Text == "部分结算")
|
||||
orderSettleState = enumOrderSettleState.部分结算;
|
||||
|
||||
enumSearchOrderState orderState = enumSearchOrderState.全部;
|
||||
if (cmbOrderState.Text == "已完成")
|
||||
orderState = enumSearchOrderState.已完成;
|
||||
if (cmbOrderState.Text == "已取消")
|
||||
orderState = enumSearchOrderState.已取消;
|
||||
if (cmbOrderState.Text == "已发货")
|
||||
orderState = enumSearchOrderState.已发货;
|
||||
if (cmbOrderState.Text == "待发货")
|
||||
orderState = enumSearchOrderState.待发货;
|
||||
|
||||
enumOrderPayMethod orderPayMethod = enumOrderPayMethod.全部;
|
||||
if (cmbOrderPayMethod.Text == "微信支付")
|
||||
orderPayMethod = enumOrderPayMethod.微信支付;
|
||||
if (cmbOrderPayMethod.Text == "先付后用")
|
||||
orderPayMethod = enumOrderPayMethod.先付后用;
|
||||
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
int num = 0;
|
||||
foreach (var row in selectRows)
|
||||
{
|
||||
num++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "店铺订单流水查询 第 " + num + " 个店铺,共 " + selectRows.Count + " 个店铺";
|
||||
row.Cells["colMessage"].Value = "";
|
||||
}));
|
||||
if (this.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var shopId = row.Cells["colShopId"].Value.ParseToString();
|
||||
var shop = GlobalConfig.ValidShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
|
||||
if (shop != null)
|
||||
{
|
||||
// 短视频带货
|
||||
//if (chkFeed.Checked)
|
||||
{
|
||||
|
||||
int page = 0;
|
||||
int pageSize = 20;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (this.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
page++;
|
||||
var getTaxMoneyRst = WXTaxBLL.getListOrderFlow(shop, page, orderSettleState.ParseToInt(), orderState.ParseToInt(), orderPayMethod.ParseToInt(), createTimeBegin, createTimeEnd);
|
||||
Thread.Sleep(Randomx.GetId(300, 600));
|
||||
|
||||
if (!getTaxMoneyRst.ParseToString().Contains("\"code\":0"))
|
||||
{
|
||||
var error = BaseRegex.GetStringJsonByRegs(ref getTaxMoneyRst, getTaxMoneyRst, "errmsg");
|
||||
if (error.ParseToString().Contains("biz magic invalid"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(r
|
||||
=> r.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
error = "店铺掉线";
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colMessage"].Value = "店铺流水查询失败 " + error;
|
||||
}));
|
||||
break;
|
||||
}
|
||||
|
||||
var wxTaxMoneyList = JsonHelper.DeserializeJsonToList<WxTaxMoneyInfo>(JsonHelper.JObjectParse(getTaxMoneyRst)["dataList"].ParseToString());
|
||||
if (wxTaxMoneyList == null)
|
||||
wxTaxMoneyList = new List<WxTaxMoneyInfo>();
|
||||
this.lstWxTaxMoneyInfo.AddRange(wxTaxMoneyList);
|
||||
foreach (var tax in wxTaxMoneyList)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
//if (prod.spuMonthSales.ParseToInt() >= txtSaleCount.Text.Trim().ParseToInt() &&
|
||||
// !dgvDaRenProd.Rows.Cast<DataGridViewRow>().Any(r => r.Cells["colTalentSpuId"].Value.ParseToString() == prod.spuId))
|
||||
{
|
||||
var rowIndex = dgvTaxMoney.Rows.Add(
|
||||
true,
|
||||
shop.ShopId,
|
||||
shop.ShopAccount,
|
||||
"登录",
|
||||
"进店",
|
||||
tax.orderId, // 订单号
|
||||
BaseClass.StampToDateTime(tax.orderCreateTime.ParseToInt()).ToString("yyyy年MM月dd日 HH:mm:ss"),
|
||||
(enumRstOrderState)tax.orderState,
|
||||
(enumOrderSettleState)tax.orderSettleState,
|
||||
tax.buyerPaidAmount.IsNullOrZero() ? "-" : "¥" + (tax.buyerPaidAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
tax.mchReceivedAmount.IsNullOrZero() ? "-" : "¥" + (tax.mchReceivedAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
tax.platformCommissionAmount.IsNullOrZero() ? "-" : "-¥" + (tax.platformCommissionAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
tax.buyerRefundAmount.IsNullOrZero() ? "-" : "-¥" + (tax.buyerRefundAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
tax.otherExpenseAmount.IsNullOrZero() ? "-" : "-¥" + (tax.otherExpenseAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
tax.mchSettleAmount.IsNullOrZero() ? "-" : "¥" + (tax.mchSettleAmount * 0.01m).ParseToDecimal().ToString("0.00"),
|
||||
shop.ShopAccount
|
||||
);
|
||||
dgvTaxMoney.Rows[rowIndex].Height = 60;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
var total = BaseRegex.GetIntJson(ref getTaxMoneyRst, "totalCount").ParseToInt();
|
||||
var totalPage = Math.Ceiling(total * 1m / pageSize).ParseToInt();
|
||||
if (page >= totalPage)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
pictureBox1.Visible = false;
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text += " 查询操作中断";
|
||||
BaseMsgForm.ShowInfo("查询操作中断");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text += " 查询操作结束";
|
||||
BaseMsgForm.ShowInfo("查询操作结束");
|
||||
}
|
||||
}));
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private void btnClearFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void btnFilterShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
row.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnEmptyShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtFilterShopName.Text = "";
|
||||
cmbFilterShopNotes.Text = "全部";
|
||||
cmbFilterShopGroup.Text = "全部";
|
||||
btnFilterShop_Click(null, null);
|
||||
}
|
||||
|
||||
private void btnReverse_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == true)
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == false)
|
||||
continue;
|
||||
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
continue;
|
||||
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddUnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == false)
|
||||
continue;
|
||||
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
continue;
|
||||
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelectOnline_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == true)
|
||||
{
|
||||
if (row.Cells["colLoginStatus"].Value.ParseToString() == "在线")
|
||||
{
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelectOffline_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == true)
|
||||
{
|
||||
if (row.Cells["colLoginStatus"].Value.ParseToString() != "在线")
|
||||
{
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnExportCSV_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectRows = dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).ToList();
|
||||
if (selectRows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("请选择店铺");
|
||||
return;
|
||||
}
|
||||
|
||||
var selectTaxRows = dgvTaxMoney.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
if (selectTaxRows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("请选择要导出的流水");
|
||||
return;
|
||||
}
|
||||
|
||||
SaveFileDialog dialog = new SaveFileDialog();
|
||||
dialog.Title = "保存文件...";
|
||||
dialog.Filter = "CSV文件 (*.csv)|*.csv|All files (*.*)|*.*";
|
||||
dialog.RestoreDirectory = true;
|
||||
|
||||
dialog.FileName = "用户 " + BaseClass.NickName + DateTime.Now.ToString(" 订单流水yyyyMMddHHmmss") + ".csv";
|
||||
if (dialog.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
var path = dialog.FileName;
|
||||
|
||||
//FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
//if (dialog.ShowDialog() != DialogResult.OK)
|
||||
// return;
|
||||
|
||||
//var path = dialog.SelectedPath;
|
||||
//string fileName = path + "\\用户 " + base + DateTime.Now.ToString("订单流水yyyyMMddHHmmss") + ".csv";
|
||||
|
||||
pictureBox1.Visible = true;
|
||||
|
||||
this.btnExport.Enabled = false;
|
||||
this.btnSearch.Enabled = false;
|
||||
Task.Run(() => {
|
||||
Thread.Sleep(5000);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.btnExport.Enabled = true;
|
||||
this.btnSearch.Enabled = true;
|
||||
}));
|
||||
});
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
int num = 0;
|
||||
foreach (var row in selectRows)
|
||||
{
|
||||
num++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在导出 第 " + num + " 个店铺,共 " + selectRows.Count + " 个店铺";
|
||||
row.Cells["colMessage"].Value = "";
|
||||
}));
|
||||
if (this.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var shopId = row.Cells["colShopId"].Value.ParseToString();
|
||||
var shop = GlobalConfig.ValidShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
|
||||
if (shop != null)
|
||||
{
|
||||
var rows = dgvTaxMoney.Rows.Cast<DataGridViewRow>()
|
||||
.Where(r => r.Cells["colDgvTaxShopId"].Value.ParseToString() == shop.ShopId && r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
var rst = OutExcel.SaveFile(path, num == 1, true, rows, "", "登录", "进店", "店铺");
|
||||
}
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
pictureBox1.Visible = false;
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text += " 导出操作中断";
|
||||
BaseMsgForm.ShowInfo("导出操作中断");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text += " 导出操作结束";
|
||||
BaseMsgForm.ShowInfo("导出操作结束");
|
||||
}
|
||||
}));
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private void dgvDaRenProd_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvTaxMoney.Columns[e.ColumnIndex].HeaderText;
|
||||
var shopId = dgvTaxMoney.Rows[e.RowIndex].Cells["colDgvTaxShopId"].Value.ParseToString();
|
||||
var shop = GlobalConfig.ValidShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "删除":
|
||||
break;
|
||||
case "登录":
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.ShowDialog();
|
||||
RefreshShopLogin();
|
||||
}
|
||||
break;
|
||||
case "进店":
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus == "登录成功")
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/home";
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.ShowDialog();
|
||||
RefreshShopLogin();
|
||||
}
|
||||
}
|
||||
break;
|
||||
//case "商品图片":
|
||||
// {
|
||||
// ShowImgForm imgFrom = new ShowImgForm(dgvTaxMoney.Rows[e.RowIndex].Cells["colDgvProdImgUrl"].Value.ParseToString());
|
||||
// imgFrom.ShowDialog();
|
||||
// break;
|
||||
// }
|
||||
//case "带货题图":
|
||||
// {
|
||||
// ShowImgForm imgFrom = new ShowImgForm(dgvTaxMoney.Rows[e.RowIndex].Cells["colLiveObjectImgUrl"].Value.ParseToString());
|
||||
// imgFrom.ShowDialog();
|
||||
// break;
|
||||
// }
|
||||
case "":
|
||||
dgvTaxMoney.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvTaxMoney.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public enum enumOrderSettleState
|
||||
{
|
||||
全部 = 0,
|
||||
待结算 = 1,
|
||||
无需结算 = 2,
|
||||
已结算 = 60,
|
||||
部分结算 = 100,
|
||||
}
|
||||
public enum enumSearchOrderState
|
||||
{
|
||||
全部 = 0,
|
||||
待发货 = 20,
|
||||
已发货 = 30,
|
||||
已完成 = 100,
|
||||
已取消 = 250,
|
||||
}
|
||||
public enum enumRstOrderState
|
||||
{
|
||||
全部 = 0,
|
||||
礼物待收下 = 12,
|
||||
待发货 = 20,
|
||||
已发货 = 30,
|
||||
已完成 = 100,
|
||||
已取消 = 200,
|
||||
}
|
||||
public enum enumOrderPayMethod
|
||||
{
|
||||
全部 = 0,
|
||||
微信支付 = 1,
|
||||
先付后用 = 3,
|
||||
}
|
||||
}
|
||||
|
||||
public class WXTaxBLL
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <param name="orderSettleState">结算状态 0全部 1待结算 2无需结算 60已结算 100部分结算</param>
|
||||
/// <param name="orderState">订单状态 0全部 20待发货 30已发货 100已完成 250已取消</param>
|
||||
/// <param name="orderPayMethod">支付方式 0全部 1微信支付 3先用后付</param>
|
||||
/// <param name="createTimeBegin">开始时间</param>
|
||||
/// <param name="createTimeEnd">结束时间</param>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public static string getListOrderFlow(ShopLoginInfo shop, int page = 1, int orderSettleState = 60, int orderState = 100, int orderPayMethod = 1,
|
||||
int createTimeBegin = 0, int createTimeEnd = 0, int pageSize = 20)
|
||||
{
|
||||
if (createTimeEnd == 0)
|
||||
createTimeEnd = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(1).AddSeconds(-1));
|
||||
|
||||
pageSize = 20;
|
||||
var offset = Math.Max(page - 1, 0) * pageSize;
|
||||
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradefunds/cgi/listOrderFlow?token=&lang=zh_CN";
|
||||
string body = @"{""orderSettleState"":" + orderSettleState + @",""orderState"":" + orderState + @",""orderPayMethod"":" + orderPayMethod +
|
||||
@",""createTimeBegin"":""" + createTimeBegin + @""",""createTimeEnd"":""" + createTimeEnd + @""",""paginationInfo"":{""limit"":20,""offset"":" + offset + "}}";
|
||||
string referer = "https://store.weixin.qq.com/shop/funds/moneyManage?section=3";
|
||||
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class WXAddFinderParam
|
||||
{
|
||||
public string ContactPerson { get; set; }
|
||||
public string WxNumber { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string Explain { get; set; }
|
||||
}
|
||||
|
||||
public class WXProdIdWithListingTime
|
||||
{
|
||||
public string spuId { get; set; } // "10000538960743"
|
||||
public string productName { get; set; } // "点教英语 《高中英语听力精听训练》强化版"
|
||||
public int? listingTime { get; set; } // 1773912220
|
||||
public int? soldNum { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user