feat:【antd】【mall】修复满减送编辑时表单打开异常的问题,原因:antd RangePicker 需要 dayjs 对象

This commit is contained in:
puhui999
2025-12-20 11:35:01 +08:00
parent 535c82c844
commit 568d5aa4cf
2 changed files with 9 additions and 2 deletions

View File

@@ -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();
}

View File

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