diff --git a/src/pages/index/components/renting-cabinet-container.vue b/src/pages/index/components/renting-cabinet-container.vue
index f0f3e9a..2a86d26 100644
--- a/src/pages/index/components/renting-cabinet-container.vue
+++ b/src/pages/index/components/renting-cabinet-container.vue
@@ -16,7 +16,7 @@ const emit = defineEmits<{
// 状态管理
const rentingCabinetStore = useRentingCabinetStore();
-const { rentingCabinets, rentingCartItems, rentingCartTotalQuantity } = storeToRefs(rentingCabinetStore);
+const { rentingCabinets, rentingCartItems, rentingCartTotalQuantity, rentingCartTotalPrice } = storeToRefs(rentingCabinetStore);
// 从props接收的数据
const activeCategory = ref(0); // 这里的分类可以根据 cabinetName 来划分,也可以简化为所有可租用格口
@@ -57,14 +57,22 @@ function getRentingCartItemCount(cellId: number) {
// 过滤格口列表,搜索框功能
const filteredRentingCells = computed(() => {
let cells: any[] = [];
- // 如果有分类,则按分类过滤
+
+ // 根据当前选中的分类获取对应的柜机格口
if (rentingCabinets.value.length > 0) {
- // Flattern all cells from all cabinets
- cells = rentingCabinets.value.flatMap(cabinet => cabinet.cells);
+ if (activeCategory.value >= 0 && activeCategory.value < rentingCabinets.value.length) {
+ // 只显示当前选中柜机的格口
+ cells = rentingCabinets.value[activeCategory.value].cells || [];
+ } else {
+ // 显示所有柜机的格口
+ cells = rentingCabinets.value.flatMap(cabinet => cabinet.cells || []);
+ }
}
- // 过滤掉已租用 (isRented = 1) 和已占用 (usageStatus = 2) 的格口
- const availableCells = cells.filter(cell => cell.isRented === 0 && cell.usageStatus === 1);
+ // 过滤掉已租用 (isRented = 1)、已占用 (usageStatus = 2) 或不可用 (availableStatus = 2) 的格口
+ const availableCells = cells.filter(cell =>
+ cell.isRented === 0 && cell.usageStatus === 1 && cell.availableStatus === 1
+ );
// 搜索过滤
if (!searchQuery.value) {
@@ -155,17 +163,16 @@ function showCartDetail() {
-
- 🛒
- {{ rentingCartTotalQuantity }}
-
-
- 已选格口数:{{ rentingCartTotalQuantity }}
-
+
+
+
+
+ 合计{{ rentingCartTotalQuantity }}格 ¥{{ rentingCartTotalPrice.toFixed(2) }}
+
-
+
@@ -173,7 +180,7 @@ function showCartDetail() {
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 94281c6..56145d2 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -1,11 +1,13 @@