feat(payment): 兑换码 - 增加可配置联动小铺入口 (#668)

Co-authored-by: linxi <linxi@enjoysoftware.cn>
This commit is contained in:
naidalao
2026-10-05 13:41:17 +08:00
committed by GitHub
parent b4ba329ad5
commit 7c3f06b151
6 changed files with 85 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import { closePaymentOrder, createPaymentOrder, getPaymentOrder, listPaymentProv
import { getWallet, redeemCredits, type CreditLedgerEntry, type WalletSummary } from "@/services/api/wallet";
import { cn } from "@/lib/utils";
import { openWorkspaceWallet, WORKSPACE_WALLET_OPEN_EVENT, type WorkspaceWalletOpenDetail } from "@/lib/workspace-wallet";
import { useAppearanceStore } from "@/stores/use-appearance-store";
import { useUserStore } from "@/stores/use-user-store";
type WalletModalTab = "topup" | "redeem" | "history";
@@ -64,6 +65,7 @@ export function WorkspaceWalletHost() {
export function WorkspaceWalletModal({ open, onClose, pendingPaymentOrderId, paymentInvalid }: { open: boolean; onClose: () => void; pendingPaymentOrderId?: string; paymentInvalid?: boolean }) {
const { message } = App.useApp();
const redeemPurchaseUrl = useAppearanceStore((state) => state.appearance.redeemPurchaseUrl);
const [tab, setTab] = useState<WalletModalTab>("topup");
const [wallet, setWallet] = useState<WalletSummary | null>(null);
const [walletLoading, setWalletLoading] = useState(false);
@@ -378,7 +380,14 @@ export function WorkspaceWalletModal({ open, onClose, pendingPaymentOrderId, pay
<div className="workspace-wallet-section-heading">
<div>
<h3>兑换码</h3>
<p>输入兑换码,将积分存入当前账户。</p>
<p>
购买后请复制卡密,返回此处兑换。
{redeemPurchaseUrl ? (
<a className="workspace-wallet-redeem-link" href={redeemPurchaseUrl} target="_blank" rel="noopener noreferrer">
获取兑换码
</a>
) : null}
</p>
</div>
<TicketCheck />
</div>