Compare commits

..

3 Commits

Author SHA1 Message Date
shanshanzhong147 1834b97fe2 修复(#134): 促销前端展示对齐 (expires_at / billing 补 promo_discount / 类型补字段)
PR Check / Lint, Check, Test and Build (push) Has been cancelled
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 中英文文案。
2026-06-02 20:27:54 -07:00
shanshanzhong147 23f51a1ef4 修复(#122): 合并促销价档位提交到测试环境
PR Check / Lint, Check, Test and Build (push) Has been cancelled
2026-05-29 04:15:40 -07:00
shanshanzhong147 c46944aae1 新功能(#113): 新增促销管理后台页面
PR Check / Lint, Check, Test and Build (push) Has been cancelled
2026-05-29 00:34:37 -07:00
7 changed files with 40 additions and 37 deletions
+5 -11
View File
@@ -44,7 +44,7 @@ const WITHDRAWAL_METHOD_MAP: Record<number, string> = {
0: "其他",
1: "支付宝",
2: "微信",
3: "USDT(TRC20)",
3: "银行卡",
};
const rejectSchema = z.object({
@@ -55,12 +55,6 @@ const rejectSchema = z.object({
.max(500, "拒绝原因不能超过 500 个字符"),
});
function toOptionalNumber(value?: string) {
if (!value) return;
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : undefined;
}
function QrCodeCell({ url }: { url?: string }) {
const [zoomOpen, setZoomOpen] = useState(false);
if (!url) return <span>--</span>;
@@ -149,7 +143,7 @@ export default function WithdrawalPage() {
const methodOptions = [
{ value: "1", label: "支付宝" },
{ value: "2", label: "微信" },
{ value: "3", label: "USDT(TRC20)" },
{ value: "3", label: "银行卡" },
{ value: "0", label: "其他" },
];
@@ -315,9 +309,9 @@ export default function WithdrawalPage() {
const { data } = await getWithdrawalList({
page: pagination.page,
size: pagination.size,
status: toOptionalNumber(filter.status),
method: toOptionalNumber(filter.method),
user_id: toOptionalNumber(filter.user_id),
status: filter.status ? Number(filter.status) : undefined,
method: filter.method ? Number(filter.method) : undefined,
user_id: filter.user_id ? Number(filter.user_id) : undefined,
});
return {
@@ -9,6 +9,7 @@
"originalPrice": "Original Price (Monthly)",
"price": "Price",
"productDiscount": "Product Discount",
"promoDiscount": "Promo Discount",
"total": "Total"
},
"buy": "Buy",
@@ -9,6 +9,7 @@
"originalPrice": "原价(按月)",
"price": "价格",
"productDiscount": "商品折扣",
"promoDiscount": "促销优惠",
"total": "总价"
},
"buy": "购买",
@@ -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<SubscribeBillingProps>) {
<Display type="currency" value={order?.discount} />
</span>
</li>
<li>
<span className="text-muted-foreground">
{t("billing.promoDiscount", "Promo Discount")}
</span>
<span>
<Display type="currency" value={order?.promo_discount} />
</span>
</li>
<li>
<span className="text-muted-foreground">
{t("billing.couponDiscount", "Coupon Discount")}
@@ -18,10 +18,10 @@ export function PromoInfo({ discount }: Readonly<PromoInfoProps>) {
<span className="font-medium">
{promo.rule_name || t("promo.available", "Promo Available")}
</span>
{promo.end_time && (
{promo.expires_at && (
<span className="text-muted-foreground text-xs">
{t("promo.validUntil", "Valid until")}:{" "}
{new Date(promo.end_time * 1000).toLocaleString()}
{new Date(promo.expires_at * 1000).toLocaleString()}
</span>
)}
</div>
+19 -23
View File
@@ -63,7 +63,7 @@ import { useGlobalStore } from "@/stores/global";
const WITHDRAWAL_METHODS = [
{ value: 1, label: "支付宝" },
{ value: 2, label: "微信" },
{ value: 3, label: "USDT(TRC20)" },
{ value: 3, label: "银行卡" },
{ value: 0, label: "其他" },
] as const;
@@ -111,21 +111,13 @@ function QrCodeView({ url }: { url: string }) {
<img
alt="收款码"
className="h-16 w-16 cursor-zoom-in object-cover"
height={64}
src={url}
width={64}
/>
</button>
{zoomOpen && (
<Dialog onOpenChange={setZoomOpen} open={zoomOpen}>
<DialogContent className="max-w-sm">
<img
alt="收款码"
className="w-full"
height={320}
src={url}
width={320}
/>
<img alt="收款码" className="w-full" src={url} />
</DialogContent>
</Dialog>
)}
@@ -161,16 +153,18 @@ const withdrawalFormSchema = z
if (!data.account) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "USDT(TRC20) 地址为必填",
message: "银行卡收款账号为必填",
path: ["account"],
});
}
} else if (data.method === 0) {
if (!data.account && !data.content) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "收款账号和备注至少填一项",
path: ["account"],
});
}
} else if (data.method === 0 && !(data.account || data.content)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "收款账号和备注至少填一项",
path: ["account"],
});
}
});
@@ -427,7 +421,9 @@ export default function Affiliate() {
<FormItem>
<FormLabel>
<span className="ml-1 text-destructive">*</span>
<span className="ml-1 text-destructive">
*
</span>
</FormLabel>
{watchedQrCodeUrl ? (
<div className="relative inline-block">
@@ -450,9 +446,7 @@ export default function Affiliate() {
returnType="file"
>
<div className="flex h-24 w-24 flex-col items-center justify-center rounded border-2 border-dashed text-muted-foreground text-xs">
{qrUploading
? "上传中..."
: "点击上传\n收款码"}
{qrUploading ? "上传中..." : "点击上传\n收款码"}
</div>
</UploadImage>
)}
@@ -480,7 +474,7 @@ export default function Affiliate() {
<Input
placeholder={
watchedMethod === 3
? "请输入 USDT(TRC20) 收款地址"
? "请输入银行卡号或账户信息"
: "请输入收款账号(与备注至少填一项)"
}
{...field}
@@ -525,7 +519,9 @@ export default function Affiliate() {
</Button>
<Button
disabled={
submitting || qrUploading || availableCommission <= 0
submitting ||
qrUploading ||
availableCommission <= 0
}
form="withdrawal-form"
type="submit"
+3 -1
View File
@@ -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 = {