using AllBase; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.KJDForms.AdminForms; using TemuKJD.BaseForms; using TemuKJD.KJDForms.ProductSelectForms; using TemuKJD.KJDForms.ProductThirdSelectForms; using TemuKJD.KJDForms.ShopForms.Statistics; using NaiBa.Util.Extension; using Work._29Tools.Forms.UserForms; namespace TemuKJD.WXForms.ShopForms { public partial class WXShopForm : BaseForm { public static WXShopForm instance { get; set; } public Lazy shopListForm = new Lazy(); public Lazy sbuAccountForm = new Lazy(); public Lazy shopStatisticsForm = new Lazy(); public Lazy taxManageForm = new Lazy(); public Lazy shopOptimizeForm = new Lazy(); public Lazy shopAfterSaleAddressListForm = new Lazy(); public Lazy getTopUpQrCode = new Lazy(); public Lazy oemAccountForm = new Lazy(); public Lazy oemAccountBalanceForm = new Lazy(); public Lazy oemAccountPointsForm = new Lazy(); public Lazy oemWithdrawalForm = new Lazy(); public WXShopForm() { InitializeComponent(); instance = this; try { var hideNames = getHideTreeNodes(); foreach (var item in hideNames) { var n = tv.Nodes[0].Nodes.Find(item, true); if (n.Count() > 0) n[0].Remove(); } tv.SelectedNode = tv.Nodes[0].Nodes[0]; tv.ExpandGroup(tv.Nodes[0].Name); } catch { } } public List getHideTreeNodes() { List hideNames = new List() { "积分充值", "OEM账号管理", "OEM返现明细", "OEM积分明细", "OEM提现管理", "店铺地址管理", "评分考核", "子账号管理", "高级运费模板", "运费模板", "素材库管理", "订单金额统计", "工作明细统计", "店铺经营统计1" }; if (BaseClass.SaLevel == 1) { //hideName.Remove("店铺地址管理"); } if (BaseClass.GroupId == 3) { hideNames.Remove("店铺地址管理"); hideNames.Remove("子账号管理"); hideNames.Remove("评分考核"); } if (BaseClass.UserAuthority.Contains("评分考核")) { hideNames.Remove("评分考核"); } if (BaseClass.UserAuthority.Contains("充值用户") && BaseClass.GroupId == 3 && BaseClass.AgentCode.IsNullOrEmpty() && BaseClass.OemId.IsNullOrEmpty()) { //hideNames.Remove("积分充值"); } if (!BaseClass.OemId.IsNullOrEmpty() && BaseClass.IsOemOwner) { hideNames.Remove("OEM账号管理"); hideNames.Remove("OEM返现明细"); hideNames.Remove("OEM积分明细"); hideNames.Remove("OEM提现管理"); } foreach (var forbiddenPage in BaseClass.ForbiddenPage.Split(',')) { hideNames.Add(forbiddenPage); } return hideNames; } public void ClickShopAddress() { var node = tv.Nodes[0].Nodes.Find("店铺地址管理", true).FirstOrDefault(); if (node != null) tv.SelectedNode = node; } private void tv_AfterSelect(object sender, TreeViewEventArgs e) { MainForm.sCurrentModule = e.Node.Name; this.lblName.Text = e.Node.Text; // 如果是一级菜单,不做任何动作 if (e.Node.Parent == null) return; new Thread(() => { Thread.Sleep(200); Invoke(new Action(() => { switch (e.Node.Name) { case "店铺列表": SetForm(shopListForm.Value); break; case "子账号管理": SetForm(sbuAccountForm.Value); break; case "店铺经营统计": SetForm(shopStatisticsForm.Value); break; case "税务申报": SetForm(taxManageForm.Value); break; case "店铺地址管理": SetForm(shopAfterSaleAddressListForm.Value); break; case "评分考核": SetForm(shopOptimizeForm.Value); break; case "积分充值": SetForm(getTopUpQrCode.Value); break; case "OEM账号管理": SetForm(oemAccountForm.Value); break; case "OEM返现明细": SetForm(oemAccountBalanceForm.Value); break; case "OEM积分明细": SetForm(oemAccountPointsForm.Value); break; case "OEM提现管理": SetForm(oemWithdrawalForm.Value); break; } })); }).Start(); } /// /// 显示隐藏层 /// /// private void SetForm(Form f) { if (f == null) { foreach (Control form in panel3.Controls) { form.Visible = false; if (form is Form) { panel3.Controls.Remove(form as Form); } } return; } bool had = false; string sCurrentFormName = f.Name; for (int i = 0; i < panel3.Controls.Count; i++) { if (sCurrentFormName == panel3.Controls[i].Name) { had = true; panel3.Controls[i].Visible = true; } else { panel3.Controls[i].Visible = false; } } if (had) { f = null; return; } f.TopLevel = false; f.Left = 0; f.Top = 0; f.FormBorderStyle = FormBorderStyle.None; panel3.Controls.Add(f); f.AutoSize = true; f.Dock = DockStyle.Fill; try { f.Show(); } catch { } } private void ShopForm_Load(object sender, EventArgs e) { try { var ns = tv.Nodes.Find("运费模板", true); if (ns.Count() > 0) { //foreach (var n in ns) //{ // tv.Nodes.Remove(n); //} if (AllBase.BaseClass.IsCloudBuyOrder) this.tv.Nodes[0].Nodes.Insert(ns[0].Index + 1, new TreeNode() { Text = "高级运费模板", Name = "高级运费模板" }); } tv.SelectedNode = tv.Nodes[0].Nodes[0]; tv.ExpandGroup(tv.Nodes[0].Name); } catch { } } private void panel3_Paint(object sender, PaintEventArgs e) { } } }