取消关闭支付弹窗调用关闭订单接口 & 添加未实名去支付时的拦截
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lanhu-web",
|
||||
"version": "1.7.0",
|
||||
"version": "1.8.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -H 0.0.0.0 --turbopack",
|
||||
|
||||
@@ -17,21 +17,21 @@ export type PaymentModalProps = {
|
||||
export function PaymentModal(props: PaymentModalProps) {
|
||||
// 手动关闭时的处理
|
||||
const handleClose = async () => {
|
||||
try {
|
||||
const res = await payClose({
|
||||
trade_no: props.inner_no,
|
||||
method: props.method,
|
||||
})
|
||||
if (!res.success) {
|
||||
throw new Error(res.message)
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error('关闭订单失败:', error)
|
||||
}
|
||||
finally {
|
||||
props.onClose?.()
|
||||
}
|
||||
// try {
|
||||
// const res = await payClose({
|
||||
// trade_no: props.inner_no,
|
||||
// method: props.method,
|
||||
// })
|
||||
// if (!res.success) {
|
||||
// throw new Error(res.message)
|
||||
// }
|
||||
// }
|
||||
// catch (error) {
|
||||
// console.error('关闭订单失败:', error)
|
||||
// }
|
||||
// finally {
|
||||
props.onClose?.()
|
||||
// }
|
||||
}
|
||||
|
||||
// SSE处理方式检查支付状态
|
||||
|
||||
@@ -14,6 +14,7 @@ import {ExtraResp} from '@/lib/api'
|
||||
import {formatPurchaseLiveLabel} from './sku'
|
||||
import {User} from '@/lib/models'
|
||||
import {PurchaseFormValues} from './form-values'
|
||||
import {IdCard} from 'lucide-react'
|
||||
|
||||
const emptyPrice: ExtraResp<typeof getPrice> = {
|
||||
price: '0.00',
|
||||
@@ -107,15 +108,30 @@ export function PurchaseSidePanel(props: PurchaseSidePanelProps) {
|
||||
<span className="text-xl text-orange-500">¥{discountedPrice}</span>
|
||||
</p>
|
||||
{profile ? (
|
||||
<>
|
||||
<FieldPayment balance={profile.balance}/>
|
||||
<Pay
|
||||
method={method}
|
||||
balance={profile.balance}
|
||||
amount={discountedPrice}
|
||||
resource={resource}
|
||||
/>
|
||||
</>
|
||||
profile.id_type !== 0 ? (
|
||||
<>
|
||||
<FieldPayment balance={profile.balance}/>
|
||||
<Pay
|
||||
method={method}
|
||||
balance={profile.balance}
|
||||
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()}>
|
||||
登录后支付
|
||||
|
||||
Reference in New Issue
Block a user