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
73c79e8a
Commit
73c79e8a
authored
Aug 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H5微信支付
parent
aae2761d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
src/components/order/payOrder/PayOrder.js
+9
-14
No files found.
src/components/order/payOrder/PayOrder.js
View file @
73c79e8a
...
@@ -98,7 +98,6 @@ export default class PayOrder extends Component {
...
@@ -98,7 +98,6 @@ export default class PayOrder extends Component {
const
{
payType
,
orderId
}
=
this
.
state
;
const
{
payType
,
orderId
}
=
this
.
state
;
if
(
payType
===
0
)
{
if
(
payType
===
0
)
{
this
.
alipayPay
(
orderId
);
this
.
alipayPay
(
orderId
);
}
else
if
(
payType
===
1
)
{
}
else
if
(
payType
===
1
)
{
this
.
weixinPay
(
orderId
)
this
.
weixinPay
(
orderId
)
}
}
...
@@ -118,7 +117,7 @@ export default class PayOrder extends Component {
...
@@ -118,7 +117,7 @@ export default class PayOrder extends Component {
if
(
res
.
data
.
errno
===
0
)
{
if
(
res
.
data
.
errno
===
0
)
{
window
.
location
.
href
=
res
.
data
.
data
.
url
+
"&redirect_url="
+
encodeURIComponent
(
window
.
location
.
href
+
"&weixinpay=1"
).
toLowerCase
();
window
.
location
.
href
=
res
.
data
.
data
.
url
+
"&redirect_url="
+
encodeURIComponent
(
window
.
location
.
href
+
"&weixinpay=1"
).
toLowerCase
();
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
+
'weixinPay'
,
2
)
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
}
})
})
}
}
...
@@ -182,7 +181,7 @@ export default class PayOrder extends Component {
...
@@ -182,7 +181,7 @@ export default class PayOrder extends Component {
onBridgeReady
();
onBridgeReady
();
}
}
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
+
'isweixinPay'
,
2
)
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
}
})
})
}
}
...
@@ -199,12 +198,12 @@ export default class PayOrder extends Component {
...
@@ -199,12 +198,12 @@ export default class PayOrder extends Component {
clearInterval
(
_this
.
intervalPayStatus
);
clearInterval
(
_this
.
intervalPayStatus
);
_this
.
intervalPayStatus
=
null
;
_this
.
intervalPayStatus
=
null
;
// 获取课程类型
// 获取课程类型
http
.
get
(
`
${
API
.
home
}
/m/app_order/detail/
${
getParam
(
'oid'
)}
`
).
then
(
res
=>
{
http
.
get
(
`
${
API
[
'base-api'
]
}
/m/app_order/detail/
${
getParam
(
'oid'
)}
`
).
then
(
res
=>
{
if
(
res
.
data
.
data
.
course_type
===
'2'
)
{
if
(
Number
(
res
.
data
.
data
.
course_type
)
===
2
)
{
this
.
props
.
history
.
replace
(
`/togroup?id=
${
getParam
(
'oid'
)}
`
);
_
this
.
props
.
history
.
replace
(
`/togroup?id=
${
getParam
(
'oid'
)}
`
);
}
else
{
}
else
{
// 跳转到已购课程 /purchased 不需要传递任何参数
// 跳转到已购课程 /purchased 不需要传递任何参数
this
.
props
.
history
.
replace
(
`/purchased`
);
_
this
.
props
.
history
.
replace
(
`/purchased`
);
}
}
});
});
...
@@ -214,12 +213,8 @@ export default class PayOrder extends Component {
...
@@ -214,12 +213,8 @@ export default class PayOrder extends Component {
}
}
onBridgeReady1
=
(
data
)
=>
{
onBridgeReady1
=
(
data
)
=>
{
Toast
.
info
(
data
.
appId
,
2
);
console
.
log
(
`181 line data:
${
JSON
.
stringify
(
data
)}
`
);
let
_this
=
this
;
let
_this
=
this
;
data
=
data
||
_this
.
BridgeData
;
data
=
data
||
_this
.
BridgeData
;
console
.
log
(
`184 line data:
${
JSON
.
stringify
(
data
)}
`
);
Toast
.
info
(
data
.
appId
,
100
);
WeixinJSBridge
.
invoke
(
WeixinJSBridge
.
invoke
(
'getBrandWCPayRequest'
,
{
'getBrandWCPayRequest'
,
{
...
@@ -247,7 +242,7 @@ export default class PayOrder extends Component {
...
@@ -247,7 +242,7 @@ export default class PayOrder extends Component {
this
.
payCallback
();
this
.
payCallback
();
window
.
location
=
res
.
data
.
data
.
url
;
window
.
location
=
res
.
data
.
data
.
url
;
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
+
'alipayPay'
,
2
)
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
}
})
})
}
}
...
@@ -261,7 +256,7 @@ export default class PayOrder extends Component {
...
@@ -261,7 +256,7 @@ export default class PayOrder extends Component {
if
(
res
.
data
.
errno
===
0
)
{
if
(
res
.
data
.
errno
===
0
)
{
window
.
location
=
res
.
data
.
data
.
url
;
window
.
location
=
res
.
data
.
data
.
url
;
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
+
"huabeiPay"
,
2
)
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
}
});
});
}
}
...
@@ -271,7 +266,7 @@ export default class PayOrder extends Component {
...
@@ -271,7 +266,7 @@ export default class PayOrder extends Component {
http
.
post
(
`
${
API
[
'base-api'
]}
/m/order/detail`
,
{
order_id
:
this
.
state
.
orderId
}).
then
((
res
)
=>
{
http
.
post
(
`
${
API
[
'base-api'
]}
/m/order/detail`
,
{
order_id
:
this
.
state
.
orderId
}).
then
((
res
)
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
if
(
res
.
data
.
errno
!==
200
)
{
if
(
res
.
data
.
errno
!==
200
)
{
Toast
.
info
(
res
.
data
.
msg
+
'componentDidMount'
,
2
);
Toast
.
info
(
res
.
data
.
msg
,
2
);
return
;
return
;
}
}
const
{
course
,
pay_amount
}
=
res
.
data
.
data
;
const
{
course
,
pay_amount
}
=
res
.
data
.
data
;
...
...
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