Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-webview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
mall-webview
Commits
eda7d6f2
Commit
eda7d6f2
authored
May 21, 2026
by
zengqiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2026-05-08-wechat-transfer' into 'test'
Feature/2026 05 08 wechat transfer See merge request wykolor/mall-webview!14
parents
b258ad08
890c4c1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
44 deletions
+13
-44
use-native-bridge.ts
src/util/use-native-bridge.ts
+10
-5
ConfirmReceipt.vue
src/views/withdraw/ConfirmReceipt.vue
+3
-39
No files found.
src/util/use-native-bridge.ts
View file @
eda7d6f2
...
@@ -87,20 +87,25 @@ export { useNativeBridge }
...
@@ -87,20 +87,25 @@ export { useNativeBridge }
const
INVOKE_NATIVE_METHOD_TIMEOUT
=
10000
const
INVOKE_NATIVE_METHOD_TIMEOUT
=
10000
function
invokeNativeMethod
<
T
=
any
,
P
=
any
>
(
arg
:
{
type
:
string
;
data
?:
P
}):
Promise
<
T
>
{
function
invokeNativeMethod
<
T
=
any
,
P
=
any
>
(
arg
:
{
type
:
string
;
data
?:
P
}
,
timeout
=
INVOKE_NATIVE_METHOD_TIMEOUT
):
Promise
<
T
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
callbackName
=
`
${
arg
.
type
}
_callback_
${
Math
.
random
()}
`
.
replace
(
/
\.
/
,
''
)
const
callbackName
=
`
${
arg
.
type
}
_callback_
${
Math
.
random
()}
`
.
replace
(
/
\.
/
,
''
)
let
timer
:
ReturnType
<
typeof
setTimeout
>
|
null
=
null
const
timer
=
setTimeout
(()
=>
{
// 如果 timeout 大于 0,则设置一个定时器,如果超时则拒绝请求
if
(
timeout
>
0
)
{
timer
=
setTimeout
(()
=>
{
reject
(
new
Error
(
`invoke
${
arg
.
type
}
timeout`
))
reject
(
new
Error
(
`invoke
${
arg
.
type
}
timeout`
))
eventBus
.
off
(
GEEK_NATIVE_NAME
,
onCallback
)
eventBus
.
off
(
GEEK_NATIVE_NAME
,
onCallback
)
},
INVOKE_NATIVE_METHOD_TIMEOUT
)
},
timeout
)
}
eventBus
.
on
(
GEEK_NATIVE_NAME
,
onCallback
)
eventBus
.
on
(
GEEK_NATIVE_NAME
,
onCallback
)
function
onCallback
(
params
?:
NativeInvokeFuncParams
)
{
function
onCallback
(
params
?:
NativeInvokeFuncParams
)
{
if
(
params
?.
method
===
callbackName
)
{
if
(
params
?.
method
===
callbackName
)
{
if
(
timer
)
{
clearTimeout
(
timer
)
clearTimeout
(
timer
)
}
if
(
params
.
error
)
{
if
(
params
.
error
)
{
reject
(
new
Error
(
params
.
error
))
reject
(
new
Error
(
params
.
error
))
}
else
{
}
else
{
...
@@ -165,5 +170,5 @@ export interface WechatOpenBusinessViewResp extends WechatBaseResp {
...
@@ -165,5 +170,5 @@ export interface WechatOpenBusinessViewResp extends WechatBaseResp {
}
}
export
function
requestMerchantTransfer
(
params
:
RequestMerchantTransferParams
)
{
export
function
requestMerchantTransfer
(
params
:
RequestMerchantTransferParams
)
{
return
invokeNativeMethod
<
WechatOpenBusinessViewResp
,
RequestMerchantTransferParams
>
({
type
:
'requestMerchantTransfer'
,
data
:
params
})
return
invokeNativeMethod
<
WechatOpenBusinessViewResp
,
RequestMerchantTransferParams
>
({
type
:
'requestMerchantTransfer'
,
data
:
params
}
,
-
1
)
}
}
src/views/withdraw/ConfirmReceipt.vue
View file @
eda7d6f2
...
@@ -6,10 +6,6 @@
...
@@ -6,10 +6,6 @@
</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>
...
@@ -21,7 +17,7 @@
...
@@ -21,7 +17,7 @@
<p
class=
"timeout-hint"
>
⏰ 请在24小时内确认,超时将自动退回
</p>
<p
class=
"timeout-hint"
>
⏰ 请在24小时内确认,超时将自动退回
</p>
</div>
</div>
<button
class=
"btn-confirm"
:disabled=
"showAppIdMismatchTip"
:class=
"
{ disabled: showAppIdMismatchTip }"
@click="handleConfirm">👆 确认收款
</button>
<button
class=
"btn-confirm"
@
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"
>
...
@@ -47,9 +43,6 @@ export default defineComponent({
...
@@ -47,9 +43,6 @@ export default defineComponent({
packageInfo
:
''
,
packageInfo
:
''
,
mchId
:
''
,
mchId
:
''
,
appId
:
''
,
appId
:
''
,
// H5 APP 的 appId 固定值
currentAppId
:
'wxce3ddfea994471b9'
,
showAppIdMismatchTip
:
false
,
loading
:
true
loading
:
true
}
}
},
},
...
@@ -64,7 +57,7 @@ export default defineComponent({
...
@@ -64,7 +57,7 @@ export default defineComponent({
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
.
appId
=
(
query
.
appId
as
string
)
||
''
this
.
checkAppIdMismatch
()
this
.
loading
=
false
}
else
if
(
this
.
withdrawNo
)
{
}
else
if
(
this
.
withdrawNo
)
{
// 场景2:从列表页进入,需要查询 packageInfo
// 场景2:从列表页进入,需要查询 packageInfo
await
this
.
fetchPackageInfo
()
await
this
.
fetchPackageInfo
()
...
@@ -73,13 +66,6 @@ export default defineComponent({
...
@@ -73,13 +66,6 @@ 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
)
...
@@ -90,23 +76,18 @@ export default defineComponent({
...
@@ -90,23 +76,18 @@ export default defineComponent({
this
.
mchId
=
res
.
mchId
||
''
this
.
mchId
=
res
.
mchId
||
''
this
.
appId
=
res
.
appId
||
''
this
.
appId
=
res
.
appId
||
''
console
.
log
(
'packageInfo:'
,
this
.
packageInfo
,
'mchId:'
,
this
.
mchId
,
'appId:'
,
this
.
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
.
showAppIdMismatchTip
)
{
return
}
if
(
!
this
.
packageInfo
||
!
this
.
mchId
||
!
this
.
appId
)
{
if
(
!
this
.
packageInfo
||
!
this
.
mchId
||
!
this
.
appId
)
{
console
.
error
(
'Missing params:'
,
{
packageInfo
:
this
.
packageInfo
,
mchId
:
this
.
mchId
,
appId
:
this
.
appId
})
console
.
error
(
'Missing params:'
,
{
packageInfo
:
this
.
packageInfo
,
mchId
:
this
.
mchId
,
appId
:
this
.
appId
})
alert
(
'缺少必要参数,无法确认收款'
)
alert
(
'缺少必要参数,无法确认收款'
)
...
@@ -163,18 +144,6 @@ export default defineComponent({
...
@@ -163,18 +144,6 @@ 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
;
...
@@ -238,11 +207,6 @@ export default defineComponent({
...
@@ -238,11 +207,6 @@ 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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment