diff --git a/src/views/order/OrderList.vue b/src/views/order/OrderList.vue index 063d8a9..4f6dab3 100644 --- a/src/views/order/OrderList.vue +++ b/src/views/order/OrderList.vue @@ -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++