From d121ac7e73c97c97747005a075aaa428d64b0421 Mon Sep 17 00:00:00 2001 From: Chengdong Zhang Date: Wed, 18 Nov 2026 16:52:27 +0800 Subject: [PATCH] feat(mall): show a reconciled price breakdown for configured services Option labels and right-aligned amounts now add up through the monthly subtotal, term, and discount to the total on the product page and direct checkout. Co-authored-by: Cursor --- apps/mall/components/QuoteBreakdown.vue | 63 +++++++++++++++++++++++++ apps/mall/locales/checkout.ts | 4 -- apps/mall/locales/product.ts | 8 ++++ apps/mall/pages/checkout/index.vue | 22 ++++----- apps/mall/pages/goods/[id].vue | 7 +-- docs/code_index/mall.md | 1 + 6 files changed, 82 insertions(+), 23 deletions(-) create mode 100644 apps/mall/components/QuoteBreakdown.vue diff --git a/apps/mall/components/QuoteBreakdown.vue b/apps/mall/components/QuoteBreakdown.vue new file mode 100644 index 0000000..3048585 --- /dev/null +++ b/apps/mall/components/QuoteBreakdown.vue @@ -0,0 +1,63 @@ + + + diff --git a/apps/mall/locales/checkout.ts b/apps/mall/locales/checkout.ts index 45851ec..a9c15bb 100644 --- a/apps/mall/locales/checkout.ts +++ b/apps/mall/locales/checkout.ts @@ -30,8 +30,6 @@ export default { serviceContact: "Delivery contact", priceChanged: "The price changed. Review the new total and confirm.", confirmPrice: "Confirm new price", - monthly: "Monthly equivalent", - termDiscount: "Term discount", promotion: "Promotion", noPromotion: "No promotion", thresholdDiscount: "Threshold reduction", @@ -86,8 +84,6 @@ export default { serviceContact: "交付联系方式", priceChanged: "价格已变化,请核对新的总价后再确认。", confirmPrice: "确认新价格", - monthly: "月均", - termDiscount: "账期折扣", promotion: "优惠", noPromotion: "不使用优惠", thresholdDiscount: "满减优惠", diff --git a/apps/mall/locales/product.ts b/apps/mall/locales/product.ts index 0ae4d93..4a15c30 100644 --- a/apps/mall/locales/product.ts +++ b/apps/mall/locales/product.ts @@ -57,6 +57,10 @@ export default { termDiscount: "Term discount", componentSpecs: "{vcpu} vCPU · {mem} GB · {mbps} Mbps", quoteFailed: "Unable to price this configuration.", + breakdown: "Price breakdown", + quoteTotal: "Total", + monthlySubtotal: "Monthly subtotal", + termTimes: "× {n} months", }, }, zh: { @@ -116,6 +120,10 @@ export default { termDiscount: "账期折扣", componentSpecs: "{vcpu} 核 · {mem} GB · {mbps} Mbps", quoteFailed: "无法计算该配置的价格。", + breakdown: "价格明细", + quoteTotal: "合计", + monthlySubtotal: "月费小计", + termTimes: "× {n} 个月", }, }, }; diff --git a/apps/mall/pages/checkout/index.vue b/apps/mall/pages/checkout/index.vue index c5669ff..87e6027 100644 --- a/apps/mall/pages/checkout/index.vue +++ b/apps/mall/pages/checkout/index.vue @@ -8,6 +8,7 @@ import type { Coupon, GroupBuyIntent, LocalizedText, + OptionGroup, PricingQuote, ShippingQuote, ShopProfile, @@ -43,6 +44,7 @@ const renewSubscriptionId = computed(() => const directConfig = ref(null); const expectedTotal = ref(null); const serviceQuote = ref(null); +const directGroups = ref([]); const priceChanged = ref(false); function readDirectConfig(): void { @@ -272,6 +274,7 @@ async function loadCart(): Promise { $api.getProduct(directProductId.value), $api.listShops().catch(() => [] as ShopProfile[]), ]); + directGroups.value = product.option_groups ?? []; readDirectConfig(); const sku = product.skus?.find((item) => item.id === directSkuId.value); if (directConfig.value) { @@ -452,19 +455,12 @@ onBeforeUnmount(() => {

{{ t("checkout.address") }}

{{ t("checkout.serviceNoAddress") }}

-
    -
  • - {{ line.kind === "discount" ? t("checkout.termDiscount") : line.group_key }} - -
  • -
  • - {{ t("checkout.monthly") }} - -
  • -
+

{{ quoteError }}

-
    -
  • - {{ line.kind === "discount" ? t("product.termDiscount") : line.group_key }} - -
  • -
+
{{ group.key }} diff --git a/docs/code_index/mall.md b/docs/code_index/mall.md index 63212b0..1df0e0f 100644 --- a/docs/code_index/mall.md +++ b/docs/code_index/mall.md @@ -26,6 +26,7 @@ Guidelines: `docs/frontend-guidelines.md`. | `config/chatty.ts` | Chatty plan definitions (catalog slugs, SKU attribute names, provisional examples), capabilities, FAQ, enquiry options | | `composables/useChattyPlans.ts` | resolves each plan's option SKUs from the `chatty` shop, plus option picking helpers; plans with no options stay provisional (not purchasable) | | `locales/chatty.ts` | `chatty.*` en/zh strings | +| `components/QuoteBreakdown.vue` | configured-price breakdown (option-group labels, right-aligned monthly amounts, monthly subtotal × term, discount, total) used on the product page and direct checkout | | `composables/` | session/cart stores, `usePrice` (currency conversion display), `useUnreadMessages` (header badge count) | Remember: mall is the only app with a mock adapter; every new live domain