From 1834b97fe22a3fd89f93003e01c5c88764fdf3ea Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Tue, 2 Jun 2026 20:27:54 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(#134):=20=E4=BF=83=E9=94=80?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=B1=95=E7=A4=BA=E5=AF=B9=E9=BD=90=20(expir?= =?UTF-8?q?es=5Fat=20/=20billing=20=E8=A1=A5=20promo=5Fdiscount=20/=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=A1=A5=E5=AD=97=E6=AE=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squash merge of fix/134-促销前端展示对齐 (4702dee). HIF-79/HIF-113 落地后前端有三处对齐缺失: - promo-info.tsx 仍读 promo.end_time,但后端 SubscribeDiscountPromo JSON 字段是 expires_at(×2 处) - billing.tsx 缺 Promo Discount 行,PreOrderResponse 拿到 promo_discount 时无处可渲染 - typings.d.ts: SubscribeDiscountPromo 缺 expires_at/rule_type, PreOrderResponse 缺 promo_discount 本次仅修字段对齐与展示行,不动业务逻辑、不动 OrderDetail 类型 (后端 当前未透出 promo_discount)。新增 billing.promoDiscount 中英文文案。 --- apps/user/public/assets/locales/en-US/subscribe.json | 1 + apps/user/public/assets/locales/zh-CN/subscribe.json | 1 + apps/user/src/sections/subscribe/billing.tsx | 9 +++++++++ apps/user/src/sections/subscribe/promo-info.tsx | 4 ++-- packages/ui/src/services/user/typings.d.ts | 4 +++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/user/public/assets/locales/en-US/subscribe.json b/apps/user/public/assets/locales/en-US/subscribe.json index 77526c0..812832f 100644 --- a/apps/user/public/assets/locales/en-US/subscribe.json +++ b/apps/user/public/assets/locales/en-US/subscribe.json @@ -9,6 +9,7 @@ "originalPrice": "Original Price (Monthly)", "price": "Price", "productDiscount": "Product Discount", + "promoDiscount": "Promo Discount", "total": "Total" }, "buy": "Buy", diff --git a/apps/user/public/assets/locales/zh-CN/subscribe.json b/apps/user/public/assets/locales/zh-CN/subscribe.json index ece8ba7..d0375bb 100644 --- a/apps/user/public/assets/locales/zh-CN/subscribe.json +++ b/apps/user/public/assets/locales/zh-CN/subscribe.json @@ -9,6 +9,7 @@ "originalPrice": "原价(按月)", "price": "价格", "productDiscount": "商品折扣", + "promoDiscount": "促销优惠", "total": "总价" }, "buy": "购买", diff --git a/apps/user/src/sections/subscribe/billing.tsx b/apps/user/src/sections/subscribe/billing.tsx index c24db2e..ec016a4 100644 --- a/apps/user/src/sections/subscribe/billing.tsx +++ b/apps/user/src/sections/subscribe/billing.tsx @@ -10,6 +10,7 @@ interface SubscribeBillingProps { unit_price: number; unit_time: string; subscribe_discount: number; + promo_discount: number; show_original_price?: boolean; } >; @@ -66,6 +67,14 @@ export function SubscribeBilling({ order }: Readonly) { +
  • + + {t("billing.promoDiscount", "Promo Discount")} + + + + +
  • {t("billing.couponDiscount", "Coupon Discount")} diff --git a/apps/user/src/sections/subscribe/promo-info.tsx b/apps/user/src/sections/subscribe/promo-info.tsx index d6f439e..55f88c0 100644 --- a/apps/user/src/sections/subscribe/promo-info.tsx +++ b/apps/user/src/sections/subscribe/promo-info.tsx @@ -18,10 +18,10 @@ export function PromoInfo({ discount }: Readonly) { {promo.rule_name || t("promo.available", "Promo Available")} - {promo.end_time && ( + {promo.expires_at && ( {t("promo.validUntil", "Valid until")}:{" "} - {new Date(promo.end_time * 1000).toLocaleString()} + {new Date(promo.expires_at * 1000).toLocaleString()} )} diff --git a/packages/ui/src/services/user/typings.d.ts b/packages/ui/src/services/user/typings.d.ts index cfcc498..9a5e1be 100644 --- a/packages/ui/src/services/user/typings.d.ts +++ b/packages/ui/src/services/user/typings.d.ts @@ -548,6 +548,7 @@ declare namespace API { price: number; amount: number; discount: number; + promo_discount: number; gift_amount: number; coupon: string; coupon_discount: number; @@ -1024,8 +1025,9 @@ declare namespace API { type SubscribeDiscountPromo = { rule_name?: string; + rule_type?: string; promo_price: number; - end_time?: number; + expires_at?: number; }; type SubscribeGroup = {