commit_0529

main
123456789zs 6 months ago
parent 774b223a9b
commit 987dec7d53

@ -1,2 +1,4 @@
Services: ×ãÔ¡, Order info:
按摩 - 8号技师
1001, 按摩
按摩 - 88号技师

@ -9,6 +9,7 @@ class FootSpaManagementSystem:
self.root.geometry("500x300")
self.user_data_file = "user_data.txt" # 用户数据文件路径
self.order_data_file = "order_data.txt" # 订单数据文件路径
self.order_num = 1000 # 初始化订单号
self.order_info = order_info
self.create_main_window() # 创建主界面
@ -75,6 +76,18 @@ class FootSpaManagementSystem:
self.frame_order.pack_forget()
self.user_frame.pack()
def surer3(self):
self.frame_technician.pack_forget()
self.user_frame.pack()
if hasattr(self, "back_button_order"):
self.back_button_order.pack_forget() # 移除返回主界面的按钮
self.frame_technician.pack_forget()
self.user_frame.pack()
def surer4(self):
self.delete_frame.pack_forget()
self.user_frame.pack()
#注册界面
def switch_to_register(self):
self.main_frame.pack_forget()
@ -138,12 +151,46 @@ class FootSpaManagementSystem:
#查看订单
def view_order(self):
messagebox.showinfo("查看订单", "查看订单功能正在开发中!")
with open(self.order_data_file, "r") as file:
orders = file.readlines()
if orders:
order_info = "\n".join(orders)
messagebox.showinfo("查看订单", f"您的订单信息:\n{order_info}")
else:
messagebox.showinfo("查看订单", "暂无订单信息。")
#删除界面
def delete_order(self):
# 在这里添加删除订单逻辑
messagebox.showinfo("删除订单", "删除订单功能正在开发中!")
self.user_frame.pack_forget() # 移除用户界面
self.delete_frame = tk.Frame(self.root)
self.delete_frame.pack()
self.order_number_label = tk.Label(self.delete_frame, text="请输入订单号:")
self.order_number_label.pack()
self.order_number_entry = tk.Entry(self.delete_frame)
self.order_number_entry.pack()
self.confirm_delete_button = tk.Button(self.delete_frame, text="确认删除", command=self.confirm_delete)
self.confirm_delete_button.pack()
self.back_button_order = tk.Button(self.delete_frame, text="返回用户界面", command=self.surer4)
self.back_button_order.pack()
def confirm_delete(self):
order_number_to_delete = self.order_number_entry.get()
with open(self.order_data_file, "r") as file:
orders = file.readlines()
if orders:
with open(self.order_data_file, "w") as file:
for order in orders:
if order_number_to_delete not in order:
file.write(order)
messagebox.showinfo("删除订单", f"订单号{order_number_to_delete}已删除。")
else:
messagebox.showinfo("删除订单", "暂无订单信息。")
#选择订单界面
def switch_to_order(self):
@ -182,16 +229,21 @@ class FootSpaManagementSystem:
def confirm_order(self):
selected_services = [service for service, selected in self.services.items() if selected.get() == 1]
if selected_services:
messagebox.showinfo("下单成功", f"您选择了:{', '.join(selected_services)}\n")
order_number = self.generate_order_number() # 生成订单号
messagebox.showinfo("下单成功", f"您选择了:{', '.join(selected_services)}\n 订单号:{order_number}")
# 显示选择技师的界面
self.show_select_technician_screen()
with open(self.order_data_file, "a") as file:
file.write(f"Services: {', '.join(selected_services)}, Order info: {self.order_info}\n")
file.write(f"{order_number}, {', '.join(selected_services)}{self.order_info}\n")
else:
messagebox.showerror("下单失败", "请选择至少一项服务。")
def generate_order_number(self):
self.order_num += 1
return f"{self.order_num}" # 以XXXX格式生成订单号
# 选择技师界面
def show_select_technician_screen(self):
self.frame_order.pack_forget() # 移除选择订单界面
@ -224,16 +276,23 @@ class FootSpaManagementSystem:
self.confirm_technician_button = tk.Button(self.frame_technician, text="确认技师",command=self.confirm_technician)
self.confirm_technician_button.pack()
self.back_button_order = tk.Button(self.frame_technician, text="返回用户界面", command=self.surer2)
self.back_button_order = tk.Button(self.frame_technician, text="返回用户界面", command=self.surer3)
self.back_button_order.pack()
def confirm_technician(self):
selected_technicians = [technician for technician, selected in self.technicians.items() if selected.get() == 1]
if selected_technicians:
technician_message = f"您选择了技师:{', '.join(selected_technicians)}"
messagebox.showinfo("选择技师成功", technician_message)
else:
messagebox.showerror("选择技师失败", "请选择至少一名技师。")
selected_services = [service for service, selected in self.services.items() if selected.get() == 1]
if selected_services:
selected_technicians = [technician for technician, selected in self.technicians.items() if
selected.get() == 1]
selected_services_str = ', '.join(selected_services)
selected_technicians_str = ', '.join(selected_technicians)
messagebox.showinfo("下单成功",
f"您选择了:{selected_services_str}\n所选择的技师: {selected_technicians_str}")
with open(self.order_data_file, "a") as file:
file.write(f"{selected_services_str} - {selected_technicians_str}{self.order_info}\n")
def run(self):
self.root.mainloop() # 启动主循环

Loading…
Cancel
Save