fix: 新购订单自动计算到期时间
Build and Deploy Vue3 / build (push) Successful in 1m41s
Build and Deploy Vue3 / deploy (push) Successful in 47s

This commit is contained in:
shiran
2026-07-21 18:12:21 +08:00
parent c5d4dbc0db
commit 09918d03e3
+14
View File
@@ -1405,6 +1405,19 @@ const handleDurationChange = (value) => {
orderForm.pay_num = duration
}
const calculateExpireTime = (months) => {
const duration = Math.max(1, Math.floor(Number(months) || 1))
const expireDate = new Date()
const originalDay = expireDate.getDate()
expireDate.setDate(1)
expireDate.setMonth(expireDate.getMonth() + duration)
const lastDay = new Date(expireDate.getFullYear(), expireDate.getMonth() + 1, 0).getDate()
expireDate.setDate(Math.min(originalDay, lastDay))
return expireDate.getTime()
}
// 分步导航
const handleNextStep = async () => {
if (currentStep.value === 0) {
@@ -1420,6 +1433,7 @@ const handleNextStep = async () => {
if (isAutoPriceMode.value) {
const priced = await fetchOrderPrice()
if (!priced) return
orderForm.expire_time = calculateExpireTime(orderForm.pay_num)
}
}
currentStep.value++