取消关闭支付弹窗调用关闭订单接口 & 添加未实名去支付时的拦截

This commit is contained in:
Eamon-meng
2026-04-20 16:22:49 +08:00
parent 74d53c619d
commit 27e694ee0d
3 changed files with 41 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "lanhu-web", "name": "lanhu-web",
"version": "1.7.0", "version": "1.8.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -H 0.0.0.0 --turbopack", "dev": "next dev -H 0.0.0.0 --turbopack",

View File

@@ -17,21 +17,21 @@ export type PaymentModalProps = {
export function PaymentModal(props: PaymentModalProps) { export function PaymentModal(props: PaymentModalProps) {
// 手动关闭时的处理 // 手动关闭时的处理
const handleClose = async () => { const handleClose = async () => {
try { // try {
const res = await payClose({ // const res = await payClose({
trade_no: props.inner_no, // trade_no: props.inner_no,
method: props.method, // method: props.method,
}) // })
if (!res.success) { // if (!res.success) {
throw new Error(res.message) // throw new Error(res.message)
} // }
} // }
catch (error) { // catch (error) {
console.error('关闭订单失败:', error) // console.error('关闭订单失败:', error)
} // }
finally { // finally {
props.onClose?.() props.onClose?.()
} // }
} }
// SSE处理方式检查支付状态 // SSE处理方式检查支付状态

View File

@@ -14,6 +14,7 @@ import {ExtraResp} from '@/lib/api'
import {formatPurchaseLiveLabel} from './sku' import {formatPurchaseLiveLabel} from './sku'
import {User} from '@/lib/models' import {User} from '@/lib/models'
import {PurchaseFormValues} from './form-values' import {PurchaseFormValues} from './form-values'
import {IdCard} from 'lucide-react'
const emptyPrice: ExtraResp<typeof getPrice> = { const emptyPrice: ExtraResp<typeof getPrice> = {
price: '0.00', price: '0.00',
@@ -107,15 +108,30 @@ export function PurchaseSidePanel(props: PurchaseSidePanelProps) {
<span className="text-xl text-orange-500">{discountedPrice}</span> <span className="text-xl text-orange-500">{discountedPrice}</span>
</p> </p>
{profile ? ( {profile ? (
<> profile.id_type !== 0 ? (
<FieldPayment balance={profile.balance}/> <>
<Pay <FieldPayment balance={profile.balance}/>
method={method} <Pay
balance={profile.balance} method={method}
amount={discountedPrice} balance={profile.balance}
resource={resource} amount={discountedPrice}
/> resource={resource}
</> />
</>
) : (
<div className="flex flex-col gap-3">
<p className="text-sm text-gray-500">
</p>
<Link
href="/admin/identify"
className={buttonVariants()}
>
<IdCard size={16} className="mr-1"/>
</Link>
</div>
)
) : ( ) : (
<Link href="/login" className={buttonVariants()}> <Link href="/login" className={buttonVariants()}>