Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-app
Project
Project
Details
Activity
Releases
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
李伟
cust-app
Commits
9f48015c
Commit
9f48015c
authored
Jan 23, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接了支付接口(暂定,缺参数)
parent
80fab316
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
6 deletions
+82
-6
index.js
api/activity/index.js
+12
-0
activityDetail.vue
pagesActivity/activityDetail.vue
+70
-6
No files found.
api/activity/index.js
View file @
9f48015c
...
...
@@ -26,3 +26,15 @@ export function addApplication(data) {
})
}
// 支付
export
function
pay
(
data
)
{
return
request
({
url
:
'/app/wxPay/pay'
,
method
:
'post'
,
data
,
headers
:
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
isToken
:
true
}
})
}
pagesActivity/activityDetail.vue
View file @
9f48015c
...
...
@@ -50,7 +50,7 @@
</
template
>
<
script
>
import
{
activityDetail
,
addApplication
}
from
"../api/activity/index.js"
import
{
activityDetail
,
addApplication
,
pay
}
from
"../api/activity/index.js"
export
default
{
data
()
{
return
{
...
...
@@ -109,11 +109,75 @@
// 添加订单(报名)
addApplication
(
params
).
then
(
res
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
show
=
false
uni
.
showToast
({
title
:
'报名成功'
,
icon
:
'success'
})
const
activityId
=
this
.
activityId
const
orderId
=
res
.
data
.
data
.
businessId
// 如果支付总金额大于0,则进行支付,反之则不进行支付
// if(this.totalprice > 0){
// 支付
const
payquery
=
{
orderId
:
orderId
,
activityId
:
this
.
activityId
}
pay
(
payquery
).
then
(
res
=>
{
console
.
log
(
"支付参数"
,
res
)
console
.
log
(
"测试支付"
,
res
.
data
.
errMsg
)
if
(
res
.
data
.
errMsg
===
'OK'
)
{
if
(
!
res
.
data
.
data
.
nonceStr
)
{
uni
.
showToast
({
title
:
'下单失败,请稍后重试'
,
icon
:
'none'
})
}
else
{
// 调取微信支付窗口
uni
.
requestPayment
({
provider
:
"wxpay"
,
appId
:
res
.
data
.
appid
,
// 微信小程序appid
timeStamp
:
res
.
data
.
timeStamp
,
// 时间戳
nonceStr
:
res
.
data
.
nonceStr
,
// 随机字符串
package
:
res
.
data
.
package
,
signType
:
"MD5"
,
// 签名算法
paySign
:
res
.
data
.
paySign
,
// 签名
success
(
res
)
{
uni
.
showToast
({
title
:
'支付成功'
,
icon
:
'success'
})
this
.
show
=
false
uni
.
navigateTo
({
url
:
'/my/myorder/index'
})
},
fail
(
e
)
{
console
.
log
(
"支付失败"
,
e
)
uni
.
showToast
({
title
:
'支付已取消'
,
icon
:
'none'
})
const
orderStatus
=
{
orderId
:
orderId
,
activityId
:
activityId
}
// 修改订单状态为待支付
// updateorderstatus(orderStatus).then(res=>{
// console.log('修改订单状态',res)
// })
}
});
}
}
else
{
uni
.
showToast
({
title
:
'下单失败'
,
icon
:
'none'
})
}
})
// }else{
// uni.showToast({
// title: '支付成功',
// icon: 'success'
// })
// }
}
else
if
(
res
.
data
.
code
!==
200
){
uni
.
showToast
({
title
:
res
.
data
.
message
,
...
...
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