diff --git a/src/order_pages/orderDetail/index.tsx b/src/order_pages/orderDetail/index.tsx index 1962064..cec4fae 100644 --- a/src/order_pages/orderDetail/index.tsx +++ b/src/order_pages/orderDetail/index.tsx @@ -64,8 +64,7 @@ function genGameNotice(order_status, start_time) { function GameInfo(props) { const { detail, currentLocation, orderDetail, init } = props; - // console.log(orderDetail, "orderDetail"); - const { order_status, refund_status } = orderDetail; + const { order_status, refund_status, amount } = orderDetail; const { latitude, longitude, location, location_name, start_time, end_time, weather } = detail || {}; @@ -219,18 +218,19 @@ function GameInfo(props) { } } + console.log(gameNotice) return ( + {["refund", "progress", "expired"].includes(orderStatus) && ( + + {refundTextMap.get(refund_status)} ¥ {amount} + + )} {["progress", "expired"].includes(orderStatus) && ( - <> - - {refundTextMap.get(refund_status)} ¥ 90 - - - {gameNotice.title} - {gameNotice.content && {gameNotice.content}} - - + + {gameNotice.title} + {gameNotice.content && {gameNotice.content}} + )} {/* Date and Weather */} diff --git a/src/utils/orderActions.ts b/src/utils/orderActions.ts index 4cef8e4..2367a23 100644 --- a/src/utils/orderActions.ts +++ b/src/utils/orderActions.ts @@ -1,16 +1,17 @@ -import { OrderStatus, CancelType } from "@/services/orderService"; +import { OrderStatus, CancelType, RefundStatus } from "@/services/orderService"; export function getOrderStatus(orderData) { - const { order_status, cancel_type, order_no } = orderData + const { order_status, cancel_type, refund_status, order_no } = orderData if (!order_no) { return 'none' } const unPay = order_status === OrderStatus.PENDING && cancel_type === CancelType.NONE; + const refund = [RefundStatus.PENDING, RefundStatus.SUCCESS].includes(refund_status); const expired = order_status === OrderStatus.FINISHED || [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type); - return unPay ? 'unpay' : expired ? 'expired' : 'progress' + return unPay ? 'unpay' : refund ? 'refund' : expired ? 'expired' : 'progress' } // scene: list、detail @@ -55,6 +56,7 @@ export function generateOrderActions(orderData, actions, scene) { const actionMap = new Map([ ['expired', [deleteOrder, gameDetail]], ['progress', [quitGame, gameDetail]], + ['refund', [deleteOrder, gameDetail]], ['unpay', [cancelOrder, payNow]] ]) return actionMap.get(key) @@ -64,6 +66,7 @@ export function generateOrderActions(orderData, actions, scene) { const actionMap = new Map([ ['expired', [gameDetail, deleteOrder]], ['progress', [gameDetail, quitGame]], + ['refund', [deleteOrder, gameDetail]], ['unpay', [cancelOrder]] ]) return actionMap.get(key)