✨ feat(封装招商银行支付):
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { Button, View } from '@tarojs/components'
|
||||
import Taro, { useDidShow, useRouter } from '@tarojs/taro'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
interface Param {
|
||||
merchId: string
|
||||
custMerchId: string
|
||||
needCashier?: '1'|'0'
|
||||
}
|
||||
export default () => {
|
||||
const [payStatus, setPayStatus] = useState(false)
|
||||
Taro.onAppShow((res) => {
|
||||
if (res?.referrerInfo?.appId == 'wx65934ee32a88d726') {
|
||||
const tf = res?.referrerInfo?.extraData?.payStatus == 'success'
|
||||
setPayStatus(() => tf)
|
||||
}
|
||||
})
|
||||
const pullBank = ({ merchId = '', custMerchId = '', needCashier = '1' }: Param) => {
|
||||
Taro.navigateToMiniProgram({
|
||||
appId: CURRENT_PAY_Bank_APPID, // 生产环境Id【UAT测试环境appId:wx0fb358ee24237c71】
|
||||
// appId: 'wx0fb358ee24237c71', // 生产环境Id【UAT测试环境appId:wx0fb358ee24237c71】
|
||||
path: 'pages/index/index',
|
||||
extraData: {
|
||||
merchId, // 传商户号(必填,此处传JE开头的商户号)
|
||||
custMerchId, // 传缴费号(必填,对接下单接口的payNo)
|
||||
needCashier, // 0-展示支付方式选择页,1-跳过支付方式选择页,直接用微信支付(当配置了多种支付方式时,传1也不会跳过支付方式选择页)
|
||||
},
|
||||
success(res) { // 打开成功的回调函数
|
||||
console.log('打开成功::', res)
|
||||
},
|
||||
fail(res) {
|
||||
console.log('打开失败::', res)
|
||||
},
|
||||
complete(res) {
|
||||
console.log('打开结果::', res)
|
||||
},
|
||||
})
|
||||
}
|
||||
return {
|
||||
pullBank,
|
||||
payStatus,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user