Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-h5-ailipay
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 657f48e4
authored
Aug 12, 2025
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug修复
1 parent
f3197b66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
39 deletions
src/views/alipay/index.vue
src/views/alipay/index.vue
View file @
657f48e
...
...
@@ -95,6 +95,7 @@ export default {
merchantName
:
''
,
shopMerchantId
:
''
,
shopMerchantName
:
''
,
pay
:
''
,
payMoney
:
''
,
// 支付金额
unPayMoneyList
:
[
'0'
,
'0.'
,
'0.0'
,
'0.00'
],
canPay
:
false
,
...
...
@@ -123,38 +124,46 @@ export default {
},
mounted
()
{
const
that
=
this
console
.
log
(
baseConfig
)
//
console.log(baseConfig)
const
{
appId
}
=
baseConfig
// console.log(appId)
const
{
merchantName
,
merchantId
,
shopMerchantId
,
shopMerchantName
}
=
this
.
getHrefParams
()
const
{
merchantName
,
merchantId
,
shopMerchantId
,
shopMerchantName
,
M
,
MN
,
SM
,
SMN
,
P
}
=
this
.
getHrefParams
()
this
.
paymentChannelId
=
P
// 区分是流量方还是导流方
// this.getMiniAppConfig()
this
.
setMerchantDisabled
(
merchantId
||
shopMerchantId
)
if
(
merchantId
)
{
this
.
merchantId
=
merchantId
this
.
merchantName
=
merchantName
if
(
merchantId
||
M
)
{
this
.
merchantId
=
merchantId
||
M
this
.
merchantName
=
merchantName
||
MN
}
else
{
this
.
shopMerchantId
=
shopMerchantId
this
.
shopMerchantName
=
shopMerchantName
this
.
shopMerchantId
=
shopMerchantId
||
SM
this
.
shopMerchantName
=
shopMerchantName
||
SMN
this
.
isYqType
=
false
}
console
.
log
(
appId
,
'appId'
)
// console.log('ap.getAuthCode', ap.getAuthCode)
// ap.alert(appId)
// 请求用户授权
ap
.
getAuthCode
({
appId
,
scopes
:
[
'auth_base'
]
// 主动授权:auth_user,静默授权:auth_base。或者其它scope
},
function
(
res
)
{
// ap.alert(JSON.stringify(res))
console
.
log
(
JSON
.
stringify
(
res
))
res
.
authCode
&&
that
.
getOpenId
(
res
.
authCode
)
},
function
(
res
)
{
// alert(JSON.stringify(res))
console
.
log
(
'res.fail'
,
res
)
// res.authCode && that.getOpenId(res.authCode)
})
console
.
log
(
ap
,
'ap'
)
console
.
log
(
ap
.
getAuthCode
,
'ap.getAuthCode'
)
try
{
// 请求用户授权
ap
.
getAuthCode
({
appId
,
scopes
:
[
'auth_base'
]
// 主动授权:auth_user,静默授权:auth_base。或者其它scope
},
function
(
res
)
{
// ap.alert(JSON.stringify(res))
console
.
log
(
JSON
.
stringify
(
res
))
res
.
authCode
&&
that
.
getOpenId
(
res
.
authCode
)
},
function
(
res
)
{
// alert(JSON.stringify(res))
console
.
log
(
'res.fail'
,
res
)
// res.authCode && that.getOpenId(res.authCode)
})
}
catch
(
error
)
{
console
.
log
(
error
,
'error'
)
}
// this.getOpenId('ab3aa51e466140b5b96475706653UX72')
...
...
@@ -286,7 +295,8 @@ export default {
subOpenid
:
userId
,
oprBy
:
userId
,
receivedMoney
:
payMoney
*
100
,
payType
:
4
payType
:
4
,
paymentChannelId
:
this
.
paymentChannelId
}
if
(
this
.
isYqType
)
{
params
.
merchantId
=
this
.
merchantId
...
...
@@ -299,8 +309,9 @@ export default {
duration
:
0
})
createWxPayH5
(
params
).
then
((
result
)
=>
{
const
{
tradeNO
}
=
JSON
.
parse
(
result
.
jsapiPayInfo
)
this
.
tradeNO
=
tradeNO
// tradeNO 银盛 chnlPayInfo 通联
const
{
tradeNO
,
chnlPayInfo
}
=
JSON
.
parse
(
result
.
jsapiPayInfo
)
this
.
tradeNO
=
tradeNO
||
chnlPayInfo
console
.
log
(
'tradeNO'
,
tradeNO
)
this
.
tradeNO
&&
this
.
aliPayment
()
}).
catch
((
err
)
=>
{
...
...
@@ -308,27 +319,12 @@ export default {
}).
finally
(()
=>
{
this
.
$toast
.
clear
()
})
// createWxPayH5(params).then((result) => {
// console.log(result, 'result')
// const { code, data, message } = result
// if (code == 0) {
// const { tradeNO } = JSON.parse(result.jsapiPayInfo)
// this.tradeNO = tradeNO
// console.log('tradeNO', tradeNO)
// this.tradeNO && this.aliPayment()
// } else {
// this.$toast.fail(message || '支付失败')
// }
// }).catch((err) => {
// console.log(err)
// }).finally(() => {
// this.$toast.clear()
// })
},
aliPayment
()
{
const
that
=
this
// 调用支付宝api唤起支付功能
console
.
log
(
'this.tradeNO'
,
this
.
tradeNO
)
// this.tradeNO = '2025073122001417721400156209'
const
{
tradeNO
}
=
this
AlipayJSBridge
.
call
(
'tradePay'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment