diff --git a/apps/web-antd/src/views/mall/product/comment/modules/form.vue b/apps/web-antd/src/views/mall/product/comment/modules/form.vue index 3ff475282..0599f5977 100644 --- a/apps/web-antd/src/views/mall/product/comment/modules/form.vue +++ b/apps/web-antd/src/views/mall/product/comment/modules/form.vue @@ -99,16 +99,14 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { + // 关闭时重置表单状态 selectedSku.value = undefined; + await formApi.setValues({ spuId: undefined, skuId: undefined }); return; } // 加载数据 const data = modalApi.getData(); if (!data || !data.id) { - // 新建模式:重置表单 - // TODO @puhui999:这里的重置,可以统一到 103 行那么? - selectedSku.value = undefined; - await formApi.setValues({ spuId: undefined, skuId: undefined }); return; } // 编辑模式:加载数据 diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue index 1c508cc7e..17e405bfb 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue @@ -4,7 +4,7 @@ import type { MallSpuApi } from '#/api/mall/product/spu'; import { computed, ref, watch } from 'vue'; -import { CloseCircleFilled, PlusOutlined } from '@vben/icons'; +import { IconifyIcon } from '@vben/icons'; import { Image, Tooltip } from 'ant-design-vue'; @@ -110,9 +110,9 @@ function emitSpuChange() { class="h-full w-full rounded-lg object-cover" /> - - @@ -126,8 +126,7 @@ function emitSpuChange() { class="flex h-[60px] w-[60px] cursor-pointer items-center justify-center rounded-lg border-2 border-dashed transition-colors hover:border-primary hover:bg-primary/5" @click="handleOpenSpuSelect" > - - + diff --git a/apps/web-antd/src/views/mall/product/spu/form/index.vue b/apps/web-antd/src/views/mall/product/spu/form/index.vue index c2f5e3061..0d654b318 100644 --- a/apps/web-antd/src/views/mall/product/spu/form/index.vue +++ b/apps/web-antd/src/views/mall/product/spu/form/index.vue @@ -32,30 +32,6 @@ const spuId = ref(); const { params, name } = useRoute(); const { closeCurrentTab } = useTabs(); const activeTabName = ref('info'); -// TODO @puhui999:这个要不要类似 ele 里,直接写到 html 里? -const tabList = ref([ - { - key: 'info', - tab: '基础设置', - }, - { - key: 'sku', - tab: '价格库存', - }, - { - key: 'delivery', - tab: '物流设置', - }, - { - key: 'description', - tab: '商品详情', - }, - { - key: 'other', - tab: '其它设置', - }, -]); - const formLoading = ref(false); // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const isDetail = ref(name === 'ProductSpuDetail'); // 是否查看详情 const skuListRef = ref(); // 商品属性列表 Ref @@ -95,22 +71,22 @@ const propertyList = ref([]); // 商品属性列表 const ruleConfig: RuleConfig[] = [ { name: 'stock', - rule: (arg) => arg >= 0, + rule: (arg: number) => arg >= 0, message: '商品库存必须大于等于 1 !!!', }, { name: 'price', - rule: (arg) => arg >= 0.01, + rule: (arg: number) => arg >= 0.01, message: '商品销售价格必须大于等于 0.01 元!!!', }, { name: 'marketPrice', - rule: (arg) => arg >= 0.01, + rule: (arg: number) => arg >= 0.01, message: '商品市场价格必须大于等于 0.01 元!!!', }, { name: 'costPrice', - rule: (arg) => arg >= 0.01, + rule: (arg: number) => arg >= 0.01, message: '商品成本价格必须大于等于 0.00 元!!!', }, ]; // sku 相关属性校验规则 @@ -222,7 +198,7 @@ async function handleSubmit() { item.secondBrokeragePrice = convertToInteger(item.secondBrokeragePrice); }); } - // 处理轮播图列表 TODO @puhui999:这个是必须的哇? + // 处理轮播图列表:上传组件可能返回对象或字符串,统一处理成字符串数组 const newSliderPicUrls: any[] = []; values.sliderPicUrls!.forEach((item: any) => { // 如果是前端选的图 @@ -344,7 +320,28 @@ onMounted(async () => { @@ -410,7 +407,6 @@ onMounted(async () => {