You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
283 lines
15 KiB
283 lines
15 KiB
import wx
|
|
from database import execute_query
|
|
|
|
class shop(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"店铺信息", pos=wx.DefaultPosition, size=wx.Size(302, 362),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "店铺名称", (20, 20))
|
|
wx.StaticText(self.panel, -1, "月销量", (80, 20))
|
|
self.OnClick(None)
|
|
|
|
def OnClick(self, event):
|
|
results = execute_query("select * from foodshop")
|
|
h = 30
|
|
for row in results:
|
|
h += 20
|
|
shop_name, salenum = row[0], row[1]
|
|
wx.StaticText(self.panel, -1, shop_name, (20, h))
|
|
wx.StaticText(self.panel, -1, str(salenum), (80, h))
|
|
|
|
class inputshop(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"店铺上架", pos=wx.DefaultPosition, size=wx.Size(302, 250),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "请输入店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(130, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入月销量:", (20, 80))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(130, 80), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="上架", pos=(20, 150), size=(100, 45), style=wx.BORDER_MASK)
|
|
btn.Bind(wx.EVT_BUTTON, self.insert)
|
|
|
|
def insert(self, event):
|
|
shop_name = self.t1.GetValue()
|
|
salenum = self.t2.GetValue()
|
|
data = (shop_name, salenum)
|
|
execute_query("insert into foodshop values (%s,%s)", data)
|
|
wx.MessageDialog(None, '成功上架!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class outputshop(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"店铺下架", pos=wx.DefaultPosition, size=wx.Size(200, 200),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(20, 50), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="下架", pos=(20, 90), size=(90, 40))
|
|
btn.Bind(wx.EVT_BUTTON, self.delete)
|
|
|
|
def delete(self, event):
|
|
shop_name = self.t1.GetValue()
|
|
execute_query("delete from foodshop where shop_name=%s", (shop_name,))
|
|
wx.MessageDialog(None, '成功下架!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class courier(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"派送员信息", pos=wx.DefaultPosition, size=wx.Size(400, 415),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(90, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "派送员编号", (20, 60))
|
|
wx.StaticText(self.panel, -1, "派送员姓名", (120, 60))
|
|
wx.StaticText(self.panel, -1, "派送员电话", (220, 60))
|
|
btn = wx.Button(self.panel, label="查询", pos=(240, 20), size=(70, 25))
|
|
btn.Bind(wx.EVT_BUTTON, self.find)
|
|
|
|
def find(self, event):
|
|
results = execute_query("select * from courier where foodshop_shop_name=%s", (self.t1.GetValue(),))
|
|
h = 80
|
|
for row in results:
|
|
h += 20
|
|
courier_id, courier_name, courier_phone ,foodshop_shop_name= row[0], row[1], row[2],row[3]
|
|
wx.StaticText(self.panel, -1, courier_id, (20, h))
|
|
wx.StaticText(self.panel, -1, courier_name, (120, h))
|
|
wx.StaticText(self.panel, -1, courier_phone, (220, h))
|
|
wx.StaticText(self.panel, -1, foodshop_shop_name, (220, h))
|
|
|
|
class inputcourier(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"聘请派送员", pos=wx.DefaultPosition, size=wx.Size(400, 350),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "请输入店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(140, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入派送员编号:", (20, 80))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(140, 80), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入派送员姓名:", (20, 140))
|
|
self.t3 = wx.TextCtrl(self.panel, pos=(140, 140), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入派送员电话:", (20, 200))
|
|
self.t4 = wx.TextCtrl(self.panel, pos=(140, 200), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="聘请", pos=(20, 250), size=(100, 45))
|
|
btn.Bind(wx.EVT_BUTTON, self.insert)
|
|
|
|
def insert(self, event):
|
|
shop_name = self.t1.GetValue()
|
|
courier_id = self.t2.GetValue()
|
|
courier_name = self.t3.GetValue()
|
|
courier_phone = self.t4.GetValue()
|
|
data = (courier_id, courier_name, courier_phone, shop_name)
|
|
execute_query("insert into courier values (%s,%s,%s,%s)", data)
|
|
wx.MessageDialog(None, '成功聘请派送员!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class outputcourier(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"解雇派送员", pos=wx.DefaultPosition, size=wx.Size(200, 200),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "派送员编号:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(20, 50), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="解雇", pos=(20, 90), size=(90, 40))
|
|
btn.Bind(wx.EVT_BUTTON, self.delete)
|
|
|
|
def delete(self, event):
|
|
courier_id = self.t1.GetValue()
|
|
execute_query("delete from courier where courier_id=%s", (courier_id,))
|
|
wx.MessageDialog(None, '成功解雇派送员!', '结果', wx.YES_NO).ShowMdoal()
|
|
|
|
class server(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"客服人员信息", pos=wx.DefaultPosition, size=wx.Size(400, 401),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(90, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "客服人员编号", (20, 60))
|
|
wx.StaticText(self.panel, -1, "客服人员姓名", (120, 60))
|
|
btn = wx.Button(self.panel, label="查询", pos=(240, 20), size=(70, 25))
|
|
btn.Bind(wx.EVT_BUTTON, self.find)
|
|
|
|
def find(self, event):
|
|
results = execute_query("select * from server where foodshop_shop_name=%s", (self.t1.GetValue(),))
|
|
h = 80
|
|
for row in results:
|
|
h += 20
|
|
server_id, server_name = row[0], row[1]
|
|
wx.StaticText(self.panel, -1, server_id, (20, h))
|
|
wx.StaticText(self.panel, -1, server_name, (120, h))
|
|
|
|
class inputserver(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"聘请客服人员", pos=wx.DefaultPosition, size=wx.Size(400, 300),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "请输入店铺名称:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(160, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入客服人员编号:", (20, 80))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(160, 80), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入客服人员姓名:", (20, 140))
|
|
self.t3 = wx.TextCtrl(self.panel, pos=(160, 140), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="聘请", pos=(20, 200), size=(100, 45))
|
|
btn.Bind(wx.EVT_BUTTON, self.insert)
|
|
|
|
def insert(self, event):
|
|
shop_name = self.t1.GetValue()
|
|
server_id = self.t2.GetValue()
|
|
server_name = self.t3.GetValue()
|
|
data = (server_id, server_name, shop_name)
|
|
execute_query("insert into server values (%s,%s,%s)", data)
|
|
wx.MessageDialog(None, '成功聘请客服!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class outputserver(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"解雇客服人员", pos=wx.DefaultPosition, size=wx.Size(200, 200),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "客服人员编号:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(20, 50), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="解雇", pos=(20, 90), size=(90, 40))
|
|
btn.Bind(wx.EVT_BUTTON, self.delete)
|
|
|
|
def delete(self, event):
|
|
server_id = self.t1.GetValue()
|
|
execute_query("delete from server where server_id=%s", (server_id,))
|
|
wx.MessageDialog(None, '成功解雇客服!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class bookinformmation(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"订单信息", pos=wx.DefaultPosition, size=wx.Size(500, 400),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "买家电话:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(90, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "客服人员编号", (20, 60))
|
|
wx.StaticText(self.panel, -1, "订单编号", (120, 60))
|
|
wx.StaticText(self.panel, -1, "订单金额", (220, 60))
|
|
wx.StaticText(self.panel, -1, "订餐方式", (320, 60))
|
|
btn = wx.Button(self.panel, label="查询", pos=(240, 20), size=(70, 25))
|
|
btn.Bind(wx.EVT_BUTTON, self.find)
|
|
|
|
def find(self, event):
|
|
results = execute_query("select * from book where student_phone=%s", (self.t1.GetValue(),))
|
|
h = 80
|
|
for row in results:
|
|
h += 20
|
|
student_phone ,server_id, order_id, order_money, order_way = row[0],row[1], row[2], row[3], row[4]
|
|
wx.StaticText(self.panel, -1, server_id, (20, h))
|
|
wx.StaticText(self.panel, -1, order_id, (120, h))
|
|
wx.StaticText(self.panel, -1, str(order_money), (220, h))
|
|
wx.StaticText(self.panel, -1, order_way, (320, h))
|
|
|
|
class book(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"学生订餐", pos=wx.DefaultPosition, size=wx.Size(400, 400),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "请输入买家电话:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(150, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入客服人员编号:", (20, 80))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(150, 80), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入订单编号:", (20, 140))
|
|
self.t3 = wx.TextCtrl(self.panel, pos=(150, 140), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入订单金额:", (20, 200))
|
|
self.t4 = wx.TextCtrl(self.panel, pos=(150, 200), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入订餐方式:", (20, 260))
|
|
self.t5 = wx.TextCtrl(self.panel, pos=(150, 260), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="订餐", pos=(20, 310), size=(100, 45))
|
|
btn.Bind(wx.EVT_BUTTON, self.insert)
|
|
|
|
def insert(self, event):
|
|
student_phone = self.t1.GetValue()
|
|
server_id = self.t2.GetValue()
|
|
order_id = self.t3.GetValue()
|
|
order_money = self.t4.GetValue()
|
|
order_way = self.t5.GetValue()
|
|
data = (student_phone, server_id, order_id, order_money, order_way)
|
|
execute_query("insert into book values(%s,%s,%s,%s,%s)", data)
|
|
wx.MessageDialog(None, '成功订餐!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class outbook(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"删除订单", pos=wx.DefaultPosition, size=wx.Size(300, 300),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "客服人员编号:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(20, 50), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "买家电话:", (20, 90))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(20, 120), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="取消订单", pos=(20, 170), size=(90, 40))
|
|
btn.Bind(wx.EVT_BUTTON, self.delete)
|
|
|
|
def delete(self, event):
|
|
server_id = self.t1.GetValue()
|
|
student_phone = self.t2.GetValue()
|
|
execute_query("delete from book where server_id=%s and student_phone=%s", (server_id, student_phone))
|
|
wx.MessageDialog(None, '成功删除订单!', '结果', wx.YES_NO).ShowModal()
|
|
|
|
class amend(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, id=wx.ID_ANY, title=u"修改订单", pos=wx.DefaultPosition, size=wx.Size(400, 300),style=wx.DEFAULT_DIALOG_STYLE)
|
|
self.Center()
|
|
self.panel = wx.Panel(self)
|
|
self.panel.SetBackgroundColour('white')
|
|
wx.StaticText(self.panel, -1, "请输入客服编号:", (20, 20))
|
|
self.t1 = wx.TextCtrl(self.panel, pos=(160, 20), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请输入买家电话:", (20, 80))
|
|
self.t2 = wx.TextCtrl(self.panel, pos=(160, 80), size=(120, 25))
|
|
wx.StaticText(self.panel, -1, "请更正订单金额:", (20, 140))
|
|
self.t3 = wx.TextCtrl(self.panel, pos=(160, 140), size=(120, 25))
|
|
btn = wx.Button(self.panel, label="确认修改", pos=(20, 200), size=(100, 45))
|
|
btn.Bind(wx.EVT_BUTTON, self.change)
|
|
|
|
def change(self, event):
|
|
server_id = self.t1.GetValue()
|
|
student_phone = self.t2.GetValue()
|
|
order_money = self.t3.GetValue()
|
|
data = (order_money, server_id, student_phone)
|
|
execute_query("update book set order_money=%s where server_id=%s and student_phone=%s", data)
|
|
wx.MessageDialog(None, '成功修改订单!', '结果', wx.YES_NO).ShowModal()
|