From 310391c4bca6f0d1d2bbd769b3f88a080865d9aa Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Fri, 2 Jan 2026 01:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=92=8C=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tes-specialist.ts | 42 +- src/hooks/useLocation.ts | 31 ++ src/hooks/useOrder.ts | 54 +-- src/pages/order/detail.vue | 748 +++++++++++++++++--------------- src/pages/order/order.vue | 584 +++++++++++-------------- src/utils/order.ts | 41 -- src/utils/teaSpecialistOrder.ts | 75 ++++ 7 files changed, 797 insertions(+), 778 deletions(-) create mode 100644 src/utils/teaSpecialistOrder.ts diff --git a/src/api/tes-specialist.ts b/src/api/tes-specialist.ts index bc63f9b..afde92c 100644 --- a/src/api/tes-specialist.ts +++ b/src/api/tes-specialist.ts @@ -31,8 +31,8 @@ export function addTeaSpecialistQualification(data) { /** * 茶艺师资质详情 */ -export function getTeaSpecialistQualification() { - return http.Post('/teamapi/user/certDetails') +export function getTeaSpecialistQualification(cert_id: number) { + return http.Post('/teamapi/user/certDetails', { cert_id }) } /** @@ -40,4 +40,42 @@ export function getTeaSpecialistQualification() { */ export function editTeaSpecialistQualification(data) { return http.Post('/teamapi/user/editCert', data) +} + +/** + * 茶艺师订单列表 + */ +export interface TeaSpecialistOrderListParams { + page: number + size: number + order_status?: string + search?: string +} + +export function getTeaSpecialistOrderList(data: TeaSpecialistOrderListParams) { + return http.Post('/teamapi/order/orderTeamList', data) +} + +/** + * 茶艺师订单详情 + * @param id 订单ID + */ +export function getTeaSpecialistOrderDetails(id: number) { + return http.Post('/teamapi/order/orderDetails', { id }) +} + +/** + * 茶艺师接单 + * @param id 订单ID + */ +export function acceptTeaSpecialistOrder(id: number) { + return http.Post('/teamapi/order/orderTake', { id }) +} + +/** + * 茶艺师出发 + * @param id 订单ID + */ +export function departTeaSpecialistOrder(id: number) { + return http.Post('/teamapi/order/orderDepart', { id }) } \ No newline at end of file diff --git a/src/hooks/useLocation.ts b/src/hooks/useLocation.ts index fdcef75..7ef7eea 100644 --- a/src/hooks/useLocation.ts +++ b/src/hooks/useLocation.ts @@ -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) diff --git a/src/hooks/useOrder.ts b/src/hooks/useOrder.ts index a745872..cca8249 100644 --- a/src/hooks/useOrder.ts +++ b/src/hooks/useOrder.ts @@ -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 } } \ No newline at end of file diff --git a/src/pages/order/detail.vue b/src/pages/order/detail.vue index da9e9c7..3b4b9c2 100644 --- a/src/pages/order/detail.vue +++ b/src/pages/order/detail.vue @@ -18,7 +18,7 @@ 订单备注 - @@ -37,20 +37,20 @@ - 订单号:1744601722882174 + 订单号:{{ order.order_sn }} - - - - + + + + @@ -78,7 +78,7 @@ 订单总额 - ¥ {{ costDetail.orderTotal.toFixed(2) }} + ¥ {{ order.team_income_price }} @@ -141,12 +141,15 @@ 平台服务费 ¥ {{ costDetail.platformFee.toFixed(2) }} - + + + - - - 实际收入 - ¥ {{ costDetail.actualIncome.toFixed(2) }} + + + 实际收入 + ¥ {{ costDetail.deductFee.toFixed(2) }} + @@ -160,25 +163,36 @@ - - 请务必提前确认服务日程,妥善安排好时间 - - - + + 还剩 - + + + 订单自动取消 + + + + + + + + + + 还剩 + + 开始服务,请妥善安排行程 - - + + @@ -189,15 +203,15 @@ - + - 辛苦了,感谢您本次的用心服务! + 辛苦了,感谢您本次的用心服务! - 订单已取消,期待您下次的精彩服务! + 订单已取消,期待您下次的精彩服务! @@ -206,7 +220,7 @@ + :price="order.team_income_price" /> @@ -218,8 +232,9 @@ - {{ orderData.serviceName }} - + {{ order.title }} + + 订单已续订 @@ -235,11 +250,11 @@ 预约时间: - {{ orderData.appointmentTimeFull }} + {{ order.day_time }} {{ order.start_time }}-{{ order.end_time }} 预约时长: - {{ orderData.duration }} + {{ order.hours }} @@ -251,48 +266,56 @@ 服务人数 - {{ orderData.servicePeople }}人 + {{ order.server_number }}人 预定茶叶 - {{ orderData.teaName }} + {{ order.leaf_name }} 茶具使用 - {{ orderData.teawareUsage }} + {{ order.is_teacup == 0 ? '自带' : '茶艺师提供' }} - 续订信息 - 续定茶叶 - {{ orderData.teawareUsage }} + 续单时长 + {{ order.renew_hours || 0 }}/小时 + + + 续单金额 + {{ order.renew_price || 0 }} + + + 续单茶叶金额 + {{ order.renew_tea_price || 0 }} - + 订单备注 备注信息 - 12311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122 + {{ order.remark }} - - + + - + 拍照记录 @@ -307,12 +330,13 @@ - 2025/09/18 09:00:23 + {{ order.image_time }} - + + @@ -323,23 +347,28 @@ 服务方式 - {{ orderData.serviceType }} + {{ order.server_type == 1 ? '到店服务' : '上门服务' }} 服务地址 - {{ orderData.address }} - + {{ order.address }} + - - - 订单记录 - - - + + + + 订单记录 + + + @@ -350,21 +379,21 @@ 订单编号 - {{ orderData.orderSn }} - |复制 + {{ order.order_sn }} + |复制 - + 交易方式 - {{ orderData.paymentMethod }} + {{ order.pay_title }} 创建时间 - {{ orderData.createTime }} + {{ order.dtime }} - + 付款时间 - {{ orderData.payTime }} + {{ order.pay_time }} @@ -374,28 +403,35 @@ -