用户列表页面完成 订单列表页面开始 10%

This commit is contained in:
wule committed 2026-06-19 16:56:02 +08:00
1 parent 25cdf642bf
commit edc7913637
52 files changed
+2032 -365

No files matched your search

@@ -215,7 +215,7 @@ namespace _29WxOrder.FactoryExportForms
public void UpdateOrderStatusAndEncrypt(string orderId)
{
DouYinOrderModel douYinOrderModel = this.lstDouYinOrder.Find(x => x.order_id == orderId);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (douYinOrderModel != null && shop != null)
{
DouyinApi dyapi = new DouyinApi(shop);
+69 -61
View File
@@ -41,6 +41,7 @@ using Work.Api;
using Work.BaseForms;
using Work.BuyUsers;
using _29WxOrder.MyControl;
using Work.BLL;
namespace _29WxOrder
{
@@ -352,7 +353,7 @@ namespace _29WxOrder
{
Task.Run(() =>
{
GetServerDouShop();
GetServerShop();
});
}
private void readBuyOrder(object sender, EventArgs e)
@@ -1642,7 +1643,7 @@ namespace _29WxOrder
DouOrderListInfo.Shop_order_listItem orderListItem = new DouOrderListInfo.Shop_order_listItem();
orderListItem.order_id = jOrderObj["shop_order_id"].ToString();
orderListItem.shop_id = shop.ShopId.ParseToInt();
orderListItem.shop_name = shop.ShopName;
orderListItem.shop_name = shop.ShopAccount;
orderListItem.post_tel = jOrderObj["receiver_info"]["post_tel"].ToString();
orderListItem.productName = jOrderObj["product_item"][0]["product_name"].ToString();
orderListItem.post_receiver = jOrderObj["receiver_info"]["post_receiver"].ToString();
@@ -1816,7 +1817,7 @@ namespace _29WxOrder
foreach (DouYinOrderModel getOrderShop in onelist)
{
if (BaseClass.is_read_commission == 1) { break; }
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == getOrderShop.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == getOrderShop.shop_id.ToString());
if (shop != null && !string.IsNullOrEmpty(shop.Cookies))
{
var td = CEFBrowser.DeleteCookieAsync(cefJuLiangWebBrowser.RequestContext.GetCookieManager(null));
@@ -2211,7 +2212,7 @@ namespace _29WxOrder
DouyinApi apix = new DouyinApi(shop);
apix.JsonData = dic;
BaseClass.ShopId = shop.ShopId;
BaseClass.ShopName = shop.ShopName;
BaseClass.ShopName = shop.ShopAccount;
string html = apix.GetOrderList();
for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++)
@@ -2413,7 +2414,7 @@ namespace _29WxOrder
#region 店铺
bool readshop = false;
public List<ShopLoginInfo> GetServerDouShop()
public List<ShopLoginInfo> GetServerShop()
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
if (readshop == false)
@@ -2431,64 +2432,68 @@ namespace _29WxOrder
while (true)
{
page++;
var url = BaseClass.Build29WxObjString("shop&act=get_shop_list");
//var url = BaseClass.BuildObjString("shop&act=get_shop_list");
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
var data = UserLogin.GetSignaturex() + "&page=" + page;
var html = GetHtml.PostUtf8(url, data);
while (string.IsNullOrEmpty(html))
{
Thread.Sleep(1000);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
}
if (string.IsNullOrEmpty(html) || !html.Contains("shop_name") || !html.Contains("shop_id") || !html.Contains("name") || !html.Contains("password"))
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html)
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
break;
}
var jArr = JObject.Parse(html)["data"]["list"];
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
break;
foreach (JObject jObj in jArr)
{
string shopStr = jObj.ToString();
ShopLoginInfo shop = new ShopLoginInfo();
shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
if (shop.DbId == null)
continue;
shop.UserName = BaseRegex.GetStringJson(ref shopStr, "name");
shop.ShopName = BaseRegex.GetStringJson(ref shopStr, "shop_name");
shop.ApiAuthStatus = "读取中...";
shop.LoginStatus = "读取中...";
shop.Password = BaseRegex.GetStringJson(ref shopStr, "password");
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
//string shopStr = jObj.ToString();
//ShopLoginInfo shop = new ShopLoginInfo();
//shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
//if (shop.DbId == null)
// continue;
//shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name");
//shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_name");
//shop.ApiAuthStatus = "读取中...";
//shop.LoginStatus = "读取中...";
//shop.Password = BaseRegex.GetStringJson(ref shopStr, "password");
//shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
url = BaseClass.Build29WxObjString("shop&act=get_shop_token");
data = UserLogin.GetSignaturex() + "&shop_id=" + shop.ShopId;
//url = BaseClass.Build29WxObjString("shop&act=get_shop_token");
//data = UserLogin.GetSignaturex() + "&shop_id=" + shop.ShopId;
string htmltoken = GetHtml.PostUtf8(url, data, "", 5);
for (int i = 0; i < 10 && (string.IsNullOrEmpty(htmltoken) || htmltoken.Replace(" ", "").Contains("\"code\":400")); i++)
{
Thread.Sleep(100);
htmltoken = GetHtml.PostUtf8(url, data, "", 5);
}
var jArrs = JObject.Parse(htmltoken)["data"];
foreach (JObject jObjs in jArrs)
{
string tokens = jObjs.ToString();
string token = BaseRegex.GetStringJson(ref tokens, "access_token");
string app_key = BaseRegex.GetStringJson(ref tokens, "app_key");
string expires_in = BaseRegex.GetStringJson(ref tokens, "expires_in");
if (app_key == "7016502755254683171")
{
shop.AccessToken = token;
shop.TokenExpiresTime = Convert.ToDateTime(expires_in);
}
}
//string htmltoken = GetHtml.PostUtf8(url, data, "", 5);
//for (int i = 0; i < 10 && (string.IsNullOrEmpty(htmltoken) || htmltoken.Replace(" ", "").Contains("\"code\":400")); i++)
//{
// Thread.Sleep(100);
// htmltoken = GetHtml.PostUtf8(url, data, "", 5);
//}
//var jArrs = JObject.Parse(htmltoken)["data"];
//foreach (JObject jObjs in jArrs)
//{
// string tokens = jObjs.ToString();
// string token = BaseRegex.GetStringJson(ref tokens, "access_token");
// string app_key = BaseRegex.GetStringJson(ref tokens, "app_key");
// string expires_in = BaseRegex.GetStringJson(ref tokens, "expires_in");
// if (app_key == "7016502755254683171")
// {
// shop.AccessToken = token;
// shop.TokenExpiresTime = Convert.ToDateTime(expires_in);
// }
//}
shop.Group = BaseRegex.GetStringJson(ref shopStr, "cat_name");
shop.BuyAccount = BaseRegex.GetStringJson(ref shopStr, "buy_user_name");
shop.UploadAccount = BaseRegex.GetStringJson(ref shopStr, "upload_user_name");
if (list.Any(l => l.UserName == shop.UserName) || list.Any(l => l.ShopName == shop.ShopName))
//shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "cat_name");
//shop.BuyAccount = BaseRegex.GetStringJson(ref shopStr, "buy_user_name");
//shop.UploadAccount = BaseRegex.GetStringJson(ref shopStr, "upload_user_name");
var shop = ShopBLL.DeserializationShop(jObj);
if (list.Any(l => l.ShopId == shop.ShopId))
continue;
list.Add(shop);
@@ -2509,7 +2514,7 @@ namespace _29WxOrder
string shopNames = "";
foreach (var shop in list)
{
shopNames += shop.ShopName + ",";
shopNames += shop.ShopAccount + ",";
}
var cookies = GetServerShopCookies(shopNames);
@@ -2520,9 +2525,9 @@ namespace _29WxOrder
{
for (int j = 0; data != null && j < data.Count(); j++)
{
if (data[j][shop.ShopName] != null)
if (data[j][shop.ShopAccount] != null)
{
shop.Cookies = data[j][shop.ShopName].ToString().Replace("&", "&").Replace("%", "%").Replace("+", "+");
shop.Cookies = data[j][shop.ShopAccount].ToString().Replace("&", "&").Replace("%", "%").Replace("+", "+");
break;
}
}
@@ -2581,7 +2586,10 @@ namespace _29WxOrder
}
#endregion
}
GlobalConfig.ShopLoginList = list;
foreach (var shop in list)
{
GlobalConfig.ShopLoginList.Add(shop);
}
CheckShopLogin(list);
readshop = false;
@@ -2597,11 +2605,11 @@ namespace _29WxOrder
{
var row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopId);
if (row == null)
dgvShop.Rows.Add(true, shop.ShopId, shop.UserName, shop.ShopName, shop.ApiAuthStatus, shop.LoginStatus);
dgvShop.Rows.Add(true, shop.ShopId, shop.LoginName, shop.ShopAccount, shop.ApiAuthStatus, shop.LoginStatus);
else
{
row.Cells["colShopAccount"].Value = shop.UserName;
row.Cells["colShopName"].Value = shop.ShopName;
row.Cells["colShopAccount"].Value = shop.LoginName;
row.Cells["colShopName"].Value = shop.ShopAccount;
row.Cells["colAuthStatus"].Value = shop.ApiAuthStatus;
row.Cells["colLoginStatus"].Value = shop.LoginStatus;
}
@@ -2636,7 +2644,7 @@ namespace _29WxOrder
var data = UserLogin.GetSignaturex() + "&timestamp=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "&shop_id=" + doushop.ShopId;
var result = GetHtml.PostUtf8(url, data);
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopName == doushop.ShopName);
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopAccount == doushop.ShopAccount);
if (shop != null)
{
var loginResult = GetShopStatus(shop);
@@ -2654,7 +2662,7 @@ namespace _29WxOrder
shop.ExpiresTime = Convert.ToDateTime(expires_in);
}
if (!string.IsNullOrEmpty(shopToken)) shop.ShopToken = shopToken;
if (!string.IsNullOrEmpty(shopName)) shop.ShopName = shopName;
if (!string.IsNullOrEmpty(shopName)) shop.ShopAccount = shopName;
if (!string.IsNullOrEmpty(mobile)) shop.Mobile = mobile;
}
else if (loginResult.Contains("未登录"))
@@ -3055,7 +3063,7 @@ namespace _29WxOrder
/// <param name="shopid">店铺ID</param>
public void chaqi(string orderid, int color, string shopid)
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
if (shop != null)
{
DouyinApi apix = new DouyinApi(shop);
@@ -3238,7 +3246,7 @@ namespace _29WxOrder
if (text == "店铺账号")
{
string shopname = dgvShop.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.UserName == shopname);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.LoginName == shopname);
ShopBrower shopBrower = new ShopBrower();
shopBrower.TitleText = "店铺后台";
shopBrower.shop = shop;
@@ -3738,7 +3746,7 @@ namespace _29WxOrder
DouyinApi apix = new DouyinApi(shop);
apix.JsonData = dic;
BaseClass.ShopId = shop.ShopId;
BaseClass.ShopName = shop.ShopName;
BaseClass.ShopName = shop.ShopAccount;
string html = apix.GetOrderList();
for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++)
@@ -3823,7 +3831,7 @@ namespace _29WxOrder
{
foreach (ShopLoginInfo shop in GlobalConfig.ShopLoginList)
{
if (shop.ShopName == "开箱小店")
if (shop.ShopAccount == "开箱小店")
{
DouyinApi api = new DouyinApi(shop);
api.CreateOrder();
@@ -111,7 +111,7 @@ namespace _29WxOrder.OrderForms
isread = true;
foreach (var shop in GlobalConfig.ShopLoginList)
{
Invoke(new Action(() => { this.mainform.lblMsg.Text = "正在读取售后:" + shop.ShopName; }));
Invoke(new Action(() => { this.mainform.lblMsg.Text = "正在读取售后:" + shop.ShopAccount; }));
int size = 10;
int page = 0;
if (shop.ApiAuthStatus != "授权成功")
@@ -490,7 +490,7 @@ namespace _29WxOrder.OrderForms
{
int rowId = DgvSaleOrderList.Rows.Add(
/*"售后单号"*/ afterSale.aftersale_info.aftersale_id,
/*"店铺名称"*/ shop.ShopName,
/*"店铺名称"*/ shop.ShopAccount,
/*"店铺编号"*/ shop.ShopId,
/*"上家ID"*/ up_product_id,
/*"本店ID"*/ item.product_id,
@@ -605,7 +605,7 @@ namespace _29WxOrder.OrderForms
string name = DgvSaleOrderList.Columns[e.ColumnIndex].HeaderText;
if (name == "售后订单编号")
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
ShopBrower shopBrower = new ShopBrower();
shopBrower.TitleText = "店铺后台-售后";
shopBrower.shop = shop;
@@ -615,7 +615,7 @@ namespace _29WxOrder.OrderForms
}
else if (name == "订单号")
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
if (shop != null)
{
ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower();
@@ -753,7 +753,7 @@ namespace _29WxOrder.OrderForms
{
IEnumerable<DataGridViewRow> enumerableList = this.DgvSaleOrderList.Rows.Cast<DataGridViewRow>();
List<DataGridViewRow> list = (from item in enumerableList where item.Cells["col_order_id"].Value.ToString() == orderid select item).ToList();
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString());
if (shop != null)
{
DouyinApi dyapi = new DouyinApi(shop);
@@ -898,7 +898,7 @@ namespace _29WxOrder.OrderForms
}
var shopid = DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString();
string aftersale_id = DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["col_aftersale_id"].Value.ToString();
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
ShopBrower shopBrower = new ShopBrower();
shopBrower.TitleText = "店铺后台-售后";
shopBrower.shop = shop;
@@ -82,7 +82,7 @@ namespace _29WxOrder.OrderForms
{
if (lstProvince.Count == 0)
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId);
DouyinApi api = new DouyinApi(shop);
var address = api.GetAddressProvince();
//{"code":10000,"data":[{"province":"安徽省","province_id":34},{"province":"澳门特别行政区","province_id":82},{"province":"北京市","province_id":11},{"province":"重庆市","province_id":50},{"province":"福建省","province_id":35},{"province":"广东省","province_id":44},{"province":"甘肃省","province_id":62},{"province":"广西壮族自治区","province_id":45},{"province":"贵州省","province_id":52},{"province":"河北省","province_id":13},{"province":"湖北省","province_id":42},{"province":"黑龙江省","province_id":23},{"province":"河南省","province_id":41},{"province":"湖南省","province_id":43},{"province":"海南省","province_id":46},{"province":"吉林省","province_id":22},{"province":"江苏省","province_id":32},{"province":"江西省","province_id":36},{"province":"辽宁省","province_id":21},{"province":"内蒙古自治区","province_id":15},{"province":"宁夏回族自治区","province_id":64},{"province":"青海省","province_id":63},{"province":"四川省","province_id":51},{"province":"山东省","province_id":37},{"province":"上海市","province_id":31},{"province":"山西省","province_id":14},{"province":"陕西省","province_id":61},{"province":"天津市","province_id":12},{"province":"台湾省","province_id":71},{"province":"香港特别行政区","province_id":81},{"province":"新疆维吾尔自治区","province_id":65},{"province":"西藏自治区","province_id":54},{"province":"云南省","province_id":53},{"province":"浙江省","province_id":33}],"err_no":0,"log_id":"20220715142943010208016085061166AE","message":"success","msg":"success","sub_code":"","sub_msg":""}
@@ -265,7 +265,7 @@ namespace _29WxOrder.OrderForms
var prov = lstArea.FirstOrDefault(a => a.code.ToString() == item.Name);
if (prov == null)
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId);
DouyinApi api = new DouyinApi(shop);
var area = api.GetAreasByProvince(item.Name.ToString());
if (area.Contains("\"message\":\"success\"") || area.Contains("\"code\":10000"))
@@ -346,7 +346,7 @@ namespace _29WxOrder.OrderForms
private void btnAcceptReturnRefund_Click(object sender, EventArgs e)
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId);
var type = "101";
+1 -1
View File
@@ -254,7 +254,7 @@ namespace _29WxOrder.OrderForms
#region 更新订单
shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == orderDetail.shop_id.ToString());
shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == orderDetail.shop_id.ToString());
this.buyOrderListForm.UpdateOrderStatusAndEncrypt(orderDetail);
#endregion
+7 -7
View File
@@ -78,7 +78,7 @@ namespace _29WxOrder.OrderForms
for (int i = 0; i < CollectionClass.orderDataList.Count; i++)
{
DouYinOrderModel dymodel = CollectionClass.orderDataList[i];
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == dymodel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == dymodel.shop_id.ToString());
if (BaseClass.isUseSimGetRealAddress && (dymodel.name.Contains("解密失败") || dymodel.mobile.Contains("#1##") || dymodel.mobile == "******"))
{
isdecryption = false;
@@ -1003,7 +1003,7 @@ namespace _29WxOrder.OrderForms
/// </summary>
public void UpdateOrderStatusAndEncrypt(DouYinOrderModel douYinOrderModel, UpdateOrderType updateOrderType = UpdateOrderType.UpdateAll)
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (douYinOrderModel != null)
{
if (shop != null)
@@ -1342,9 +1342,9 @@ namespace _29WxOrder.OrderForms
string districtId = "";
BuyOrderForms.MatchAddress(ref address, ref province, ref provinceId, ref city, ref cityId, ref district, ref districtId);
var shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
string data = @"{""order_id"":""" + orderid +
@""",""shop_name"":""" + GetHtml.UrlEncodeUtf8(shop.ShopName) +
@""",""shop_name"":""" + GetHtml.UrlEncodeUtf8(shop.ShopAccount) +
@""",""up_goods_id"":""" + upproductid.Replace("pdd-", "").Replace("pd-", "") +
@""",""pay_name"":""" + GetHtml.UrlEncodeUtf8(orderDetail.name) +
@""",""pay_phone"":""" + orderDetail.mobile +
@@ -1404,7 +1404,7 @@ namespace _29WxOrder.OrderForms
}
else if (name == "订单号")
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
if (shop != null)
{
ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower();
@@ -1419,7 +1419,7 @@ namespace _29WxOrder.OrderForms
string GetOrderStatusl(string orderid)
{
DouYinOrderModel douYinOrderModel = CollectionClass.orderDataList.Find(x => x.order_id == orderid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (douYinOrderModel != null)
{
if (shop != null)
@@ -1442,7 +1442,7 @@ namespace _29WxOrder.OrderForms
var msg = BaseRegex.GetStringJson(ref htmljm, "sub_msg");
if (!string.IsNullOrEmpty(msg))
{
BaseMsgForm.ShowError(msg.Replace("access_token已过期", "店铺 " + shop.ShopName + " 授权已过期,请重新授权"));
BaseMsgForm.ShowError(msg.Replace("access_token已过期", "店铺 " + shop.ShopAccount + " 授权已过期,请重新授权"));
}
}
}
+1 -1
View File
@@ -191,7 +191,7 @@ namespace _29WxOrder.OrderForms
sb.Append("&remark=" + tbremark.Text);
sb.Append("&is_update_order=0"); // 1修改状态0不修改状态
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == orderDetail.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == orderDetail.shop_id.ToString());
if (shop != null)
{
orderDetail.remark = tbremark.Text.ToString();
+1 -1
View File
@@ -45,7 +45,7 @@ namespace _29WxOrder.OrderForms
return;
}
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (shop != null)
{
douYinOrderModel.remark = tbremark.Text.ToString();
+2 -2
View File
@@ -465,7 +465,7 @@ namespace _29WxOrder.OrderForms
#region 更新订单
DouYinOrderModel douYinOrderModel = CollectionClass.orderSenderDataList.Find(x => x.order_id == orderid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (douYinOrderModel != null)
{
if (shop != null)
@@ -809,7 +809,7 @@ namespace _29WxOrder.OrderForms
{
string orderid = DgvSendOrderList.Rows[e.RowIndex].Cells["col_order_id"].Value.ToString();
string shopid = DgvSendOrderList.Rows[e.RowIndex].Cells["col_shop_id"].Value.ToString();
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
if (shop != null)
{
ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower();
+3 -3
View File
@@ -92,7 +92,7 @@ namespace _29WxOrder.OrderForms
CollectionClass.successOrderDataList.Add(douYinOrderModel);
orderList.Add(douYinOrderModel);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString());
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
if (shop != null && douYinOrderModel.order_status != 4) // 订单状态不为4的放入列表,后面按时间段查询更新订单。
{
if (!shopList.Contains(shop))
@@ -302,7 +302,7 @@ namespace _29WxOrder.OrderForms
DouyinApi apix = new DouyinApi(shop);
apix.JsonData = dic;
BaseClass.ShopId = shop.ShopId;
BaseClass.ShopName = shop.ShopName;
BaseClass.ShopName = shop.ShopAccount;
string html = apix.GetOrderList();
for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++)
@@ -653,7 +653,7 @@ namespace _29WxOrder.OrderForms
}
else if (name == "订单号")
{
ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid);
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid);
if (shop != null)
{
ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower();
+41 -2
View File
@@ -56,6 +56,9 @@
<Reference Include="NaiBa.Util">
<HintPath>..\DllReference\NaiBa.Util.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
@@ -81,10 +84,23 @@
<DependentUpon>BaseMsgWindow.xaml</DependentUpon>
</Compile>
<Compile Include="BaseWindows\BaseWindow.cs" />
<Compile Include="Converters\TextToVisibilityConverter.cs" />
<Compile Include="Ctrls\OrderCtrls\OrderListRowCtrl.xaml.cs">
<DependentUpon>OrderListRowCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\OrderCtrls\OrderListRowHeaderCtrl.xaml.cs">
<DependentUpon>OrderListRowHeaderCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\ShopCtrls\ShopDataGridCtrl.xaml.cs">
<DependentUpon>ShopDataGridCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\ShopCtrls\ShopListCtrl.xaml.cs">
<DependentUpon>ShopListCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="LoginWindows\LoginWindow.xaml.cs">
<DependentUpon>LoginWindow.xaml</DependentUpon>
</Compile>
<Compile Include="OrderCtrls\OrderListCtrl.xaml.cs">
<Compile Include="Ctrls\OrderCtrls\OrderListCtrl.xaml.cs">
<DependentUpon>OrderListCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="ToolCtrls\Icons.xaml.cs">
@@ -94,10 +110,27 @@
<Compile Include="UserControls\UcWindowBoxes.xaml.cs">
<DependentUpon>UcWindowBoxes.xaml</DependentUpon>
</Compile>
<Compile Include="Utils\UiCtrlUtils.cs" />
<Page Include="BaseWindows\BaseMsgWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\OrderCtrls\OrderListRowCtrl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Ctrls\OrderCtrls\OrderListRowHeaderCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\ShopCtrls\ShopDataGridCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\ShopCtrls\ShopListCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LoginWindows\LoginWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -114,7 +147,7 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="OrderCtrls\OrderListCtrl.xaml">
<Page Include="Ctrls\OrderCtrls\OrderListCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -126,6 +159,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\BaseDataGridStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\BaseTextBoxStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -177,6 +214,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -237,5 +275,6 @@
<ItemGroup>
<Resource Include="Resources\close_gray.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+3 -1
View File
@@ -7,14 +7,16 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/BaseWindowStyle.xaml" />
<ResourceDictionary Source="Styles/BaseDataGridStyle.xaml" />
<ResourceDictionary Source="Styles/BaseButtonStyle.xaml" />
<ResourceDictionary Source="Styles/BaseTextBoxStyle.xaml" />
<ResourceDictionary Source="Styles/BaseComboBoxStyle.xaml" />
<ResourceDictionary Source="Styles/BaseComboBoxStyle.xaml" />
<ResourceDictionary Source="Styles/UcImageButtonStyle.xaml" />
<ResourceDictionary Source="Styles/StaticImageDictionary.xaml" />
<ResourceDictionary Source="Styles/StaticColorBrushDictionary.xaml" />
<ResourceDictionary Source="Styles/StaticImageBrushDictionary.xaml" />
<!-- 可以添加更多资源字典 -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
+106 -10
View File
@@ -1,11 +1,15 @@
using System;
using _29WxOrderWpf.BaseWindows;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
using Work;
using Work.BaseForms;
namespace _29WxOrderWpf
{
@@ -23,15 +27,107 @@ namespace _29WxOrderWpf
args = e.Args;
}
#region 后台修改logo
//// 替换字典程序logo等
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
//// 获取资源字典
//ResourceDictionary dict = Application.Current.Resources;
//// 添加或更新资源
//dict["main29WeixinIcon"] = newBitmapImage;
#endregion
try
{
//设置应用程序处理异常方式:ThreadException处理
//Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//处理UI线程异常
//Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
//处理非UI线程异常
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
//StartUp.Init();
new Initialization().Get();
#region 贴牌
//本地缓存文件
string IgPakFile = "locales/ig.pak";//贴牌客服端码
string OenVersionFile = "locales/igv.pak";//贴牌资源配置版本
string IaPakFile = "locales/ia.pak";//logo
string IbPakFile = "locales/ib.pak";//ico
string IcPakFile = "locales/ic.pak";//功能配置
//OenMechanism(IgPakFile, OenVersionFile, IaPakFile, IbPakFile, IcPakFile);
#region 后台修改logo 贴牌用
//// 替换字典程序logo等
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
//// 获取资源字典
//ResourceDictionary dict = Application.Current.Resources;
//// 添加或更新资源
//dict["main29WeixinIcon"] = newBitmapImage;
#endregion
#endregion
}
catch (Exception ex)
{
string str = GetExceptionMsg(ex, string.Empty);
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
//BaseMsgForm.ShowError(str, "系统错误");
BaseMsgWindow.ShowError(null, str, "系统错误");
}
}
//static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
//{
// string str = GetExceptionMsg(e.Exception, e.ToString());
// NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
// BaseMsgWindow.ShowError(null, str, "系统错误");
//}
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.Exception, e.ToString());
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
BaseMsgWindow.ShowError(null, str, "系统错误");
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
BaseMsgWindow.ShowError(null, str, "系统错误");
}
/// <summary>
/// 生成自定义异常消息
/// </summary>
/// <param name="ex">异常对象</param>
/// <param name="backStr">备用异常消息:当ex为null时有效</param>
/// <returns>异常字符串文本</returns>
static string GetExceptionMsg(Exception ex, string backStr)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("****************************异常文本****************************");
sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
if (ex != null)
{
sb.AppendLine("【异常类型】:" + ex.GetType().Name);
sb.AppendLine("【异常信息】:" + ex.Message);
sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
}
else
{
sb.AppendLine("【未处理异常】:" + backStr);
}
sb.AppendLine("***************************************************************");
NaiBa.Util.Helper.LogHelper.WriteWithTime("Error:" + sb);
BaseMsgWindow.ShowError(null, sb.ToString(), "系统错误");
return sb.ToString();
}
/// <summary>
/// Oen贴牌机制
/// </summary>
/// <param name="sIgPakFile">贴牌商客户端码文件</param>
/// <param name="sOenVersionFile">贴牌配置版本号文件</param>
/// <param name="sIaPakFile">ico本地缓存文件</param>
/// <param name="sIbPakFile">logo本地缓存文件</param>
/// <param name="sIcPakFile">贴牌配置本地缓存文件</param>
private static void OenMechanism(string IgPakFile, string OenVersionFile, string IaPakFile, string IbPakFile, string IcPakFile)
{
//todo: 贴牌相关处理逻辑
}
}
}
+39
View File
@@ -21,6 +21,45 @@ namespace _29WxOrderWpf.BaseWindows
WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 8, ResizeBorderThickness = new Thickness(4), });
this.DataContext = this;
this.Loaded += BaseWindow_Loaded;
SizeChanged += BaseWindow_SizeChanged;
}
private void BaseWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (WindowState == WindowState.Maximized)
{
//// 获取当前屏幕的工作区(排除任务栏)
//var workArea = SystemParameters.WorkArea;
//// 设置窗口位置和大小
//this.Left = workArea.Left;
//this.Top = workArea.Top;
//this.Width = workArea.Width;
//this.Height = workArea.Height;
this.Padding = new Thickness(6);
}
else
this.Padding = new Thickness(0);
}
private void BaseWindow_Loaded(object sender, RoutedEventArgs e)
{
if (SystemParameters.PrimaryScreenWidth < this.Width + 0)
this.Width = SystemParameters.PrimaryScreenWidth - 0;
if (SystemParameters.WorkArea.Height < this.Height + 0)
this.Height = SystemParameters.WorkArea.Height - 0;
this.MaxHeight = SystemParameters.WorkArea.Height + 14;
//this.MaxWidth = SystemParameters.WorkArea.Width + 13;
double screenWidth = SystemParameters.PrimaryScreenWidth;
double screenHeight = SystemParameters.WorkArea.Height;
double windowWidth = this.ActualWidth;
double windowHeight = this.ActualHeight;
this.Left = (screenWidth / 2) - (windowWidth / 2);
this.Top = (screenHeight / 2) - (windowHeight / 2);
}
}
}
@@ -0,0 +1,36 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace _29WxOrderWpf.Converters
{
public class HasTextToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
public class NotHasTextToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
}
@@ -0,0 +1,82 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
xmlns:utils="clr-namespace:_29WxOrderWpf.Utils"
xmlns:converters="clr-namespace:_29WxOrderWpf.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Loaded="Window_Loaded">
<UserControl.Resources>
<converters:NotHasTextToVisibilityConverter x:Key="NotHasTextVisibility"/>
</UserControl.Resources>
<Grid Background="{StaticResource ListCtrlBackColorBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridSearch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox x:Name="txtShopName" Grid.Column="0" Margin="4,0,-4,0" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" Height="28" VerticalContentAlignment="Center"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
<TextBlock Text="全部店铺" Grid.Column="0" Margin="8,0,8,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray" Visibility="{Binding ElementName=txtShopName,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>
<Button Grid.Column="1" x:Name="btnMultiShopChoice" Style="{StaticResource BasePageButtonStyle}" Margin="-4,0,0,0" Grid.Row="4" Content=" ... " Width="28" Height="28" Click="btnMultiShopChoice_Click"></Button>
<TextBox x:Name="txtGoodsName" Grid.Column="2" Margin="4,0" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" Height="28" VerticalContentAlignment="Center"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"/>
<TextBlock Text="商品标题" Grid.Column="2" Margin="8,0,8,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray" Visibility="{Binding ElementName=txtGoodsName,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>
</Grid>
<Grid x:Name="gridListHeader" Margin="4,0" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<ListBox IsHitTestVisible="True" BorderThickness="0" ItemsSource="{Binding lstOrder}" Grid.Row="2" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="4,0,4,4">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--此处绑定将数据源传递给子自定义控件OrderListRowCtrl-->
<local:OrderListRowCtrl DataContext="{Binding}"></local:OrderListRowCtrl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
@@ -0,0 +1,174 @@
using AllBase;
using AllBase.Extension;
using AllBase.Helper;
using AllBase.Model;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Work;
using Work.BLL;
namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
/// <summary>
/// OrderListCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListCtrl : UserControl
{
public ObservableCollection<oms_wei_order_info> lstOrder { get; set; } = new ObservableCollection<oms_wei_order_info>();
public List<oms_wei_order_info> lstOrder1 { get; set; } = new List<oms_wei_order_info>();
public OrderListCtrl()
{
InitializeComponent();
DataContext = this;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项
//_myDataCollection.Add(newItem); // 添加到集合中
//dataGrid.Items.Refresh();.
//dgOrder.Items.Add(1111111);
//dgOrder.ItemsSource = lstOrder;
//lbxOrder.ItemsSource = lstOrder;
Task.Run(() =>
{
while (!MainWindow.Instance.hasReadShop)
{
Thread.Sleep(100);
}
GetOrder();
//GetOrderTest();
});
}
void GetOrderTest()
{
for (int i = 0; i < 10000; i++)
{
//lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
}
lstOrder.SortDesc(o => o.order_id.ParseToLong());
}
void GetOrder()
{
Task.Run(() =>
{
int page = 0;
int totalPage = 1;
while (true)
{
if (page >= totalPage)
{
break;
}
page++;
var url = BaseClass.Build29WxObjString("order/get_order_list");
var data = UserLogin.GetSignaturex() + "&page=" + page;
var shop_id = string.Join(",", GlobalConfig.ShopLoginList.Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty()));
data += "&erp_shop_id_in=" + shop_id;
Dispatcher.Invoke(new Action(() =>
{
if (!string.IsNullOrEmpty(txtShopName.Text.Trim()))
{
var shopNames = txtShopName.Text.Trim().Split(';').Where(s => !s.IsNullOrEmpty()).ToList();
shop_id = string.Join(",", GlobalConfig.ShopLoginList.Where(s => shopNames.Contains(s.ShopAccount)).Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty()));
}
}));
Thread.Sleep(200);
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"))
{
break;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
break;
foreach (JObject jObj in jArr)
{
Dispatcher.Invoke(new Action(() =>
{
var order = JsonHelper.DeserializeJsonToObject<oms_wei_order_info>(JsonHelper.SerializeObject(jObj));
var orderExist = this.lstOrder.FirstOrDefault(o => o.order_id == order.order_id);
if (orderExist != null)
this.lstOrder.Remove(orderExist);
var nextOrder = this.lstOrder.FirstOrDefault(o => o.create_time < order.create_time);
if (nextOrder != null)
{
lstOrder.Insert(lstOrder.IndexOf(nextOrder), order);
}
else
{
lstOrder.Add(order);
}
}));
}
}
});
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
private void btnMultiShopChoice_Click(object sender, RoutedEventArgs e)
{
MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged;
MainWindow.Instance.shopListCtrl.Visibility = Visibility.Visible;
MainWindow.Instance.shopListCtrl.IsVisibleChanged += ShopListCtrl_IsVisibleChanged;
}
private void ShopListCtrl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!MainWindow.Instance.shopListCtrl.IsVisible && MainWindow.Instance.shopListCtrl.IsAcceptChoiceShop == true)
{
var list = MainWindow.Instance.shopListCtrl.lbxShop.ItemsSource as ObservableCollection<ShopLoginInfo>;
if (list != null)
this.txtShopName.Text = string.Join(";", list.Where(s => s.IsSelect == true).Select(s => s.ShopAccount));
}
MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged;
}
}
}
@@ -0,0 +1,40 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListRowCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="800">
<Border Margin="12,12,12,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1"
BorderBrush="{StaticResource ListRowBorderColorBrush}" CornerRadius="10">
<Border.Style>
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="120">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!--子控件是普通控件而非模板页控件,无需指定DataContext="{Binding}"-->
<local:OrderListRowHeaderCtrl></local:OrderListRowHeaderCtrl>
<!--<local:OrderListRowHeaderCtrl DataContext="{Binding}"></local:OrderListRowHeaderCtrl>-->
<Border Grid.Row="1" Background="Transparent" CornerRadius="0,0,12,12" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</Border>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,41 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
/// <summary>
/// OrderListRowCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListRowCtrl : UserControl
{
public OrderListRowCtrl()
{
InitializeComponent();
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,29 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListRowHeaderCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="800">
<Border Background="{StaticResource ListRowBorderColorBrush}" CornerRadius="12,12,0,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="8,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="店铺单号:" BorderThickness="0" />
<TextBox Grid.Column="1" Margin="0,8,8,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True"
Text="{Binding order_id}" BorderThickness="0" />
<Border Grid.Column="2" Width="12" Background="Transparent" Height="12" VerticalAlignment="Center" Cursor="Hand"
Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown">
<Path Margin="0,0,0,0" Fill="#409eff" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown" Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z" Stretch="Uniform" />
</Border>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,41 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
/// <summary>
/// OrderListRowHeaderCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListRowHeaderCtrl : UserControl
{
public OrderListRowHeaderCtrl()
{
InitializeComponent();
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,73 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopDataGridCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
AutoGenerateColumns = "False" HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}" CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="{StaticResource ListBackColorBrush}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource mainForegroundColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Width="50"/>
<DataGridTemplateColumn Width="*" Header="订单编号" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="图标">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="26" Padding="0" Margin="5" CornerRadius="5" Background="LightYellow" BorderBrush="Orange" BorderThickness="1">
<Label HorizontalAlignment="Center" Width="Auto" Content="店铺待发货" Foreground="Orange"></Label>
</Border>
<TextBox Grid.Row="2" HorizontalAlignment="Center" Width="Auto" Height="20" IsReadOnly="True" Text="收货地址 吕* 1********** 江苏省 镇江市 京口区" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.ShopCtrls
{
/// <summary>
/// ShopDataGridCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopDataGridCtrl : UserControl
{
public ShopDataGridCtrl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,145 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopListCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" x:Name="shopListCtrl" Loaded="shopListCtrl_Loaded">
<Grid Background="{StaticResource ListCtrlBackColorBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridSearch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="店名" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Margin="6,0,0,0"/>
<Border Grid.Column="1" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<TextBox x:Name="txtShopName" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseTextBoxStyle}"/>
</Border>
<TextBlock Text="分组" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2"/>
<Border Grid.Column="3" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<ComboBox x:Name="cmbGroup" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseComboBoxStyle}" SelectionChanged="cmbGroup_SelectionChanged"/>
</Border>
<TextBlock Text="备注" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="4"/>
<Border Grid.Column="5" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<ComboBox x:Name="cmbNotes" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseComboBoxStyle}" SelectionChanged="cmbNotes_SelectionChanged"/>
</Border>
<Button Grid.Column="6" x:Name="btnSearch" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 搜索 " Height="26" Click="btnSearch_Click"></Button>
<Button Grid.Column="7" x:Name="btnRestore" Style="{StaticResource BasePageButtonLightStyle}" Grid.Row="4" Content=" 还原 " Height="26" Click="btnRestore_Click" Margin="4,0,6,0"></Button>
</Grid>
<Grid x:Name="lstTitle" Grid.Row="1" Margin="4,0" Background="{StaticResource ListHeadBackColorBrush}">
<Border BorderThickness="0,0,1,0" BorderBrush="{StaticResource ListHeadBorderColorBrush}">
<DataGrid Margin="0,0,18,0" x:Name="dgShopHeader" Grid.ColumnSpan="100" AutoGenerateColumns="False" CanUserReorderColumns="False"
ColumnHeaderHeight="{Binding ElementName=lstTitle, Path=ActualHeight}" BorderThickness="0"
ColumnDisplayIndexChanged="dgShopHeader_ColumnDisplayIndexChanged"
LayoutUpdated="dgShopHeader_LayoutUpdated">
<DataGrid.Columns>
<DataGridTemplateColumn x:Name="colSelectAll" Header="选择" Width="50" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<Grid Width="14" Height="14">
<!--<CheckBox x:Name="headerCheckBox" BorderThickness="0" IsChecked="{Binding DataContext.AreAllSelected, RelativeSource={RelativeSource AncestorType=DataGrid}, UpdateSourceTrigger=PropertyChanged}" Checked="HeaderCheckBox_Checked" Unchecked="HeaderCheckBox_Unchecked"/>-->
<CheckBox x:Name="chkSelectAll" BorderThickness="0" IsChecked="False" Checked="ChkSelectAll_Checked" Unchecked="ChkSelectAll_Unchecked" Loaded="ChkSelectAll_Loaded" IsThreeState="True"/>
<Border BorderThickness="1" Background="Transparent" BorderBrush="{StaticResource mainColorBrush}" Width="14" Height="14"
HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False">
</Border>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!--<CheckBox IsChecked="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="AppId"/>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="店铺名称"/>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="分组"/>
<DataGridTextColumn Width="82*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header=" 备注"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
<!--<ListBox Grid.Row="2" x:Name="lbxShop" ItemsSource="{Binding GlobalConfig.ShopLoginList}" BorderThickness="0" Margin="4,0,4,4">-->
<ListBox Grid.Row="2" x:Name="lbxShop" BorderThickness="0" Margin="4,0,4,4" SelectionMode="Extended">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--<local:ShopListRowCtrl></local:ShopListRowCtrl>-->
<Border Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0, 0, 0, 1" MinHeight="50"
BorderBrush="{StaticResource ListRowBorderColorBrush}" CornerRadius="0">
<Border.Style>
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid x:Name="gridListItem">
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="{Binding colShopIdWidth,RelativeSource={RelativeSource AncestorType={x:Type local:ShopListCtrl}}}" ></ColumnDefinition>-->
<ColumnDefinition x:Name="colCheck" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colShopId" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colShopName" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colGroupName" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colNotes" Width="100*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Tag="{Binding ShopId}" IsChecked="{Binding IsSelect, Mode=TwoWay}" Click="CheckBox_Click"/>
<TextBox Grid.Column="1" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding ShopId}" />
<TextBox Grid.Column="2" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding ShopAccount}" />
<TextBox Grid.Column="3" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding GroupName}" />
<TextBox Grid.Column="4" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding Notes}" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid x:Name="gridRefreshOrSelect" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" x:Name="btnRefreshShop" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 刷新店铺 " Height="26" Margin="6,0,0,0" Click="btnRefreshShop_Click"></Button>
<Button Grid.Column="6" x:Name="btnApplySelectShop" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 确定 " Height="26" Click="btnApplySelectShop_Click"></Button>
<Button Grid.Column="7" x:Name="btnCancelSelectShop" Style="{StaticResource BasePageButtonLightStyle}" Grid.Row="4" Content=" 取消 " Height="26" Margin="4,0,6,0" Click="btnCancelSelectShop_Click"></Button>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,191 @@
using _29WxOrderWpf.Utils;
using AllBase.Helper;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.ShopCtrls
{
/// <summary>
/// ShopListCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopListCtrl : UserControl
{
public bool? IsAcceptChoiceShop { get; set; } = false;
CheckBox chkSelectAll = null;
public ShopListCtrl()
{
InitializeComponent();
DataContext = this;
}
private void shopListCtrl_Loaded(object sender, RoutedEventArgs e)
{
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
Task.Run(() => {
while(MainWindow.Instance.hasReadShop == false)
{
Thread.Sleep(100);
}
Dispatcher.Invoke(new Action(() => {
cmbGroup.Items.Clear();
cmbGroup.Items.Add("");
foreach (var group in GlobalConfig.ShopLoginList.Select(s => s.GroupName).Distinct())
{
if (!string.IsNullOrEmpty(group))
this.cmbGroup.Items.Add(group);
}
cmbNotes.Items.Clear();
cmbNotes.Items.Add("");
foreach (var notes in GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct())
{
if (!string.IsNullOrEmpty(notes))
this.cmbNotes.Items.Add(notes);
}
}));
});
}
private void dgShopHeader_ColumnDisplayIndexChanged(object sender, DataGridColumnEventArgs e)
{
}
private void dgShopHeader_LayoutUpdated(object sender, EventArgs e)
{
foreach (var item in lbxShop.Items)
{
ListBoxItem container = (ListBoxItem)lbxShop.ItemContainerGenerator.ContainerFromIndex(lbxShop.Items.IndexOf(item));
if (container != null)
{
// 找到grid控件并修改列大小
Grid grid = UiCtrlUtils.FindVisualChild<Grid>(container, "gridListItem");
if (grid != null)
{
for(int i = 0; i< grid.ColumnDefinitions.Count; i++)
{
if (dgShopHeader.Columns.Count > i)
{
// 最后一列因滚动条变窄,已在表头补偿
if (i == grid.ColumnDefinitions.Count - 1)
grid.ColumnDefinitions[i].Width = new GridLength(Math.Max(0, dgShopHeader.Columns[i].ActualWidth - 0));
else
grid.ColumnDefinitions[i].Width = new GridLength(dgShopHeader.Columns[i].ActualWidth);
}
}
}
}
}
}
private void ChkSelectAll_Checked(object sender, RoutedEventArgs e)
{
foreach (var shop in GlobalConfig.ShopLoginList.ToList())
{
//shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool();
shop.IsSelect = true;
}
}
private void ChkSelectAll_Unchecked(object sender, RoutedEventArgs e)
{
foreach (var shop in GlobalConfig.ShopLoginList.ToList())
{
//shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool();
shop.IsSelect = false;
}
}
private void ChkSelectAll_Loaded(object sender, RoutedEventArgs e)
{
chkSelectAll = sender as CheckBox;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
chkSelectAll.Checked -= ChkSelectAll_Checked;
chkSelectAll.Unchecked -= ChkSelectAll_Unchecked;
if (GlobalConfig.ShopLoginList.All(s => s.IsSelect))
chkSelectAll.IsChecked = true;
else if (GlobalConfig.ShopLoginList.All(s => !s.IsSelect))
chkSelectAll.IsChecked = false;
else
chkSelectAll.IsChecked = null;
chkSelectAll.Checked += ChkSelectAll_Checked;
chkSelectAll.Unchecked += ChkSelectAll_Unchecked;
}
private void cmbNotes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void cmbGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
ObservableCollection<ShopLoginInfo> shops = new ObservableCollection<ShopLoginInfo>();
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (!shop.ShopAccount.ParseToString().Contains(txtShopName.Text))
continue;
if (!shop.GroupName.ParseToString().Contains(cmbGroup.Text))
continue;
if (!shop.Notes.ParseToString().Contains(cmbNotes.Text))
continue;
shops.Add(shop);
}
this.lbxShop.ItemsSource = shops;
}
private void btnRestore_Click(object sender, RoutedEventArgs e)
{
txtShopName.Text = "";
cmbNotes.Text = "";
cmbGroup.Text = "";
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
}
private void btnRefreshShop_Click(object sender, RoutedEventArgs e)
{
MainWindow.Instance.GetServerShop();
}
private void btnCancelSelectShop_Click(object sender, RoutedEventArgs e)
{
this.IsAcceptChoiceShop = false;
MainWindow.Instance.gridUser.Visibility = Visibility.Hidden;
}
private void btnApplySelectShop_Click(object sender, RoutedEventArgs e)
{
this.IsAcceptChoiceShop = true;
MainWindow.Instance.gridUser.Visibility = Visibility.Hidden;
}
}
}
@@ -0,0 +1,12 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopListRowCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="{Binding ShopAccount}"></TextBlock>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.ShopCtrls
{
/// <summary>
/// ShopListRowCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopListRowCtrl : UserControl
{
public ShopListRowCtrl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _29WxOrderWpf.Ctrls.ShopCtrls
{
internal class ShopListViewModel
{
}
}
+8 -3
View File
@@ -12,7 +12,7 @@
<RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Background="{StaticResource mainForegroundLinearColorBrush}"></Border>
<Border Background="{StaticResource mainLinearColorBrush}"></Border>
<Grid Grid.Row="1" Margin="2,0,2,2" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
@@ -26,6 +26,7 @@
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
@@ -52,15 +53,19 @@
<Border Grid.Row="2" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<PasswordBox x:Name="txtPassword" Margin="6,0" VerticalContentAlignment="Center" Style="{StaticResource BasePasswordBoxStyle}"></PasswordBox>
</Border>
<Button x:Name="btnLogin" Style="{StaticResource BaseButtonStyle}" Grid.Row="4" Content="安 全 登 录" Height="26" Click="btnLogin_Click"></Button>
<CheckBox Content="记住密码" x:Name="chkRemember" BorderBrush="{StaticResource mainColorBrush}" FontSize="12" HorizontalAlignment="Left" Grid.Row="3" VerticalAlignment="Center" Checked="chkRemember_Checked"/>
<Button x:Name="btnLogin" Style="{StaticResource BaseButtonStyle}" Grid.Row="4" Content="安 全 登 录" Height="26" Click="btnLogin_Click"></Button>
<CheckBox Content="调试模式" Height="24" Visibility="Collapsed" x:Name="chkDebug" BorderBrush="{StaticResource mainColorBrush}"
FontSize="12" VerticalContentAlignment="Center" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Center" Checked="chkDebug_Checked" Unchecked="chkDebug_Checked"/>
</Grid>
</Grid>
<Image Source="{StaticResource main29WeixinIcon}" Height="24" Width="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4"></Image>
<Label x:Name="lblAppName" FontSize="28" Margin="0,14,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" Content="拍单软件"></Label>
<Image Source="{StaticResource main29WeixinIcon}" Height="24" Width="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4"></Image>
<Label x:Name="lblTitle" Margin="30,2" Foreground="White" Content="{Binding ElementName=loginWindow, Path=Title}"></Label>
<userctrls:UcWindowBoxes VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Collapsed" MinBoxVisibility="Collapsed"/>
</Grid>
</basewindows:BaseWindow>
+20 -3
View File
@@ -32,7 +32,7 @@ namespace _29WxOrderWpf.LoginWindows
{
public static ConcurrentList<UserParam> UserParamList { get; set; } = new ConcurrentList<UserParam>();
bool isLogin = false;
public bool IsLogin { get; set; } = false;
string[] argsuser;
@@ -43,6 +43,7 @@ namespace _29WxOrderWpf.LoginWindows
if (!string.IsNullOrEmpty(BaseClass.ProgramName))
{
lblAppName.Content = BaseClass.ProgramName;
MainWindow.Instance.lblAppName.Content = lblAppName.Content;
}
this.Title = "用户登录";
@@ -51,6 +52,10 @@ namespace _29WxOrderWpf.LoginWindows
private void loginWindow_Loaded(object sender, RoutedEventArgs e)
{
#if DEBUG
chkDebug.Visibility = Visibility.Visible;
#endif
GetUserList();
foreach (var user in UserParamList)
{
@@ -83,7 +88,7 @@ namespace _29WxOrderWpf.LoginWindows
//else
// e.Cancel = true;
if (!isLogin)
if (!IsLogin)
{
if (BaseMsgWindow.ShowConfirm(this, "是否关闭软件?\r\n必须登录账户才能使用,无账户请先注册一个。", "请先登录或者注册").DialogResult == true)
Process.GetCurrentProcess().Kill();
@@ -136,7 +141,7 @@ namespace _29WxOrderWpf.LoginWindows
});
SaveUserList();
}
this.isLogin = true;
this.IsLogin = true;
this.Close();
}
@@ -193,5 +198,17 @@ namespace _29WxOrderWpf.LoginWindows
{
BaseClass.Remember = chkRemember.IsChecked.ParseToBool();
}
private void chkDebug_Checked(object sender, RoutedEventArgs e)
{
if (chkDebug.IsChecked == true)
{
BaseClass.LoginApiUrl = BaseClass.DebugUrl;
}
else
{
BaseClass.LoginApiUrl = BaseClass.ServerUrl;
}
}
}
}
+26 -4
View File
@@ -4,18 +4,40 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf"
xmlns:orderctrls="clr-namespace:_29WxOrderWpf.OrderCtrls"
xmlns:orderctrls="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
xmlns:shopctrls="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Style="{StaticResource BaseNoneBorderWindowStyle}"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded" Closing="BaseWindow_Closing">
x:Name="mainWindow" Title="MainWindow" Height="900" Width="1600" Loaded="Window_Loaded" Closing="BaseWindow_Closing">
<Grid Background="Transparent">
<Grid Background="Transparent" Margin="{Binding ElementName=mainWindow, Path=Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridTitle">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="{StaticResource main29WeixinIcon}" Height="50" Width="50" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4"></Image>
<Label x:Name="lblAppName" FontSize="20" Margin="0,0,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalContentAlignment="Center" Content="拍单软件" Grid.Column="1"></Label>
</Grid>
<Grid x:Name="gridContainer" Grid.Row="1" Background="White" Margin="2,0,2,2">
<orderctrls:OrderListWindow x:Name="OrderListWindow" Visibility="Hidden"></orderctrls:OrderListWindow>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<orderctrls:OrderListCtrl x:Name="orderListCtrl" Grid.Column="1" Visibility="Collapsed"></orderctrls:OrderListCtrl>
<Grid x:Name="gridUser" Visibility="Hidden" Grid.ColumnSpan="2" Background="#7F000000">
<Border CornerRadius="4" Width="500" Height="600" Background="White">
<shopctrls:ShopListCtrl x:Name="shopListCtrl" Visibility="{Binding ElementName=gridUser,Mode=TwoWay,Path=Visibility}" Margin="2"
Grid.ColumnSpan="2"></shopctrls:ShopListCtrl>
</Border>
</Grid>
</Grid>
<userctrls:UcWindowBoxes VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Visible"/>
</Grid>
+89 -3
View File
@@ -1,10 +1,14 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.OrderCtrls;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using AllBase;
using AllBase.DouYinModel.Result;
using AllBase.Extension;
using AllBase.Helper;
using AllBase.Model;
using AllBase.Model.Result;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -27,7 +31,9 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml.Linq;
using Work;
using Work.BLL;
namespace _29WxOrderWpf
{
@@ -36,13 +42,15 @@ namespace _29WxOrderWpf
/// </summary>
public partial class MainWindow : BaseWindow
{
public static MainWindow Instance { get; private set; }
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
Instance = this;
this.Height = 800;
this.Width = 1600;
gridUser.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@@ -54,6 +62,16 @@ namespace _29WxOrderWpf
loginWindow.Owner = this;
loginWindow.ShowDialog();
#endregion
if (loginWindow.IsLogin)
{
//shopListCtrl.Visibility = Visibility.Visible;
orderListCtrl.Visibility = Visibility.Visible;
Task.Run(() =>
{
GetServerShop();
});
}
}
#region 反抓包功能
@@ -175,5 +193,73 @@ namespace _29WxOrderWpf
else
e.Cancel = true;
}
public bool readShop { get; set; } = false;
public bool hasReadShop { get; set; } = false;
public void GetServerShop()
{
if (readShop == false)
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
Dispatcher.Invoke(new Action(() =>
{
}));
readShop = true;
int page = 0;
while (true)
{
page++;
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
var data = UserLogin.GetSignaturex() + "&page=" + page;
data += "&is_get_erp_shop_id=true";
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("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
break;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
break;
foreach (JObject jObj in jArr)
{
var shop = ShopBLL.DeserializationShop(jObj);
var shopExist = list.Where(l => l.ShopId == shop.ShopId).ToList();
if (shopExist != null)
shopExist.Remove(shop);
list.Add(shop);
if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
{
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.ShopLoginList.Add(shop);
}));
}
}
}
Dispatcher.Invoke(new Action(() =>
{
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList())
{
GlobalConfig.ShopLoginList.Remove(shop);
}
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => s.is_point_shop_expire).ToList())
{
GlobalConfig.ShopLoginList.Remove(shop);
}
}));
readShop = false;
hasReadShop = true;
}
}
}
}
-158
View File
@@ -1,158 +0,0 @@
<UserControl x:Class="_29WxOrderWpf.OrderCtrls.OrderListWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf.OrderCtrls"
mc:Ignorable="d"
Height="450" Width="800" Loaded="Window_Loaded">
<Grid Background="AliceBlue">
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
ItemsSource="{Binding lstOrder}" AutoGenerateColumns = "False" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray"
CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Width="50"/>
<DataGridTemplateColumn Width="*" Header="订单编号" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="图标">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="26" Padding="0" Margin="5" CornerRadius="5" Background="LightYellow" BorderBrush="Orange" BorderThickness="1">
<Label HorizontalAlignment="Center" Width="Auto" Content="店铺待发货" Foreground="Orange"></Label>
</Border>
<TextBox Grid.Row="2" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="收货地址 吕* 1********** 江苏省 镇江市 京口区" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Margin="4,0" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<ListBox IsHitTestVisible="True" Opacity="1" ItemsSource="{Binding lstOrder}" Grid.Row="1" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="4,0,4,4">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Margin="12,12,12,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="LightGray" CornerRadius="10">
<Border.Style>
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="120">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Background="AliceBlue" CornerRadius="12,12,0,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="8,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="店铺单号:" BorderThickness="0" />
<TextBox Grid.Column="1" Margin="0,8,8,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0" />
<Border Grid.Column="2" Width="12" Background="AliceBlue" Height="12" VerticalAlignment="Center" Cursor="Hand" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown">
<Path Margin="0,0,0,0" Fill="#409eff" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown" Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z" Stretch="Uniform" />
</Border>
</Grid>
</Border>
<Border Grid.Row="1" Background="Transparent" CornerRadius="0,0,12,12" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</Border>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>
@@ -1,67 +0,0 @@
using AllBase;
using AllBase.Extension;
using AllBase.Model;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace _29WxOrderWpf.OrderCtrls
{
/// <summary>
/// OrderListWindow.xaml 的交互逻辑
/// </summary>
public partial class OrderListWindow : UserControl
{
public ObservableCollection<oms_wei_order_info> lstOrder { get; set; } = new ObservableCollection<oms_wei_order_info>();
public List<oms_wei_order_info> lstOrder1 { get; set; } = new List<oms_wei_order_info>();
public OrderListWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项
//_myDataCollection.Add(newItem); // 添加到集合中
//dataGrid.Items.Refresh();.
//dgOrder.Items.Add(1111111);
dgOrder.ItemsSource = lstOrder;
lbxOrder.ItemsSource = lstOrder;
for (int i = 0; i < 10000; i++)
{
//lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
}
lstOrder.SortDesc(o => o.order_id.ParseToLong());
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
+67 -3
View File
@@ -41,8 +41,8 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorDarkBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
BorderBrush="{DynamicResource mainColorDarkBrush}" CornerRadius="0"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
@@ -72,7 +72,7 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorLightBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorBrush}"
BorderBrush="{DynamicResource mainColorBrush}" CornerRadius="0"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
@@ -98,4 +98,68 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BasePageButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorDarkBrush}" CornerRadius="4"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BasePageButtonLightStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource mainColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorLightBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorBrush}" CornerRadius="4"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -0,0 +1,23 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="BaseDataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource ListHeadBackColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderBrush" Value="{DynamicResource ListHeadBorderColorBrush}"/>
<Setter Property="BorderThickness" Value="1,0,0,0"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="BaseDataGridColumnHeaderLeftAlignmentStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource ListHeadBackColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderBrush" Value="{DynamicResource ListHeadBorderColorBrush}"/>
<Setter Property="BorderThickness" Value="1,0,0,0"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
</Style>
</ResourceDictionary>
+23
View File
@@ -22,6 +22,29 @@
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="BaseRoundCornerTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!--去除高亮框-->
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
+2 -2
View File
@@ -4,7 +4,7 @@
<Style x:Key="BaseWindowStyle" TargetType="Window">
<Setter Property="Background" Value="{DynamicResource mainColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontSize" Value="12"/>
<!-- 其他样式设置 -->
</Style>
@@ -13,7 +13,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True"/>
</Style>
@@ -4,8 +4,19 @@
<SolidColorBrush x:Key="mainColorLightBrush" Color="#f5ebff"/>
<SolidColorBrush x:Key="mainColorDarkBrush" Color="#FF6b5393"/>
<SolidColorBrush x:Key="mainForegroundColorBrush" Color="#FF666666"/>
<LinearGradientBrush x:Key="mainForegroundLinearColorBrush" StartPoint="0,0" EndPoint="1,0" >
<LinearGradientBrush x:Key="mainLinearColorBrush" StartPoint="0,0" EndPoint="1,0" >
<GradientStop Color="#FF98638f" Offset="0.0"/>
<GradientStop Color="#FF6b5393" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ListCtrlBackColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListHeadBackColorBrush" Color="#FFf8f8f9"/>
<SolidColorBrush x:Key="ListHeadBorderColorBrush" Color="#FFe9e9ea"/>
<SolidColorBrush x:Key="ListBackColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListRowTitleBackColorBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="ListRowBorderColorBrush" Color="#FFf8f8f9"/>
<SolidColorBrush x:Key="ListRowHoverBackColorBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="HorizontalGridLinesBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="VerticalGridLinesBrush" Color="#FFFFFFFF"/>
</ResourceDictionary>
+70
View File
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace _29WxOrderWpf.Utils
{
public class UiCtrlUtils
{
/// <summary>
/// 查找模板控件的子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static T FindVisualChild<T>(DependencyObject obj) where T : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child != null && child is T)
{
return (T)child;
}
else
{
T childOfChild = FindVisualChild<T>(child);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}
/// <summary>
/// 查找模板控件的子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <param name="xName"></param>
/// <returns></returns>
public static T FindVisualChild<T>(DependencyObject obj, string xName) where T : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
string controlName = child?.GetValue(Control.NameProperty) as string;
if (controlName == xName)
{
return (T)child;
}
else
{
T childOfChild = FindVisualChild<T>(child, xName);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
</packages>
+2 -1
View File
@@ -58,7 +58,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
@@ -138,6 +138,7 @@
<Compile Include="JsonHelper.cs" />
<Compile Include="LogSave.cs" />
<Compile Include="Md5Base.cs" />
<Compile Include="Model\MvvmBaseClasses\PropertyNotifyObject.cs" />
<Compile Include="Model\oms_wei_order_info.cs" />
<Compile Include="Model\o_shop_info.cs" />
<Compile Include="Model\PddMultiBuyerInfo.cs" />
+4 -5
View File
@@ -23,7 +23,8 @@ namespace AllBase
public static int VersionCount = 100;
public static string ServerUrl = "http://1.13.195.131:9000";
public static string ServerUrl { get; set; } = "http://1.13.195.131:9000";
public static string DebugUrl { get; set; } = "http://localhost:9000";
/// <summary>
@@ -42,11 +43,9 @@ namespace AllBase
/// </summary>
public static string routeInUse = "buy_order_api";
public static string MyApiUrl = "https://new.qixiaoke.com";
public static string ApiUrl = "http://xiaohuomao.nai8.net";//"http://xiaohuomao.nai8.net";//"http://192.168.8.191"; //" "http://192.168.8.191" http://ddapi.nai8.net:29999";
public static bool UserApi = true;
public static string ApiUrl { get; set; } = "http://xiaohuomao.nai8.net"; //"http://xiaohuomao.nai8.net";//"http://192.168.8.191"; //" "http://192.168.8.191" http://ddapi.nai8.net:29999";
public static bool UserApi { get; set; } = true;
public static string PddUid = "";
public static string TaoBaoUid = "";
public static string ALUid = "";
+17
View File
@@ -443,6 +443,7 @@ namespace AllBase
return true;
return false;
}
/// <summary>
/// 获取值
/// </summary>
@@ -563,6 +564,22 @@ namespace AllBase
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static bool GetBoolJson(ref string html, string reg)
{
var temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*(true|false)");
bool res;
if (bool.TryParse(temp, out res))
return res;
return false;
}
/// <summary>
/// 时间戳转字符串时间
/// </summary>
+30 -5
View File
@@ -1,19 +1,40 @@
using System;
using AllBase.Model.MvvmBaseClasses;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result
{
public class ShopLoginInfo
public class ShopLoginInfo : PropertyNotifyObject
{
/// <summary>
/// 是否被选中
/// </summary>
public bool IsSelect
{
get { return this.GetValue(x => x.IsSelect); }
set { this.SetValue(x => x.IsSelect, value); }
}
/// <summary>
/// 是否被过滤掉
/// </summary>
public bool IsFilter
{
get { return this.GetValue(x => x.IsFilter); }
set { this.SetValue(x => x.IsFilter, value); }
}
public string DbId { get; set; }
public string UserName { get; set; }
public string CompanyName { get; set; }
public string LoginName { get; set; }
public string Password { get; set; }
public string ShopId { get; set; }
public string ShopName { get; set; }
public string ShopAccount { get; set; }
public string Mobile { get; set; }
public string ErpShopId { get; set; }
public string SubUserName { get; set; }
public string ShopToken { get; set; }
public string Signature { get; set; }
public string TouTiaoId { get; set; }
@@ -28,7 +49,8 @@ namespace AllBase.Model.Result
/// 拍单(采购)用户账户
/// </summary>
public string BuyAccount { get; set; }
public string Group { get; set; }
public string GroupName { get; set; }
public string Notes { get; set; }
public string LastRefreshDate { get; set; }
public string AccessToken { get; set; }
@@ -37,5 +59,8 @@ namespace AllBase.Model.Result
public DateTime AddTime { get; set; }
public DateTime ExpiresTime { get; set; }
public DateTime TokenExpiresTime { get; set; }
public bool is_point_shop_expire { get; set; }
public int expire_time { get; set; }
}
}
+2 -1
View File
@@ -3,6 +3,7 @@ using AllBase.Model;
using AllBase.Model.Result;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -14,7 +15,7 @@ namespace AllBase.Helper
/// <summary>
/// 店铺列表
/// </summary>
public static List<ShopLoginInfo> ShopLoginList { get; set; } = new List<ShopLoginInfo>();
public static ObservableCollection<ShopLoginInfo> ShopLoginList { get; set; } = new ObservableCollection<ShopLoginInfo>();
public static SystemSettings SystemSettings { get; set; }
@@ -0,0 +1,117 @@
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.MvvmBaseClasses
{
public class PropertyNotifyObject
: NotifyPropertyBase, IDisposable
{
public PropertyNotifyObject()
{
}
Dictionary<object, object> _ValueDictionary = new Dictionary<object, object>();
#region 根据属性名得到属性值
public T GetPropertyValue<T>(string propertyName)
{
if (string.IsNullOrEmpty(propertyName))
throw new ArgumentException("invalid property name: " + propertyName);
object _propertyValue;
if (!_ValueDictionary.TryGetValue(propertyName, out _propertyValue))
{
_propertyValue = default(T);
_ValueDictionary.Add(propertyName, _propertyValue);
}
return (T)_propertyValue;
}
#endregion
public void SetPropertyValue<T>(string propertyName, T value)
{
if (!_ValueDictionary.ContainsKey(propertyName) || _ValueDictionary[propertyName] != (object)value)
{
_ValueDictionary[propertyName] = value;
OnPropertyChanged(propertyName);
}
}
#region Dispose
public void Dispose()
{
DoDispose();
}
~PropertyNotifyObject()
{
DoDispose();
}
void DoDispose()
{
if (_ValueDictionary != null)
_ValueDictionary.Clear();
}
#endregion
}
public static class PropertyNotifyObjectEx
{
public static U GetValue<T, U>(this T t, Expression<Func<T, U>> exp) where T : PropertyNotifyObject
{
string _pN = MyCommMetoh.GetPropertyName(exp);
return t.GetPropertyValue<U>(_pN);
}
public static void SetValue<T, U>(this T t, Expression<Func<T, U>> exp, U value) where T : PropertyNotifyObject
{
string _pN = MyCommMetoh.GetPropertyName(exp);
t.SetPropertyValue<U>(_pN, value);
}
}
public class NotifyPropertyBase : INotifyPropertyChanged
{
#region INotifyPropertyChanged
public void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
public static class NotifyPropertyBaseEx
{
public static void OnPropertyChanged<T,U>(this T npb, Expression<Func<T, U>> exp) where T : NotifyPropertyBase, new()
{
string _PropertyName = MyCommMetoh.GetPropertyName(exp);
npb.OnPropertyChanged(_PropertyName);
}
}
public class MyCommMetoh
{
//得到属性的名称
public static string GetPropertyName<T, U>(Expression<Func<T, U>> exp)
{
string _pName = "";
if (exp.Body is MemberExpression)
{
_pName = (exp.Body as MemberExpression).Member.Name;
}
else if (exp.Body is UnaryExpression)
{
_pName = ((exp.Body as UnaryExpression).Operand as MemberExpression).Member.Name;
}
return _pName;
}
}
}
+228 -1
View File
@@ -11,7 +11,234 @@ namespace AllBase.Model
{
public bool is_select { get; set; }
public long id { get; set; }
public string order_id { get; set; }
public long shop_id { get; set; }
public string shop_name { get; set; }
/// <summary>
/// 商户ID
/// </summary>
public string merchant_id { get; set; }
public string order_id { get; set; }
/// <summary>
/// 买家身份标识
/// </summary>
public string openid { get; set; }
public int create_time { get; set; }
public int update_time { get; set; }
public string unionid { get; set; }
/// <summary>
/// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
/// </summary>
public int? status { get; set; }
/// <summary>
/// 售后信息json
/// </summary>
public string aftersale_detail { get; set; }
/// <summary>
/// 支付信息
/// </summary>
public string pay_info { get; set; }
/// <summary>
/// 额外信息
/// </summary>
public string ext_info { get; set; }
/// <summary>
/// 商品总价
/// </summary>
public int? product_price { get; set; }
/// <summary>
/// 订单金额,单位为分,order_price=original_order_price-discounted_price-deduction_price-change_down_price
/// </summary>
public int? order_price { get; set; }
/// <summary>
/// 采购价,单位为分
/// </summary>
public int? purchase_price { get; set; }
/// <summary>
/// 采购时间
/// </summary>
public int? purchase_time { get; set; }
/// <summary>
/// 运费,单位为分
/// </summary>
public int? freight { get; set; }
/// <summary>
/// 平台服务费(微信小店:预计技术服务费),单位为分
/// </summary>
public int? predict_commission_fee { get; set; }
/// <summary>
/// 达人佣金(微信小店:分账金额),单位为分
/// </summary>
public int? commission_amount { get; set; }
/// <summary>
/// 优惠券优惠金额,单位为分
/// </summary>
public int? discounted_price { get; set; }
/// <summary>
/// 采购状态,默认值为:0未采购,推送仓库时修改为1采购
/// </summary>
public int? purchase_status { get; set; }
/// <summary>
/// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时)
/// </summary>
public int? delivery_deadline { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public int? delivery_time { get; set; }
/// <summary>
/// 收货人姓名
/// </summary>
public string user_name { get; set; }
/// <summary>
/// 邮编
/// </summary>
public string postal_code { get; set; }
public string province_name { get; set; }
public string city_name { get; set; }
/// <summary>
/// 区
/// </summary>
public string county_name { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string detail_info { get; set; }
public string tel_number { get; set; }
/// <summary>
/// 门牌号码
/// </summary>
public string house_number { get; set; }
/// <summary>
/// 虚拟发货订单联系方式(deliver_method=1时返回)
/// </summary>
public string virtual_order_tel_number { get; set; }
/// <summary>
/// 额外的联系方式信息(虚拟号码相关)
/// </summary>
public string tel_number_ext_info { get; set; }
/// <summary>
/// 0:不使用虚拟号码,1:使用虚拟号码
/// </summary>
public int? use_tel_number { get; set; }
/// <summary>
/// 标识当前店铺下一个唯一的用户收货地址
/// </summary>
public string hash_code { get; set; }
/// <summary>
/// 发货物流信息JSON
/// </summary>
public string delivery_product_info { get; set; }
/// <summary>
/// 发货完成时间,秒级时间戳
/// </summary>
public int? ship_done_time { get; set; }
/// <summary>
/// 电子面单代发时的订单密文
/// </summary>
public string ewaybill_order_code { get; set; }
/// <summary>
/// 结算信息json
/// </summary>
public string settle_info { get; set; }
/// <summary>
/// 订单审核状态(0待审核1已审核)
/// </summary>
public int? audit_status { get; set; }
/// <summary>
/// 订单审核时间
/// </summary>
public DateTime audit_time { get; set; }
/// <summary>
/// erp发货快递公司
/// </summary>
public string erp_send_company { get; set; }
/// <summary>
/// erp发货快递单号
/// </summary>
public string erp_send_code { get; set; }
/// <summary>
/// erp发货状态
/// </summary>
public int? erp_send_status { get; set; }
/// <summary>
/// erp发货时间
/// </summary>
public DateTime erp_send_time { get; set; }
/// <summary>
/// 旗帜颜色备注,1:灰旗,2:红旗,3:橙旗,4:绿旗,5:天蓝旗,6:紫旗
/// </summary>
public int? colour_flag { get; set; }
/// <summary>
/// 旗帜备注时间
/// </summary>
public DateTime colour_flag_update_time { get; set; }
/// <summary>
/// 供应商备注异常单
/// </summary>
public string supplier_remark_exception { get; set; }
/// <summary>
/// 礼物单状态,默认值0:不存在礼物单,1:礼物单已发货,2:礼物单信息已更正
/// </summary>
public int? gift_order_status { get; set; }
/// <summary>
/// 店铺备注:取微信ext_info.merchant_notes
/// </summary>
public string shop_remark { get; set; }
/// <summary>
/// 软件备注
/// </summary>
public string soft_remark { get; set; }
/// <summary>
/// 外采金额(单位:分,整数存储)
/// </summary>
public int? out_amount { get; set; }
/// <summary>
/// 外采账户
/// </summary>
public string out_account { get; set; }
/// <summary>
/// 外采订单号
/// </summary>
public string out_order_no { get; set; }
/// <summary>
/// 外采快递公司
/// </summary>
public string out_express_company { get; set; }
/// <summary>
/// 外采快递单号
/// </summary>
public string out_express_no { get; set; }
/// <summary>
/// 外采是否发货(0 未发货,1 已发货)
/// </summary>
public int? out_shipped { get; set; }
/// <summary>
/// 判断是否优化过发货0 未优化, 1已优化
/// </summary>
public int? is_shipment_optimized { get; set; }
/// <summary>
/// 判断是否优随机使用快递单号0 未使用, 1已使用
/// </summary>
public int? is_express_no_used { get; set; }
/// <summary>
/// 外采订单售后状态
/// </summary>
public string out_after_sale_status { get; set; }
/// <summary>
/// 是否支持运费险:0-不支持,1-支持
/// </summary>
public int? has_freight_insurance { get; set; }
/// <summary>
/// 运费险金额(单位:元)
/// </summary>
public decimal? freight_insurance_amount { get; set; }
/// <summary>
/// 是否外采礼物单:0-否,1-是(外采订单)
/// </summary>
public int? external_gift { get; set; }
/// <summary>
/// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号
/// </summary>
public decimal? transfer_warehouse_status { get; set; }
}
}
+1
View File
@@ -193,6 +193,7 @@
<Compile Include="BaseForms\UserComponents\UcTreeView.designer.cs">
<DependentUpon>UcTreeView.cs</DependentUpon>
</Compile>
<Compile Include="BLL\ShopBLL.cs" />
<Compile Include="BoundJs.cs" />
<Compile Include="BuyUsers\ALBuyUser.cs" />
<Compile Include="BuyUsers\CookieVisitor.cs" />
+59
View File
@@ -0,0 +1,59 @@
using AllBase;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.BLL
{
public class ShopBLL
{
public static List<ShopLoginInfo> DeserializationShop(string shopJson, string shopDataName = "data")
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
if (!shopJson.Contains(shopDataName))
return list;
var jArr = JObject.Parse(shopJson)[shopDataName];
if (jArr.Count() == 0)
return list;
foreach (JObject jObj in jArr)
{
var shop = DeserializationShop(jObj);
if (shop != null)
list.Add(shop);
}
return list;
}
public static ShopLoginInfo DeserializationShop(JObject shopObj)
{
string shopStr = shopObj.ToString();
ShopLoginInfo shop = new ShopLoginInfo();
shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
if (shop.DbId == null)
return null;
shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name");
shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass");
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account");
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "group_name");
shop.Cookies = shopObj["cookie"].ParseToString().Replace("&", "&").Replace("%", "%").Replace("+", "+").Replace(""", "\"");
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
shop.AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time") == null ? DateTime.MinValue : Convert.ToDateTime(BaseRegex.GetStringJson(ref shopStr, "add_time"));
shop.is_point_shop_expire = BaseRegex.GetBoolJson(ref shopStr, "is_point_shop_expire");
shop.expire_time = BaseRegex.GetIntJson(ref shopStr, "expire_time");
shop.ErpShopId = BaseRegex.GetStringJson(ref shopStr, "erp_shop_id");
return shop;
}
}
}
+12 -8
View File
@@ -34,14 +34,14 @@ namespace Work
BaseClass.IsMainCompany = true;
}
BaseClass.IsBuyer = FileBase.Exists(Application.StartupPath + "\\buyer.ini");
new Thread(Update).Start();//--------检查更新
new Thread(GetAuthConfig).Start();
new Thread(new JumpUpProductNew().Ini).Start();
new Thread(CheckFiles).Start();
new Thread(UpdateTime).Start();
new Thread(GetMacCode).Start();
//new Thread(Update).Start();//--------检查更新
//new Thread(GetAuthConfig).Start();
//new Thread(new JumpUpProductNew().Ini).Start();
//new Thread(CheckFiles).Start();
//new Thread(UpdateTime).Start();
//new Thread(GetMacCode).Start();
//new Thread(CheckUpdataFile).Start();
//////new Thread(CheckUpdataFile).Start();
CheckHecker r = new CheckHecker();
new Thread(r.Check).Start();//防止破解
if (!File.Exists(ConfigFilePach))
@@ -64,7 +64,8 @@ namespace Work
MessageBox.Show("配置文件异常,自动重置");
WriteFile();
}
GetPublicIp();
// 获取本机IP
//GetPublicIp();
}
@@ -140,7 +141,10 @@ namespace Work
}
}
else//如果自动更新文件不存在,则强制更新主文件
{
GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath);
}
try
{
Process.Start(upfilepath);
+1 -1
View File
@@ -311,7 +311,7 @@ namespace Work
return time1;
}
return GetSignature(isPhoneOrder) + "&version=" + BaseClass.VersionCount + "&uid=" + BaseClass.UserId + "&key=" + BaseClass.UserKey +
"&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) +
"&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) + "&user_name=" + BaseClass.UserName +
"&sid=" + shopId + "&shop=" + GetHtml.UrlEncodeUtf8(shopName);
}