调试订单列表和详情接口
This commit is contained in:
@ -181,6 +181,37 @@ export async function handleGetLocationCity(lat: number, lng: number) {
|
||||
}
|
||||
}
|
||||
|
||||
export function handleGetLocationFallback() {
|
||||
return new Promise<{ lat: number, lng: number, }>((resolve) => {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
resolve({ lat: res.latitude, lng: res.longitude})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
// 用户拒绝授权
|
||||
if (shouldShowAuthModal()) {
|
||||
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要获取您的地理位置,请授权定位服务',
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
// 可引导用户去设置页面
|
||||
uni.openSetting({})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 检查是否需要弹授权框
|
||||
function shouldShowAuthModal() {
|
||||
const lastDeny = uni.getStorageSync(LOCATION_DENY_TIME_KEY)
|
||||
|
||||
@ -1,56 +1,30 @@
|
||||
import { router } from '@/utils/tools'
|
||||
import { toast } from '@/utils/toast'
|
||||
import {
|
||||
cancelTeaRoomOrder,
|
||||
deleteTeaRoomOrder,
|
||||
releaseTeaRoomOrder
|
||||
} from '@/api/order'
|
||||
import { acceptTeaSpecialistOrder } from '@/api/tes-specialist'
|
||||
|
||||
|
||||
/**
|
||||
* 释放时间
|
||||
* 茶艺师接单
|
||||
* @param id 订单ID
|
||||
*/
|
||||
export async function handleReleaseTeaRoomOrderHookds (id: number) {
|
||||
export async function handleReleaseOrderHooks(id: number) {
|
||||
try {
|
||||
await releaseTeaRoomOrder(id)
|
||||
uni.$emit('refreshOrderList')
|
||||
uni.$emit('refreshOrderDetail')
|
||||
toast.info('释放成功')
|
||||
} catch (error) {
|
||||
router.navigateBack()
|
||||
throw error
|
||||
await acceptTeaSpecialistOrder(id)
|
||||
return true
|
||||
}
|
||||
catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
* @param orderId 订单ID
|
||||
* 茶艺师出发
|
||||
*/
|
||||
export async function handleCancelOrderHooks(id: number) {
|
||||
export async function handleDepartOrderHooks(id: number) {
|
||||
try {
|
||||
await cancelTeaRoomOrder(id)
|
||||
uni.$emit('refreshOrderList')
|
||||
uni.$emit('refreshOrderDetail')
|
||||
toast.info('取消成功')
|
||||
} catch (error) {
|
||||
router.navigateBack()
|
||||
throw error
|
||||
await acceptTeaSpecialistOrder(id)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
export async function handleDeleteOrderHooks(id: number) {
|
||||
try {
|
||||
await deleteTeaRoomOrder(id)
|
||||
uni.$emit('refreshOrderList')
|
||||
uni.$emit('refreshOrderDetail')
|
||||
toast.info('删除订单成功')
|
||||
} catch (error) {
|
||||
router.navigateBack()
|
||||
throw error
|
||||
catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user