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
533c5f55
Commit
533c5f55
authored
Aug 14, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
普通课程立即报名
parent
6f366566
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
22 deletions
+59
-22
src/components/detail/btnstatus/index.js
+13
-2
src/components/order/index.js
+46
-20
No files found.
src/components/detail/btnstatus/index.js
View file @
533c5f55
...
...
@@ -89,6 +89,16 @@ class BtnStatus extends Component {
})
}
};
// 普通课程的立即报名 要模拟结算过程
simpleCourse
=
()
=>
{
http
.
get
(
`
${
API
[
'base-api'
]}
/m/cart/addtopreorder/[
${
getParam
(
'id'
)}
]`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
===
0
)
{
this
.
props
.
history
.
push
(
`/order?id=[
${
getParam
(
'id'
)}
]`
,
{
simple
:
1
})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
};
// 格式化开课时间
formatDate
=
(
date
)
=>
{
let
ary
=
date
.
split
(
'-'
);
...
...
@@ -208,7 +218,8 @@ class BtnStatus extends Component {
<
button
className
=
'btn btn-s bg-FCCD05'
onClick
=
{
e
=>
this
.
toCart
(
1
)}
>
加入购物车
<
/button
>
}
<
Link
to
=
'/order'
className
=
'btn btn-s bg-FD7700'
>
立即报名
<
/Link
>
{
/*<Link to='/order' className='btn btn-s bg-FD7700'>立即报名</Link>*/
}
<
span
className
=
'btn btn-s bg-FD7700'
onClick
=
{
e
=>
this
.
simpleCourse
()}
>
立即报名
<
/span
>
<
/div
>
}
...
...
@@ -217,7 +228,7 @@ class BtnStatus extends Component {
info
.
is_baoming
===
1
&&
<
div
className
=
'btns-box'
>
<
a
className
=
'consult consult-m'
href
=
"https://q.url.cn/AB8aue?_type=wpa&qidian=true"
>
<
i
className
=
'iconfont iconerji'
><
/i
>
<
i
className
=
'iconfont iconerji'
/
>
<
span
>
课程咨询
<
/span
>
<
/a
>
<
Link
to
=
{
`/play?id=
${
getParam
(
'id'
)}
`
}
className
=
'btn btn-m bg-09f'
>
开始学习
<
/Link
>
...
...
src/components/order/index.js
View file @
533c5f55
...
...
@@ -81,11 +81,10 @@ class Order extends Component {
info
:
false
,
offset
:
0
,
};
console
.
log
(
this
.
props
.
location
.
state
);
}
// 提交订单
submitOrder
=
()
=>
{
if
(
this
.
state
.
orderList
.
lengt
j
h
===
0
)
{
if
(
this
.
state
.
orderList
.
length
===
0
)
{
Toast
.
info
(
'没有要提交的订单!'
);
return
;
}
...
...
@@ -93,7 +92,7 @@ class Order extends Component {
Toast
.
info
(
'请完善报名信息!'
);
}
let
url
=
`
${
API
[
'base-api'
]}
/m/v34/cart/order?ischeck=
${
this
.
state
.
useBalance
}
`
;
if
(
this
.
props
.
location
.
state
.
type
===
1
)
{
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
type
===
1
)
{
url
+=
'&type=1'
}
http
.
get
(
url
).
then
(
res
=>
{
...
...
@@ -210,37 +209,64 @@ class Order extends Component {
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
}
else
{
}
else
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
simple
===
1
)
{
http
.
get
(
`
${
API
.
home
}
/m/order/preorder`
).
then
(
res
=>
{
console
.
log
(
res
);
if
(
res
.
data
.
code
===
200
)
{
const
{
course
,
total
,
user_account
,
user_info
,
discount
}
=
res
.
data
.
data
;
this
.
cacheObj
=
{
perfect
:
user_info
,
orderList
:
course
,
user_account
,
total
,
discount
,
};
this
.
setState
({
perfect
:
user_info
,
orderList
:
course
,
user_account
,
total
,
discount
,
});
if
(
this
.
props
.
history
.
action
===
'PUSH'
)
{
sessionStorage
.
removeItem
(
'orderUseCacheObj'
);
}
else
{
const
cacheObj
=
sessionStorage
.
getItem
(
'orderUseCacheObj'
);
if
(
cacheObj
!==
null
)
{
this
.
setState
({
useBalance
:
true
});
this
.
computedMoneyByCache
();
}
}
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
});
}
else
{
if
(
getParam
(
'id'
))
{
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/m/del_cart_order/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
API
.
home
}
/m/order/preorder`
)
,
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
getParam
(
'id'
)}
`
)
]).
then
(
res
=>
{
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/m/del_cart_order/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
API
.
home
}
/m/order/preorder`
)]).
then
(
res
=>
{
console
.
log
(
res
);
let
preorder
=
res
[
1
],
detail
=
res
[
2
],
orderList
=
[];
console
.
log
(
detail
);
orderList
=
preorder
.
data
.
data
.
course
;
if
(
preorder
.
data
.
code
!==
200
)
{
Toast
.
info
(
preorder
.
data
.
msg
,
2
);
return
;
}
if
(
detail
.
data
.
code
!==
200
)
{
Toast
.
info
(
preorder
.
data
.
msg
,
2
);
return
;
}
const
{
user_info
,
user_account
,
discount
}
=
preorder
.
data
.
data
;
const
{
course_info
}
=
detail
.
data
.
data
;
orderList
.
push
(
course_info
);
this
.
cacheObj
=
{
perfect
:
user_info
,
orderList
:
orderList
,
user_account
,
total
:
course_info
.
pdd_group_info
.
price
,
total
:
preorder
.
data
.
data
.
total
,
discount
,
}
}
;
_this
.
setState
({
perfect
:
user_info
,
orderList
:
orderList
,
user_account
,
total
:
course_info
.
pdd_group_info
.
price
,
total
:
preorder
.
data
.
data
.
total
,
discount
,
});
})
...
...
@@ -301,7 +327,7 @@ class Order extends Component {
!
this
.
state
.
perfect
&&
<
Link
to
=
{{
pathname
:
'/orderinfo'
,
state
:
{
type
:
this
.
props
.
location
.
state
.
type
,
id
:
getParam
(
'id'
)}
state
:
{
type
:
this
.
props
.
location
.
state
?
this
.
props
.
location
.
state
.
type
:
null
,
id
:
getParam
(
'id'
)}
}}
className
=
"order-information"
>
<
i
className
=
"iconfont iconiconfront-6 order-addsize"
><
/i
>
...
...
@@ -317,7 +343,7 @@ class Order extends Component {
pathname
:
'/orderinfo'
,
state
:
{
...
this
.
state
.
perfect
,
type
:
this
.
props
.
location
.
state
.
type
,
type
:
this
.
props
.
location
.
state
?
this
.
props
.
location
.
state
.
type
:
null
,
id
:
getParam
(
'id'
)
}
}
...
...
@@ -340,7 +366,7 @@ class Order extends Component {
<
/div
>
}
<
div
className
=
"order-list"
>
<
OrderList
list
=
{
orderList
}
compute
=
{
this
.
computedMoney
}
courseId
=
{
getParam
(
'id'
)}
isaist
=
{
this
.
props
.
location
.
state
.
type
}
/
>
<
OrderList
list
=
{
orderList
}
compute
=
{
this
.
computedMoney
}
courseId
=
{
getParam
(
'id'
)}
isaist
=
{
this
.
props
.
location
.
state
?
this
.
props
.
location
.
state
.
type
:
null
}
/
>
<
/div
>
<
div
className
=
"order-balance"
>
<
List
>
...
...
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