diff --git a/config/env.ts b/config/env.ts index f630969..78c1e6e 100644 --- a/config/env.ts +++ b/config/env.ts @@ -2,8 +2,8 @@ export const ENV_CONFIG = { // 开发环境 development: { - // API_BASE_URL: 'http://127.0.0.1:9200/api', - API_BASE_URL: 'https://mp-api.websoft.top/api', + API_BASE_URL: 'http://127.0.0.1:9200/api', + // API_BASE_URL: 'https://mp-api.websoft.top/api', APP_NAME: '开发环境', DEBUG: 'true', }, diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 1c6565e..ed9d2c4 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -313,7 +313,7 @@ function Home() { Taro.navigateTo({ url: '/user/ticket/index' })} + onClick={() => Taro.navigateTo({ url: 'shop/orderConfirm/index?goodsId=10074' })} > 买水票更优惠 diff --git a/src/shop/orderDetail/index.tsx b/src/shop/orderDetail/index.tsx index b0345d5..5fd937c 100644 --- a/src/shop/orderDetail/index.tsx +++ b/src/shop/orderDetail/index.tsx @@ -10,6 +10,17 @@ import dayjs from "dayjs"; import PaymentCountdown from "@/components/PaymentCountdown"; import './index.scss' +// 申请退款:支付成功后仅允许在指定时间窗内发起(前端展示层限制,后端仍应校验) +const isWithinRefundWindow = (payTime?: string, windowMinutes: number = 60): boolean => { + if (!payTime) return false; + const raw = String(payTime).trim(); + const t = /^\d+$/.test(raw) + ? dayjs(Number(raw) < 1e12 ? Number(raw) * 1000 : Number(raw)) // 兼容秒/毫秒时间戳 + : dayjs(raw); + if (!t.isValid()) return false; + return dayjs().diff(t, 'minute') <= windowMinutes; +}; + const OrderDetail = () => { const [order, setOrder] = useState(null); const [orderGoodsList, setOrderGoodsList] = useState([]); @@ -228,7 +239,9 @@ const OrderDetail = () => { {!order.payStatus && } {!order.payStatus && } - {order.orderStatus === 1 && } + {order.orderStatus === 1 && order.payStatus && isWithinRefundWindow(order.payTime, 60) && ( + + )} {canConfirmReceive && (