Commit 2792a20a authored by zengqiang's avatar zengqiang

feat: 确认收款按钮调用原生requestMerchantTransfer方法

- 导入requestMerchantTransfer方法 - appId固定为wxce3ddfea994471b9 - 添加参数校验和错误处理 - 确认后跳转到处理状态页面
parent 822877e7
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { getWithdrawPackageInfo } from '@/server/api/withdrawService' import { getWithdrawPackageInfo } from '@/server/api/withdrawService'
import { requestMerchantTransfer } from '@/util/use-native-bridge'
// 微信开放平台移动应用 appId
const WECHAT_APP_ID = 'wxce3ddfea994471b9'
export default defineComponent({ export default defineComponent({
name: 'ConfirmReceipt', name: 'ConfirmReceipt',
...@@ -84,18 +88,33 @@ export default defineComponent({ ...@@ -84,18 +88,33 @@ export default defineComponent({
} }
}, },
async handleConfirm () { async handleConfirm () {
// H5 唤起用户确认收款弹窗 - 使用 alert 模拟 if (!this.packageInfo || !this.mchId) {
alert('H5确认收款功能:packageInfo=' + this.packageInfo + ', mchId=' + this.mchId) console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId })
alert('缺少必要参数,无法确认收款')
return
}
// 模拟确认成功,跳转到处理状态页面 try {
// 调用原生方法唤起微信确认收款
await requestMerchantTransfer({
mchId: this.mchId,
appId: WECHAT_APP_ID,
package: this.packageInfo
})
// 跳转到处理状态页面
this.$router.replace({ this.$router.replace({
path: '/withdraw/processing-status', path: '/withdraw/processing-status',
query: { query: {
status: 'WAIT_CONFIRM', status: 'TRANSFERING',
withdrawNo: this.withdrawNo, withdrawNo: this.withdrawNo,
amount: this.amount amount: this.amount
} }
}) })
} catch (error) {
console.error('requestMerchantTransfer error:', error)
alert('确认收款失败: ' + error)
}
}, },
handleBack () { handleBack () {
this.$router.replace({ path: '/' }) this.$router.replace({ path: '/' })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment