diff --git a/apps/web-antd/src/views/product/detail/composables/product-detail-page/sku-actions.ts b/apps/web-antd/src/views/product/detail/composables/product-detail-page/sku-actions.ts index 59a0461..ae445ab 100644 --- a/apps/web-antd/src/views/product/detail/composables/product-detail-page/sku-actions.ts +++ b/apps/web-antd/src/views/product/detail/composables/product-detail-page/sku-actions.ts @@ -67,6 +67,19 @@ export function createProductDetailSkuActions( ); } + function formatOptionExtraPrice(extraPrice: number) { + const normalized = normalizeMoney(extraPrice); + const prefix = normalized >= 0 ? '+' : '-'; + return `${prefix}¥${Math.abs(normalized).toFixed(2)}`; + } + + function getOptionDisplayText(templateId: string, optionId: string) { + if (!optionId) return '-'; + const name = getOptionName(templateId, optionId); + const extraPrice = resolveSpecOptionExtraPrice(templateId, optionId); + return `${name} (${formatOptionExtraPrice(extraPrice)})`; + } + function getSkuAttrOptionId( row: ProductDetailSkuRowState, templateId: string, @@ -218,6 +231,7 @@ export function createProductDetailSkuActions( applySkuBatchPrice, applySkuBatchStock, buildSkuRows, + getOptionDisplayText, getOptionName, getSkuAttrOptionId, getTemplateName, diff --git a/apps/web-antd/src/views/product/detail/composables/useProductDetailPage.ts b/apps/web-antd/src/views/product/detail/composables/useProductDetailPage.ts index 2dbf63e..7d97069 100644 --- a/apps/web-antd/src/views/product/detail/composables/useProductDetailPage.ts +++ b/apps/web-antd/src/views/product/detail/composables/useProductDetailPage.ts @@ -138,6 +138,7 @@ export function useProductDetailPage() { deleteCurrentProduct: dataActions.deleteCurrentProduct, detail, form, + getOptionDisplayText: skuActions.getOptionDisplayText, getOptionName: skuActions.getOptionName, getSkuAttrOptionId: skuActions.getSkuAttrOptionId, getTemplateName: skuActions.getTemplateName, diff --git a/apps/web-antd/src/views/product/detail/index.vue b/apps/web-antd/src/views/product/detail/index.vue index 2bcc453..82e1cc5 100644 --- a/apps/web-antd/src/views/product/detail/index.vue +++ b/apps/web-antd/src/views/product/detail/index.vue @@ -47,7 +47,7 @@ const { deleteCurrentProduct, detail, form, - getOptionName, + getOptionDisplayText, getSkuAttrOptionId, goBack, isLoading, @@ -534,7 +534,7 @@ watch( > {{ - getOptionName( + getOptionDisplayText( column.id, getSkuAttrOptionId(row, column.id) || '', )