修改访客邀请、一键开门bug

This commit is contained in:
zhouyanli
2026-05-07 11:57:57 +08:00
parent 231de9cde8
commit 0fb361ad64
6 changed files with 82 additions and 114 deletions

View File

@@ -54,9 +54,16 @@
"setting" : { "setting" : {
"urlCheck" : false "urlCheck" : false
}, },
"requiredPrivateInfos": [
"chooseLocation",
"getLocation"
],
"permission": { "permission": {
"scope.camera": { "scope.camera": {
"desc": "用于扫码" "desc": "用于扫码"
},
"scope.userLocation": {
"desc": "你的位置信息将用于定位选择"
} }
}, },
"usingComponents" : true "usingComponents" : true

View File

@@ -526,11 +526,11 @@ watch(() => myFilter.value, () => {
} }
.action-btn { .action-btn {
padding: 0 40rpx; padding: 0px 26rpx;
height: 60rpx; height: 50rpx;
line-height: 60rpx; line-height: 50rpx;
font-size: 24rpx; font-size: 22rpx;
border-radius: 35rpx; border-radius: 10rpx;
margin: 0; margin: 0;
} }

View File

@@ -66,7 +66,7 @@ const currentLength = ref(0);
// 图片列表(本地临时路径) // 图片列表(本地临时路径)
const imgList = ref([]); const imgList = ref([]);
// 定位信息 // 定位信息
const location = ref('山东省日照市东港区学院路'); const location = ref('');
// 经纬度 // 经纬度
const longitude = ref(''); const longitude = ref('');
const latitude = ref(''); const latitude = ref('');
@@ -158,10 +158,10 @@ const submitStatus = async () => {
uni.showToast({ title: '请输入实况描述', icon: 'none' }); uni.showToast({ title: '请输入实况描述', icon: 'none' });
return; return;
} }
if (!activityId.value) { // if (!activityId.value) {
uni.showToast({ title: '活动ID缺失', icon: 'none' }); // uni.showToast({ title: '活动ID缺失', icon: 'none' });
return; // return;
} // }
uni.showLoading({ title: '提交中...', mask: true }); uni.showLoading({ title: '提交中...', mask: true });

View File

@@ -107,10 +107,10 @@ const getAccessControl = async () =>{
}) })
} }
}catch{ }catch(err){
doorList.value = [] doorList.value = []
uni.showToast({ uni.showToast({
title:res.msg, title:err.msg || '查询失败',
icon:"error" icon:"error"
}) })
} }
@@ -136,26 +136,19 @@ const getAccessOpenData = async () =>{
let params = {deviceId:selectedDoor.value} let params = {deviceId:selectedDoor.value}
const res = await getAccessOpen(params) const res = await getAccessOpen(params)
if(res.code === 200){ if(res.code === 200){
if(res.data){ uni.showToast({
uni.showToast({ title:'开门成功',
title:'开门成功', icon:'success'
icon:"success" })
})
}else{
uni.showToast({
title:'开门失败',
icon:"error"
})
}
}else{ }else{
uni.showToast({ uni.showToast({
title:'开门失败', title:'开门失败',
icon:"error" icon:"error"
}) })
} }
}catch{ }catch(err){
uni.showToast({ uni.showToast({
title: res.msg, title: err.msg || '开门失败',
icon:"error" icon:"error"
}) })
} }

View File

