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