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
93d8d984
Commit
93d8d984
authored
Jun 21, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail
parent
e85cbfb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
22 deletions
+65
-22
src/components/detail/single/index.js
+65
-22
No files found.
src/components/detail/single/index.js
View file @
93d8d984
...
...
@@ -12,13 +12,15 @@ class Single extends Component {
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
status
:
3
,
status
:
1
,
orderId
:
''
,
nowPrice
:
''
,
laterPrice
:
''
,
hour
:
''
,
min
:
''
,
sec
:
''
,
endTime
:
''
,
groupOrderId
:
''
,
payType
:
'0'
,
// 1支付宝 0微信
}
}
...
...
@@ -169,11 +171,55 @@ class Single extends Component {
}
// 0元参团
zerogroupBuy
=
()
=>
{
this
.
setState
({
status
:
7
this
.
getOrderId
()
}
// 获取订单号-0元参团
getOrderId
=
()
=>
{
let
data
=
{
course_id
:
getParam
(
'id'
)
}
http
.
post
(
`
${
api
[
'pay-api'
]}
/pdd/sys`
,
data
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
===
0
)
{
this
.
setState
({
groupOrderId
:
res
.
data
.
data
.
order_id
})
this
.
getOrderStatus
(
res
.
data
.
data
.
order_id
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
})
}
// 获取订单状态-0元参团
getOrderStatus
=
(
id
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/pdd/order_status/
${
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
getTime
(
res
.
data
.
data
.
pdd_order_id
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
})
}
// 获取倒计时-0元参团
getTime
=
(
id
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/pdd_order_end_time/
${
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
endTime
:
res
.
data
.
data
.
end_time
,
status
:
7
})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
})
}
// 邀请好友参团
toGroup
=
()
=>
{
this
.
props
.
history
.
push
(
`/togroup?id=
${
this
.
state
.
groupOrderId
}
`
)
}
// 关闭弹窗
colse
=
()
=>
{
this
.
props
.
boxHide
(
false
);
...
...
@@ -183,24 +229,21 @@ class Single extends Component {
}
render
()
{
// if (this.state.bargainData.expire_time) {
let
date
=
1561140170
*
1000
let
now
=
Date
.
now
()
setInterval
(()
=>
{
date
-=
1000
let
s
=
differenceInSeconds
(
new
Date
(
date
),
now
)
%
60
,
m
=
differenceInMinutes
(
new
Date
(
date
),
now
)
%
60
,
h
=
differenceInHours
(
new
Date
(
date
),
now
)
%
24
this
.
setState
({
hour
:
h
,
min
:
m
,
sec
:
s
,
})
},
1000
)
// }
if
(
this
.
state
.
endTime
)
{
let
date
=
this
.
state
.
endTime
*
1000
let
now
=
Date
.
now
()
setInterval
(()
=>
{
date
-=
1000
let
s
=
differenceInSeconds
(
new
Date
(
date
),
now
)
%
60
,
m
=
differenceInMinutes
(
new
Date
(
date
),
now
)
%
60
,
h
=
differenceInHours
(
new
Date
(
date
),
now
)
%
24
this
.
setState
({
hour
:
h
,
min
:
m
,
sec
:
s
,
})
},
1000
)
}
return
(
<
div
>
...
...
@@ -305,7 +348,7 @@ class Single extends Component {
alt
=
""
/>
<
/div
>
<
div
className
=
'btn-l btn-FF4000'
>
<
div
className
=
'btn-l btn-FF4000'
onClick
=
{
this
.
toGroup
}
>
剩余
{
String
(
this
.
state
.
hour
).
padStart
(
2
,
0
)}
:
{
String
(
this
.
state
.
min
).
padStart
(
2
,
0
)}
:
{
String
(
this
.
state
.
sec
).
padStart
(
2
,
0
)}
邀请好友参团
<
/div
>
...
...
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