@@ -40,7 +40,7 @@
<!-- 预约时间 --> <!-- 预约时间 -->
<view class="form-item time-item" @click="openTimePopup"> <view class="form-item time-item" @click="openTimePopup">
<text class="label">预约时间</text> <text class="label">预约时间</text>
<text class="value time-value">{{ showTimeText }}</text> <text class="value time-value">{{ showTimeText || '请选择预约时间' }}</text>
</view> </view>
<!-- <view class="form-item"> <!-- <view class="form-item">
<text class="label">预约时间</text> <text class="label">预约时间</text>
@@ -142,7 +142,6 @@
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app' import { onLoad, onUnload } from '@dcloudio/uni-app'
@@ -153,7 +152,7 @@ import moment from 'moment/moment'
const houseName = ref('') const houseName = ref('')
const houseId = ref('') const houseId = ref('')
const projectName = ref('') const projectName = ref('')
const projectId = ref('') // ✅ 修复新增项目ID const projectId = ref('')
// 表单数据 // 表单数据
const form = ref({ const form = ref({
@@ -166,10 +165,10 @@ const form = ref({
// ========== 基础数据 ========== // ========== 基础数据 ==========
const timePopupRef = ref(null) const timePopupRef = ref(null)
const selectedTime = ref(moment().hour(9).minute(30).second(0)) const selectedTime = ref('')
const tempTime = ref(moment().hour(9).minute(30).second(0)) const tempTime = ref(moment().hour(9).minute(30).second(0))
// ========== 时间选择列数据 ✅ 修复:固定小时/分钟,不跟随当前时间 ========== // ========== 时间选择列数据 ==========
const dateList = ref([ const dateList = ref([
{ label: '(今天)', value: moment().format('YYYY-MM-DD') }, { label: '(今天)', value: moment().format('YYYY-MM-DD') },
{ label: '(明天)', value: moment().add(1, 'day').format('YYYY-MM-DD') }, { label: '(明天)', value: moment().add(1, 'day').format('YYYY-MM-DD') },
@@ -195,11 +194,12 @@ const selectedMinute = ref('')
// ========== 滚动配置 ========== // ========== 滚动配置 ==========
const itemHeight = 80 const itemHeight = 80
const dateScrollTop = ref(0) const dateScrollTop = ref(0)
const hourScrollTop = ref(1) const hourScrollTop = ref(0)
const minuteScrollTop = ref(1) const minuteScrollTop = ref(0)
// ========== 显示文本 ========== // ========== 显示文本 ==========
const showTimeText = computed(() => { const showTimeText = computed(() => {
if(!selectedTime.value) return ''
return selectedTime.value.format('YYYY-MM-DD HH:mm') return selectedTime.value.format('YYYY-MM-DD HH:mm')
}) })
@@ -228,7 +228,7 @@ const confirmTime = () => {
}) })
} }
// ========== 滚动/选择逻辑 ========== // ========== 核心修复:只允许点击,滚动失效! ==========
const syncScrollPosition = () => { const syncScrollPosition = () => {
const dateIdx = dateList.value.findIndex(i => i.value === selectedDate.value) const dateIdx = dateList.value.findIndex(i => i.value === selectedDate.value)
const hourIdx = hourList.value.findIndex(i => i.time === selectedHour.value) const hourIdx = hourList.value.findIndex(i => i.time === selectedHour.value)
@@ -239,47 +239,32 @@ const syncScrollPosition = () => {
minuteScrollTop.value = minIdx * itemHeight minuteScrollTop.value = minIdx * itemHeight
} }
// 点击选择日期
const selectDate = (index) => { const selectDate = (index) => {
selectedDate.value = dateList.value[index].value selectedDate.value = dateList.value[index].value
dateScrollTop.value = index * itemHeight syncScrollPosition()
updateTempTime()
}
const selectHour = (index) => {
selectedHour.value = hourList.value[index].time
hourScrollTop.value = index * itemHeight
updateTempTime()
}
const selectMinute = (index) => {
selectedMinute.value = minuteList.value[index].minute
minuteScrollTop.value = index * itemHeight
updateTempTime() updateTempTime()
} }
const onDateScroll = (e) => { // 点击选择小时
const idx = Math.round(e.detail.scrollTop / itemHeight) const selectHour = (index) => {
if (idx >= 0 && idx < dateList.value.length) { selectedHour.value = hourList.value[index].time
selectedDate.value = dateList.value[idx].value syncScrollPosition() // 选中后立刻复位滚动
dateScrollTop.value = idx * itemHeight updateTempTime()
updateTempTime()
}
} }
const onHourScroll = (e) => {
const idx = Math.round(e.detail.scrollTop / itemHeight) // 点击选择分钟
if (idx >= 0 && idx < hourList.value.length) { const selectMinute = (index) => {
selectedHour.value = hourList.value[idx].time selectedMinute.value = minuteList.value[index].minute
hourScrollTop.value = idx * itemHeight syncScrollPosition() // 选中后立刻复位滚动
updateTempTime() updateTempTime()
}
}
const onMinuteScroll = (e) => {
const idx = Math.round(e.detail.scrollTop / itemHeight)
if (idx >= 0 && idx < minuteList.value.length) {
selectedMinute.value = minuteList.value[idx].minute
minuteScrollTop.value = idx * itemHeight
updateTempTime()
}
} }
// 完全禁用滚动监听(去掉滚动干扰)
const onDateScroll = () => {}
const onHourScroll = () => {}
const onMinuteScroll = () => {}
const updateTempTime = () => { const updateTempTime = () => {
tempTime.value = moment(`${selectedDate.value} ${selectedHour.value}:${selectedMinute.value}`, 'YYYY-MM-DD HH:mm') tempTime.value = moment(`${selectedDate.value} ${selectedHour.value}:${selectedMinute.value}`, 'YYYY-MM-DD HH:mm')
} }
@@ -296,7 +281,7 @@ onLoad(() => {
}) })
uni.$on('selectProject', (data) => { uni.$on('selectProject', (data) => {
projectName.value = data.name projectName.value = data.name
projectId.value = data.id // 接收项目ID projectId.value = data.id
}) })
}) })
@@ -369,7 +354,6 @@ const submitForm = async () => {
try { try {
const imageUrls = await uploadImages() const imageUrls = await uploadImages()
// 参数
const params = { const params = {
villageId, villageId,
houseId: houseId.value, houseId: houseId.value,
@@ -388,8 +372,6 @@ const submitForm = async () => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ title: '提交成功', icon: 'success' }) uni.showToast({ title: '提交成功', icon: 'success' })
// const tempProjectId = projectId.value
// 清空表单
form.value = { title: '', desc: '', phone: '', datetime: '', images: [] } form.value = { title: '', desc: '', phone: '', datetime: '', images: [] }
houseName.value = '' houseName.value = ''
houseId.value = '' houseId.value = ''
@@ -397,22 +379,21 @@ const submitForm = async () => {
projectId.value = '' projectId.value = ''
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url:'/pageSubPack/online-repair/onlineRepair' url:'/pageSubPack/online-repair/onlineRepair'
}) })
// uni.navigateTo({ url: `/pageSubPack/online-repair/onlineRepair?maintenanceProjectId=${tempProjectId}` })
}, 1500) }, 1500)
} else { } else {
uni.showToast({ title: res.msg || '提交失败', icon: 'none' }) uni.showToast({ title: res.msg || '提交失败', icon: 'none' })
} }
} catch (e) { } catch (e) {
// console.error('提交异常:', e)
uni.showToast({ title: '提交失败,请检查网络或重试', icon: 'none' }) uni.showToast({ title: '提交失败,请检查网络或重试', icon: 'none' })
} finally { } finally {
uni.hideLoading() uni.hideLoading()
} }
} }
</script> </script>
<style scoped> <style scoped>
.form-container { .form-container {
padding: 15px; padding: 15px;
@@ -462,20 +443,7 @@ const submitForm = async () => {
/* border-bottom: 1px solid #eee; */ /* border-bottom: 1px solid #eee; */
padding-bottom: 10px; padding-bottom: 10px;
} }
/* .label {
font-size: 14px;
color: #333;
margin-bottom: 8px;
display: block;
}
.value {
font-size: 14px;
color: #666;
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
} */
.switch { .switch {
font-size: 12px; font-size: 12px;
color: #007aff; color: #007aff;
@@ -589,25 +557,14 @@ textarea {
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #BBBCBE;
position: relative; position: relative;
} }
/* 选中项样式(高亮) */ /* 选中项样式(高亮) */
.time-item.active { .time-item.active {
color: #007aff; color: #1D2129;
font-weight: 600; font-weight: 600;
background-color: #d0d0d0; background-color: #F7F7F7;
}
.time-item.active::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
/* width: 80%; */
/* height: 1px; */
background-color: #d0d0d0;
} }
</style> </style>

View File

@@ -13,9 +13,9 @@
</up-steps> </up-steps>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<view class="step-time">2026-03-26 09:30:38</view> <view class="step-time" v-if="currentStep >= 0">{{timeData.createTime}}</view>
<view class="step-time">2026-03-26 09:30:38</view> <view class="step-time" v-if="currentStep >= 1">{{timeData.dispatchTime}}</view>
<view class="step-time-3">2026-03-28 09:30:38</view> <view class="step-time-3" v-if="currentStep >= 2">{{timeData.finishTime}}</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
</view> </view>
@@ -61,9 +61,9 @@
</view> </view>
<!-- 联系物业按钮 --> <!-- 联系物业按钮 -->
<view class="btn-container"> <!-- <view class="btn-container">
<button class="contact-btn" @click="contactProperty">联系物业</button> <button class="contact-btn" @click="contactProperty">联系物业</button>
</view> </view> -->
</view> </view>
</template> </template>
@@ -87,6 +87,13 @@ const repairInfo = ref({
// 步骤状态 // 步骤状态
const currentStep = ref(0) const currentStep = ref(0)
// 三个步骤对应的时间
const timeData = ref({
createTime: '', // 待处理/提交时间
dispatchTime: '', // 已派单时间
finishTime: '' // 已完成时间
})
const setStep = (status) => { const setStep = (status) => {
if (status === '0' || status === 0) currentStep.value = 0 if (status === '0' || status === 0) currentStep.value = 0
@@ -108,6 +115,10 @@ const mapData = (data) => {
images images
} }
setStep(data.problemStatus) setStep(data.problemStatus)
// 三个步骤时间赋值
timeData.value.createTime = data.updateTime || ''
timeData.value.dispatchTime = data.updateTime || ''
timeData.value.finishTime = data.updateTime || ''
} }
// 获取详情接口 // 获取详情接口
@@ -145,11 +156,11 @@ const previewImage = (url) => {
} }
// 联系物业按钮点击事件 // 联系物业按钮点击事件
const contactProperty = () => { // const contactProperty = () => {
uni.makePhoneCall({ // uni.makePhoneCall({
phoneNumber: '物业电话' // 换成真实电话 // phoneNumber: '物业电话' // 换成真实电话
}) // })
} // }
</script> </script>
<style scoped> <style scoped>