增加展示选择
This commit is contained in:
@@ -47,14 +47,14 @@ import ServicePanel from '@/components/homeService/ServicePanel.uvue'
|
||||
import type { DeliveryLocationType, DeliveryOrderType } from '@/types/delivery.uts'
|
||||
import { checkinOrder, getDeliveryOrderDetail } from '@/services/deliveryService.uts'
|
||||
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
import { getCurrentUserId } from '@/utils/store.uts'
|
||||
import { getDeliveryRouteParam } from '@/utils/deliveryRoute.uts'
|
||||
import {
|
||||
emailLogin,
|
||||
checkinPrecheck,
|
||||
getHomecareToken,
|
||||
getHomecareUser,
|
||||
getReasonText
|
||||
} from '@/utils/homecareAuth.uts'
|
||||
import { debugCurrentUser } from '@/utils/akUserMapping.uts'
|
||||
|
||||
const orderId = ref('')
|
||||
const order = ref<DeliveryOrderType | null>(null)
|
||||
@@ -79,16 +79,13 @@ const reasonText = ref('')
|
||||
|
||||
function updateHomecareLoginStatus(): void {
|
||||
console.warn('[CHECKIN DEBUG] updateHomecareLoginStatus: called')
|
||||
const token = getHomecareToken()
|
||||
console.warn('[CHECKIN DEBUG] updateHomecareLoginStatus: token length:', token.length)
|
||||
if (token !== '') {
|
||||
// 改用 Supabase 当前用户判断是否已登录(homecare 专属 token 已废弃,从未被写入)
|
||||
const userId = getCurrentUserId()
|
||||
console.warn('[CHECKIN DEBUG] updateHomecareLoginStatus: token length:', userId.length)
|
||||
if (userId !== '') {
|
||||
isHomecareLoggedIn.value = true
|
||||
const user = getHomecareUser()
|
||||
if (user != null) {
|
||||
const email = user.getString('email')
|
||||
homecareUserEmail.value = email != null ? email : ''
|
||||
console.warn('[CHECKIN DEBUG] updateHomecareLoginStatus: logged in as', homecareUserEmail.value)
|
||||
}
|
||||
homecareUserEmail.value = '已登录 (uid: ' + userId.substring(0, 8) + '...)'
|
||||
console.warn('[CHECKIN DEBUG] updateHomecareLoginStatus: logged in as', homecareUserEmail.value)
|
||||
} else {
|
||||
isHomecareLoggedIn.value = false
|
||||
homecareUserEmail.value = ''
|
||||
@@ -263,6 +260,10 @@ async function handlePrecheck(): Promise<void> {
|
||||
}
|
||||
|
||||
console.warn('[CHECKIN PAGE] 开始预校验流程')
|
||||
|
||||
// 调试:打印当前 ak_user 信息
|
||||
debugCurrentUser()
|
||||
|
||||
prechecking.value = true
|
||||
canCheckin.value = false
|
||||
distanceText.value = '定位中...'
|
||||
@@ -334,6 +335,13 @@ async function submitCheckin() {
|
||||
uni.showToast({ title: '订单信息缺失', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 必须通过预校验才能提交
|
||||
if (!canCheckin.value) {
|
||||
uni.showToast({ title: '请先完成距离预校验', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (currentLocation.value == null) {
|
||||
console.warn('[CHECKIN DEBUG] submitCheckin: currentLocation is null, calling getCurrentLocation')
|
||||
await getCurrentLocation()
|
||||
@@ -373,8 +381,17 @@ async function doCheckin() {
|
||||
checkinMode: 'gps'
|
||||
})
|
||||
console.warn('[CHECKIN DEBUG] submitCheckin: checkinOrder succeeded')
|
||||
uni.showToast({ title: '签到成功', icon: 'success' })
|
||||
uni.redirectTo({ url: '/pages/mall/delivery/service-record/index?id=' + orderId.value })
|
||||
|
||||
// 签到成功后显示等待消费者确认
|
||||
uni.showModal({
|
||||
title: '签到成功',
|
||||
content: '已提交到达签到,等待消费者确认',
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
// 返回订单列表或详情页
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn('[CHECKIN DEBUG] submitCheckin error:', error)
|
||||
uni.showToast({ title: '签到失败,请重试', icon: 'none' })
|
||||
|
||||
Reference in New Issue
Block a user