From 568d5aa4cfb3b9943036aa0b1f297111120dd2d8 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sat, 20 Dec 2025 11:35:01 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90mal?= =?UTF-8?q?l=E3=80=91=E4=BF=AE=E5=A4=8D=E6=BB=A1=E5=87=8F=E9=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=E8=A1=A8=E5=8D=95=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=EF=BC=9Aantd=20RangePicker=20=E9=9C=80=E8=A6=81=20day?= =?UTF-8?q?js=20=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mall/promotion/coupon/components/select.vue | 4 +++- .../views/mall/promotion/rewardActivity/modules/form.vue | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web-antd/src/views/mall/promotion/coupon/components/select.vue b/apps/web-antd/src/views/mall/promotion/coupon/components/select.vue index e1420315a..94d79a0bb 100644 --- a/apps/web-antd/src/views/mall/promotion/coupon/components/select.vue +++ b/apps/web-antd/src/views/mall/promotion/coupon/components/select.vue @@ -2,7 +2,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallCouponTemplateApi } from '#/api/mall/promotion/coupon/couponTemplate'; -import { ref } from 'vue'; +import { nextTick, ref } from 'vue'; import { Modal } from 'ant-design-vue'; @@ -57,6 +57,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ /** 打开弹窗 */ async function open() { visible.value = true; + // 等待 Modal 和 Grid 组件挂载完成后再查询 + await nextTick(); await gridApi.query(); } diff --git a/apps/web-antd/src/views/mall/promotion/rewardActivity/modules/form.vue b/apps/web-antd/src/views/mall/promotion/rewardActivity/modules/form.vue index e171559b8..fda9fc9f9 100644 --- a/apps/web-antd/src/views/mall/promotion/rewardActivity/modules/form.vue +++ b/apps/web-antd/src/views/mall/promotion/rewardActivity/modules/form.vue @@ -11,6 +11,7 @@ import { import { convertToInteger, formatToFraction } from '@vben/utils'; import { message } from 'ant-design-vue'; +import dayjs from 'dayjs'; import { useVbenForm } from '#/adapter/form'; import { @@ -98,7 +99,11 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(); try { const result = await getReward(data.id); - result.startAndEndTime = [result.startTime, result.endTime] as any[]; + // antd RangePicker 需要 dayjs 对象 + result.startAndEndTime = [ + result.startTime ? dayjs(result.startTime) : undefined, + result.endTime ? dayjs(result.endTime) : undefined, + ] as any[]; result.rules?.forEach((item: any) => { item.discountPrice = formatToFraction(item.discountPrice || 0); if (result.conditionType === PromotionConditionTypeEnum.PRICE.type) {