From 760c5dde2a0995d4ddb0112a5dff0e6a97f68bba Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Tue, 21 Oct 2025 18:17:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=9B=E4=B8=80=E6=AD=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/mall/product/spu/modules/form.vue | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/web-antd/src/views/mall/product/spu/modules/form.vue b/apps/web-antd/src/views/mall/product/spu/modules/form.vue index d1b1a1508..7a0c2c10d 100644 --- a/apps/web-antd/src/views/mall/product/spu/modules/form.vue +++ b/apps/web-antd/src/views/mall/product/spu/modules/form.vue @@ -89,7 +89,7 @@ const formData = ref({ virtualSalesCount: 0, // 虚拟销量 }); const propertyList = ref([]); // 商品属性列表 -const formLoading = ref(false); // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 +const formLoading = ref(true); // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const isDetail = ref(false); // 是否查看详情 const skuListRef = ref(); // 商品属性列表 Ref @@ -236,13 +236,12 @@ async function onSubmit() { } /** 获得详情 */ -const getDetail = async () => { +async function getDetail() { if (name === 'ProductSpuDetail') { isDetail.value = true; } const id = params.id as unknown as number; if (id) { - formLoading.value = true; try { const res = await getSpu(spuId.value!); res.skus?.forEach((item) => { @@ -276,7 +275,7 @@ const getDetail = async () => { } // 将 SKU 的属性,整理成 PropertyAndValues 数组 propertyList.value = getPropertyList(formData.value); -}; +} // =========== sku form 逻辑 =========== @@ -285,21 +284,21 @@ function openPropertyAddForm() { } /** 调用 SkuList generateTableData 方法*/ -const generateSkus = (propertyList: any[]) => { +function generateSkus(propertyList: any[]) { skuListRef.value.generateTableData(propertyList); -}; +} /** 分销类型 */ -const changeSubCommissionType = () => { +function changeSubCommissionType() { // 默认为零,类型切换后也要重置为零 for (const item of formData.value.skus!) { item.firstBrokeragePrice = 0; item.secondBrokeragePrice = 0; } -}; +} /** 选择规格 */ -const onChangeSpec = () => { +function onChangeSpec() { // 重置商品属性列表 propertyList.value = []; // 重置sku列表 @@ -317,7 +316,7 @@ const onChangeSpec = () => { secondBrokeragePrice: 0, }, ]; -}; +} // 监听 sku form schema 变化,更新表单 watch( @@ -345,7 +344,8 @@ onMounted(async () => { { +