Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-group-course
Overview
Overview
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
黄志
ydl-group-course
Commits
5013b8f8
Commit
5013b8f8
authored
Mar 05, 2023
by
huangzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支付成功跳转
parent
dadc5cc5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
32 deletions
+45
-32
pay.vue
src/pages/pay/pay.vue
+45
-32
No files found.
src/pages/pay/pay.vue
View file @
5013b8f8
...
...
@@ -28,7 +28,7 @@
<
button
class
=
"pay-button"
:
loading
=
"loading"
@
click
=
"
p
ay"
@
click
=
"
onP
ay"
>
确认支付
<
/button
>
...
...
@@ -38,6 +38,7 @@
<
script
>
import
{
setTrackData
}
from
'@/utils/util'
import
{
hostPrefix
}
from
'@/config'
export
default
{
name
:
'OrderPay'
,
...
...
@@ -83,23 +84,27 @@ export default {
}
,
methods
:
{
// 调用后端接口得到支付参数
async
p
ay
()
{
async
onP
ay
()
{
if
(
this
.
loading
)
{
return
}
setTrackData
({
events
:
[
{
event_id
:
'content_click'
,
event_custom_properties
:
{
part
:
'order_middle_page'
,
position
:
'foot_column'
,
element
:
'confirm_payment'
,
content
:
this
.
orderId
,
}
,
}
,
],
}
)
// todo
this
.
handleSuccess
()
// setTrackData(
{
// events: [
//
{
// event_id: 'content_click',
// event_custom_properties:
{
// part: 'order_middle_page',
// position: 'foot_column',
// element: 'confirm_payment',
// content: this.orderId,
//
}
,
//
}
,
// ],
//
}
)
this
.
loading
=
true
const
{
uid
,
accessToken
,
openId
}
=
this
.
$store
.
state
.
user
// 组合支付从余额里面扣除的金额
...
...
@@ -107,6 +112,7 @@ export default {
// 支付方式,1: 余额 5: 微信 7: 微信 + 余额
const
payType
=
this
.
payAmount
>
0
?
(
this
.
balance
>
0
?
7
:
5
)
:
1
try
{
// todo 这是一个什么页面?,一定要传吗
const
wxUrl
=
encodeURIComponent
(
'http://m.ydl.com?backPayId='
+
this
.
payId
)
const
res
=
await
this
.
$request
.
post
(
'/auth/cashierV2/unityPay'
,
...
...
@@ -115,8 +121,9 @@ export default {
orderId
:
this
.
orderId
,
payAmount
:
this
.
payAmount
,
openId
:
openId
,
payType
,
payBalance
,
// todo
payType
:
1
,
payBalance
:
0.1
,
payChannel
:
'WX_MINI_APP'
,
quitUrl
:
wxUrl
,
returnUrl
:
wxUrl
,
...
...
@@ -175,26 +182,32 @@ export default {
}
)
}
,
handleSuccess
()
{
// 支付成功埋点
setTrackData
({
events
:
[
{
event_id
:
'payment_succ_page_visit'
,
event_custom_properties
:
{
part
:
'order_middle_page'
,
position
:
''
,
element
:
''
,
order_id
:
this
.
orderId
,
}
,
}
,
],
}
)
//
//
支付成功埋点
//
setTrackData(
{
//
events: [
//
{
//
event_id: 'payment_succ_page_visit',
//
event_custom_properties:
{
//
part: 'order_middle_page',
//
position: '',
//
element: '',
//
order_id: this.orderId,
//
}
,
//
}
,
//
],
//
}
)
// 触发支付成功事件
uni
.
$emit
(
'paySuccess'
,
this
.
from
)
//
uni.$emit('paySuccess', this.from)
uni
.
showToast
({
title
:
'支付成功'
,
duration
:
1500
,
}
)
const
url
=
`${hostPrefix
}
/h5-course/pay/groupSuccess`
uni
.
navigateTo
({
url
:
`/pages/web/web?title=${
this.doctor.name ? `
$
{
this
.
doctor
.
name
}的评价
` : ''
}
&loadUrl=${encodeURIComponent(url)
}
`
,
}
)
}
,
}
,
}
...
...
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