-
+
格口 {{ locker.cellNo }}
¥{{ (locker.price || 0).toFixed(2) }}
-
{{ locker.goodsName }}
-
-
-
-
格口 {{ locker.cellNo }}
-
¥0.00
-
-
空闲
+
- 立即开启
+ 开启格口
@@ -74,9 +49,10 @@ import type { RentingCabinetDetailDTO, CabinetCellEntity } from '@/common/apis/c
import { useWxStore } from '@/pinia/stores/wx';
import { publicPath } from "@/common/utils/path";
import { showDialog, showToast } from 'vant';
+import { useAb98UserStore } from '@/pinia/stores/ab98-user';
const wxStore = useWxStore();
-const { userid: qyUserid, name: qyName, corpid } = storeToRefs(wxStore);
+const { userid: userid, qyUserId: qyUserId, name: qyName, corpid, ab98User } = storeToRefs(wxStore);
const activeCabinet = ref(0)
const cabinetList = ref
([])
@@ -85,11 +61,6 @@ const openingLockerId = ref(null)
const showBindGoodsPopup = ref(false)
const currentLocker = ref(null)
const cabinetData = ref([]);
-// 机柜地址选择相关状态
-const showShopList = ref(true);
-const shopList = ref([]);
-const shopId = ref(0);
-const selectedShop = ref(null);
let scrollListener: any[] = [];
interface CabinetItem {
@@ -111,11 +82,12 @@ interface LockerItem {
}
// 获取用户租用的机柜列表
-const loadUserRentedCabinetDetail = async (selectedShopId?: number) => {
- const targetShopId = selectedShopId || shopId.value;
- if (!targetShopId || !corpid.value || !qyUserid.value) return;
+const loadUserRentedCabinetDetail = async () => {
+ if (!ab98User.value || !ab98User.value.ab98UserId) {
+ return;
+ }
try {
- const { data } = await getUserRentedCabinetListApi(corpid.value, Number(qyUserid.value));
+ const { data } = await getUserRentedCabinetListApi(corpid.value, ab98User.value.ab98UserId);
cabinetData.value = data || [];
cabinetList.value = cabinetData.value.map(cabinet => ({
cabinetId: cabinet.cabinetId,
@@ -142,7 +114,7 @@ const updateLockerList = (cabinet: RentingCabinetDetailDTO) => {
status: cell.isRented ? 1 : 0,
statusClass: cell.isRented ? 'occupied' : 'available',
// 这里假设商品信息可能在其他字段中,根据实际情况调整
- goodsName: '已租用商品',
+ goodsName: '',
price: cell.cellPrice,
coverImg: `${publicPath}img/product-image.svg`
}))
@@ -162,7 +134,7 @@ const handleOpenLocker = async (locker: LockerItem) => {
// 调用打开柜口接口
await openCabinet(cabinetList.value[activeCabinet.value].cabinetId, locker.lockerNumber, {
cellId: locker.lockerId,
- userid: qyUserid.value,
+ userid: userid.value,
isInternal: 2,
name: qyName.value,
mobile: '',
@@ -177,40 +149,7 @@ const handleOpenLocker = async (locker: LockerItem) => {
// 初始化方法
const init = async () => {
- if (showShopList.value) {
- await getShopList();
- } else if (shopId.value) {
- await loadUserRentedCabinetDetail();
- }
-};
-
-// 获取商店列表
-const getShopList = async () => {
- try {
- const res = await getShopListApi(wxStore.corpid, -1);
- if (res?.code === 0 && res?.data?.length > 0) {
- shopList.value = res.data;
- }
- } catch (error) {
- console.error('获取商店列表失败:', error);
- }
-};
-
-// 选择商店
-const handleShopSelect = (selectedShopId: number) => {
- const shop = shopList.value.find(s => s.shopId === selectedShopId);
- if (shop) {
- selectedShop.value = shop;
- shopId.value = selectedShopId;
- }
- showShopList.value = false;
- loadUserRentedCabinetDetail(selectedShopId);
-};
-
-// 返回商店列表
-const handleBackToShopList = () => {
- showShopList.value = true;
- shopId.value = 0;
+ await loadUserRentedCabinetDetail();
};
onMounted(() => {
diff --git a/src/pinia/stores/wx.ts b/src/pinia/stores/wx.ts
index 1f7211e..1bb010b 100644
--- a/src/pinia/stores/wx.ts
+++ b/src/pinia/stores/wx.ts
@@ -120,6 +120,9 @@ export const useWxStore = defineStore("wx", () => {
if (!userid.value) {
userid.value = balanceRes.data.userid;
}
+ if (!ab98User.value && balanceRes.data.ab98User) {
+ setAb98User(balanceRes.data.ab98User);
+ }
/* if (!corpid.value) {
corpid.value = balanceRes.data.corpid;
} */
diff --git a/src/router/index.ts b/src/router/index.ts
index 9d6b63c..9ae525d 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -73,6 +73,27 @@ export const routes: RouteRecordRaw[] = [
component: () => import('@/pages/order/index.vue'),
meta: {
title: '订单详情',
+ layout: {
+ navBar: {
+ showNavBar: true,
+ showLeftArrow: true
+ }
+ },
+ requiresAuth: true
+ }
+ },
+ {
+ path: '/rental-list',
+ name: 'RentalList',
+ component: () => import('@/pages/rental/index.vue'),
+ meta: {
+ title: '我的柜子',
+ layout: {
+ navBar: {
+ showNavBar: true,
+ showLeftArrow: true
+ }
+ },
requiresAuth: true
}
},