Commit b258ad08 authored by zengqiang's avatar zengqiang

Merge branch 'feature/2026-05-08-wechat-transfer' into 'test'

Feature/2026 05 08 wechat transfer See merge request wykolor/mall-webview!11
parents 2792a20a 3698dc79
......@@ -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 {
......
......@@ -6,6 +6,10 @@
</div>
<template v-else>
<div class="upgrade-tip" v-if="showAppIdMismatchTip">
该提现需在微信小程序中确认收款,请前往微信小程序操作。
</div>
<div class="confirm-icon">💰</div>
<div class="confirm-title">提现申请已提交</div>
<div class="confirm-amount">¥{{ amount }}</div>
......@@ -17,7 +21,7 @@
<p class="timeout-hint">⏰ 请在24小时内确认,超时将自动退回</p>
</div>
<button class="btn-confirm" @click="handleConfirm">👆 确认收款</button>
<button class="btn-confirm" :disabled="showAppIdMismatchTip" :class="{ disabled: showAppIdMismatchTip }" @click="handleConfirm">👆 确认收款</button>
<button class="btn-back" @click="handleBack">返回奖励金首页</button>
<div class="confirm-faq">
......@@ -33,9 +37,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 +46,10 @@ export default defineComponent({
withdrawAccount: '',
packageInfo: '',
mchId: '',
appId: '',
// H5 APP 的 appId 固定值
currentAppId: 'wxce3ddfea994471b9',
showAppIdMismatchTip: false,
loading: true
}
},
......@@ -58,7 +63,8 @@ export default defineComponent({
// 场景1:从提现表单页进入,已有 packageInfo
this.packageInfo = decodeURIComponent(query.packageInfo as string)
this.mchId = (query.mchId as string) || ''
this.loading = false
this.appId = (query.appId as string) || ''
this.checkAppIdMismatch()
} else if (this.withdrawNo) {
// 场景2:从列表页进入,需要查询 packageInfo
await this.fetchPackageInfo()
......@@ -67,6 +73,13 @@ export default defineComponent({
}
},
methods: {
checkAppIdMismatch () {
// 检查 appId 是否与当前平台一致(暂时禁用,保留代码用于测试)
// if (this.appId && this.appId !== this.currentAppId) {
// this.showAppIdMismatchTip = true
// }
this.loading = false
},
async fetchPackageInfo () {
try {
console.log('fetchPackageInfo called, withdrawNo:', this.withdrawNo)
......@@ -75,21 +88,27 @@ 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)
this.checkAppIdMismatch()
} else {
console.log('no data in response')
alert('获取提现信息失败')
this.loading = false
}
} catch (error) {
console.error('fetchPackageInfo error:', error)
alert('网络请求失败: ' + error)
} finally {
this.loading = false
}
},
async handleConfirm () {
if (!this.packageInfo || !this.mchId) {
console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId })
if (this.showAppIdMismatchTip) {
return
}
if (!this.packageInfo || !this.mchId || !this.appId) {
console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId, appId: this.appId })
alert('缺少必要参数,无法确认收款')
return
}
......@@ -98,7 +117,7 @@ export default defineComponent({
// 调用原生方法唤起微信确认收款
await requestMerchantTransfer({
mchId: this.mchId,
appId: WECHAT_APP_ID,
appId: this.appId,
package: this.packageInfo
})
......@@ -117,7 +136,7 @@ export default defineComponent({
}
},
handleBack () {
this.$router.replace({ path: '/' })
this.$router.back()
}
}
})
......@@ -144,6 +163,18 @@ export default defineComponent({
font-size: 4vw;
}
.upgrade-tip {
width: 100%;
background: #fff3e0;
color: #fa8c16;
padding: 3vw 4vw;
border-radius: 2vw;
font-size: 3.2vw;
text-align: left;
margin-bottom: 4vw;
box-sizing: border-box;
}
.confirm-icon {
font-size: 10vw;
margin-bottom: 4vw;
......@@ -207,6 +238,11 @@ export default defineComponent({
cursor: pointer;
}
.btn-confirm.disabled {
background: #ccc;
cursor: not-allowed;
}
.btn-back {
width: 100%;
padding: 3.5vw;
......
......@@ -132,7 +132,7 @@ export default defineComponent({
}
},
handleBackHome () {
this.$router.replace({ path: '/' })
this.$router.back()
}
}
})
......
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