forked from gxwebsoft/mp-10550
refactor(order): 优化订单列表倒计时展示逻辑
- 更新 API 基础 URL 以适应开发环境 - 调整倒计时组件样式,移除冗余样式 - 优化订单列表中倒计时的显示逻辑 - 统一处理订单状态文本和颜色
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
export const ENV_CONFIG = {
|
export const ENV_CONFIG = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||||
APP_NAME: '开发环境',
|
APP_NAME: '开发环境',
|
||||||
DEBUG: 'true',
|
DEBUG: 'true',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,32 +7,30 @@
|
|||||||
color: white;
|
color: white;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
|
box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
||||||
.countdown-text {
|
.countdown-text {
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 紧急状态(少于1小时) */
|
/* 紧急状态(少于1小时) */
|
||||||
&.urgent {
|
&.urgent {
|
||||||
background: linear-gradient(135deg, #ff6b6b, #ee5a52);
|
color: #ff6b6b;
|
||||||
animation: pulse 2s infinite;
|
animation: pulse 2s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 非常紧急状态(少于10分钟) */
|
/* 非常紧急状态(少于10分钟) */
|
||||||
&.critical {
|
&.critical {
|
||||||
background: linear-gradient(135deg, #ff4757, #c44569);
|
color: #c44569;
|
||||||
animation: flash 1s infinite;
|
animation: flash 1s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 过期状态 */
|
/* 过期状态 */
|
||||||
&.expired {
|
&.expired {
|
||||||
background: linear-gradient(135deg, #95a5a6, #7f8c8d);
|
color: #95a5a6;
|
||||||
animation: none;
|
animation: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,21 +38,20 @@
|
|||||||
/* 纯文本模式样式 */
|
/* 纯文本模式样式 */
|
||||||
.payment-countdown-text {
|
.payment-countdown-text {
|
||||||
color: #ff4757;
|
color: #ff4757;
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
/* 紧急状态 */
|
/* 紧急状态 */
|
||||||
&.urgent {
|
&.urgent {
|
||||||
color: #ff6b6b;
|
color: #ff6b6b;
|
||||||
animation: textPulse 2s infinite;
|
animation: textPulse 2s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 非常紧急状态 */
|
/* 非常紧急状态 */
|
||||||
&.critical {
|
&.critical {
|
||||||
color: #ff4757;
|
color: #ff4757;
|
||||||
animation: textFlash 1s infinite;
|
animation: textFlash 1s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 过期状态 */
|
/* 过期状态 */
|
||||||
&.expired {
|
&.expired {
|
||||||
color: #95a5a6;
|
color: #95a5a6;
|
||||||
@@ -64,39 +61,39 @@
|
|||||||
|
|
||||||
/* 动画效果 */
|
/* 动画效果 */
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0% {
|
0% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
transform: scale(1.02);
|
transform: scale(1.02);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes flash {
|
@keyframes flash {
|
||||||
0% {
|
0% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
25% {
|
25% {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
75% {
|
75% {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,35 +115,30 @@
|
|||||||
/* 响应式调整 */
|
/* 响应式调整 */
|
||||||
@media (max-width: 375px) {
|
@media (max-width: 375px) {
|
||||||
.payment-countdown-badge {
|
.payment-countdown-badge {
|
||||||
font-size: 11px;
|
|
||||||
padding: 3px 6px;
|
padding: 3px 6px;
|
||||||
|
|
||||||
.countdown-text {
|
.countdown-text {
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-countdown-text {
|
.payment-countdown-text {
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 详情页专用样式 */
|
/* 详情页专用样式 */
|
||||||
.order-detail-countdown {
|
.order-detail-countdown {
|
||||||
.payment-countdown-badge {
|
.payment-countdown-badge {
|
||||||
font-size: 14px;
|
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
margin: 8px 0;
|
margin: 8px 0;
|
||||||
|
|
||||||
.countdown-text {
|
.countdown-text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-countdown-text {
|
.payment-countdown-text {
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,17 +146,16 @@
|
|||||||
/* 列表页专用样式 */
|
/* 列表页专用样式 */
|
||||||
.order-list-countdown {
|
.order-list-countdown {
|
||||||
.payment-countdown-badge {
|
.payment-countdown-badge {
|
||||||
font-size: 11px;
|
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
|
|
||||||
.countdown-text {
|
.countdown-text {
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-countdown-text {
|
.payment-countdown-text {
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import {
|
import {
|
||||||
usePaymentCountdown,
|
usePaymentCountdown,
|
||||||
formatCountdownText,
|
formatCountdownText,
|
||||||
isUrgentCountdown,
|
isUrgentCountdown,
|
||||||
isCriticalCountdown
|
isCriticalCountdown
|
||||||
} from '@/hooks/usePaymentCountdown';
|
} from '@/hooks/usePaymentCountdown';
|
||||||
import './PaymentCountdown.scss';
|
import './PaymentCountdown.scss';
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ const PaymentCountdown: React.FC<PaymentCountdownProps> = ({
|
|||||||
// 判断紧急程度
|
// 判断紧急程度
|
||||||
const isUrgent = isUrgentCountdown(timeLeft);
|
const isUrgent = isUrgentCountdown(timeLeft);
|
||||||
const isCritical = isCriticalCountdown(timeLeft);
|
const isCritical = isCriticalCountdown(timeLeft);
|
||||||
|
|
||||||
// 格式化倒计时文本
|
// 格式化倒计时文本
|
||||||
const countdownText = formatCountdownText(timeLeft, showSeconds);
|
const countdownText = formatCountdownText(timeLeft, showSeconds);
|
||||||
const fullText = `等待付款 ${countdownText}`;
|
const fullText = `等待付款 ${countdownText}`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {Avatar, Cell, Space, Empty, Tabs, Button, TabPane, Image} from '@nutui/nutui-react-taro'
|
import {Avatar, Cell, Space, Empty, Tabs, Button, TabPane, Image} from '@nutui/nutui-react-taro'
|
||||||
import {useEffect, useState, CSSProperties} from "react";
|
import {useEffect, useState, CSSProperties} from "react";
|
||||||
import {View} from '@tarojs/components'
|
import {View, Text} from '@tarojs/components'
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import {InfiniteLoading} from '@nutui/nutui-react-taro'
|
import {InfiniteLoading} from '@nutui/nutui-react-taro'
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
@@ -334,7 +334,6 @@ function OrderList(props: OrderListProps) {
|
|||||||
}, [props.searchParams?.statusFilter]); // 监听statusFilter变化
|
}, [props.searchParams?.statusFilter]); // 监听statusFilter变化
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tabs
|
<Tabs
|
||||||
@@ -394,7 +393,7 @@ function OrderList(props: OrderListProps) {
|
|||||||
}
|
}
|
||||||
loadMoreText={
|
loadMoreText={
|
||||||
list.length === 0 ? (
|
list.length === 0 ? (
|
||||||
<Empty style={{ backgroundColor: 'transparent' }} description="您还没有订单哦"/>
|
<Empty style={{backgroundColor: 'transparent'}} description="您还没有订单哦"/>
|
||||||
) : (
|
) : (
|
||||||
<View className={'h-24'}>
|
<View className={'h-24'}>
|
||||||
没有更多了
|
没有更多了
|
||||||
@@ -416,18 +415,19 @@ function OrderList(props: OrderListProps) {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
copyText(`${item.orderNo}`)
|
copyText(`${item.orderNo}`)
|
||||||
}}>{item.orderNo}</View>
|
}}>{item.orderNo}</View>
|
||||||
{/* 添加倒计时显示 - 列表页不实时更新 */}
|
</View>
|
||||||
<View className="order-list-countdown">
|
<View className={`${getOrderStatusColor(item)} font-medium`}>
|
||||||
|
{item.orderStatus === 0 && (
|
||||||
<PaymentCountdown
|
<PaymentCountdown
|
||||||
createTime={item.createTime}
|
createTime={item.createTime}
|
||||||
payStatus={item.payStatus}
|
payStatus={item.payStatus}
|
||||||
realTime={false}
|
realTime={false}
|
||||||
showSeconds={false}
|
showSeconds={false}
|
||||||
mode="badge"
|
mode="text"
|
||||||
/>
|
/>
|
||||||
</View>
|
)}
|
||||||
|
<Text>{getOrderStatusText(item)}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={`${getOrderStatusColor(item)} font-medium`}>{getOrderStatusText(item)}</View>
|
|
||||||
</View>
|
</View>
|
||||||
<div
|
<div
|
||||||
className={'create-time text-gray-400 text-xs'}>{dayjs(item.createTime).format('YYYY年MM月DD日 HH:mm:ss')}</div>
|
className={'create-time text-gray-400 text-xs'}>{dayjs(item.createTime).format('YYYY年MM月DD日 HH:mm:ss')}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user