From 2772e7f1df05d5a639c07be04b5bcae6a6f0984a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=B0?= Date: Sun, 19 Oct 2025 18:40:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=E3=80=81=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=BF=87=E7=A8=8B=E4=B8=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=8C=89=E9=92=AE=E4=B8=80=E7=9B=B4=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game_pages/detail/index.tsx | 12 +++- src/order_pages/orderDetail/index.config.ts | 1 + src/order_pages/orderDetail/index.module.scss | 9 +++ src/order_pages/orderDetail/index.tsx | 56 ++++++++++++------- src/order_pages/orderList/index.tsx | 15 ++++- src/store/orderStore.ts | 16 ++++++ src/utils/orderActions.ts | 11 ++-- 7 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 src/store/orderStore.ts diff --git a/src/game_pages/detail/index.tsx b/src/game_pages/detail/index.tsx index 7129756..77d3557 100644 --- a/src/game_pages/detail/index.tsx +++ b/src/game_pages/detail/index.tsx @@ -7,6 +7,7 @@ import DetailService from "@/services/detailService"; import * as LoginService from "@/services/loginService"; import { getCurrentLocation } from "@/utils/locationUtils"; import { useUserInfo, useUserActions } from "@/store/userStore"; +import { useGlobalState } from "@/store/global"; import GameTags from "./components/GameTags"; import Carousel from "./components/Carousel"; import StickyBottom from "./components/StickyBottom"; @@ -33,6 +34,9 @@ function Index() { const { fetchUserInfo } = useUserActions(); // 获取登录用户的userInfo const myInfo = useUserInfo(); + const { statusNavbarHeightInfo } = useGlobalState(); + const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo; + useSceneRedirect("game_pages/detail/index"); const isMyOwn = userInfo.id === myInfo.id; @@ -151,7 +155,13 @@ function Index() { return ( {/* custom navbar */} - + view > view:nth-child(2) { + justify-content: flex-start; + margin-left: -30px; + } +} + .container { padding: 20px; box-sizing: border-box; diff --git a/src/order_pages/orderDetail/index.tsx b/src/order_pages/orderDetail/index.tsx index 24f92e0..47d47de 100644 --- a/src/order_pages/orderDetail/index.tsx +++ b/src/order_pages/orderDetail/index.tsx @@ -20,8 +20,10 @@ import { generateOrderActions, } from "@/utils"; import { getStorage, setStorage } from "@/store/storage"; +import { useGlobalStore } from "@/store/global"; +import { useOrder } from "@/store/orderStore"; import detailService, { GameData } from "@/services/detailService"; -import { withAuth, RefundPopup } from "@/components"; +import { withAuth, RefundPopup, GeneralNavbar } from "@/components"; import img from "@/config/images"; import CustomerIcon from "@/static/order/customer.svg"; import { handleCustomerService } from "@/services/userService"; @@ -49,6 +51,9 @@ const gameNoticeMap = new Map([ function genGameNotice(order_status, start_time) { const startTime = dayjs(start_time); let key = ""; + if (order_status === OrderStatus.PENDING) { + return {}; + } if (order_status === OrderStatus.FINISHED) { key = "finish"; } @@ -235,12 +240,13 @@ function GameInfo(props) { {refundTextMap.get(refund_status)} ¥ {amount} )} - {["progress", "expired"].includes(orderStatus) && ( - - {gameNotice.title} - {gameNotice.content && {gameNotice.content}} - - )} + {["progress", "expired"].includes(orderStatus) && + order_status !== OrderStatus.PENDING && ( + + {gameNotice.title} + {gameNotice.content && {gameNotice.content}} + + )} {/* Date and Weather */} @@ -505,7 +511,7 @@ const OrderCheck = () => { const [location, setLocation] = useState([0, 0]); const [checkOrderInfo, setCheckOrderInfo] = useState({}); const [orderDetail, setOrderDetail] = useState({}); - const [paying, setPaying] = useState(false); + const { paying, setPaying } = useOrder(); useDidShow(() => { init(); @@ -615,8 +621,19 @@ const OrderCheck = () => { const { order_status, cancel_type } = orderDetail; + const { statusNavbarHeightInfo } = useGlobalStore(); + const { totalHeight } = statusNavbarHeightInfo; + return ( - + + {/* Game Date and Address */} { {(!id || (order_status === OrderStatus.PENDING && - cancel_type === CancelType.NONE)) && ( - - )} + cancel_type === CancelType.NONE)) && + !paying && ( + + )} ); }; diff --git a/src/order_pages/orderList/index.tsx b/src/order_pages/orderList/index.tsx index fc59b8c..ba22c7e 100644 --- a/src/order_pages/orderList/index.tsx +++ b/src/order_pages/orderList/index.tsx @@ -11,6 +11,7 @@ import orderService, { refundTextMap, } from "@/services/orderService"; import { getStorage, removeStorage, setStorage } from "@/store/storage"; +import { useGlobalStore } from "@/store/global"; import { handleCustomerService } from "@/services/userService"; import { withAuth, RefundPopup, GeneralNavbar } from "@/components"; import { payOrder, generateOrderActions } from "@/utils"; @@ -256,8 +257,14 @@ const OrderList = () => { const flatList = list.flat(); + const { statusNavbarHeightInfo } = useGlobalStore(); + const { totalHeight } = statusNavbarHeightInfo; + return ( - + { const unPay = item.order_status === OrderStatus.PENDING && item.cancel_type === CancelType.NONE; - const timeout = item.cancel_type === CancelType.TIMEOUT; + const canceled = [CancelType.USER, CancelType.TIMEOUT].includes( + item.cancel_type + ); const { game_info } = item; const { @@ -300,7 +309,7 @@ const OrderList = () => { > {item?.game_info?.title} - {!timeout && ( + {!canceled && ( void; +} + +export const useOrderStore = create()((set) => ({ + paying: false, + setPaying: (paying: boolean) => set({ paying }), +})); + +export const useOrder = () => useOrderStore(({ paying, setPaying }) => ({ + paying, + setPaying, +})) diff --git a/src/utils/orderActions.ts b/src/utils/orderActions.ts index dc53dbf..964aa9d 100644 --- a/src/utils/orderActions.ts +++ b/src/utils/orderActions.ts @@ -8,10 +8,11 @@ export function getOrderStatus(orderData) { const unPay = order_status === OrderStatus.PENDING && ([CancelType.NONE].includes(cancel_type)); const refund = [RefundStatus.PENDING, RefundStatus.SUCCESS].includes(refund_status); const expired = - order_status === OrderStatus.FINISHED || - [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type); + order_status === OrderStatus.FINISHED; - return unPay ? 'unpay' : refund ? 'refund' : expired ? cancel_type === CancelType.TIMEOUT ? 'timeout' : 'expired' : 'progress' + const canceled = [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type); + + return unPay ? 'unpay' : refund ? 'refund' : canceled ? 'canceled' : expired ? 'expired' : 'progress' } // scene: list、detail @@ -54,7 +55,7 @@ export function generateOrderActions(orderData, actions, scene) { if (scene === 'list') { const actionMap = new Map([ - ['timeout', [deleteOrder, gameDetail]], + ['canceled', [deleteOrder, gameDetail]], ['expired', [deleteOrder, gameDetail]], ['progress', [quitGame, gameDetail]], ['refund', [deleteOrder, gameDetail]], @@ -65,7 +66,7 @@ export function generateOrderActions(orderData, actions, scene) { if (scene === 'detail') { const actionMap = new Map([ - ['timeout', [deleteOrder, gameDetail]], + ['canceled', [deleteOrder, gameDetail]], ['expired', [gameDetail, deleteOrder]], ['progress', [gameDetail, quitGame]], ['refund', [deleteOrder, gameDetail]],