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) {