diff --git a/src/components/PaymentCountdown.scss b/src/components/PaymentCountdown.scss
index b449fb2..5efb6cb 100644
--- a/src/components/PaymentCountdown.scss
+++ b/src/components/PaymentCountdown.scss
@@ -18,19 +18,19 @@
/* 紧急状态(少于1小时) */
&.urgent {
- color: #ff6b6b;
+ background: linear-gradient(135deg, #ff6b6b, #ee5a52);
animation: pulse 2s infinite;
}
/* 非常紧急状态(少于10分钟) */
&.critical {
- color: #c44569;
+ background: linear-gradient(135deg, #ff4757, #c44569);
animation: flash 1s infinite;
}
/* 过期状态 */
&.expired {
- color: #95a5a6;
+ background: linear-gradient(135deg, #95a5a6, #7f8c8d);
animation: none;
}
}
diff --git a/src/user/order/components/OrderList.tsx b/src/user/order/components/OrderList.tsx
index 25e2cff..2b2dd9a 100644
--- a/src/user/order/components/OrderList.tsx
+++ b/src/user/order/components/OrderList.tsx
@@ -11,6 +11,15 @@ import {ShopOrderGoods} from "@/api/shop/shopOrderGoods/model";
import {copyText} from "@/utils/common";
import PaymentCountdown from "@/components/PaymentCountdown";
+// 判断订单是否支付已过期
+const isPaymentExpired = (createTime: string, timeoutHours: number = 24): boolean => {
+ if (!createTime) return false;
+ const createTimeObj = dayjs(createTime);
+ const expireTime = createTimeObj.add(timeoutHours, 'hour');
+ const now = dayjs();
+ return now.isAfter(expireTime);
+};
+
const getInfiniteUlStyle = (showSearch: boolean = false): CSSProperties => ({
marginTop: showSearch ? '0' : '0', // 如果显示搜索框,增加更多的上边距
height: showSearch ? '75vh' : '84vh', // 相应调整高度
@@ -363,10 +372,10 @@ function OrderList(props: OrderListProps) {
})
}
-
+
>
)
}
diff --git a/src/utils/invite.ts b/src/utils/invite.ts
index aae3dd0..df0a00b 100644
--- a/src/utils/invite.ts
+++ b/src/utils/invite.ts
@@ -17,9 +17,12 @@ export function parseInviteParams(options: any): InviteParams | null {
try {
// 从 scene 参数中解析邀请信息
if (options.scene) {
+ // 确保 scene 是字符串类型
+ const sceneStr = typeof options.scene === 'string' ? options.scene : String(options.scene)
+
const params: InviteParams = {}
- const pairs = options.scene.split('&')
-
+ const pairs = sceneStr.split('&')
+
pairs.forEach((pair: string) => {
const [key, value] = pair.split('=')
if (key && value) {
@@ -36,10 +39,10 @@ export function parseInviteParams(options: any): InviteParams | null {
}
}
})
-
+
return params.inviter ? params : null
}
-
+
// 从 query 参数中解析邀请信息(兼容旧版本)
if (options.referrer) {
return {
@@ -47,7 +50,7 @@ export function parseInviteParams(options: any): InviteParams | null {
source: 'link'
}
}
-
+
return null
} catch (error) {
console.error('解析邀请参数失败:', error)
@@ -80,7 +83,7 @@ export function getStoredInviteParams(): InviteParams | null {
// 检查是否过期(24小时)
const now = Date.now()
const expireTime = 24 * 60 * 60 * 1000 // 24小时
-
+
if (now - stored.timestamp < expireTime) {
return {
inviter: stored.inviter,
@@ -139,7 +142,7 @@ export async function handleInviteRelation(userId: number): Promise {
// 清除本地存储的邀请参数
clearInviteParams()
-
+
console.log(`邀请关系建立成功: ${inviterId} -> ${userId}`)
return true
} catch (error) {
@@ -167,7 +170,7 @@ export function getSourceDisplayName(source: string): string {
'poster': '海报分享',
'unknown': '未知来源'
}
-
+
return sourceMap[source] || source
}
@@ -177,11 +180,11 @@ export function getSourceDisplayName(source: string): string {
export function validateInviteCode(scene: string): boolean {
try {
if (!scene) return false
-
+
// 检查是否包含必要的参数
const hasInviter = scene.includes('inviter=')
const hasSource = scene.includes('source=')
-
+
return hasInviter && hasSource
} catch (error) {
return false
@@ -208,19 +211,19 @@ export function trackInviteSource(source: string, inviterId?: number) {
timestamp: Date.now(),
userAgent: Taro.getSystemInfoSync()
}
-
+
// 可以发送到统计服务
console.log('邀请来源统计:', trackData)
-
+
// 暂存到本地,后续可批量上报
const existingTracks = Taro.getStorageSync('invite_tracks') || []
existingTracks.push(trackData)
-
+
// 只保留最近100条记录
if (existingTracks.length > 100) {
existingTracks.splice(0, existingTracks.length - 100)
}
-
+
Taro.setStorageSync('invite_tracks', existingTracks)
} catch (error) {
console.error('统计邀请来源失败:', error)