From 3dc1d71dc0183fe41317d18674cbaa29b7dd3903 Mon Sep 17 00:00:00 2001 From: YOGO <1587218160@qq.com> Date: Mon, 18 May 2026 10:41:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=20=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 5 +++- pages/index/index.vue | 64 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/App.vue b/App.vue index 91e64cd..801e34b 100644 --- a/App.vue +++ b/App.vue @@ -86,9 +86,12 @@ export default { this.globalData.statusBarHeight = statusBarHeight || 20; // #endif // authCode url 存在 就直接登陆 - console.log(window.location.href,"window.location.href") const authCode = getQueryParam('authCode'); const sfId = getQueryParam('sfId'); + const lockerId = getQueryParam('lockerId'); + if(lockerId) { + uni.setStorageSync("lockerId", lockerId); + } if(sfId) { uni.setStorageSync("sfId", sfId); } diff --git a/pages/index/index.vue b/pages/index/index.vue index 8ab08f3..0f4452b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1521,10 +1521,10 @@ const shareParams = { url: `/pages/index/index?siteId=${state.value.siteId}&lockerId=${state.value.lockerId}`, supportShare: 'YES' } -setTimeout(() => { - console.log(Object.keys(SFUIP)) - SFUIP.shareToWx(shareParams) -},3000) +// setTimeout(() => { +// console.log(Object.keys(SFUIP)) +// SFUIP.shareToWx(shareParams) +// },3000) if (params.q) { let urlParams = decodeURIComponent(params.q); @@ -1541,12 +1541,13 @@ setTimeout(() => { if (parseUrlRes.mediatorId) uni.setStorageSync('mediatorId', parseUrlRes.mediatorId); } //如果链接带了lockerId 则直接跳转到订单详情 - let url = window.location.href; - if(parseUrlParams(url).lockerId){ +// let url = window.location.href; +// if(parseUrlParams(url).lockerId){ - } +// } +debugger uni.$on('homeSiteId', (data) => { if (data.id) { state.value.siteId = data.id @@ -1559,10 +1560,54 @@ setTimeout(() => { }) getLocation().then(() => { // getSiteDetail() - }); - getSiteDetail() + }); + const lockerId = uni.getStorageSync('lockerId') + if(lockerId){ + state.value.lockerId = lockerId; + getLockerByLockerId(); + }else{ + getSiteDetail() + } }); +// 根据扫码 获取仓位信息 +const getLockerByLockerId = async () => { + uni.showLoading(); + // 重置所有参数 + reset(); + state.value.lockerId = uni.getStorageSync('lockerId'); + // 获取仓位数据 + const lockerRes = await getSiteApi.GetLockerById({ lockerId: state.value.lockerId }) + if(lockerRes.code == 200 ){ + + // 根据 仓位数据的 siteId 选中仓型 然后请求仓位 计算出费用 再清空lockerId 下次进来就不会默认这个 + if(lockerRes.data?.siteId){ + // 选中仓位 + state.value.selectUnitRow = lockerRes.data; + state.value.siteId = lockerRes.data.siteId; + const siteRes = await getSiteApi.GetUnitTypeBySiteId({ siteId: state.value.siteId }) + + if(siteRes.code == 200){ + unitTypeData.value = siteRes.data + // .filter(item => item.hasAvailableLocker); + state.value.active = unitTypeData.value.findIndex(item => item.id == lockerRes.data.unitTypeId); + state.value.unitTypeId = lockerRes.data.unitTypeId; + startDriver(); + isWaitingAppointment(true); + getLockerById(); + } + } + }else{ + uni.showToast({ + title: lockerRes.msg, + icon: 'none', + duration: 2000 + }) + } + uni.hideLoading(); + uni.removeStorageSync('lockerId') +} + onUnload(() => { uni.$off('homeSiteId'); if(driverObj){ @@ -1586,7 +1631,6 @@ const getLockerById = () => { getSiteApi.GetLockerById({ lockerId: state.value.lockerId }).then((res) => { if (res.code === 200) { state.value.lockData = res.data; - console.log(state.value.lockData,"siteData"); if (state.value.lockData.isPreSale) { // 订单可以租用 state.value.zhuangxiuzhong = true;