"use client" import { useState, useEffect } from "react" import { useStore } from "@/lib/store" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Switch } from "@/components/ui/switch" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Save, RefreshCw } from "lucide-react" export default function PaymentConfigPage() { const { settings, updateSettings, fetchSettings } = useStore() const [loading, setLoading] = useState(false) const [localSettings, setLocalSettings] = useState(settings.paymentMethods) // Sync with store on mount useEffect(() => { setLocalSettings(settings.paymentMethods) }, [settings.paymentMethods]) const handleSave = async () => { setLoading(true) // Update store (and local storage) updateSettings({ paymentMethods: localSettings }) // Simulate API call delay await new Promise(resolve => setTimeout(resolve, 800)) setLoading(false) alert("配置已保存!") } const handleRefresh = async () => { setLoading(true) await fetchSettings() setLoading(false) } const updateWechat = (field: string, value: any) => { setLocalSettings(prev => ({ ...prev, wechat: { ...prev.wechat, [field]: value } })) } const updateAlipay = (field: string, value: any) => { setLocalSettings(prev => ({ ...prev, alipay: { ...prev.alipay, [field]: value } })) } const updateUsdt = (field: string, value: any) => { setLocalSettings(prev => ({ ...prev, usdt: { ...prev.usdt, [field]: value } })) } return (
配置微信、支付宝及USDT支付参数
当未配置企业支付参数时,将显示此二维码进行个人收款