首页接口更新&&支付页面调试
This commit is contained in:
@@ -25,8 +25,6 @@ export type PayProps = {
|
||||
}
|
||||
|
||||
export default function Pay(props: PayProps) {
|
||||
console.log(props, 'props')
|
||||
|
||||
const profile = useProfileStore(store => store.profile)
|
||||
const refreshProfile = useProfileStore(store => store.refreshProfile)
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -44,7 +42,6 @@ export default function Pay(props: PayProps) {
|
||||
: props.method === 'alipay'
|
||||
? TradeMethod.SftAlipay
|
||||
: TradeMethod.SftWechat
|
||||
console.log(method, 'methodConfig')
|
||||
|
||||
const res = {
|
||||
...props.resource,
|
||||
@@ -111,7 +108,6 @@ export default function Pay(props: PayProps) {
|
||||
立即支付
|
||||
</Button>
|
||||
|
||||
{/* 余额支付对话框 */}
|
||||
{/* 余额支付对话框 */}
|
||||
{props.method === 'balance' && (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
@@ -186,11 +182,21 @@ export default function Pay(props: PayProps) {
|
||||
{props.method !== 'balance' && trade && (
|
||||
<PaymentModal
|
||||
{...trade}
|
||||
onSuccess={() => {
|
||||
toast.success('支付成功')
|
||||
setTrade(null)
|
||||
setOpen(false)
|
||||
refreshProfile()
|
||||
onConfirm={async () => {
|
||||
try {
|
||||
const resp = await completeResource({trade_no: trade.inner_no})
|
||||
if (!resp.success) {
|
||||
throw new Error(resp.message)
|
||||
}
|
||||
|
||||
toast.success('支付成功')
|
||||
setTrade(null)
|
||||
setOpen(false)
|
||||
refreshProfile()
|
||||
}
|
||||
catch (e) {
|
||||
toast.error('支付验证失败', {description: (e as Error).message})
|
||||
}
|
||||
}}
|
||||
onClose={() => {
|
||||
setTrade(null)
|
||||
|
||||
Reference in New Issue
Block a user