调试订单列表和详情接口
This commit is contained in:
@ -31,8 +31,8 @@ export function addTeaSpecialistQualification(data) {
|
||||
/**
|
||||
* 茶艺师资质详情
|
||||
*/
|
||||
export function getTeaSpecialistQualification() {
|
||||
return http.Post<any>('/teamapi/user/certDetails')
|
||||
export function getTeaSpecialistQualification(cert_id: number) {
|
||||
return http.Post<any>('/teamapi/user/certDetails', { cert_id })
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,4 +40,42 @@ export function getTeaSpecialistQualification() {
|
||||
*/
|
||||
export function editTeaSpecialistQualification(data) {
|
||||
return http.Post<any>('/teamapi/user/editCert', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师订单列表
|
||||
*/
|
||||
export interface TeaSpecialistOrderListParams {
|
||||
page: number
|
||||
size: number
|
||||
order_status?: string
|
||||
search?: string
|
||||
}
|
||||
|
||||
export function getTeaSpecialistOrderList(data: TeaSpecialistOrderListParams) {
|
||||
return http.Post<any>('/teamapi/order/orderTeamList', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师订单详情
|
||||
* @param id 订单ID
|
||||
*/
|
||||
export function getTeaSpecialistOrderDetails(id: number) {
|
||||
return http.Post<any>('/teamapi/order/orderDetails', { id })
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师接单
|
||||
* @param id 订单ID
|
||||
*/
|
||||
export function acceptTeaSpecialistOrder(id: number) {
|
||||
return http.Post<any>('/teamapi/order/orderTake', { id })
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师出发
|
||||
* @param id 订单ID
|
||||
*/
|
||||
export function departTeaSpecialistOrder(id: number) {
|
||||
return http.Post<any>('/teamapi/order/orderDepart', { id })
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">订单备注</view>
|
||||
<view class="px-32rpx">
|
||||
<wd-textarea v-model="mark" readonly
|
||||
<wd-textarea v-model="order.remark" readonly
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA] !h-500rpx' />
|
||||
</view>
|
||||
@ -37,20 +37,20 @@
|
||||
<view class="flex items-center mb-58rpx">
|
||||
<view class="bg-[#4C9F44] w-8rpx h-32rpx mr-22rpx"></view>
|
||||
<view class="font-bold text-28rpx leading-40rpx text-[#303133]">
|
||||
订单号:1744601722882174
|
||||
订单号:{{ order.order_sn }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="steps">
|
||||
<wd-steps :active="1" vertical dot>
|
||||
<wd-step title="客户下订单" description="显示时间" />
|
||||
<wd-step title="茶艺师接单" description="显示时间" />
|
||||
<wd-step title="茶艺师出发" description="显示时间" />
|
||||
<wd-steps :active="stepsActive" vertical dot>
|
||||
<wd-step title="客户下订单" :description="order.dtime" />
|
||||
<wd-step title="茶艺师接单" :description="order.take_order_time" />
|
||||
<wd-step title="茶艺师出发" :description="order.travel_time" />
|
||||
<wd-step title="茶艺师到达">
|
||||
<template #description>
|
||||
<view class="">
|
||||
<wd-img width="120rpx" height='80rpx' :src="`${OSS}icon/icon_close.png`" radius="8rpx"></wd-img>
|
||||
<view class="" v-if="order.image">
|
||||
<wd-img width="120rpx" height='80rpx' :src="order.image" radius="8rpx"></wd-img>
|
||||
</view>
|
||||
<view class="">显示时间</view>
|
||||
<view class="">{{ order.arrival_time }}</view>
|
||||
</template>
|
||||
</wd-step>
|
||||
<wd-step title="服务完成" />
|
||||
@ -78,7 +78,7 @@
|
||||
<!-- 订单总额 -->
|
||||
<view class="cost-item">
|
||||
<text class="cost-label">订单总额</text>
|
||||
<text class="cost-value">¥ {{ costDetail.orderTotal.toFixed(2) }}</text>
|
||||
<text class="cost-value">¥ {{ order.team_income_price }}</text>
|
||||
</view>
|
||||
|
||||
<view class="bg-[#FBFBFB] py-24rpx px-30rpx rounded-16rpx">
|
||||
@ -141,12 +141,15 @@
|
||||
<text class="cost-sub-label">平台服务费</text>
|
||||
<text class="cost-sub-value">¥ {{ costDetail.platformFee.toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 分隔线 -->
|
||||
<view class="cost-divider" />
|
||||
|
||||
<!-- 实际收入 -->
|
||||
<view class="actual-income">
|
||||
<text class="actual-income-label">实际收入</text>
|
||||
<text class="actual-income-value">¥ {{ costDetail.actualIncome.toFixed(2) }}</text>
|
||||
<view class="deduct-section rounded-16rpx">
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="cost-label">实际收入</view>
|
||||
<view class="cost-value">¥ {{ costDetail.deductFee.toFixed(2) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@ -160,25 +163,36 @@
|
||||
|
||||
<!-- 描述信息 -->
|
||||
<view class="text-[#909399] text-26rpx leading-36rpx mb-40rpx mt-20rpx">
|
||||
<!-- 待服务的第一种状态 -->
|
||||
<view class="ml-80rpx" v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingService">请务必提前确认服务日程,妥善安排好时间</view>
|
||||
|
||||
<!-- 待服务的第二种状态,距离开始倒计时十分钟 -->
|
||||
<view class="flex items-center justify-center" v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingService">
|
||||
<!-- 待接单-倒计时 -->
|
||||
<view class="flex items-center justify-center" v-if="orderStatus === TeaSpecialistOrderStatus.Pending && order.timekeeping > 0">
|
||||
<view class="flex items-center mr-6rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
||||
</view>
|
||||
<view class="flex items-center text-26rpx leading-36rpx text-[#909399]">
|
||||
<view>还剩</view>
|
||||
<view class="mx-6rpx">
|
||||
<wd-count-down :time="10 * 60 * 1000" custom-class="!text-[#FF5951]" />
|
||||
<wd-count-down :time="Number(order.timekeeping) * 1000" custom-class="!text-[#FF5951]"/>
|
||||
</view>
|
||||
<view>订单自动取消</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待服务-倒计时 -->
|
||||
<view class="flex items-center justify-center" v-if="orderStatus === TeaSpecialistOrderStatus.Accepted && order.timekeeping > 0">
|
||||
<view class="flex items-center mr-6rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
||||
</view>
|
||||
<view class="flex items-center text-26rpx leading-36rpx text-[#909399]">
|
||||
<view>还剩</view>
|
||||
<view class="mx-6rpx">
|
||||
<wd-count-down :time="Number(order.timekeeping) * 1000" custom-class="!text-[#FF5951]"/>
|
||||
</view>
|
||||
<view>开始服务,请妥善安排行程</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待服务的第三种状态,距离结束倒计时十分钟 -->
|
||||
<view class="text-center" v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingService">
|
||||
<!-- 服务中-倒计时 -->
|
||||
<view class="text-center" v-if="orderStatus === TeaSpecialistOrderStatus.Arrived && order.timekeeping > 0">
|
||||
<view class="flex items-center justify-center">
|
||||
<view class="flex items-center mr-6rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
||||
@ -189,15 +203,15 @@
|
||||
</view>
|
||||
|
||||
<view class="mx-6rpx">
|
||||
<wd-count-down :time="10 * 60 * 1000" custom-class="!text-[#FF5951]"/>
|
||||
<wd-count-down :time="Number(order.timekeeping) * 1000" custom-class="!text-[#FF5951]"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 服务完成 -->
|
||||
<view class="ml-80rpx" v-if="orderStatus === TeaSpecialistManageOrderStatus.Finished">辛苦了,感谢您本次的用心服务!</view>
|
||||
<view class="ml-80rpx" v-if="orderStatus === TeaSpecialistOrderStatus.Completed">辛苦了,感谢您本次的用心服务!</view>
|
||||
|
||||
<!-- 订单取消 -->
|
||||
<view class="ml-80rpx" v-if="orderStatus === TeaSpecialistManageOrderStatus.Cancelled">订单已取消,期待您下次的精彩服务!</view>
|
||||
<view class="ml-80rpx" v-if="orderStatus === TeaSpecialistOrderStatus.Cancelled">订单已取消,期待您下次的精彩服务!</view>
|
||||
</view>
|
||||
|
||||
<view class="mx-30rpx">
|
||||
@ -206,7 +220,7 @@
|
||||
<view class="order-card relative">
|
||||
<view class="price-btn" @click.stop="handlePriceClick">
|
||||
<price-format color="#FFFFFF" :first-size="32" :second-size="32" :subscript-size="24"
|
||||
:price="orderData.price" />
|
||||
:price="order.team_income_price" />
|
||||
<wd-icon name="arrow-right" size="24rpx" color="#FFFFFF" class="ml-8rpx" />
|
||||
</view>
|
||||
<view class="order-card-header">
|
||||
@ -218,8 +232,9 @@
|
||||
</view>
|
||||
<view class="order-card-content ml-50rpx">
|
||||
<view class="flex items-center justify-between w-full">
|
||||
<view class="service-name">{{ orderData.serviceName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="service-name">{{ order.title }}</view>
|
||||
<!-- is_renewal: 0没有续单 1续单 -->
|
||||
<view class="flex items-center" v-if="order.order_status && order.is_renewal == 1">
|
||||
<wd-img width="40rpx" height="40rpx" :src="`${OSS}icon/icon_renew.png`" />
|
||||
<view class="font-bold text-28rpx leading-40rpx text-[#4C9F44] ml-8rpx">订单已续订</view>
|
||||
</view>
|
||||
@ -235,11 +250,11 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">预约时间:</text>
|
||||
<text class="info-value">{{ orderData.appointmentTimeFull }}</text>
|
||||
<text class="info-value">{{ order.day_time }} {{ order.start_time }}-{{ order.end_time }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">预约时长:</text>
|
||||
<text class="info-value">{{ orderData.duration }}</text>
|
||||
<text class="info-value">{{ order.hours }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -251,48 +266,56 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">服务人数</text>
|
||||
<text class="info-value">{{ orderData.servicePeople }}人</text>
|
||||
<text class="info-value">{{ order.server_number }}人</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">预定茶叶</text>
|
||||
<text class="info-value">{{ orderData.teaName }}</text>
|
||||
<text class="info-value">{{ order.leaf_name }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">茶具使用</text>
|
||||
<text class="info-value">{{ orderData.teawareUsage }}</text>
|
||||
<text class="info-value">{{ order.is_teacup == 0 ? '自带' : '茶艺师提供' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="border-2rpx border-dashed border-[#E5E5E5]"></view>
|
||||
|
||||
<!-- TODO 有续订才显示 -->
|
||||
<view class="mt-22rpx">
|
||||
<view class="text-[#4C9F44] font-bold text-28rpx leading-40rpx">续订信息</view>
|
||||
<view class="mt-16rpx">
|
||||
<view class="info-item">
|
||||
<text class="info-label">续定茶叶</text>
|
||||
<text class="info-value">{{ orderData.teawareUsage }}</text>
|
||||
<text class="info-label">续单时长</text>
|
||||
<text class="info-value">{{ order.renew_hours || 0 }}/小时</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">续单金额</text>
|
||||
<text class="info-value">{{ order.renew_price || 0 }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">续单茶叶金额</text>
|
||||
<text class="info-value">{{ order.renew_tea_price || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- TODO 订单备注有内容在显示 -->
|
||||
<view class="bg-[#FFFDF7] px-30rpx py-20rpx rounded-16rpx mt-20rpx" @click="showOrderMarksPopup = true">
|
||||
<view class="bg-[#FFFDF7] px-30rpx py-20rpx rounded-16rpx mt-20rpx" @click="showOrderMarksPopup = true" v-if="order.remark">
|
||||
<view class="info-card-title">
|
||||
<wd-img :src="`${OSS}icon/icon_tips2.png`" width="40rpx" height="40rpx"></wd-img>
|
||||
<view class="ml-12rpx">订单备注</view>
|
||||
</view>
|
||||
<view class="flex items-start">
|
||||
<text class="text-28rpx leading-40rpx text-[#606266]">备注信息</text>
|
||||
<text class="text-28rpx text-[#303133] ml-50rpx line-2 w-450rpx">12311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122123112312312312312212311231231231231221231123123123123122</text>
|
||||
<text class="text-28rpx text-[#303133] ml-50rpx line-2 w-450rpx">{{ order.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拍照打卡 -->
|
||||
<view class="bg-white rounded-16rpx px-30rpx py-20rpx mt-20rpx" v-if="orderStatus !== TeaSpecialistManageOrderStatus.Cancelled">
|
||||
<!-- TODO 到达目的地之后不再显示 -->
|
||||
<view class="bg-white rounded-16rpx px-30rpx py-20rpx mt-20rpx"
|
||||
v-if="orderStatus === TeaSpecialistOrderStatus.Arrived || orderStatus === TeaSpecialistOrderStatus.Completed">
|
||||
<!-- TODO 暂时不做 -->
|
||||
<!-- <view class="font-500 text-[#909399] text-24rpx">距离 5 km,预计 <text class="text-[#303133]">20分钟</text> ,请妥善安排好出行时间</view> -->
|
||||
<view class="" >
|
||||
<view class="" v-if="order.is_image > 0">
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133]">拍照记录</view>
|
||||
<view class="flex items-center mt-22rpx">
|
||||
<view class="flex items-center">
|
||||
@ -307,12 +330,13 @@
|
||||
</view>
|
||||
<view class="mt-12rpx flex items-center">
|
||||
<wd-img :src="`${OSS}icon/icon_time2.png`" width="24rpx" height="24rpx"></wd-img>
|
||||
<view class="font-400 text-24rpx text-[#8A94A3] leading-34rpx ml-8rpx">2025/09/18 09:00:23</view>
|
||||
<view class="font-400 text-24rpx text-[#8A94A3] leading-34rpx ml-8rpx">{{ order.image_time }}</view>
|
||||
</view>
|
||||
<view class="mt-12rpx flex items-center">
|
||||
<!-- TODO 打卡地址-暂时不做 -->
|
||||
<!-- <view class="mt-12rpx flex items-center">
|
||||
<wd-img :src="`${OSS}icon/icon_location4.png`" width="24rpx" height="24rpx"></wd-img>
|
||||
<view class="font-400 text-24rpx text-[#8A94A3] leading-34rpx ml-8rpx line-1 w-510rpx">上海浦东新区新金桥路58号新银东大厦15楼F室</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -323,23 +347,28 @@
|
||||
</view>
|
||||
<view class="info-item flex items-center">
|
||||
<view class="info-label">服务方式</view>
|
||||
<view class="info-value">{{ orderData.serviceType }}</view>
|
||||
<view class="info-value">{{ order.server_type == 1 ? '到店服务' : '上门服务' }}</view>
|
||||
</view>
|
||||
<view class="info-item flex items-center">
|
||||
<view class="info-label mt-12rpx">服务地址</view>
|
||||
<view class="address-wrapper flex items-center">
|
||||
<view class="info-value w-200rpx line-1">{{ orderData.address }}</view>
|
||||
<wd-img :src="`${OSS}icon/icon_nav.png`" width="64rpx" height="64rpx" @click.stop="handleNavigate"></wd-img>
|
||||
<view class="info-value w-200rpx line-1">{{ order.address }}</view>
|
||||
<wd-img :src="`${OSS}icon/icon_nav.png`" width="64rpx" height="64rpx" @click.stop="Detail.handleNavigate"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单记录 -->
|
||||
<view class="bg-white rounded-16rpx px-30rpx py-20rpx mt-20rpx flex items-center justify-between" @click="showOrderRecordsPopup = true">
|
||||
<view class="text-32rpx leading-44rpx text-[#303133]">订单记录</view>
|
||||
<view class="">
|
||||
<wd-icon name="arrow-right" size="32rpx" color="#666666"></wd-icon>
|
||||
</view>
|
||||
<!-- 订单记录 -->
|
||||
<!-- TODO 订单取消状态下不显示 -->
|
||||
<view
|
||||
class="bg-white rounded-16rpx px-30rpx py-20rpx mt-20rpx flex items-center justify-between"
|
||||
@click="showOrderRecordsPopup = true"
|
||||
v-if="orderStatus !== TeaSpecialistOrderStatus.Pending"
|
||||
>
|
||||
<view class="text-32rpx leading-44rpx text-[#303133]">订单记录</view>
|
||||
<view class="">
|
||||
<wd-icon name="arrow-right" size="32rpx" color="#666666"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
@ -350,21 +379,21 @@
|
||||
<view class="info-item flex justify-between items-center">
|
||||
<text class="info-label">订单编号</text>
|
||||
<view class="order-sn-wrapper">
|
||||
<text class="info-value">{{ orderData.orderSn }}</text>
|
||||
<text class="copy-text" @click.stop="handleCopyOrderSn">|复制</text>
|
||||
<text class="info-value">{{ order.order_sn }}</text>
|
||||
<text class="copy-text" @click.stop="copy(order.order_sn)">|复制</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item flex items-center justify-between">
|
||||
<view class="info-item flex items-center justify-between" v-if="order.pay_title">
|
||||
<view class="info-label">交易方式</view>
|
||||
<view class="info-value text-right">{{ orderData.paymentMethod }}</view>
|
||||
<view class="info-value text-right">{{ order.pay_title }}</view>
|
||||
</view>
|
||||
<view class="info-item flex items-center justify-between">
|
||||
<view class="info-label">创建时间</view>
|
||||
<view class="info-value text-right">{{ orderData.createTime }}</view>
|
||||
<view class="info-value text-right">{{ order.dtime }}</view>
|
||||
</view>
|
||||
<view class="info-item flex items-center justify-between">
|
||||
<view class="info-item flex items-center justify-between" v-if="order.pay_time">
|
||||
<view class="info-label">付款时间</view>
|
||||
<view class="info-value text-right">{{ orderData.payTime }}</view>
|
||||
<view class="info-value text-right">{{ order.pay_time }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -374,28 +403,35 @@
|
||||
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx flex justify-between items-center px-58rpx">
|
||||
<!-- 待接单 -->
|
||||
<template v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingOrder">
|
||||
<template v-if="orderStatus === TeaSpecialistOrderStatus.Pending">
|
||||
<view class="w-112rpx h-90rpx text-[#606266] text-28rpx leading-90rpx" @click="Detail.handleAbandonOrder">放弃接单</view>
|
||||
<view class="w-360rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff] text-center leading-90rpx">立即接单</view>
|
||||
</template>
|
||||
|
||||
<!-- 待服务 -->
|
||||
<template v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingService">
|
||||
<template v-if="orderStatus === TeaSpecialistOrderStatus.Accepted">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff] text-center leading-90rpx" @click="Detail.handleToGo">立即出发</view>
|
||||
</template>
|
||||
|
||||
<!-- TODO 这里还有个状态就是点击立即出发之后的状态 -->
|
||||
<!-- <template v-if="orderStatus === TeaSpecialistManageOrderStatus.PendingService">
|
||||
<!-- 已出发 -->
|
||||
<template v-if="orderStatus === TeaSpecialistOrderStatus.Departed">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff] text-center leading-90rpx" @click="Detail.handleToTakePhone">已到达</view>
|
||||
</template> -->
|
||||
</template>
|
||||
|
||||
<!-- 服务中 -->
|
||||
<template v-if="orderStatus === TeaSpecialistManageOrderStatus.Service">
|
||||
<template v-if="orderStatus === TeaSpecialistOrderStatus.Arrived">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff] text-center leading-90rpx" @click="Detail.handleFinished">完成服务</view>
|
||||
</template>
|
||||
|
||||
<!-- 服务完成 -->
|
||||
<template v-if="orderStatus === TeaSpecialistManageOrderStatus.Finished || orderStatus === TeaSpecialistManageOrderStatus.Cancelled">
|
||||
<template
|
||||
v-if="
|
||||
orderStatus === TeaSpecialistOrderStatus.Completed ||
|
||||
orderStatus === TeaSpecialistOrderStatus.Cancelled ||
|
||||
orderStatus === TeaSpecialistOrderStatus.SpecialistRefund ||
|
||||
orderStatus === TeaSpecialistOrderStatus.CustomerRefundBeforeAccept ||
|
||||
orderStatus === TeaSpecialistOrderStatus.CustomerRefundAfterDepart ||
|
||||
orderStatus === TeaSpecialistOrderStatus.CustomerRefundAfterArrive">
|
||||
<view class="w-630rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] text-center leading-90rpx" @click="Detail.handleDelteOrder">删除订单</view>
|
||||
</template>
|
||||
</view>
|
||||
@ -404,321 +440,315 @@
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import PriceFormat from '@/components/PriceFormat.vue'
|
||||
import { copy } from '@/utils/tools'
|
||||
import { TeaSpecialistManageStatusTextValue, TeaSpecialistManageOrderStatus } from '@/utils/order'
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import PriceFormat from '@/components/PriceFormat.vue'
|
||||
import { copy } from '@/utils/tools'
|
||||
import { TeaSpecialistOrderStatus, TeaSpecialistManageStatusTextValue } from '@/utils/teaSpecialistOrder'
|
||||
import { getTeaSpecialistOrderDetails } from '@/api/tes-specialist'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const OSS = inject('OSS')
|
||||
|
||||
// navbar 标题
|
||||
const title = ref<string>('')
|
||||
// navbar 标题
|
||||
const title = ref<string>('')
|
||||
|
||||
// 订单ID
|
||||
const orderId = ref<string>('')
|
||||
// 订单ID
|
||||
const orderId = ref<number>(0)
|
||||
|
||||
// 订单状态:待服务 服务中等
|
||||
const orderStatus = ref<number>(0) // 订单状态:待服务 服务中等
|
||||
// 订单记录步骤条
|
||||
const stepsActive = ref<number>(0)
|
||||
|
||||
// 订单备注
|
||||
const showOrderMarksPopup = ref<boolean>(false)
|
||||
const mark = ref<string>('')
|
||||
// 订单状态:待服务 服务中等
|
||||
const orderStatus = ref<number>(0) // 订单状态:待服务 服务中等
|
||||
|
||||
// 订单记录
|
||||
const showOrderRecordsPopup = ref<boolean>(false)
|
||||
// 订单备注
|
||||
const showOrderMarksPopup = ref<boolean>(false)
|
||||
const mark = ref<string>('')
|
||||
|
||||
// 消息提示框
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
// 订单记录
|
||||
const showOrderRecordsPopup = ref<boolean>(false)
|
||||
|
||||
// 费用明细弹窗
|
||||
const showCostDetailPopup = ref(false)
|
||||
// 消息提示框
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
// 费用明细数据
|
||||
const costDetail = ref({
|
||||
orderTotal: 828.90,
|
||||
serviceFee: 640.00,
|
||||
serviceFeePerHour: 160,
|
||||
serviceHours: 4,
|
||||
travelFee: 30.90,
|
||||
travelFeePerKm: 3.00,
|
||||
distance: 10.3,
|
||||
teaServiceFee: 178.00,
|
||||
teaName: '红茶/绿茶/福鼎白茶/铁观音',
|
||||
teaPrice: 158,
|
||||
teawarePrice: 20,
|
||||
discount: 20.00,
|
||||
couponDiscount: 20,
|
||||
deductFee: 130.00,
|
||||
platformFee: 130.00,
|
||||
actualIncome: 698.90,
|
||||
})
|
||||
// 费用明细弹窗
|
||||
const showCostDetailPopup = ref(false)
|
||||
|
||||
// 订单数据
|
||||
const orderData = ref({
|
||||
id: 1,
|
||||
serviceName: '苓苑共享茶室空间',
|
||||
serviceType: '到店服务',
|
||||
price: 212.20,
|
||||
appointmentTimeFull: '2025-03-18 09:00-12:00',
|
||||
duration: '3小时',
|
||||
servicePeople: 1,
|
||||
teaName: '福鼎白茶 (3泡)',
|
||||
teawareUsage: '客户自备',
|
||||
notes: '', // 如果为空则不显示备注卡片
|
||||
address: '青浦区仓桥路478号',
|
||||
orderSn: '7327328627526903',
|
||||
paymentMethod: '微信支付',
|
||||
createTime: '2019-05-16 12:20:26',
|
||||
payTime: '2019-05-16 13:20:26',
|
||||
// 倒计时相关(秒)
|
||||
countdownSeconds: 9 * 3600 + 30 * 60 + 48, // 09:30:48
|
||||
})
|
||||
// 费用明细数据
|
||||
const costDetail = ref({
|
||||
orderTotal: 828.90,
|
||||
serviceFee: 640.00,
|
||||
serviceFeePerHour: 160,
|
||||
serviceHours: 4,
|
||||
travelFee: 30.90,
|
||||
travelFeePerKm: 3.00,
|
||||
distance: 10.3,
|
||||
teaServiceFee: 178.00,
|
||||
teaName: '红茶/绿茶/福鼎白茶/铁观音',
|
||||
teaPrice: 158,
|
||||
teawarePrice: 20,
|
||||
discount: 20.00,
|
||||
couponDiscount: 20,
|
||||
deductFee: 130.00,
|
||||
platformFee: 130.00,
|
||||
actualIncome: 698.90,
|
||||
})
|
||||
|
||||
// 倒计时
|
||||
const countdownTime = ref('09:30:48')
|
||||
let countdownTimer: any = null
|
||||
// 订单数据
|
||||
const order = ref({
|
||||
id: 0,
|
||||
order_status: 0, // 订单状态
|
||||
address: '', // 服务地址
|
||||
title: '', // 订单标题
|
||||
longitude: 0, // 地址经纬度
|
||||
latitude: 0, // 地址经纬度
|
||||
team_income_price: 0, // 茶艺师实际到手金额
|
||||
day_time: '', //预约日期
|
||||
start_time: '', //服务开始时间
|
||||
end_time: '', //服务结束时间
|
||||
hours: 0, //时长
|
||||
server_number: 0, // 服务人数
|
||||
is_renewal: 0, // 是否是续单
|
||||
leaf_name: '', // 预定茶叶
|
||||
is_teacup: 0, // 茶具使用:0自带 1茶艺师提供
|
||||
renew_hours: 0, // 续单时长
|
||||
renew_price: 0, // 续单金额
|
||||
renew_tea_price: 0, // 续单茶叶金额
|
||||
remark: '', // 订单备注
|
||||
server_type: 1, //服务方式 1到店 2上门
|
||||
order_sn: 0, // 订单编号
|
||||
dtime: '', // 创建时间
|
||||
pay_time: '', // 付款时间
|
||||
timekeeping: 0, // 倒计时
|
||||
travel_time: '', // 出发时间
|
||||
arrival_time: '', // 到达时间
|
||||
take_order_time: '', // 接单时间
|
||||
pay_title: '', // 交易方式
|
||||
is_image: 0, //是否打卡 0未打卡 1已打卡
|
||||
image: '', // 到达打卡拍照
|
||||
image_time: '', // 到达打卡时间
|
||||
})
|
||||
|
||||
// 格式化倒计时
|
||||
function formatCountdown(seconds: number) {
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
const minutes = Math.floor((seconds % 3600) / 60)
|
||||
const secs = seconds % 60
|
||||
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`
|
||||
}
|
||||
// 倒计时
|
||||
const countdownTime = ref('09:30:48')
|
||||
let countdownTimer: any = null
|
||||
|
||||
// 开始倒计时
|
||||
function startCountdown() {
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer)
|
||||
// 格式化倒计时
|
||||
function formatCountdown(seconds: number) {
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
const minutes = Math.floor((seconds % 3600) / 60)
|
||||
const secs = seconds % 60
|
||||
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
// 价格点击(查看详情)
|
||||
function handlePriceClick() {
|
||||
showCostDetailPopup.value = true
|
||||
}
|
||||
|
||||
countdownTimer = setInterval(() => {
|
||||
if (orderData.value.countdownSeconds > 0) {
|
||||
orderData.value.countdownSeconds--
|
||||
countdownTime.value = formatCountdown(orderData.value.countdownSeconds)
|
||||
}
|
||||
else {
|
||||
// 放弃接单
|
||||
function handleDecline() {
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
// TODO: 调用放弃接单的 API
|
||||
console.log('确认放弃接单')
|
||||
uni.showToast({
|
||||
title: '放弃接单成功',
|
||||
icon: 'success',
|
||||
})
|
||||
// 可以返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
}).catch(() => {
|
||||
console.log('取消放弃接单')
|
||||
})
|
||||
}
|
||||
|
||||
// 立即接单
|
||||
function handleAccept() {
|
||||
// TODO: 调用接单的 API
|
||||
console.log('立即接单')
|
||||
uni.showToast({
|
||||
title: '接单成功',
|
||||
icon: 'success',
|
||||
})
|
||||
// 可以返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
onLoad((args) => {
|
||||
orderId.value = args.orderId
|
||||
Detail.handleInit()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
// 清理倒计时
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer)
|
||||
// 倒计时结束,可以触发自动取消逻辑
|
||||
console.log('订单自动取消')
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 复制订单编号
|
||||
function handleCopyOrderSn() {
|
||||
copy(orderData.value.orderSn)
|
||||
uni.showToast({
|
||||
title: '已复制',
|
||||
icon: 'success',
|
||||
})
|
||||
}
|
||||
|
||||
// 导航
|
||||
function handleNavigate() {
|
||||
// TODO: 实现导航功能
|
||||
console.log('导航到:', orderData.value.address)
|
||||
uni.showToast({
|
||||
title: '导航功能待实现',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
const Detail = {
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res = await getTeaSpecialistOrderDetails(orderId.value)
|
||||
order.value = res
|
||||
orderStatus.value = res.order_status
|
||||
title.value = TeaSpecialistManageStatusTextValue[order.value.order_status].pageTitle || '订单详情'
|
||||
|
||||
// 价格点击(查看详情)
|
||||
function handlePriceClick() {
|
||||
showCostDetailPopup.value = true
|
||||
}
|
||||
|
||||
// 放弃接单
|
||||
function handleDecline() {
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
if (res.order_status === TeaSpecialistOrderStatus.Accepted) {
|
||||
stepsActive.value = 1
|
||||
} else if (res.order_status === TeaSpecialistOrderStatus.Departed) {
|
||||
stepsActive.value = 2
|
||||
} else if (res.order_status === TeaSpecialistOrderStatus.Arrived) {
|
||||
stepsActive.value = 3
|
||||
} else if (res.order_status === TeaSpecialistOrderStatus.Completed) {
|
||||
stepsActive.value = 4
|
||||
} else {
|
||||
stepsActive.value = 0
|
||||
}
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
// TODO: 调用放弃接单的 API
|
||||
console.log('确认放弃接单')
|
||||
uni.showToast({
|
||||
title: '放弃接单成功',
|
||||
icon: 'success',
|
||||
|
||||
/**
|
||||
* 放弃接单
|
||||
*/
|
||||
handleAbandonOrder: () => {
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 立即出发
|
||||
*/
|
||||
handleToGo: () => {
|
||||
message.confirm({
|
||||
title: '开启定位服务',
|
||||
msg: '需要开启手机定位功能,以记录本次服务的出发状态',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 已到达
|
||||
*/
|
||||
handleToTakePhone: () => {
|
||||
message.confirm({
|
||||
title: '确定到达',
|
||||
msg: '确认到达后需拍照记录,否则无法开始服务计时',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度及拍照
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 完成服务
|
||||
*/
|
||||
handleFinished: () => {
|
||||
message.alert({
|
||||
title: '服务未结束',
|
||||
msg: '当前服务时长还未结束,暂无法完成服务',
|
||||
confirmButtonText: '确定',
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
handleDelteOrder: () => {
|
||||
message.confirm({
|
||||
title: '确定删除订单?',
|
||||
msg: '删除订单后无法恢复,是否确认删除订单?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度及拍照
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 导航到目的地
|
||||
*/
|
||||
handleNavigate: () => {
|
||||
uni.openLocation({
|
||||
latitude: order.value.latitude,
|
||||
longitude: order.value.longitude,
|
||||
name: order.value.title,
|
||||
address: order.value.address,
|
||||
})
|
||||
// 可以返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
}).catch(() => {
|
||||
console.log('取消放弃接单')
|
||||
})
|
||||
}
|
||||
|
||||
// 立即接单
|
||||
function handleAccept() {
|
||||
// TODO: 调用接单的 API
|
||||
console.log('立即接单')
|
||||
uni.showToast({
|
||||
title: '接单成功',
|
||||
icon: 'success',
|
||||
})
|
||||
// 可以返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
onLoad((args) => {
|
||||
orderId.value = args.orderId
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
// 清理倒计时
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer)
|
||||
}
|
||||
})
|
||||
|
||||
const Detail = {
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
handleInit: async () => {
|
||||
// // 这里单独处理下经纬度,因为分享的时候没有经纬度
|
||||
// const res = await getTeaRoomOrderDetail({
|
||||
// id: orderId.value,
|
||||
// latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
|
||||
// longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
|
||||
// })
|
||||
// order.value = res.details
|
||||
// console.log("🚀 ~ order.value :", order.value )
|
||||
// title.value = TeaSpecialistManageStatusTextValue[order.value.order_status].title || '订单详情'
|
||||
// orderStatus.value = order.value.order_status
|
||||
|
||||
|
||||
// // 预定时间
|
||||
// const next7 = await getNext7Days(order.value.room_msg.id, currentDate)
|
||||
// Object.assign(sevenDay, next7)
|
||||
},
|
||||
|
||||
/**
|
||||
* 放弃接单
|
||||
*/
|
||||
handleAbandonOrder: () => {
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 立即出发
|
||||
*/
|
||||
handleToGo: () => {
|
||||
message.confirm({
|
||||
title: '开启定位服务',
|
||||
msg: '需要开启手机定位功能,以记录本次服务的出发状态',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 已到达
|
||||
*/
|
||||
handleToTakePhone: () => {
|
||||
message.confirm({
|
||||
title: '确定到达',
|
||||
msg: '确认到达后需拍照记录,否则无法开始服务计时',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度及拍照
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 完成服务
|
||||
*/
|
||||
handleFinished: () => {
|
||||
message.alert({
|
||||
title: '服务未结束',
|
||||
msg: '当前服务时长还未结束,暂无法完成服务',
|
||||
confirmButtonText: '确定',
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
handleDelteOrder: () => {
|
||||
message.confirm({
|
||||
title: '确定删除订单?',
|
||||
msg: '删除订单后无法恢复,是否确认删除订单?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// TODO 这里需要获取经纬度及拍照
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@ -14,55 +14,23 @@
|
||||
<!-- 消息提示框 -->
|
||||
<wd-message-box selector="wd-message-box-slot" />
|
||||
|
||||
<!-- 地图选择弹窗 -->
|
||||
<wd-popup v-model="showMapSelectPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;"
|
||||
position="bottom" :z-index="200" :close-on-click-overlay="true">
|
||||
<view class="map-select-popup">
|
||||
<!-- 拖拽指示条 -->
|
||||
<view class="popup-handle" />
|
||||
|
||||
<!-- 地图选项列表 -->
|
||||
<view class="map-options">
|
||||
<view class="map-option-item" @click="handleSelectMap('gaode')">
|
||||
<text class="map-option-text">高德地图</text>
|
||||
</view>
|
||||
<view class="map-divider" />
|
||||
<view class="map-option-item" @click="handleSelectMap('tencent')">
|
||||
<text class="map-option-text">腾讯地图</text>
|
||||
</view>
|
||||
<view class="map-divider" />
|
||||
<view class="map-option-item" @click="handleSelectMap('apple')">
|
||||
<text class="map-option-text">苹果地图</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 取消按钮 -->
|
||||
<view class="map-cancel-wrapper">
|
||||
<view class="map-cancel-divider" />
|
||||
<view class="map-option-item map-cancel-item" @click="showMapSelectPopup = false">
|
||||
<text class="map-option-text map-cancel-text">取消</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 顶部搜索和标签栏 -->
|
||||
<view class="order-header bg-[#F6F7F8]">
|
||||
<wd-navbar safe-area-inset-top custom-class="!bg-[#F6F7F8]" :bordered="false" placeholder>
|
||||
<template #left>
|
||||
<view class="search-box" @click="handleToSearch">
|
||||
<wd-search placeholder="搜索订单信息" hide-cancel disabled :placeholder-left="true"
|
||||
custom-class="search-input" />
|
||||
<view class="search-box">
|
||||
<wd-search placeholder="搜索订单信息" hide-cancel :placeholder-left="true"
|
||||
custom-class="search-input" v-model="keywords" @search="Order.handleSearch"/>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view class="tabs">
|
||||
<wd-tabs v-model="activeTab" slidable="always" swipeable @change="handleTabChange">
|
||||
<wd-tabs v-model="activeTab" slidable="always" swipeable @change="Order.handleTabChange">
|
||||
<wd-tab title="全部" :name="TeaSpecialistManageOrderStatusText.All" />
|
||||
<wd-tab title="待接单" :name="TeaSpecialistManageOrderStatusText.PendingOrder" />
|
||||
<wd-tab title="待服务" :name="TeaSpecialistManageOrderStatusText.PendingService" />
|
||||
<wd-tab title="服务中" :name="TeaSpecialistManageOrderStatusText.Service" />
|
||||
<wd-tab title="已完成" :name="TeaSpecialistManageOrderStatusText.Finished" />
|
||||
<wd-tab title="已完成" :name="TeaSpecialistManageOrderStatusText.Completed" />
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
@ -70,9 +38,9 @@
|
||||
<!-- 订单列表 -->
|
||||
<!-- <scroll-view class="order-list" scroll-y> -->
|
||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="Order.upCallback" :down="downOption" :up="upOption">
|
||||
<view v-for="(order, index) in filteredOrders" :key="order.id || index" class="order-item mx-30rpx">
|
||||
<view v-for="order in list" :key="order.id" class="order-item mx-30rpx">
|
||||
<!-- 订单内容区域(可点击跳转) -->
|
||||
<view class="order-content" @click="handleOrderClick(order)">
|
||||
<view class="order-content" @click="router.navigateTo(`/pages/order/detail?orderId=${order.id}`)">
|
||||
<!-- 订单头部 -->
|
||||
<view class="order-header-row">
|
||||
<view class="order-title-row">
|
||||
@ -81,35 +49,35 @@
|
||||
<text class="order-title">订单</text>
|
||||
</view>
|
||||
<view class="order-status-row flex items-center">
|
||||
<view class="order-status" :class="getStatusClass(order.status)">
|
||||
{{ order.statusText }}
|
||||
<view class="order-status" :class="Order.handleGetStatusClass(order.order_status)">
|
||||
{{ TeaSpecialistManageStatusTextValue[order.order_status].title }}
|
||||
</view>
|
||||
<view class="mt-4rpx">
|
||||
<wd-count-down :time="30 * 60 * 1000" custom-class="!text-[#FF5951]" />
|
||||
<view class="mt-4rpx" v-if="order.timekeeping > 0">
|
||||
<wd-count-down :time="Number(order.timekeeping) * 1000" custom-class="!text-[#FF5951]" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 服务信息 -->
|
||||
<view class="order-service-info flex items-center justify-between">
|
||||
<text class="service-name">{{ order.serviceName }}</text>
|
||||
<text class="service-name">{{ order.title }}</text>
|
||||
<view class="order-price">
|
||||
<price-format color="#303133" :first-size="32" :second-size="32" :subscript-size="24"
|
||||
:price="order.price" />
|
||||
:price="order.team_income_price" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view class="mb-24rpx">
|
||||
<text class="service-type" :class="getServiceTypeClass(order.serviceType)">
|
||||
{{ order.serviceType }}
|
||||
<text class="service-type" :class="getServiceTypeClass(order.server_type)">
|
||||
{{ order.server_type == 1 ? '到店服务' : '上门服务' }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 预约时间 -->
|
||||
<view class="order-info-row">
|
||||
<text class="info-label">预约时间:</text>
|
||||
<text class="info-value">{{ order.appointmentTime }}</text>
|
||||
<text class="info-value">{{ order.day_time }} {{ order.start_time }}-{{ order.end_time }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 地址 -->
|
||||
@ -121,9 +89,9 @@
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="order-actions" @click.stop>
|
||||
<wd-button v-for="(action, actionIndex) in getOrderActions(order.status)" :key="actionIndex"
|
||||
<wd-button v-for="(action, actionIndex) in Order.handleGetOrderActions(order.order_status)" :key="actionIndex"
|
||||
:type="action.type" :plain="action.plain" :custom-class="action.customClass" size="small"
|
||||
@click="handleAction(order, action.action)">
|
||||
@click="Order.handleAction(order, action.action)">
|
||||
{{ action.text }}
|
||||
</wd-button>
|
||||
</view>
|
||||
@ -133,14 +101,18 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { useMessage, useToast } from 'wot-design-uni'
|
||||
import PriceFormat from '@/components/PriceFormat.vue'
|
||||
import { router } from '@/utils/tools'
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { TeaSpecialistManageOrderStatusText } from '@/utils/order'
|
||||
import { TeaSpecialistManageOrderStatusText, TeaSpecialistOrderStatus, TeaSpecialistManageStatusTextValue } from '@/utils/teaSpecialistOrder'
|
||||
import { getTeaSpecialistOrderList } from '@/api/tes-specialist'
|
||||
import { handleGetLocationFallback } from '@/hooks/useLocation'
|
||||
import { handleReleaseOrderHooks } from '@/hooks/useOrder'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const toast = useToast()
|
||||
|
||||
// mescroll
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||
@ -158,11 +130,6 @@
|
||||
// 消息提示框
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
// 地图选择弹窗
|
||||
const showMapSelectPopup = ref(false)
|
||||
// 当前要导航的订单
|
||||
const currentNavigateOrder = ref<any>(null)
|
||||
|
||||
// 当前选中的标签
|
||||
const activeTab = ref('all')
|
||||
|
||||
@ -244,141 +211,9 @@
|
||||
},
|
||||
])
|
||||
|
||||
// 根据标签过滤订单
|
||||
const filteredOrders = computed(() => {
|
||||
if (activeTab.value === 'all') {
|
||||
return orders.value
|
||||
}
|
||||
// 处理待服务状态,包含 waiting 和 waiting_arrived
|
||||
if (activeTab.value === 'waiting') {
|
||||
return orders.value.filter(order => order.status === 'waiting' || order.status === 'waiting_arrived')
|
||||
}
|
||||
return orders.value.filter(order => order.status === activeTab.value)
|
||||
})
|
||||
|
||||
// 获取状态样式类
|
||||
function getStatusClass(status: string) {
|
||||
const statusMap: Record<string, string> = {
|
||||
pending: 'status-pending',
|
||||
waiting: 'status-waiting',
|
||||
serving: 'status-serving',
|
||||
completed: 'status-completed',
|
||||
cancelled: 'status-cancelled',
|
||||
}
|
||||
return statusMap[status] || ''
|
||||
}
|
||||
|
||||
// 获取服务类型样式类
|
||||
function getServiceTypeClass(serviceType: string) {
|
||||
return serviceType === '到店服务' ? 'service-type-store' : 'service-type-home'
|
||||
}
|
||||
|
||||
// 获取订单操作按钮
|
||||
function getOrderActions(status: string) {
|
||||
const actionMap: Record<string, Array<any>> = {
|
||||
pending: [
|
||||
{ text: '放弃接单', type: 'default', plain: true, customClass: '!border-[#9CA3AF] !text-[#303133] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'decline' },
|
||||
{ text: '立即接单', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'accept' },
|
||||
],
|
||||
waiting: [
|
||||
{ text: '导航', type: 'default', plain: true, customClass: '!border-[#9CA3AF] !text-[#303133] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'navigate' },
|
||||
{ text: '立即出发', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'depart' },
|
||||
],
|
||||
waiting_arrived: [
|
||||
{ text: '导航', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'navigate' },
|
||||
{ text: '已到达', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'arrived' },
|
||||
],
|
||||
serving: [
|
||||
{ text: '完成服务', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'complete' },
|
||||
],
|
||||
completed: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
cancelled: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
}
|
||||
return actionMap[status] || []
|
||||
}
|
||||
|
||||
// 处理操作
|
||||
function handleAction(order: any, action: string) {
|
||||
console.log('操作:', action, order)
|
||||
// 这里可以添加具体的操作逻辑
|
||||
switch (action) {
|
||||
case 'accept':
|
||||
// 接单逻辑
|
||||
break
|
||||
case 'decline':
|
||||
// 放弃接单逻辑
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
// 确认放弃接单的逻辑
|
||||
console.log('确认放弃接单', order)
|
||||
// TODO: 调用放弃接单的 API
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮
|
||||
console.log('取消放弃接单')
|
||||
})
|
||||
break
|
||||
case 'navigate':
|
||||
// 导航逻辑 - 显示地图选择弹窗
|
||||
currentNavigateOrder.value = order
|
||||
showMapSelectPopup.value = true
|
||||
break
|
||||
case 'depart':
|
||||
console.log('出发逻辑', order)
|
||||
// 出发逻辑 - 跳转到详情页,状态改为 waiting_arrived(已出发,等待到达)
|
||||
router.navigateTo(`/pages/order/waiting-service-detail?id=${order.id}&status=waiting_arrived`)
|
||||
break
|
||||
case 'arrived':
|
||||
// 已到达逻辑 - 直接跳转到服务中详情页
|
||||
router.navigateTo(`/pages/order/serving-detail?id=${order.id}`)
|
||||
break
|
||||
case 'complete':
|
||||
// 完成服务逻辑
|
||||
break
|
||||
case 'delete':
|
||||
// 删除订单逻辑
|
||||
message.confirm({
|
||||
title: '确定删除订单?',
|
||||
msg: '删除订单后无法恢复,是否确认删除订单?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
// 确认删除订单的逻辑
|
||||
console.log('确认删除订单', order)
|
||||
// TODO: 调用删除订单的 API
|
||||
uni.showToast({
|
||||
title: '删除订单成功',
|
||||
icon: 'success',
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮
|
||||
console.log('取消删除订单')
|
||||
})
|
||||
break
|
||||
}
|
||||
function getServiceTypeClass(type: number) {
|
||||
return type === 1 ? 'service-type-store' : 'service-type-home'
|
||||
}
|
||||
|
||||
// 切换标签
|
||||
@ -386,157 +221,234 @@
|
||||
activeTab.value = e.name
|
||||
}
|
||||
|
||||
// 跳转搜索
|
||||
function handleToSearch() {
|
||||
router.navigateTo('/pages/search/search')
|
||||
}
|
||||
|
||||
// 点击订单跳转到详情页
|
||||
function handleOrderClick(order: any) {
|
||||
router.navigateTo(`/pages/order/detail?orderId=${order.id}`)
|
||||
// if (order.status === 'pending') {
|
||||
// router.navigateTo(`/pages/order/pending-order-detail?id=${order.id}`)
|
||||
// }
|
||||
// else if (order.status === 'waiting' || order.status === 'waiting_arrived') {
|
||||
// router.navigateTo(`/pages/order/waiting-service-detail?id=${order.id}`)
|
||||
// }
|
||||
// else if (order.status === 'cancelled') {
|
||||
// router.navigateTo(`/pages/order/cancelled-order-detail?id=${order.id}`)
|
||||
// }
|
||||
}
|
||||
|
||||
// 选择地图应用
|
||||
function handleSelectMap(mapType: string) {
|
||||
if (!currentNavigateOrder.value) {
|
||||
return
|
||||
}
|
||||
|
||||
const order = currentNavigateOrder.value
|
||||
const address = order.address || ''
|
||||
// 默认使用上海的坐标(如果订单没有经纬度)
|
||||
const latitude = order.latitude || 31.2304
|
||||
const longitude = order.longitude || 121.4737
|
||||
|
||||
// 关闭弹窗
|
||||
showMapSelectPopup.value = false
|
||||
|
||||
// 根据不同地图类型打开相应的应用
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序使用 uni.openLocation(会打开系统默认地图选择器)
|
||||
uni.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: order.serviceName || '',
|
||||
address,
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
// H5 和 App 使用 URL scheme
|
||||
let mapUrl = ''
|
||||
const encodedAddress = encodeURIComponent(address)
|
||||
|
||||
switch (mapType) {
|
||||
case 'gaode':
|
||||
// 高德地图
|
||||
// #ifdef APP-PLUS
|
||||
// App 使用 scheme
|
||||
if (uni.getSystemInfoSync().platform === 'ios') {
|
||||
mapUrl = `iosamap://path?sourceApplication=applicationName&dname=${encodedAddress}&dlat=${latitude}&dlon=${longitude}&dev=0&t=0`
|
||||
}
|
||||
else {
|
||||
mapUrl = `androidamap://route?sourceApplication=amap&dname=${encodedAddress}&dlat=${latitude}&dlon=${longitude}&dev=0&t=0`
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
mapUrl = `https://uri.amap.com/navigation?to=${longitude},${latitude}&toName=${encodedAddress}&mode=car&policy=0&src=mypage&coordinate=gaode&callnative=0`
|
||||
// #endif
|
||||
break
|
||||
case 'tencent':
|
||||
// 腾讯地图
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getSystemInfoSync().platform === 'ios') {
|
||||
mapUrl = `qqmap://map/routeplan?type=drive&to=${encodedAddress}&tocoord=${latitude},${longitude}`
|
||||
}
|
||||
else {
|
||||
mapUrl = `qqmap://map/routeplan?type=drive&to=${encodedAddress}&tocoord=${latitude},${longitude}`
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
mapUrl = `https://apis.map.qq.com/uri/v1/routeplan?type=drive&to=${encodedAddress}&tocoord=${latitude},${longitude}&policy=LEAST_TIME&referer=myapp`
|
||||
// #endif
|
||||
break
|
||||
case 'apple':
|
||||
// 苹果地图
|
||||
// #ifdef APP-PLUS
|
||||
mapUrl = `http://maps.apple.com/?daddr=${latitude},${longitude}&dirflg=d`
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
mapUrl = `http://maps.apple.com/?daddr=${latitude},${longitude}&dirflg=d`
|
||||
// #endif
|
||||
break
|
||||
}
|
||||
|
||||
if (mapUrl) {
|
||||
// #ifdef APP-PLUS
|
||||
const plusRuntime = (globalThis as any).plus?.runtime
|
||||
if (plusRuntime) {
|
||||
plusRuntime.openURL(mapUrl, (error: any) => {
|
||||
console.error('打开地图失败:', error)
|
||||
// 如果打开失败,尝试使用系统默认地图
|
||||
uni.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: order.serviceName || '',
|
||||
address,
|
||||
})
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 如果 plus 不可用,使用系统默认地图
|
||||
uni.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: order.serviceName || '',
|
||||
address,
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
window.open(mapUrl, '_blank')
|
||||
// #endif
|
||||
}
|
||||
else {
|
||||
// 如果没有指定地图 URL,使用系统默认地图
|
||||
uni.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: order.serviceName || '',
|
||||
address,
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
const Order = {
|
||||
upCallback: (mescroll) => {
|
||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||
// const filter = {
|
||||
// page: mescroll.num,
|
||||
// size: mescroll.size,
|
||||
// order_status: orderStatus.value,
|
||||
// search: keywords.value
|
||||
// }
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
order_status: orderStatus.value,
|
||||
search: keywords.value
|
||||
}
|
||||
|
||||
// getTeaRoomOrderList(filter).then((res) => {
|
||||
// const curPageData = res.list || [] // 当前页数据
|
||||
// if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
// list.value = list.value.concat(curPageData) //追加新数据
|
||||
// mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
// }).catch(() => {
|
||||
getTeaSpecialistOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
// })
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索订单
|
||||
*/
|
||||
handleSearch: () => {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取状态样式类
|
||||
* @param status 订单状态
|
||||
*/
|
||||
handleGetStatusClass: (status: number) => {
|
||||
const statusMap: Record<number, string> = {
|
||||
[TeaSpecialistOrderStatus.Pending]: 'status-pending',
|
||||
[TeaSpecialistOrderStatus.Accepted]: 'status-serving',
|
||||
[TeaSpecialistOrderStatus.Departed]: 'status-serving',
|
||||
[TeaSpecialistOrderStatus.Arrived]: 'status-serving',
|
||||
[TeaSpecialistOrderStatus.Completed]: 'status-completed',
|
||||
[TeaSpecialistOrderStatus.Cancelled]: 'status-cancelled',
|
||||
[TeaSpecialistOrderStatus.SpecialistRefund]: 'status-cancelled',
|
||||
[TeaSpecialistOrderStatus.CustomerRefundBeforeAccept]: 'status-cancelled',
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterDepart]: 'status-cancelled',
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterArrive]: 'status-cancelled',
|
||||
}
|
||||
return statusMap[status] || ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取订单操作按钮
|
||||
* @param status 订单状态
|
||||
*/
|
||||
handleGetOrderActions(status: number) {
|
||||
const actionMap: Record<number, Array<any>> = {
|
||||
[TeaSpecialistOrderStatus.Pending]: [
|
||||
{ text: '放弃接单', type: 'default', plain: true, customClass: '!border-[#9CA3AF] !text-[#303133] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'decline' },
|
||||
{ text: '立即接单', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'accept' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.Accepted]: [
|
||||
{ text: '导航', type: 'default', plain: true, customClass: '!border-[#9CA3AF] !text-[#303133] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'navigate' },
|
||||
{ text: '立即出发', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'depart' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.Departed]: [
|
||||
{ text: '导航', type: 'default', plain: true, customClass: '!border-[#9CA3AF] !text-[#303133] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'navigate' },
|
||||
{ text: '已到达', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'arrived' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.Arrived]: [
|
||||
{ text: '完成服务', type: 'primary', plain: true, customClass: '!border-[#4c9f44] !text-[#4c9f44] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'complete' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.Completed]: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.SpecialistRefund]: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.CustomerRefundBeforeAccept]: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterDepart]: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterArrive]: [
|
||||
{ text: '删除订单', type: 'default', plain: true, customClass: '!border-[#dcdfe6] !text-[#909399] !bg-transparent !border-2rpx !text-28rpx !w-176rpx !h-60rpx !leading-64rpx !rounded-8rpx', action: 'delete' },
|
||||
],
|
||||
}
|
||||
return actionMap[status] || []
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理操作
|
||||
* @param order 订单对象
|
||||
* @param action 操作类型
|
||||
*/
|
||||
handleAction: async (order: any, action: string) => {
|
||||
// 这里可以添加具体的操作逻辑
|
||||
switch (action) {
|
||||
case 'accept':
|
||||
// 接单逻辑
|
||||
message.confirm({
|
||||
title: '确定接单?',
|
||||
msg: '请务必提前确认服务日程,妥善安排好时间',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then(async (res) => {
|
||||
if (res.action === 'confirm') {
|
||||
toast.loading('加载中...')
|
||||
const res = await handleReleaseOrderHooks(order.id)
|
||||
toast.close()
|
||||
|
||||
if (res) {
|
||||
toast.show('接单成功')
|
||||
Order.handleSearch()
|
||||
}
|
||||
}
|
||||
}).catch(() => {})
|
||||
break
|
||||
case 'decline':
|
||||
// 放弃接单逻辑
|
||||
message.confirm({
|
||||
title: '确定放弃接单?',
|
||||
msg: '放弃接单后无法恢复,确认放弃吗?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
toast.show('已放弃接单')
|
||||
}
|
||||
}).catch(() => {})
|
||||
break
|
||||
case 'navigate':
|
||||
// 导航逻辑 - 显示地图选择弹窗
|
||||
uni.openLocation({
|
||||
latitude: order.latitude,
|
||||
longitude: order.longitude,
|
||||
name: order.title,
|
||||
address: order.address,
|
||||
})
|
||||
break
|
||||
case 'depart':
|
||||
// 出发逻辑 - 获取位置并上传
|
||||
message.confirm({
|
||||
title: '开启定位服务',
|
||||
msg: '需要开启手机定位功能,以记录本次服务的出发状态',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then(async (res) => {
|
||||
if (res.action === 'confirm') {
|
||||
const res = await handleGetLocationFallback()
|
||||
// res = {lat: 30.74501, lng: 120.7555}
|
||||
console.log("🚀 ~ res:", res)
|
||||
}
|
||||
}).catch(() => {})
|
||||
break
|
||||
case 'arrived':
|
||||
// 已到达逻辑 - 直接跳转到服务中详情页
|
||||
break
|
||||
case 'complete':
|
||||
// 完成服务逻辑
|
||||
break
|
||||
case 'delete':
|
||||
// 删除订单逻辑
|
||||
message.confirm({
|
||||
title: '确定删除订单?',
|
||||
msg: '删除订单后无法恢复,是否确认删除订单?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
}).then((res) => {
|
||||
if (res.action === 'confirm') {
|
||||
// 确认删除订单的逻辑
|
||||
console.log('确认删除订单', order)
|
||||
// TODO: 调用删除订单的 API
|
||||
uni.showToast({
|
||||
title: '删除订单成功',
|
||||
icon: 'success',
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮
|
||||
console.log('取消删除订单')
|
||||
})
|
||||
break
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换列表标签
|
||||
*/
|
||||
handleTabChange(e: { index: number, name: string }) {
|
||||
let value = ''
|
||||
if (e.name === TeaSpecialistManageOrderStatusText.All) {
|
||||
value = ''
|
||||
} else if (e.name === TeaSpecialistManageOrderStatusText.PendingOrder) {
|
||||
value = TeaSpecialistOrderStatus.Pending.toString()
|
||||
} else if (e.name === TeaSpecialistManageOrderStatusText.PendingService) {
|
||||
value = `${TeaSpecialistOrderStatus.Accepted},${TeaSpecialistOrderStatus.Departed}`
|
||||
} else if (e.name === TeaSpecialistManageOrderStatusText.Service) {
|
||||
value = TeaSpecialistOrderStatus.Arrived.toString()
|
||||
} else if (e.name === TeaSpecialistManageOrderStatusText.Completed) {
|
||||
value = `${TeaSpecialistOrderStatus.Completed}`
|
||||
}
|
||||
|
||||
orderStatus.value = value
|
||||
Order.handleSearch()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -381,44 +381,3 @@ export const AdminOrderStatusValue: Record<AdminOrderStatusText, string | number
|
||||
[AdminOrderStatusText.Finished]: 3,
|
||||
[AdminOrderStatusText.Cancelled]: 4,
|
||||
}
|
||||
|
||||
|
||||
/* 上面的代码可能用不到了,以后优化的时候需要删除 */
|
||||
|
||||
// 茶艺师-订单管理状态
|
||||
export enum TeaSpecialistManageOrderStatus {
|
||||
PendingOrder = 0, // 待接单
|
||||
PendingService = 1, // 待服务
|
||||
Service = 2, // 服务中
|
||||
Finished = 3, // 已完成(已完结)
|
||||
Cancelled = 4, // 取消订单(已取消)
|
||||
}
|
||||
|
||||
// 茶艺师-订单状态文本
|
||||
export enum TeaSpecialistManageOrderStatusText {
|
||||
All = 'all', // 全部
|
||||
PendingOrder = 'pendingOrder', // 待接单
|
||||
PendingService = 'pendingService', // 待服务
|
||||
Service = 'service',// 服务中
|
||||
Finished = 'finished', // 已完成(已完结)
|
||||
Cancelled = 'cancelled', // 取消订单(已取消)
|
||||
}
|
||||
|
||||
// 茶艺师-状态内容映射
|
||||
export const TeaSpecialistManageStatusTextValue: Record<TeaSpecialistManageOrderStatus, any> = {
|
||||
[TeaSpecialistManageOrderStatus.PendingOrder]: {
|
||||
title: '待接单'
|
||||
},
|
||||
[TeaSpecialistManageOrderStatus.PendingService]: {
|
||||
title: ' 待服务'
|
||||
},
|
||||
[TeaSpecialistManageOrderStatus.Service]: {
|
||||
title: '服务中'
|
||||
},
|
||||
[TeaSpecialistManageOrderStatus.Finished]: {
|
||||
title: '服务完成'
|
||||
},
|
||||
[TeaSpecialistManageOrderStatus.Cancelled]: {
|
||||
title: '订单取消'
|
||||
},
|
||||
}
|
||||
|
||||
75
src/utils/teaSpecialistOrder.ts
Normal file
75
src/utils/teaSpecialistOrder.ts
Normal file
@ -0,0 +1,75 @@
|
||||
// 茶艺师-订单状态文本(列表页,订单状态筛选)
|
||||
export enum TeaSpecialistManageOrderStatusText {
|
||||
All = 'all', // 全部
|
||||
PendingOrder = 'pendingOrder', // 待接单
|
||||
PendingService = 'pendingService', // 待服务
|
||||
Service = 'service',// 服务中
|
||||
Completed = 'completed', // 已完成(已完结)
|
||||
Cancelled = 'cancelled', // 取消订单(已取消)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师订单状态枚举
|
||||
*/
|
||||
export enum TeaSpecialistOrderStatus {
|
||||
Unpaid = 10, // 未支付
|
||||
Cancelled = 20, // 已取消
|
||||
Pending = 28, // 待接单
|
||||
Accepted = 29, // 已接单
|
||||
Departed = 30, // 已出发(待服务)
|
||||
Arrived = 31, // 已到达(服务中)
|
||||
Completed = 32, // 已完成
|
||||
SpecialistRefund = 40, // 茶艺师放弃接单退款
|
||||
CustomerRefundBeforeAccept = 41, // 客户在未接单前退款
|
||||
CustomerRefundAfterDepart = 42, // 客户在茶艺师出发后退款
|
||||
CustomerRefundAfterArrive = 43, // 客户在茶艺师到达后退款
|
||||
}
|
||||
|
||||
// 茶艺师-订单列表标题内容映射
|
||||
// title是订单列表的标题,pageTitle是订单详情页的标题(根据UI图进行区分显示,有些状态是不显示的)
|
||||
export const TeaSpecialistManageStatusTextValue: Partial<Record<TeaSpecialistOrderStatus, { title: string, pageTitle: string }>> = {
|
||||
[TeaSpecialistOrderStatus.Unpaid]: {
|
||||
title: '未支付',
|
||||
pageTitle: '未支付'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Cancelled]: {
|
||||
title: '订单取消',
|
||||
pageTitle: '订单取消'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Pending]: { // 待接单
|
||||
title: '待接单',
|
||||
pageTitle: '待接单'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Accepted]: { // 已接单
|
||||
title: '待服务',
|
||||
pageTitle: '待服务'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Departed]: { // 已出发
|
||||
title: '待服务',
|
||||
pageTitle: '待服务'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Arrived]: { // 已到达
|
||||
title: '服务中',
|
||||
pageTitle: '服务中'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.Completed]: { // 服务完成
|
||||
title: '已完成',
|
||||
pageTitle: '已完成'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.SpecialistRefund]: {
|
||||
title: '订单取消',
|
||||
pageTitle: '订单取消'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.CustomerRefundBeforeAccept]: {
|
||||
title: '订单取消',
|
||||
pageTitle: '订单取消'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterDepart]: {
|
||||
title: '订单取消',
|
||||
pageTitle: '订单取消'
|
||||
},
|
||||
[TeaSpecialistOrderStatus.CustomerRefundAfterArrive]: {
|
||||
title: '订单取消',
|
||||
pageTitle: '订单取消'
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user