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
e70786d8
Commit
e70786d8
authored
Mar 20, 2023
by
huangzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支付成功页跳转 拼团首页二维码 加入分享参数
parent
77d41957
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
14 deletions
+39
-14
package.json
package.json
+1
-0
pay.vue
src/pages/pay/pay.vue
+22
-6
test.vue
src/pages/test/test.vue
+6
-3
web.vue
src/pages/web/web.vue
+10
-5
No files found.
package.json
View file @
e70786d8
...
@@ -78,6 +78,7 @@
...
@@ -78,6 +78,7 @@
"
lodash
"
:
"^4.17.21"
,
"
lodash
"
:
"^4.17.21"
,
"
uview-ui
"
:
"^2.0.35"
,
"
uview-ui
"
:
"^2.0.35"
,
"
decimal.js
"
:
"^10.4.3"
,
"
decimal.js
"
:
"^10.4.3"
,
"
qs
"
:
"^6.11.0"
,
"
vue
"
:
"^2.6.11"
,
"
vue
"
:
"^2.6.11"
,
"
vuex
"
:
"^3.2.0"
"
vuex
"
:
"^3.2.0"
},
},
...
...
src/pages/pay/pay.vue
View file @
e70786d8
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<
script
>
<
script
>
import
{
hostPrefix
}
from
'@/config'
import
{
hostPrefix
}
from
'@/config'
import
Decimal
from
'decimal.js'
import
Decimal
from
'decimal.js'
import
qs
from
'qs'
// totalAmount 活动后实际的商品价格
// totalAmount 活动后实际的商品价格
// balance 可用余额
// balance 可用余额
...
@@ -38,17 +39,22 @@ export default {
...
@@ -38,17 +39,22 @@ export default {
name
:
'OrderPay'
,
name
:
'OrderPay'
,
data
()
{
data
()
{
return
{
return
{
buyType
:
undefined
,
// 1 拼团购买, 其他 为非拼团购买
groupRecordId
:
''
,
// 下单成功后,订单接口返回的成团记录id
courseId
:
''
,
// 课程id
orderId
:
''
,
// 订单id
orderId
:
''
,
// 订单id
payType
:
1
,
// 支付方式,1: 余额 5: 微信 7: 微信 + 余额
payType
:
1
,
// 支付方式,1: 余额 5: 微信 7: 微信 + 余额
totalAmount
:
0
,
// 活动后实际的商品价格
totalAmount
:
0
,
// 活动后实际的商品价格
balance
:
0
,
// 账户余额
balance
:
0
,
// 账户余额
loading
:
false
,
loading
:
false
,
openId
:
this
.
$store
.
state
.
user
.
openId
,
openId
:
this
.
$store
.
state
.
user
.
openId
,
buyType
:
1
,
// 1 是拼团购买,其他是 单独或券后购买
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
const
{
orderId
,
totalAmount
,
balance
,
payType
}
=
options
const
{
buyType
,
groupRecordId
,
courseId
,
orderId
,
totalAmount
,
balance
,
payType
}
=
options
this
.
buyType
=
buyType
this
.
groupRecordId
=
groupRecordId
this
.
courseId
=
courseId
this
.
orderId
=
orderId
this
.
orderId
=
orderId
this
.
totalAmount
=
totalAmount
?
Number
(
totalAmount
)
:
0
this
.
totalAmount
=
totalAmount
?
Number
(
totalAmount
)
:
0
this
.
balance
=
balance
?
Number
(
balance
)
:
0
this
.
balance
=
balance
?
Number
(
balance
)
:
0
...
@@ -190,12 +196,22 @@ export default {
...
@@ -190,12 +196,22 @@ export default {
title
:
'支付成功'
,
title
:
'支付成功'
,
duration
:
1500
,
duration
:
1500
,
})
})
// todo 如何是 非拼团购买,就跳普通页面。
// 当前只有拼团业务才会被分享出来,在微信小程序中支付
const
pageParams
=
{
const
url
=
`
${
hostPrefix
}
/h5-course/pay/groupSuccess?ccc=qwe&ttt=123`
uid
:
this
.
$store
.
state
.
user
.
uid
||
''
,
// const url = `${hostPrefix}/h5-course/detail/7934?uid&accessToken&appId=wx1106c32a36d87d49&isFromMin=weapp&miniType=groupActivity&ffrom=AppletWechatCourseFuLi×tamp=1678689403156`
accessToken
:
this
.
$store
.
state
.
user
.
accessToken
||
''
,
isFromMin
:
'weapp'
,
courseId
:
this
.
courseId
,
groupRecordId
:
this
.
groupRecordId
,
}
const
urlStr
=
qs
.
stringify
(
pageParams
)
console
.
log
(
'urlStr'
,
urlStr
)
let
pagePath
=
'pay/success'
if
(
Number
(
this
.
buyType
)
===
1
)
{
pagePath
=
'pay/groupSuccess'
}
const
url
=
`
${
hostPrefix
}
/h5-course/
${
pagePath
}
?
${
urlStr
}
`
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
`/pages/web/web?title=
${
'支付成功'
}
&loadUrl=
${
encodeURIComponent
(
url
)}
`
,
url
:
`/pages/web/web?title=
${
'支付成功'
}
&loadUrl=
${
encodeURIComponent
(
url
)}
`
,
})
})
...
...
src/pages/test/test.vue
View file @
e70786d8
...
@@ -63,12 +63,15 @@ export default {
...
@@ -63,12 +63,15 @@ export default {
this
.
cccc
=
options
.
scene
this
.
cccc
=
options
.
scene
// todo
this
.
testScene
=
options
.
scene
||
'a07f38fb0baa4e3a9388a44f662e1acb'
// 有scene,说明是扫描二维码进入
// 有scene,说明是扫描二维码进入
if
(
options
.
s
cene
)
{
if
(
this
.
testS
cene
)
{
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'加载中'
,
title
:
'加载中'
,
})
})
this
.
getParamsByScene
(
options
.
s
cene
)
this
.
getParamsByScene
(
this
.
testS
cene
)
}
}
},
},
// 移除登录成功事件
// 移除登录成功事件
...
@@ -77,7 +80,7 @@ export default {
...
@@ -77,7 +80,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
// this.options.scene 无值,说明是非扫描二维码,此时自己拼装路径
// this.options.scene 无值,说明是非扫描二维码,此时自己拼装路径
if
(
!
this
.
options
.
s
cene
)
{
if
(
!
this
.
testS
cene
)
{
this
.
initWeviewUrl
()
this
.
initWeviewUrl
()
}
}
},
},
...
...
src/pages/web/web.vue
View file @
e70786d8
...
@@ -104,14 +104,19 @@ export default {
...
@@ -104,14 +104,19 @@ export default {
// shareUid 分享人id
// shareUid 分享人id
// moreId 待定
// moreId 待定
const
params
=
[
'activityId'
,
'channel'
,
'recordId'
,
'shareUid'
].
reduce
((
acc
,
key
)
=>
{
const
params
=
[
'activityId'
,
'channel'
,
'recordId'
,
'shareUid'
].
reduce
((
acc
,
key
)
=>
{
// groupRecordId
if
(
res
[
key
]
||
res
[
key
]
===
0
)
{
if
(
res
[
key
]
||
res
[
key
]
===
0
)
{
// 为了保证参数连贯性,使用通用的
groupRecordI
d
// 为了保证参数连贯性,使用通用的
shareGroupRecordId 标识 分享的参团记录i
d
if
(
key
===
'recordId'
)
{
if
(
key
===
'recordId'
)
{
acc
[
'groupRecordId'
]
=
res
[
key
]
acc
[
'shareGroupRecordId'
]
=
res
[
key
]
}
else
{
return
acc
acc
[
key
]
=
res
[
key
]
}
}
// 拼团分享渠道
if
(
key
===
'channel'
)
{
acc
[
'groupChannel'
]
=
res
[
key
]
return
acc
}
acc
[
key
]
=
res
[
key
]
return
acc
}
}
return
acc
return
acc
},
{})
},
{})
...
...
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