Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
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
baiguangyao
mr-julyedu
Commits
65bff2be
Commit
65bff2be
authored
Aug 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信支付
parent
7cce25fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
src/components/order/payOrder/PayOrder.js
+21
-13
No files found.
src/components/order/payOrder/PayOrder.js
View file @
65bff2be
...
@@ -124,7 +124,8 @@ export default class PayOrder extends Component {
...
@@ -124,7 +124,8 @@ export default class PayOrder extends Component {
}
}
// 微信内部支付
// 微信内部支付
isweixinPay
=
()
=>
{
isweixinPay
=
()
=>
{
let
weixin_code
=
getParam
(
'code'
)
let
_this
=
this
;
let
weixin_code
=
getParam
(
'code'
);
if
(
weixin_code
)
{
if
(
weixin_code
)
{
if
(
getParam
(
'oid'
)
===
undefined
)
{
if
(
getParam
(
'oid'
)
===
undefined
)
{
return
return
...
@@ -132,20 +133,10 @@ export default class PayOrder extends Component {
...
@@ -132,20 +133,10 @@ export default class PayOrder extends Component {
http
.
get
(
`
${
API
[
'base-api'
]}
/pay/wxpay/pub_charge/oid/
${
getParam
(
'oid'
)}
/code/
${
weixin_code
}
`
).
then
((
res
)
=>
{
http
.
get
(
`
${
API
[
'base-api'
]}
/pay/wxpay/pub_charge/oid/
${
getParam
(
'oid'
)}
/code/
${
weixin_code
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
===
0
)
{
if
(
res
.
data
.
errno
===
0
)
{
let
data
=
res
.
data
.
data
;
let
data
=
res
.
data
.
data
;
// this.BridgeData = res.data.data;
// Toast.info(this.BridgeData.appId, 1);
// this.onBridgeReady(this.BridgeData); // 这个应该不需要
function
onBridgeReady
()
{
function
onBridgeReady
()
{
Toast
.
info
(
data
.
appId
,
2
);
console
.
log
(
`181 line data:
${
JSON
.
stringify
(
data
)}
`
);
let
_this
=
this
;
// data = data || _this.BridgeData;
console
.
log
(
`184 line data:
${
JSON
.
stringify
(
data
)}
`
);
Toast
.
info
(
data
.
appId
,
5
);
WeixinJSBridge
.
invoke
(
WeixinJSBridge
.
invoke
(
'getBrandWCPayRequest'
,
{
'getBrandWCPayRequest'
,
{
appId
:
"wx23dac6775ac82877"
,
//公众号名称,由商户传入
appId
:
data
.
appId
,
//公众号名称,由商户传入
timeStamp
:
data
.
timeStamp
,
//时间戳,自1970年以来的秒数
timeStamp
:
data
.
timeStamp
,
//时间戳,自1970年以来的秒数
nonceStr
:
data
.
nonceStr
,
//随机串
nonceStr
:
data
.
nonceStr
,
//随机串
package
:
data
.
package
,
package
:
data
.
package
,
...
@@ -155,7 +146,24 @@ export default class PayOrder extends Component {
...
@@ -155,7 +146,24 @@ export default class PayOrder extends Component {
function
(
res
)
{
function
(
res
)
{
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
Toast
.
info
(
'支付成功'
,
2
);
Toast
.
info
(
'支付成功'
,
2
);
_this
.
payCallback
();
_this
.
intervalPayStatus
=
setInterval
(
function
(){
http
.
get
(
`
${
API
[
'base-api'
]}
/m/orderState/oid/
${
getParam
(
'oid'
)}
`
).
then
(
res
=>
{
if
(
res
.
data
.
errno
===
401
)
{
clearInterval
(
_this
.
intervalPayStatus
);
_this
.
intervalPayStatus
=
null
;
// 获取课程类型
http
.
get
(
`
${
API
.
home
}
/m/app_order/detail/
${
getParam
(
'oid'
)}
`
).
then
(
res
=>
{
if
(
res
.
data
.
data
.
course_type
===
'2'
)
{
this
.
props
.
history
.
replace
(
`/togroup?id=
${
getParam
(
'oid'
)}
`
);
}
else
{
// 跳转到已购课程 /purchased 不需要传递任何参数
this
.
props
.
history
.
replace
(
`/purchased`
);
}
});
}
})
},
1000
)
}
else
{
}
else
{
alert
(
'支付失败'
)
alert
(
'支付失败'
)
}
}
...
...
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