import tkinter as tk
import tkinter.ttk as ttk
import random as r
class logIn:#登录界面
    def __init__(self):
        x=admin()
        '''self.t=tk.Tk()
        self.t.geometry("560x860+600+0")
        self.t.title("登录管理员系统")
        file=tk.PhotoImage(file=".\\img\\3.png")
        img=tk.Canvas(self.t,width=560,height=860)
        img.create_image(280,430,image=file)
        img.place(x=0,y=0)
        t2=tk.Entry(self.t,width=40)
        t2.place(x=130,y=390)
        t2.select_clear()
        file2=tk.PhotoImage(file=".\\img\\b11.png")
        b=tk.Button(self.t,bg="orange",relief="raised",image=file2,command=self.log)
        b.place(x=230,y=480)
        self.t.mainloop()'''
    def log(self):#登录函数
        self.t.destroy()
        
class admin:#管理员主界面
    def __init__(self):
        self.t=tk.Tk()
        self.t.geometry("560x860+600+0")
        sty=ttk.Style()
        sty.configure("Treeview",font=(None,15))
        file=tk.PhotoImage(file=".\\img 2\\4.png")
        self.file2=tk.PhotoImage(file=".\\img 2\\food.png")
        self.file3=tk.PhotoImage(file=".\\img 2\\bill.png")
        self.file4=tk.PhotoImage(file=".\\img 2\\food.png")
        self.file5=tk.PhotoImage(file=".\\img 2\\psd.png")
        self.file6=tk.PhotoImage(file=".\\img 2\\cbill.png")
        self.file7=tk.PhotoImage(file=".\\img 2\\sent.png")
        self.file8=tk.PhotoImage(file=".\\img 2\\return.png")
        self.file9=tk.PhotoImage(file=".\\img 2\\ckxx.png")
        self.file10=tk.PhotoImage(file=".\\img 2\\zf.png")
        self.file11=tk.PhotoImage(file=".\\img 2\\sf.png")
        self.file12=tk.PhotoImage(file=".\\img 2\\cf.png")
        self.file13=tk.PhotoImage(file=".\\img 2\\qrxg.png")
        img=tk.Canvas(self.t,width=560,height=860)
        img.create_image(280,430,image=file)
        img.place(x=0,y=0)
        self.admin_main()
        self.t.mainloop()
    def admin_main(self):
        self.b1=tk.Button(self.t,relief="raised",image=self.file2,command=self.bill,bg="orange")
        self.b2=tk.Button(self.t,relief="raised",image=self.file3,command=self.customer,bg="orange")
        self.b3=tk.Button(self.t,relief="raised",image=self.file5,command=self.psd,bg="orange")
        
        self.b1.place(x=220,y=180)
        self.b2.place(x=220,y=250)
        self.b3.place(x=220,y=320)
    def re1(self):
        self.b5.destroy()
        self.b6.destroy()
        self.b7.destroy()
        self.f1.destroy()
        self.tree.destroy()
        self.admin_main()
    def re2(self):
        self.b8.destroy()
        self.b9.destroy()
        self.f2.destroy()
        self.tree2.destroy()
        self.admin_main()
    def re3(self):
        self.b10.destroy()

        self.b13.destroy()
        self.f3.destroy()
        self.tree3.destroy()
        self.admin_main()
    def re4(self):
        self.b14.destroy()
        self.b15.destroy()
        self.e1.destroy()
        self.e2.destroy()
        self.admin_main()
    def bill1(self):
        self.b1.destroy()
        self.b2.destroy()
        self.b3.destroy()
        self.f1=tk.Frame(height=312,width=520,relief='sunken',bd=5)
        self.tree=ttk.Treeview(self.f1,height=15,show="tree")
        self.f1.place(x=20,y=50)
        self.tree.place(x=0,y=0,width=510)
        self.tree.insert("","end",text="流水号:2213012390")
        self.tree.insert("","end",text="餐品:100")
        self.tree.insert("","end",text="点餐列表：")
        self.tree.insert("","end",iid="piz",text="九寸披萨￥60")
        self.tree.insert("piz","end",text="水果拼牛肉￥30")
        self.tree.insert("piz","end",text="加厚饼底￥10")
        self.tree.insert("piz","end",text="双份芝士￥30")
        self.tree.insert("","end",iid="co",text="拿铁咖啡￥10")
        self.tree.insert("co","end",text="90%纯奶添加￥5")
        self.tree.insert("co","end",text="冰滴萃取￥3")
        self.tree.insert("","end",text="总计￥148")
        self.b5=tk.Button(self.t,relief="raised",image=self.file6,bg="orange")
        self.b6=tk.Button(self.t,relief="raised",image=self.file7,bg="orange")
        self.b7=tk.Button(self.t,relief="raised",image=self.file8,bg="orange",command=self.re1)
        self.b5.place(x=220,y=400)
        self.b6.place(x=220,y=460)
        self.b7.place(x=220,y=520)


    def customer(self):
        self.b1.destroy()
        self.b2.destroy()
        self.b3.destroy()
        self.f2=tk.Frame(height=372,width=520,relief='sunken',bd=5)
        self.tree2=ttk.Treeview(self.f2,height=18,show="tree")
        self.f2.place(x=20,y=50)
        self.tree2.place(x=0,y=0,width=510)
        self.b8=tk.Button(self.t,relief="raised",image=self.file9,bg="orange")
        self.b9=tk.Button(self.t,relief="raised",image=self.file8,bg="orange",command=self.re2)
        self.b8.place(x=220,y=460)
        self.b9.place(x=220,y=520)
        self.tree2.insert("","end",iid=1,text="餐品:1 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=2,text="餐品:2 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=3,text="餐品:3 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=4,text="餐品:4 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=5,text="餐品:5 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=6,text="餐品:6 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=7,text="餐品:7 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=8,text="餐品:8 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=9,text="餐品:9 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=10,text="餐品:10 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=11,text="餐品:11 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=12,text="餐品:12 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=13,text="餐品:13 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=14,text="餐品:14 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=15,text="餐品:15 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=16,text="餐品:16 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=17,text="餐品:17 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        self.tree2.insert("","end",iid=18,text="餐品:18 xxx菜品{} ￥{}".format(r.randint(1,10),r.randint(10,60)))
        for i  in range(1,18):
            self.tree2.insert(i,"end",text="菜品1:xxxxxxx")
            self.tree2.insert(i,"end",text="菜品2:xxxxxxx")
            self.tree2.insert(i,"end",text="菜品3:xxxxxxx")
        pass
    def bill(self):
        self.b1.destroy()
        self.b2.destroy()
        self.b3.destroy()
        self.f3=tk.Frame(height=312,width=520,relief='sunken',bd=5)
        self.tree3=ttk.Treeview(self.f3,height=15,show="tree")
        self.f3.place(x=20,y=40)
        self.tree3.place(x=0,y=0,width=510)
        self.b10=tk.Button(self.t,relief="raised",image=self.file10,bg="orange")

        self.b13=tk.Button(self.t,relief="raised",image=self.file8,bg="orange",command=self.re3)
        self.b10.place(x=220,y=360)
        self.b13.place(x=220,y=540)
        self.tree3.insert("","end",iid=1,text="拿铁咖啡")
        self.tree3.insert("","end",iid=2,text="摩卡咖啡")
        self.tree3.insert("","end",iid=3,text="卡布奇诺")
        self.tree3.insert("","end",iid=4,text="港式奶茶")
        self.tree3.insert("","end",iid=5,text="珍珠奶茶")
        self.tree3.insert("","end",iid=6,text="9寸披萨")
        self.tree3.insert("","end",iid=7,text="12寸披萨")
        self.tree3.insert("","end",iid=8,text="菠萝烧肉")
        self.tree3.insert("","end",iid=9,text="红烧牛肉")
        self.tree3.insert("","end",iid=10,text="糖醋里脊")
        for i  in range(1,11):
            self.tree3.insert(i,"end",text="糖度:xxxxxxx")
            self.tree3.insert(i,"end",text="浓度:xxxxxxx")
            self.tree3.insert(i,"end",text="用料:xxxxxxx")
        pass
    def psd(self):
        self.b1.destroy()
        self.b2.destroy()
        self.b3.destroy()
        self.e1=tk.Entry(self.t,width=50)
        self.e1.insert("end","请输入您的诉求")
        self.e1.place(x=100,y=200)
        self.e2=tk.Entry(self.t,width=50)
        self.b14=tk.Button(self.t,relief="raised",image=self.file13,bg="orange")
        self.b15=tk.Button(self.t,relief="raised",image=self.file8,bg="orange",command=self.re4)
        self.b14.place(x=220,y=480)
        self.b15.place(x=220,y=540)
        pass

start=logIn()