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
3cb95b0a
Commit
3cb95b0a
authored
Aug 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调试
parent
6d139f2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
9 deletions
+37
-9
src/components/order/payOrder/PayOrder.js
+37
-9
No files found.
src/components/order/payOrder/PayOrder.js
View file @
3cb95b0a
...
@@ -131,19 +131,47 @@ export default class PayOrder extends Component {
...
@@ -131,19 +131,47 @@ export default class PayOrder extends Component {
}
else
{
}
else
{
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
;
//
this.BridgeData = res.data.data;
Toast
.
info
(
this
.
BridgeData
.
appId
,
1
);
//
Toast.info(this.BridgeData.appId, 1);
// this.onBridgeReady(this.BridgeData); // 这个应该不需要
// this.onBridgeReady(this.BridgeData); // 这个应该不需要
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
(
'getBrandWCPayRequest'
,
{
appId
:
"wx23dac6775ac82877"
,
//公众号名称,由商户传入
timeStamp
:
data
.
timeStamp
,
//时间戳,自1970年以来的秒数
nonceStr
:
data
.
nonceStr
,
//随机串
package
:
data
.
package
,
signType
:
data
.
signType
,
//微信签名方式:
paySign
:
data
.
paySign
//微信签名
},
function
(
res
)
{
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
Toast
.
info
(
'支付成功'
,
2
);
_this
.
payCallback
();
}
else
{
alert
(
'支付失败'
)
}
}
)
}
if
(
typeof
WeixinJSBridge
==
"undefined"
)
{
if
(
typeof
WeixinJSBridge
==
"undefined"
)
{
if
(
document
.
addEventListener
)
{
if
(
document
.
addEventListener
)
{
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
this
.
onBridgeReady
,
false
)
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
onBridgeReady
,
false
)
}
else
if
(
document
.
attachEvent
)
{
}
else
if
(
document
.
attachEvent
)
{
document
.
attachEvent
(
'WeixinJSBridgeReady'
,
this
.
onBridgeReady
);
document
.
attachEvent
(
'WeixinJSBridgeReady'
,
onBridgeReady
);
document
.
attachEvent
(
'onWeixinJSBridgeReady'
,
this
.
onBridgeReady
)
document
.
attachEvent
(
'onWeixinJSBridgeReady'
,
onBridgeReady
)
}
}
}
else
{
}
else
{
this
.
onBridgeReady
(
this
.
BridgeData
);
onBridgeReady
(
);
}
}
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
+
'isweixinPay'
,
2
)
Toast
.
info
(
res
.
data
.
msg
+
'isweixinPay'
,
2
)
...
@@ -177,7 +205,7 @@ export default class PayOrder extends Component {
...
@@ -177,7 +205,7 @@ export default class PayOrder extends Component {
},
1000
)
},
1000
)
}
}
onBridgeReady
=
(
data
)
=>
{
onBridgeReady
1
=
(
data
)
=>
{
Toast
.
info
(
data
.
appId
,
2
);
Toast
.
info
(
data
.
appId
,
2
);
console
.
log
(
`181 line data:
${
JSON
.
stringify
(
data
)}
`
);
console
.
log
(
`181 line data:
${
JSON
.
stringify
(
data
)}
`
);
let
_this
=
this
;
let
_this
=
this
;
...
@@ -187,7 +215,7 @@ export default class PayOrder extends Component {
...
@@ -187,7 +215,7 @@ export default class PayOrder extends Component {
WeixinJSBridge
.
invoke
(
WeixinJSBridge
.
invoke
(
'getBrandWCPayRequest'
,
{
'getBrandWCPayRequest'
,
{
"appId"
:
data
.
appId
,
//公众号名称,由商户传入
"appId"
:
"wx23dac6775ac82877"
,
//公众号名称,由商户传入
"timeStamp"
:
data
.
timeStamp
,
//时间戳,自1970年以来的秒数
"timeStamp"
:
data
.
timeStamp
,
//时间戳,自1970年以来的秒数
"nonceStr"
:
data
.
nonceStr
,
//随机串
"nonceStr"
:
data
.
nonceStr
,
//随机串
"package"
:
data
.
package
,
"package"
:
data
.
package
,
...
...
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