Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CFFP-HB
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chao Sun
CFFP-HB
Commits
f3019583
Commit
f3019583
authored
Apr 10, 2023
by
wenyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APP内支持微信支付功能
parent
a12c02f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
10 deletions
+49
-10
pages/orderConfirm/orderConfirm.vue
+49
-10
No files found.
pages/orderConfirm/orderConfirm.vue
View file @
f3019583
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</view>
</view>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<!-- #ifdef APP-PLUS -->
<!--
<view class="paymentItem" @click="selectPaymentMethod(1)">
<view
class=
"paymentItem"
@
click=
"selectPaymentMethod(1)"
>
<view>
<view>
<i
class=
"iconfont icon-py_weixinzhifu"
></i>
<i
class=
"iconfont icon-py_weixinzhifu"
></i>
<text>
微信支付
</text>
<text>
微信支付
</text>
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
<view
class=
"selectRadio"
:class=
"{'actived':paymentMethod===1}"
>
<view
class=
"selectRadio"
:class=
"{'actived':paymentMethod===1}"
>
<i
class=
"iconfont icon-duihao"
></i>
<i
class=
"iconfont icon-duihao"
></i>
</view>
</view>
</view>
-->
</view>
<!-- #endif -->
<!-- #endif -->
</view>
</view>
<!-- 底部 -->
<!-- 底部 -->
...
@@ -247,8 +247,53 @@
...
@@ -247,8 +247,53 @@
// #ifdef APP-PLUS
// #ifdef APP-PLUS
param
.
paymentType
=
1
;
param
.
paymentType
=
1
;
api
.
unifiedPay
(
param
).
then
(
res
=>
{
api
.
unifiedPay
(
param
).
then
(
res
=>
{
console
.
log
(
res
)
//
console.log(res)
this
.
paymentBtnDisabled
=
false
;
this
.
paymentBtnDisabled
=
false
;
if
(
res
[
'success'
])
{
const
prepayId
=
res
[
'data'
][
'prepayId'
];
//统一下单订单号 如果为空,代表0元订单支付成功
if
(
prepayId
){
const
orderInfoParam
=
{
"appid"
:
res
[
'data'
][
'appid'
],
// 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr"
:
res
[
'data'
][
'noncestr'
],
// 随机字符串
"package"
:
res
[
'data'
][
'packAge'
],
// 固定值
"partnerid"
:
res
[
'data'
][
'partnerid'
],
// 微信支付商户号
"prepayid"
:
prepayId
,
// 统一下单订单号
"timestamp"
:
res
[
'data'
][
'timeStamp'
],
// 时间戳(单位:秒)
"sign"
:
res
[
'data'
][
'sign'
]
// 签名,这里用的 MD5/RSA 签名
}
let
_this
=
this
uni
.
requestPayment
({
provider
:
'wxpay'
,
orderInfo
:
orderInfoParam
,
success
:
function
(
resp
)
{
uni
.
navigateTo
({
url
:
`/pages/orderStatus/orderStatus?orderId=
${
_this
.
orderId
}
&fileId=
${
_this
.
fileId
}
&orderStatus=2&userId=
${
_this
.
userId
}
&isRedirect=1`
})
},
fail
:
function
(
err
)
{
//console.log('fail:' + JSON.stringify(err));
uni
.
navigateTo
({
url
:
`/pages/orderStatus/orderStatus?orderId=
${
_this
.
orderId
}
&fileId=
${
_this
.
fileId
}
&orderStatus=1&userId=
${
_this
.
userId
}
&isRedirect=1`
})
}
});
}
else
{
uni
.
navigateTo
({
url
:
`/pages/orderStatus/orderStatus?orderId=
${
this
.
orderId
}
&fileId=
${
this
.
fileId
}
&orderStatus=2&userId=
${
this
.
userId
}
&isRedirect=1`
})
}
}
else
{
uni
.
showModal
({
content
:
res
[
'message'
],
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
console
.
log
(
'用户点击确定'
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
})
})
// #endif
// #endif
// #ifdef H5
// #ifdef H5
...
@@ -257,7 +302,6 @@
...
@@ -257,7 +302,6 @@
if
(
this
.
deviceType
==
3
)
{
if
(
this
.
deviceType
==
3
)
{
let
_this
=
this
let
_this
=
this
param
.
isPayOrAuth
=
1
;
param
.
isPayOrAuth
=
1
;
// } else {
api
.
wxAuthorize
(
param
).
then
((
res
)
=>
{
api
.
wxAuthorize
(
param
).
then
((
res
)
=>
{
_this
.
paymentBtnDisabled
=
false
;
_this
.
paymentBtnDisabled
=
false
;
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
...
@@ -269,16 +313,12 @@
...
@@ -269,16 +313,12 @@
}
else
{
}
else
{
window
.
location
.
href
=
res
[
'data'
][
'paymentForm'
][
'action'
];
window
.
location
.
href
=
res
[
'data'
][
'paymentForm'
][
'action'
];
}
}
}
}
})
})
// }
}
else
{
}
else
{
//微信二维码支付
//微信二维码支付或者微信H5支付
}
}
// #endif
// #endif
}
else
if
(
this
.
paymentMethod
==
2
)
{
}
else
if
(
this
.
paymentMethod
==
2
)
{
// APP:支付宝app支付
// APP:支付宝app支付
// #ifdef APP-PLUS
// #ifdef APP-PLUS
...
@@ -309,7 +349,6 @@
...
@@ -309,7 +349,6 @@
url
:
`/pages/orderStatus/orderStatus?orderId=
${
this
.
orderId
}
&fileId=
${
this
.
fileId
}
&orderStatus=2&userId=
${
this
.
userId
}
&isRedirect=1`
url
:
`/pages/orderStatus/orderStatus?orderId=
${
this
.
orderId
}
&fileId=
${
this
.
fileId
}
&orderStatus=2&userId=
${
this
.
userId
}
&isRedirect=1`
})
})
}
}
}
else
{
}
else
{
uni
.
showModal
({
uni
.
showModal
({
content
:
res
[
'message'
],
content
:
res
[
'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