diff --git a/apps/web-ele/src/utils/index.ts b/apps/web-ele/src/utils/index.ts index f07b644b..162976e7 100644 --- a/apps/web-ele/src/utils/index.ts +++ b/apps/web-ele/src/utils/index.ts @@ -6,6 +6,5 @@ export * from './rangePickerProps'; export * from './routerHelper'; export * from './validator'; export * from './tree'; -export * from './formatNum'; export * from './is'; export * from './bean'; diff --git a/apps/web-ele/src/views/mall/product/spu/modules/detail.vue b/apps/web-ele/src/views/mall/product/spu/modules/detail.vue index c28ebc68..147f1566 100644 --- a/apps/web-ele/src/views/mall/product/spu/modules/detail.vue +++ b/apps/web-ele/src/views/mall/product/spu/modules/detail.vue @@ -1,3 +1,499 @@ - + + + + + + 商品详情 + + + + + + + 编辑商品 + + + + 返回列表 + + + + + + + + + {{ formData.name }} + + {{ formData.introduction || '暂无简介' }} + + + 多规格 + 单规格 + 分销 + 库存: + {{ + formData.skus?.reduce( + (sum, sku) => sum + (sku.stock || 0), + 0, + ) || 0 + }} + 分类: {{ getCategoryNameById(formData.categoryId) }} + + + + + + + + + + + {{ + formData.name + }} + + {{ + getCategoryNameById(formData.categoryId) + }} + + + {{ + getBrandNameById(formData.brandId) + }} + + + {{ formData.keyword || '无' }} + {{ + formData.giveIntegral + }} + {{ + formData.virtualSalesCount + }} + {{ + formData.sort + }} + + + {{ formData.specType ? '多规格' : '单规格' }} + + + + + {{ formData.subCommissionType ? '单独设置' : '默认设置' }} + + + + + + + + + + + + {{ getDeliveryTypeName(type) }} + + + 暂无配送方式 + + + + {{ + formData.deliveryTemplateId || '未设置' + }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 价格信息 + + + 销售价: + + ¥{{ sku.price }} + + 市场价: + ¥{{ sku.marketPrice }} + 成本价: + ¥{{ sku.costPrice }} + + + + + + + 库存信息 + + + 库存: + {{ sku.stock }} 件 + 条码: + {{ sku.barCode || '未设置' }} + + + + + + + 物流信息 + + + 重量: + {{ sku.weight }} kg + 体积: + {{ sku.volume }} m³ + + + + + + + + + 分销佣金 + + + 一级佣金: + ¥{{ sku.firstBrokeragePrice }} + 二级佣金: + ¥{{ sku.secondBrokeragePrice }} + + + + + + 规格属性 + + + {{ prop.propertyName }}: {{ prop.valueName }} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web-ele/src/views/mall/product/spu/modules/form.vue b/apps/web-ele/src/views/mall/product/spu/modules/form.vue index 9df12176..a1619905 100644 --- a/apps/web-ele/src/views/mall/product/spu/modules/form.vue +++ b/apps/web-ele/src/views/mall/product/spu/modules/form.vue @@ -4,7 +4,7 @@ import { onMounted, ref, unref } from 'vue'; import { cloneDeep } from '@vben/utils'; import type { MallSpuApi } from '#/api/mall/product/spu'; import { useRouter, useRoute } from 'vue-router'; -import { floatToFixed2, formatToFraction, convertToInteger } from '@vben/utils'; +import { formatToFraction, convertToInteger } from '@vben/utils'; import * as ProductSpuApi from '#/api/mall/product/spu'; import { ElMessage } from 'element-plus'; @@ -51,36 +51,22 @@ const formData = ref({ }); const formLoading = ref(false); // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 -const isDetail = ref(false); // 是否查看详情 const { push } = useRouter(); // 路由 -const { params, name } = useRoute(); // 查询参数 +const { params } = useRoute(); // 查询参数 /** 获得详情 */ const getDetail = async () => { - if ('ProductSpuDetail' === name) { - isDetail.value = true; - } const id = params.id as unknown as number; if (id) { formLoading.value = true; try { const res = (await ProductSpuApi.getSpu(id)) as MallSpuApi.Spu; res.skus?.forEach((item: MallSpuApi.Sku) => { - if (isDetail.value) { - item.price = floatToFixed2(item.price); - item.marketPrice = floatToFixed2(item.marketPrice); - item.costPrice = floatToFixed2(item.costPrice); - item.firstBrokeragePrice = floatToFixed2(item.firstBrokeragePrice); - item.secondBrokeragePrice = floatToFixed2(item.secondBrokeragePrice); - } else { - // 回显价格分转元 - item.price = formatToFraction(item.price); - item.marketPrice = formatToFraction(item.marketPrice); - item.costPrice = formatToFraction(item.costPrice); - item.firstBrokeragePrice = formatToFraction(item.firstBrokeragePrice); - item.secondBrokeragePrice = formatToFraction( - item.secondBrokeragePrice, - ); - } + // 回显价格分转元 + item.price = formatToFraction(item.price); + item.marketPrice = formatToFraction(item.marketPrice); + item.costPrice = formatToFraction(item.costPrice); + item.firstBrokeragePrice = formatToFraction(item.firstBrokeragePrice); + item.secondBrokeragePrice = formatToFraction(item.secondBrokeragePrice); }); formData.value = res; } finally {