diff --git a/apps/web-ele/src/views/mall/promotion/coupon/template/data.ts b/apps/web-ele/src/views/mall/promotion/coupon/template/data.ts index 035259be5..0b00c1427 100644 --- a/apps/web-ele/src/views/mall/promotion/coupon/template/data.ts +++ b/apps/web-ele/src/views/mall/promotion/coupon/template/data.ts @@ -60,7 +60,6 @@ export function useFormSchema(): VbenFormSchema[] { rules: 'required', defaultValue: PromotionProductScopeEnum.ALL.scope, }, - // TODO @puhui999: 商品选择器优化 { fieldName: 'productSpuIds', label: '商品', @@ -84,7 +83,6 @@ export function useFormSchema(): VbenFormSchema[] { }, rules: 'required', }, - // TODO @puhui999: 商品分类选择器优化 { fieldName: 'productCategoryIds', label: '商品分类', diff --git a/apps/web-ele/src/views/mall/promotion/coupon/template/modules/form.vue b/apps/web-ele/src/views/mall/promotion/coupon/template/modules/form.vue index 69e5d8f1a..13e4c7535 100644 --- a/apps/web-ele/src/views/mall/promotion/coupon/template/modules/form.vue +++ b/apps/web-ele/src/views/mall/promotion/coupon/template/modules/form.vue @@ -16,11 +16,18 @@ import { updateCouponTemplate, } from '#/api/mall/promotion/coupon/couponTemplate'; import { $t } from '#/locales'; +import { ProductCategorySelect } from '#/views/mall/product/category/components'; +import { SpuShowcase } from '#/views/mall/product/spu/components'; import { useFormSchema } from '../data'; const emit = defineEmits(['success']); -const formData = ref(); +const formData = ref< + Partial & { + productCategoryIds?: number | number[]; + productSpuIds?: number[]; + } +>({}); const getTitle = computed(() => { return formData.value?.id ? $t('ui.actionTitle.edit', ['优惠券模板']) @@ -64,7 +71,7 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { - formData.value = undefined; + formData.value = {}; return; } // 加载数据 @@ -75,7 +82,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(); try { formData.value = await getCouponTemplate(data.id); - const processedData = await processLoadData(formData.value); + const processedData = await processLoadData(formData.value as any); // 设置到表单 await formApi.setValues(processedData); } finally { @@ -144,7 +151,15 @@ async function processLoadData(