Commit 0952af3b authored by zengqiang's avatar zengqiang

feat(withdraw): H5确认收款增加appId校验

- 增加appId与当前系统appId比对逻辑 - 不匹配时显示提示条并禁用确认收款按钮 - 提示样式参考微信版本校验
parent 611305f1
......@@ -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">
......@@ -43,6 +47,9 @@ export default defineComponent({
packageInfo: '',
mchId: '',
appId: '',
// H5 APP 的 appId 固定值
currentAppId: 'wxce3ddfea994471b9',
showAppIdMismatchTip: false,
loading: true
}
},
......@@ -57,7 +64,7 @@ export default defineComponent({
this.packageInfo = decodeURIComponent(query.packageInfo as string)
this.mchId = (query.mchId as string) || ''
this.appId = (query.appId as string) || ''
this.loading = false
this.checkAppIdMismatch()
} else if (this.withdrawNo) {
// 场景2:从列表页进入,需要查询 packageInfo
await this.fetchPackageInfo()
......@@ -66,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)
......@@ -76,18 +90,23 @@ export default defineComponent({
this.mchId = res.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.showAppIdMismatchTip) {
return
}
if (!this.packageInfo || !this.mchId || !this.appId) {
console.error('Missing params:', { packageInfo: this.packageInfo, mchId: this.mchId, appId: this.appId })
alert('缺少必要参数,无法确认收款')
......@@ -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;
......
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