diff --git a/pythonProject/order_data.txt b/pythonProject/order_data.txt index 4375e58..b87deca 100644 --- a/pythonProject/order_data.txt +++ b/pythonProject/order_data.txt @@ -1,19 +1,2 @@ -zs -spa -spa -foot_spa -foot_spa, spa -foot_spa, spa -massage -massage, spa -massage, spa -spa -Services: spa, Order info: -Services: spa, Order info: -Services: spa, Order info: -Services: spa, Order info: -Services: spa, Order info: -Services: spa, Order info: -Services: foot_spa, massage, spa, ear_cleaning, Order info: -Services: spa, Order info: -Services: SPA, Order info: + +Services: ×ãÔ¡, Order info: diff --git a/pythonProject/user_data.txt b/pythonProject/user_data.txt index c3f809b..1b5d237 100644 --- a/pythonProject/user_data.txt +++ b/pythonProject/user_data.txt @@ -1,2 +1,2 @@ -zs,zs + zs,zs diff --git a/pythonProject/zs1.py b/pythonProject/zs1.py index 8419dc1..83b1d49 100644 --- a/pythonProject/zs1.py +++ b/pythonProject/zs1.py @@ -26,6 +26,7 @@ class FootSpaManagementSystem: self.login_button_main = tk.Button(self.main_frame, text="登录", command=self.switch_to_login) self.login_button_main.pack() + #用户注册函数 def register_user(self): username = self.username_entry.get() password = self.password_entry.get() @@ -37,6 +38,7 @@ class FootSpaManagementSystem: else: messagebox.showerror("注册失败", "请输入用户å和密ç ã€‚") # æ˜¾ç¤ºæ³¨å†Œå¤±è´¥ä¿¡æ¯ + #用户登录函数 def login_user(self): username = self.username_entry_login.get() password = self.password_entry_login.get() @@ -44,13 +46,18 @@ class FootSpaManagementSystem: with open(self.user_data_file, "r") as file: user_data = file.readlines() - for user in user_data: - stored_username, stored_password = user.strip().split(",") - if username == stored_username and password == stored_password: - messagebox.showinfo("登录æˆåŠŸ", f"欢迎回æ¥, {username}ï¼") # 显示登录æˆåŠŸä¿¡æ¯ - self.switch_to_order() - return - messagebox.showerror("登录失败", "用户å或密ç é”™è¯¯ã€‚") # æ˜¾ç¤ºç™»å½•å¤±è´¥ä¿¡æ¯ + if user_data: + for user in user_data: + stored_data = user.strip().split(",") + if len(stored_data) == 2: + stored_username, stored_password = stored_data + if username == stored_username and password == stored_password: + messagebox.showinfo("登录æˆåŠŸ", f"欢迎回æ¥ï¼Œ{username}ï¼") # 显示登录æˆåŠŸæ¶ˆæ¯ + self.show_user_interface() # 在æˆåŠŸç™»å½•åŽæ˜¾ç¤ºç”¨æˆ·ç•Œé¢ + return + messagebox.showerror("登录失败", "无效的用户å或密ç ã€‚") # æ˜¾ç¤ºç™»å½•å¤±è´¥æ¶ˆæ¯ + else: + messagebox.showerror("登录失败", "没有用户数æ®ã€‚") # 显示找ä¸åˆ°ç”¨æˆ·æ•°æ®çš„æ¶ˆæ¯ def surer1(self): self.frame_register.pack_forget() @@ -62,11 +69,11 @@ class FootSpaManagementSystem: def surer2(self): self.frame_order.pack_forget() - self.main_frame.pack() + self.user_frame.pack() if hasattr(self, "back_button_order"): self.back_button_order.pack_forget() # 移除返回主界é¢çš„按钮 self.frame_order.pack_forget() - self.main_frame.pack() + self.user_frame.pack() #æ³¨å†Œç•Œé¢ def switch_to_register(self): @@ -109,13 +116,38 @@ class FootSpaManagementSystem: self.login_button = tk.Button(self.frame_login, text="登录", command=self.login_user) self.login_button.pack() - #选择订å•ç•Œé¢ - def switch_to_order(self): + #用户登录åŽçš„ç”¨æˆ·ç•Œé¢ + def show_user_interface(self): self.main_frame.pack_forget() # ç§»é™¤ä¸»ç•Œé¢ if hasattr(self, "frame_register"): self.frame_register.pack_forget() # 移除注册界é¢ï¼ˆå¦‚果存在) if hasattr(self, "frame_login"): self.frame_login.pack_forget() # 移除登录界é¢ï¼ˆå¦‚果存在) + # 创建用户界é¢æ¡†æž¶ + self.user_frame = tk.Frame(self.root) + self.user_frame.pack() + + self.order_button = tk.Button(self.user_frame, text="选择订å•", command=self.switch_to_order) + self.order_button.pack() + + self.view_order_button = tk.Button(self.user_frame, text="查看订å•", command=self.view_order) + self.view_order_button.pack() + + self.delete_order_button = tk.Button(self.user_frame, text="删除订å•", command=self.delete_order) + self.delete_order_button.pack() + + #æŸ¥çœ‹è®¢å• + def view_order(self): + messagebox.showinfo("查看订å•", "查看订å•åŠŸèƒ½æ­£åœ¨å¼€å‘中ï¼") + + #åˆ é™¤ç•Œé¢ + def delete_order(self): + # 在这里添加删除订å•é€»è¾‘ + messagebox.showinfo("删除订å•", "删除订å•åŠŸèƒ½æ­£åœ¨å¼€å‘中ï¼") + + #选择订å•ç•Œé¢ + def switch_to_order(self): + self.user_frame.pack_forget() self.frame_order = tk.Frame(self.root) self.frame_order.pack() @@ -144,13 +176,13 @@ class FootSpaManagementSystem: self.confirm_order_button = tk.Button(self.frame_order, text="确认订å•", command=self.confirm_order) self.confirm_order_button.pack() - self.back_button_order = tk.Button(self.frame_order, text="返回主界é¢", command=self.surer2) + self.back_button_order = tk.Button(self.frame_order, text="返回用户界é¢", command=self.surer2) self.back_button_order.pack() 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订å•ä¿¡æ¯ï¼š{self.order_info}") + messagebox.showinfo("下å•æˆåŠŸ", f"您选择了:{', '.join(selected_services)}\n") # æ˜¾ç¤ºé€‰æ‹©æŠ€å¸ˆçš„ç•Œé¢ self.show_select_technician_screen() @@ -177,26 +209,24 @@ class FootSpaManagementSystem: "88å·æŠ€å¸ˆ": tk.IntVar(), } - self.john_doe_checkbox = tk.Checkbutton(self.frame_technician, text="6å·æŠ€å¸ˆ", - variable=self.technicians["6å·æŠ€å¸ˆ"]) + self.john_doe_checkbox = tk.Checkbutton(self.frame_technician, text="6å·æŠ€å¸ˆ",variable=self.technicians["6å·æŠ€å¸ˆ"]) self.john_doe_checkbox.pack() - self.jane_smith_checkbox = tk.Checkbutton(self.frame_technician, text="8å·æŠ€å¸ˆ", - variable=self.technicians["8å·æŠ€å¸ˆ"]) + self.jane_smith_checkbox = tk.Checkbutton(self.frame_technician, text="8å·æŠ€å¸ˆ",variable=self.technicians["8å·æŠ€å¸ˆ"]) self.jane_smith_checkbox.pack() - self.mike_wilson_checkbox = tk.Checkbutton(self.frame_technician, text="66å·æŠ€å¸ˆ", - variable=self.technicians["66å·æŠ€å¸ˆ"]) + self.mike_wilson_checkbox = tk.Checkbutton(self.frame_technician, text="66å·æŠ€å¸ˆ",variable=self.technicians["66å·æŠ€å¸ˆ"]) self.mike_wilson_checkbox.pack() - self.mike_wilson_checkbox = tk.Checkbutton(self.frame_technician, text="88å·æŠ€å¸ˆ", - variable=self.technicians["88å·æŠ€å¸ˆ"]) + self.mike_wilson_checkbox = tk.Checkbutton(self.frame_technician, text="88å·æŠ€å¸ˆ",variable=self.technicians["88å·æŠ€å¸ˆ"]) self.mike_wilson_checkbox.pack() - self.confirm_technician_button = tk.Button(self.frame_technician, text="确认技师", - command=self.confirm_technician) + 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.pack() + def confirm_technician(self): selected_technicians = [technician for technician, selected in self.technicians.items() if selected.get() == 1] if selected_technicians: