Commit 1becb8ab authored by zengqiang's avatar zengqiang

feat: appId从后端返回,不再使用固定值

- WithdrawResponse和WithdrawPackageInfoResponseData添加appId字段 - withdraw/index.vue传递appId到ConfirmReceipt页面 - ConfirmReceipt.vue从URL参数或fetchPackageInfo响应获取appId
parent 2792a20a
......@@ -94,6 +94,7 @@ export interface WithdrawResponse {
expectedPayTime: string;
packageInfo?: string;
mchId?: string;
appId?: string;
}
export interface WithdrawRiskResponse {
......
......@@ -12,6 +12,7 @@ interface WithdrawStatusResponseData {
interface WithdrawPackageInfoResponseData {
packageInfo: string;
mchId: string;
appId: string;
}
/**
......
......@@ -140,7 +140,8 @@ const Withdraw = defineComponent({
amount: data.amount.toFixed(2),
withdrawAccount: encodeURIComponent(data.withdrawAccount),
packageInfo: encodeURIComponent(data.packageInfo),
mchId: data.mchId || ''
mchId: data.mchId || '',
appId: data.appId || ''
}
})
} else {
......
......@@ -33,9 +33,6 @@ import { defineComponent } from 'vue'
import { getWithdrawPackageInfo } from '@/server/api/withdrawService'
import { requestMerchantTransfer } from '@/util/use-native-bridge'
// 微信开放平台移动应用 appId
const WECHAT_APP_ID = 'wxce3ddfea994471b9'
export default defineComponent({
name: 'ConfirmReceipt',
data () {
......@@ -45,6 +42,7 @@ export default defineComponent({
withdrawAccount: '',
packageInfo: '',
mchId: '',
appId: '',
loading: true
}
},
......@@ -58,6 +56,7 @@ export default defineComponent({
// 场景1:从提现表单页进入,已有 packageInfo
this.packageInfo = decodeURIComponent(query.packageInfo as string)
this.mchId = (query.mchId as string) || ''
this.appId = (query.appId as string) || ''
this.loading = false
} else if (this.withdrawNo) {
// 场景2:从列表页进入,需要查询 packageInfo
......@@ -75,7 +74,8 @@ export default defineComponent({
if (res) {
this.packageInfo = res.packageInfo || ''
this.mchId = res.mchId || ''
console.log('packageInfo:', this.packageInfo, 'mchId:', this.mchId)
this.appId = res.appId || ''
console.log('packageInfo:', this.packageInfo, 'mchId:', this.mchId, 'appId:', this.appId)
} else {
console.log('no data in response')
alert('获取提现信息失败')
......@@ -88,8 +88,8 @@ export default defineComponent({
}
},
async handleConfirm () {
if (!this.packageInfo || !this.mchId) {
console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId })
if (!this.packageInfo || !this.mchId || !this.appId) {
console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId, appId: this.appId })
alert('缺少必要参数,无法确认收款')
return
}
......@@ -98,7 +98,7 @@ export default defineComponent({
// 调用原生方法唤起微信确认收款
await requestMerchantTransfer({
mchId: this.mchId,
appId: WECHAT_APP_ID,
appId: this.appId,
package: this.packageInfo
})
......
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