import {
Alert,
Button,
InputNumber,
QRCode,
Space,
Tag,
Typography,
} from 'antd';
import { ReloadOutlined } from '@ant-design/icons';
import type {
WeiboPaymentStatusResult,
WeiboRechargeOrderResult,
} from '../api/modules';
import { WEIBO_PAYMENT_STATUS_LABELS } from '../utils/weiboPayment';
const { Text } = Typography;
interface WeiboRechargePanelProps {
enabled: boolean;
amount: number;
onAmountChange: (value: number) => void;
creating: boolean;
onCreate: () => void;
order: WeiboRechargeOrderResult | null;
paymentStatus: WeiboPaymentStatusResult | null;
statusLoading: boolean;
onRefreshStatus: () => void;
onRefreshBalance?: () => void;
}
export default function WeiboRechargePanel({
enabled,
amount,
onAmountChange,
creating,
onCreate,
order,
paymentStatus,
statusLoading,
onRefreshStatus,
onRefreshBalance,
}: WeiboRechargePanelProps) {
const paid = paymentStatus?.status === 'PAY_STATUS_SUCCESS';
const failed = paymentStatus?.status === 'PAY_STATUS_FAILED'
|| paymentStatus?.status === 'PAY_STATUS_CLOSED';
return (
<>
助威充值
onAmountChange(Number(value) || 1)}
style={{ width: 110 }}
/>
{order && (
{paid ? (
) : failed ? (
) : (
)}
{order.amount_yuan} 元 · 预计{' '}
{order.single_reward.toLocaleString()} 微豆
订单号{' '}
{order.order_id}
}
loading={statusLoading}
onClick={onRefreshStatus}
>
刷新支付状态
{order.desktop_pay_url && !paid && !failed && (
)}
{onRefreshBalance && (
)}
{paymentStatus && (
{WEIBO_PAYMENT_STATUS_LABELS[paymentStatus.status]
|| paymentStatus.status}
)}
)}
>
);
}