mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vben.git
synced 2025-12-30 02:22:25 +00:00
feat:【antd】【mall】修复满减送编辑时表单打开异常的问题,原因:antd RangePicker 需要 dayjs 对象
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user