引入 husky,并全局重新格式化
This commit is contained in:
@@ -22,7 +22,6 @@ export type PayProps = {
|
||||
}
|
||||
|
||||
export default function Pay(props: PayProps) {
|
||||
|
||||
const profile = useProfileStore(store => store.profile)
|
||||
const refreshProfile = useProfileStore(store => store.refreshProfile)
|
||||
|
||||
@@ -115,25 +114,31 @@ export default function Pay(props: PayProps) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className={`mt-4 h-12`} onClick={onOpen}>
|
||||
<Button className="mt-4 h-12" onClick={onOpen}>
|
||||
立即支付
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle className={`flex gap-2 items-center`}>
|
||||
{props.method === 'alipay' && (<>
|
||||
<Image src={alipay} alt={`支付宝`} width={20} height={20}/>
|
||||
<span>支付宝</span>
|
||||
</>)}
|
||||
{props.method === 'wechat' && (<>
|
||||
<Image src={wechat} alt={`微信`} width={20} height={20}/>
|
||||
<span>微信</span>
|
||||
</>)}
|
||||
{props.method === 'balance' && (<>
|
||||
<Image src={balance} alt={`余额`} width={20} height={20}/>
|
||||
<span>余额支付</span>
|
||||
</>)}
|
||||
<DialogTitle className="flex gap-2 items-center">
|
||||
{props.method === 'alipay' && (
|
||||
<>
|
||||
<Image src={alipay} alt="支付宝" width={20} height={20}/>
|
||||
<span>支付宝</span>
|
||||
</>
|
||||
)}
|
||||
{props.method === 'wechat' && (
|
||||
<>
|
||||
<Image src={wechat} alt="微信" width={20} height={20}/>
|
||||
<span>微信</span>
|
||||
</>
|
||||
)}
|
||||
{props.method === 'balance' && (
|
||||
<>
|
||||
<Image src={balance} alt="余额" width={20} height={20}/>
|
||||
<span>余额支付</span>
|
||||
</>
|
||||
)}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -143,17 +148,25 @@ export default function Pay(props: PayProps) {
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-weak text-sm">账户余额</span>
|
||||
<span className={`text-lg`}>{profile.balance}元</span>
|
||||
<span className="text-lg">
|
||||
{profile.balance}
|
||||
元
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-weak text-sm">支付金额</span>
|
||||
<span className="text-lg text-accent">- {props.amount}元</span>
|
||||
<span className="text-lg text-accent">
|
||||
-
|
||||
{props.amount}
|
||||
元
|
||||
</span>
|
||||
</div>
|
||||
<hr className="my-2"/>
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-weak text-sm">支付后余额</span>
|
||||
<span className={`text-lg ${balanceEnough ? 'text-done' : `text-fail`}`}>
|
||||
{(profile.balance - Number(props.amount)).toFixed(2)}元
|
||||
{(profile.balance - Number(props.amount)).toFixed(2)}
|
||||
元
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -182,16 +195,27 @@ export default function Pay(props: PayProps) {
|
||||
? <iframe src={payInfo.pay_url} className="w-full h-full"/>
|
||||
: <canvas ref={canvas} className="w-full h-full"/>
|
||||
) : (
|
||||
<Loader size={40} className={`animate-spin text-weak`}/>
|
||||
<Loader size={40} className="animate-spin text-weak"/>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 text-center">
|
||||
请使用{props.method === 'alipay' ? '支付宝' : '微信'}扫码支付
|
||||
请使用
|
||||
{props.method === 'alipay' ? '支付宝' : '微信'}
|
||||
扫码支付
|
||||
</p>
|
||||
</div>
|
||||
<div className="text-center space-y-1">
|
||||
<p className="font-medium">支付金额: <span className="text-accent">{props.amount}元</span></p>
|
||||
<p className="text-xs text-gray-500">订单号: {payInfo?.trade_no || '创建订单中...'}</p>
|
||||
<p className="font-medium">
|
||||
支付金额:
|
||||
<span className="text-accent">
|
||||
{props.amount}
|
||||
元
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-xs text-gray-500">
|
||||
订单号:
|
||||
{payInfo?.trade_no || '创建订单中...'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user