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