微信小店商品上传 50%
This commit is contained in:
1 parent
8f9bae9875
commit
343b01ab90
83 files changed
+12877
-656
No files matched your search
@@ -0,0 +1,194 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Result;
|
||||
using TemuKJD.BaseForms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
public partial class WXSubAccountShopEditForm : LRBaseForm
|
||||
{
|
||||
ShopLoginInfo shop = null;
|
||||
public List<ShopSubAccountInfo> AllSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
|
||||
public List<ShopSubAccountInfo> ShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
|
||||
public List<ShopSubAccountInfo> NotShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
|
||||
public WXSubAccountShopEditForm(ShopLoginInfo _shop)
|
||||
{
|
||||
InitializeComponent();
|
||||
shop = _shop;
|
||||
}
|
||||
|
||||
private void SubAccountShopEditForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.TitleText = "店铺 " + shop?.ShopAccount + " 子账号编辑";
|
||||
label1.Text = "店铺 " + shop?.ShopAccount + " 子账号";
|
||||
label2.Text = "未分配的子账号";
|
||||
|
||||
GetUser();
|
||||
}
|
||||
|
||||
private void GetUser()
|
||||
{
|
||||
flpNotSubAccount.Controls.Clear();
|
||||
flpShopSubAccount.Controls.Clear();
|
||||
AllSubAccountList.Clear();
|
||||
string url = BaseClass.BuildObjString("user/get_sub_user");
|
||||
string data = UserLogin.GetSignaturex();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html))
|
||||
return;
|
||||
if (html.Contains("\"data\""))
|
||||
{
|
||||
var userObj = Newtonsoft.Json.Linq.JObject.Parse(html);
|
||||
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
|
||||
{
|
||||
string oStr = JsonHelper.SerializeObject(obj);
|
||||
ShopSubAccountInfo user = new ShopSubAccountInfo();
|
||||
user.id = BaseRegex.GetIntJson(ref oStr, "id");
|
||||
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
|
||||
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
|
||||
user.mobile = BaseRegex.GetStringJson(ref oStr, "mobile");
|
||||
user.group_id = BaseRegex.GetStringJson(ref oStr, "group_id");
|
||||
user.shop_count = BaseRegex.GetIntJson(ref oStr, "shop_count");
|
||||
|
||||
AllSubAccountList.Add(user);
|
||||
}
|
||||
|
||||
if (shop != null)
|
||||
{
|
||||
ShopSubAccountList.Clear();
|
||||
ShopSubAccountList.AddRange(AllSubAccountList.Where(u=>shop.SubUserName.Contains(u.sub_user_name)));
|
||||
shop.ShopSubAccountList.Clear();
|
||||
shop.ShopSubAccountList.AddRange(ShopSubAccountList);
|
||||
NotShopSubAccountList.AddRange(AllSubAccountList.Where(u => !ShopSubAccountList.Any(bu => bu.id == u.id)));
|
||||
foreach (var item in ShopSubAccountList)
|
||||
{
|
||||
UcSubAccount s = new UcSubAccount(item, false);
|
||||
s.AddSubAcountEvent += S_AddSubAcountEvent;
|
||||
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
|
||||
flpShopSubAccount.Controls.Add(s);
|
||||
}
|
||||
foreach (var item in NotShopSubAccountList)
|
||||
{
|
||||
UcSubAccount s = new UcSubAccount(item);
|
||||
s.AddSubAcountEvent += S_AddSubAcountEvent;
|
||||
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
|
||||
flpNotSubAccount.Controls.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void S_AddSubAcountEvent(object obj)
|
||||
{
|
||||
var s = obj as UcSubAccount;
|
||||
if (s != null)
|
||||
{
|
||||
if (this.flpShopSubAccount.Controls.Count > 0)
|
||||
{
|
||||
//BaseMsgForm.ShowInfo("只能有一个子账户!");
|
||||
//s.lblRight_Click(null, null);
|
||||
//return;
|
||||
}
|
||||
|
||||
this.flpNotSubAccount.Controls.Remove(s);
|
||||
this.flpShopSubAccount.Controls.Add(s);
|
||||
}
|
||||
}
|
||||
|
||||
private void S_RemoveSubAcountEvent(object obj)
|
||||
{
|
||||
var s = obj as UcSubAccount;
|
||||
if (s != null)
|
||||
{
|
||||
this.flpShopSubAccount.Controls.Remove(s);
|
||||
this.flpNotSubAccount.Controls.Add(s);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
var controls = this.flpShopSubAccount.Controls.Cast<Control>().ToList();
|
||||
foreach (var c in controls)
|
||||
{
|
||||
(c as UcSubAccount).DeleteAccount();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var controls = this.flpNotSubAccount.Controls.Cast<Control>().ToList();
|
||||
foreach (var c in controls)
|
||||
{
|
||||
(c as UcSubAccount).AddAccount();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<ShopSubAccountInfo> AddUsers = new List<ShopSubAccountInfo>();
|
||||
List<ShopSubAccountInfo> DeleteUsers = new List<ShopSubAccountInfo>();
|
||||
foreach (Control c in this.flpNotSubAccount.Controls)
|
||||
{
|
||||
var co = c as UcSubAccount;
|
||||
if (co == null)
|
||||
continue;
|
||||
|
||||
if (ShopSubAccountList.Contains(co.subAccount))
|
||||
{
|
||||
DeleteUsers.Add(co.subAccount);
|
||||
shop.ShopSubAccountList.Remove(co.subAccount);
|
||||
//string url = BaseClass.BuildObjString("shop&act=delete_shop_user_sub_group");
|
||||
//string data = UserLogin.GetSignaturex()
|
||||
// + "&shop_id=" + shop.ShopId
|
||||
// + "&sub_user_id=" + co.subAccount.sub_user_id
|
||||
// + "&sub_user_name=" + co.subAccount.sub_user_name
|
||||
// + "&status=" + co.subAccount.status
|
||||
// + "&group_id=" + co.subAccount.group_id;
|
||||
//string html = GetHtml.PostUtf8(url, data);
|
||||
}
|
||||
}
|
||||
foreach (Control c in this.flpShopSubAccount.Controls)
|
||||
{
|
||||
var co = c as UcSubAccount;
|
||||
if (co == null)
|
||||
continue;
|
||||
|
||||
if (NotShopSubAccountList.Contains(co.subAccount))
|
||||
{
|
||||
AddUsers.Add(co.subAccount);
|
||||
shop.ShopSubAccountList.Add(co.subAccount);
|
||||
//string url = BaseClass.BuildObjString("shop&act=update_shop_user_sub_group");
|
||||
//string data = UserLogin.GetSignaturex()
|
||||
// + "&shop_id=" + shop.ShopId
|
||||
// + "&sub_user_id=" + co.subAccount.sub_user_id
|
||||
// + "&sub_user_name=" + co.subAccount.sub_user_name
|
||||
// + "&status=" + co.subAccount.status
|
||||
// + "&group_id=" + co.subAccount.group_id;
|
||||
//string html = GetHtml.PostUtf8(url, data);
|
||||
}
|
||||
}
|
||||
|
||||
shop.SubUserName = shop.ShopSubAccountList.FirstOrDefault()?.sub_user_name;
|
||||
shop.SubUserName = string.Join(",", shop.ShopSubAccountList.Select(s => s.sub_user_name));
|
||||
var shopLst = AllBase.Helper.GlobalConfig.ShopLoginList.Where(s => s.LoginName == shop.LoginName && s.ShopId!= shop.ShopId);
|
||||
foreach(var s in shopLst)
|
||||
{
|
||||
s.SubUserName = shop.SubUserName;
|
||||
s.ShopSubAccountList.Clear();
|
||||
shop.ShopSubAccountList.AddRange(s.ShopSubAccountList);
|
||||
}
|
||||
|
||||
OnSaveComplete(shop);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user