feat: 更新流程

This commit is contained in:
GukSang.Jin
2026-02-26 14:30:48 +08:00
parent 862a282d77
commit d82f1c50c3
5 changed files with 60 additions and 16 deletions

View File

@@ -16,9 +16,9 @@ public class PetWashDbContext : DbContext
// 初始化套餐数据
modelBuilder.Entity<Package>().HasData(
new Package { Id = 1, Name = "基础清洗", Price = 50, DurationMinutes = 15, Description = "基础清洗服务,适合小型宠物" },
new Package { Id = 2, Name = "标准清洗", Price = 80, DurationMinutes = 25, Description = "标准清洗+烘干,适合中型宠物" },
new Package { Id = 3, Name = "豪华清洗", Price = 120, DurationMinutes = 35, Description = "深度清洗+烘干+护理,适合大型宠物" }
new Package { Id = 1, Name = "套餐1", Price = 50, DurationMinutes = 38, Description = "适用于小型犬" },
new Package { Id = 2, Name = "套餐2", Price = 80, DurationMinutes = 48, Description = "适用于中型犬" },
new Package { Id = 3, Name = "套餐3", Price = 120, DurationMinutes = 60, Description = "适用于大型犬" }
);
}
}

Binary file not shown.

View File

@@ -17,8 +17,9 @@
</ItemGroup>
<ItemGroup>
<Resource Include="Images\dog.png" />
<Resource Include="Images\dog1.jpg" />
<Resource Include="Images\qrcode.png" />
<Resource Include="Images\unnamed.jpg" />
</ItemGroup>
</Project>

View File

@@ -53,6 +53,8 @@ public partial class MainViewModel : ObservableObject
[ObservableProperty]
private string _currentView = "Idle";
private string _previousView = "Idle"; // 保存进入设置前的视图
[ObservableProperty]
private int _washProgress;
@@ -192,15 +194,51 @@ public partial class MainViewModel : ObservableObject
[RelayCommand]
private void ShowSettings()
{
// 保存当前视图状态
_previousView = CurrentView;
CurrentView = "Settings";
ViewChanged?.Invoke("Settings");
StatusMessage = "系统设置";
_logger.LogInfo("切换到设置界面");
_logger.LogInfo($"切换到设置界面,之前的视图: {_previousView}");
}
[RelayCommand]
private void BackToIdle()
{
// 如果从设置页面返回,且之前不是待机界面,则返回到之前的视图
if (CurrentView == "Settings" && _previousView != "Idle" && _previousView != "Settings")
{
CurrentView = _previousView;
ViewChanged?.Invoke(_previousView);
// 根据返回的视图设置相应的状态消息
switch (_previousView)
{
case "Washing":
StatusMessage = "洗护进行中...";
_logger.LogInfo("从设置返回到洗护界面");
break;
case "Payment":
StatusMessage = "请选择套餐";
_logger.LogInfo("从设置返回到支付界面");
break;
case "QRCode":
StatusMessage = $"请扫码支付 ¥{SelectedPackage?.Price}";
_logger.LogInfo("从设置返回到二维码支付界面");
break;
default:
StatusMessage = "系统就绪,请点击开始";
_logger.LogInfo("从设置返回到待机界面");
break;
}
// 重置之前的视图状态
_previousView = "Idle";
return;
}
// 默认返回到待机界面
CurrentView = "Idle";
ViewChanged?.Invoke("Idle");
StatusMessage = "系统就绪,请点击开始";
@@ -215,6 +253,7 @@ public partial class MainViewModel : ObservableObject
step.IsActive = false;
}
_previousView = "Idle";
_logger.LogInfo("返回待机界面");
}

View File

@@ -665,24 +665,28 @@
HorizontalAlignment="Center"
Margin="0,0,0,15"/>
<!-- 时长 -->
<!-- 适用犬型和时长 -->
<Border Grid.Row="1"
Background="#BF360C"
CornerRadius="10"
Padding="15,10"
Margin="0,0,0,15">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<TextBlock Text="时长:"
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="{Binding Description}"
FontSize="18"
Foreground="White"/>
<TextBlock Text="{Binding DurationMinutes}"
Foreground="White"
FontWeight="Bold"
FontSize="22"/>
<TextBlock Text=" 分钟"
FontSize="18"
Foreground="White"/>
HorizontalAlignment="Center"
Margin="0,0,0,5"/>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<TextBlock Text="{Binding DurationMinutes}"
Foreground="White"
FontWeight="Bold"
FontSize="22"/>
<TextBlock Text=" 分钟"
FontSize="18"
Foreground="White"/>
</StackPanel>
</StackPanel>
</Border>