diff --git a/apps/web-antd/src/views/mall/promotion/article/data.ts b/apps/web-antd/src/views/mall/promotion/article/data.ts index 9f10b9377..5af659775 100644 --- a/apps/web-antd/src/views/mall/promotion/article/data.ts +++ b/apps/web-antd/src/views/mall/promotion/article/data.ts @@ -96,14 +96,10 @@ export function useFormSchema(): VbenFormSchema[] { defaultValue: true, }, { - // TODO: @puhui999:商品关联 fieldName: 'spuId', label: '商品关联', component: 'Input', formItemClass: 'col-span-2', - componentProps: { - placeholder: '请输入商品 SPU 编号', - }, }, { fieldName: 'sort', diff --git a/apps/web-antd/src/views/mall/promotion/article/modules/form.vue b/apps/web-antd/src/views/mall/promotion/article/modules/form.vue index b8a8487b8..0e73e0eca 100644 --- a/apps/web-antd/src/views/mall/promotion/article/modules/form.vue +++ b/apps/web-antd/src/views/mall/promotion/article/modules/form.vue @@ -14,6 +14,7 @@ import { updateArticle, } from '#/api/mall/promotion/article'; import { $t } from '#/locales'; +import { SpuShowcase } from '#/views/mall/product/spu/components'; import { useFormSchema } from '../data'; @@ -41,6 +42,10 @@ const [Form, formApi] = useVbenForm({ const [Modal, modalApi] = useVbenModal({ async onConfirm() { + // 同步商品选择到表单,确保验证时能获取到值 + if (formData.value?.spuId) { + await formApi.setFieldValue('spuId', formData.value.spuId); + } const { valid } = await formApi.validate(); if (!valid) { return; @@ -82,6 +87,11 @@ const [Modal, modalApi] = useVbenModal({ diff --git a/apps/web-ele/src/views/mall/promotion/article/data.ts b/apps/web-ele/src/views/mall/promotion/article/data.ts index 487fa0e0f..b4e4bb614 100644 --- a/apps/web-ele/src/views/mall/promotion/article/data.ts +++ b/apps/web-ele/src/views/mall/promotion/article/data.ts @@ -92,14 +92,10 @@ export function useFormSchema(): VbenFormSchema[] { defaultValue: true, }, { - // TODO: @puhui999:商品关联 fieldName: 'spuId', label: '商品关联', component: 'Input', formItemClass: 'col-span-2', - componentProps: { - placeholder: '请输入商品 SPU 编号', - }, }, { fieldName: 'sort', diff --git a/apps/web-ele/src/views/mall/promotion/article/modules/form.vue b/apps/web-ele/src/views/mall/promotion/article/modules/form.vue index fd3aad79d..754ba967a 100644 --- a/apps/web-ele/src/views/mall/promotion/article/modules/form.vue +++ b/apps/web-ele/src/views/mall/promotion/article/modules/form.vue @@ -14,6 +14,7 @@ import { updateArticle, } from '#/api/mall/promotion/article'; import { $t } from '#/locales'; +import { SpuShowcase } from '#/views/mall/product/spu/components'; import { useFormSchema } from '../data'; @@ -41,6 +42,10 @@ const [Form, formApi] = useVbenForm({ const [Modal, modalApi] = useVbenModal({ async onConfirm() { + // 同步商品选择到表单,确保验证时能获取到值 + if (formData.value?.spuId) { + await formApi.setFieldValue('spuId', formData.value.spuId); + } const { valid } = await formApi.validate(); if (!valid) { return; @@ -82,6 +87,11 @@ const [Modal, modalApi] = useVbenModal({