|
@@ -1,6 +1,6 @@
|
|
|
import { View, ScrollView, Text, Image } from '@tarojs/components'
|
|
import { View, ScrollView, Text, Image } from '@tarojs/components'
|
|
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
|
|
-import Taro from '@tarojs/taro'
|
|
|
|
|
|
|
+import Taro, { usePullDownRefresh } from '@tarojs/taro'
|
|
|
import { orderClient } from '@/api'
|
|
import { orderClient } from '@/api'
|
|
|
import { Navbar } from '@/components/ui/navbar'
|
|
import { Navbar } from '@/components/ui/navbar'
|
|
|
import OrderButtonBar from '@/components/order/OrderButtonBar'
|
|
import OrderButtonBar from '@/components/order/OrderButtonBar'
|
|
@@ -59,6 +59,12 @@ export default function OrderDetailPage() {
|
|
|
staleTime: 5 * 60 * 1000,
|
|
staleTime: 5 * 60 * 1000,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // 使用Taro全局钩子 - 下拉刷新
|
|
|
|
|
+ usePullDownRefresh(() => {
|
|
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['order', orderId, orderNo] })
|
|
|
|
|
+ Taro.stopPullDownRefresh()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// 取消订单mutation
|
|
// 取消订单mutation
|
|
|
const cancelOrderMutation = useMutation({
|
|
const cancelOrderMutation = useMutation({
|
|
|
mutationFn: async (reason: string) => {
|
|
mutationFn: async (reason: string) => {
|
|
@@ -218,12 +224,6 @@ export default function OrderDetailPage() {
|
|
|
<ScrollView
|
|
<ScrollView
|
|
|
className="refresh-container"
|
|
className="refresh-container"
|
|
|
scrollY
|
|
scrollY
|
|
|
- refresherEnabled={true}
|
|
|
|
|
- refresherTriggered={false}
|
|
|
|
|
- onRefresherRefresh={() => {
|
|
|
|
|
- // 下拉刷新逻辑
|
|
|
|
|
- queryClient.invalidateQueries({ queryKey: ['order', orderId, orderNo] })
|
|
|
|
|
- }}
|
|
|
|
|
>
|
|
>
|
|
|
{/* 顶部状态卡片 */}
|
|
{/* 顶部状态卡片 */}
|
|
|
<View className="order-status-header">
|
|
<View className="order-status-header">
|