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
c2abe11e
Commit
c2abe11e
authored
Aug 13, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
特训营加入购物车
parent
4ed8fb07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
36 deletions
+43
-36
src/components/detail/btnstatus/index.js
+7
-30
src/components/order/index.js
+36
-6
No files found.
src/components/detail/btnstatus/index.js
View file @
c2abe11e
...
...
@@ -59,27 +59,12 @@ class BtnStatus extends Component {
// 未登录 去登陆
this
.
props
.
history
.
push
(
'/passport'
);
}
else
{
// 登陆 走登陆的逻辑
/**
let cidArr = JSON.stringify([getParam('id')]);
this.axios({
method : 'get',
url : "cart/addtopreorder/" + cidArr + "?type=1"
})
.then(function(res){
if(res.data.errno == 0 ){
_this.$router.push({ path: 'order', query: { type: 1 }});
}
})
.catch(function(err){
console.log(err);
})
}
* **/
let
cidArr
=
JSON
.
stringify
([
getParam
(
'id'
)]);
http
.
get
(
`
${
api
[
'base-api'
]}
/cart/addtopreorder/
${
cidArr
}
?type=1`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
props
.
history
.
push
({
pathname
:
'/order'
,
state
:
{
type
:
1
}})
let
cidArr
=
JSON
.
stringify
([
Number
(
getParam
(
'id'
))]);
console
.
log
(
cidArr
);
http
.
get
(
`
${
api
[
'base-api'
]}
/m/cart/addtopreorder/
${
cidArr
}
?type=1`
).
then
((
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
data
.
errno
===
0
)
{
this
.
props
.
history
.
push
({
pathname
:
'/order?id='
+
res
.
data
.
data
[
0
],
state
:
{
type
:
1
}});
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
...
...
@@ -273,19 +258,11 @@ class BtnStatus extends Component {
<
button
className
=
'btn sign-up-now'
onClick
=
{
e
=>
this
.
signUpNow
()}
>
<
span
>
立即报名
<
/span
>
<
/button
>
{
/*<Link to={`/play?id=${getParam('id')}`} className='btn btn-m learn-now'>*/
}
{
/* <span>开始学习</span>*/
}
{
/*</Link>*/
}
{
/*<button className='btn btn-m wait-open' >*/
}
{
/* <span>{this.formatDate('2019-02-10')}</span>*/
}
{
/*</button>*/
}
<
/div
>
}
{
/*特训营课程 登陆且已报名*/
}
{
info
.
is_aist
&&
!
this
.
props
.
user
.
hasError
&&
info
.
is_baoming
===
0
&&
info
.
is_aist
&&
!
this
.
props
.
user
.
hasError
&&
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
>
...
...
src/components/order/index.js
View file @
c2abe11e
...
...
@@ -11,6 +11,7 @@ import "./order.scss"
const
Item
=
List
.
Item
;
function
OrderList
(
props
)
{
console
.
log
(
props
);
const
listData
=
props
.
list
;
return
(
<
div
>
...
...
@@ -29,7 +30,7 @@ function OrderList(props) {
<
span
className
=
'order-price'
>
¥
{
price0
}
<
/span
>
<
/p
>
<
/div
>
)
)
;
return
(
<
OrderItem
{...
item
}
src
=
{
image_name
}
id
=
{
course_id
}
key
=
{
index
}
info
=
{
Info
}
>
...
...
@@ -80,7 +81,8 @@ class Order extends Component {
orderList
:
[],
info
:
false
,
offset
:
0
,
}
};
console
.
log
(
this
.
props
.
location
.
state
);
}
// 提交订单
submitOrder
=
()
=>
{
...
...
@@ -170,9 +172,35 @@ class Order extends Component {
};
componentDidMount
()
{
let
_this
=
this
;
if
(
getParam
(
'id'
)
!==
undefined
)
{
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
=>
{
console
.
log
(
this
.
props
.
location
.
state
);
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
type
===
1
)
{
http
.
get
(
`
${
api
[
'home'
]}
/m/order/preorder/`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
===
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
,
});
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
return
;
}
})
}
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
=>
{
console
.
log
(
res
);
let
preorder
=
res
[
1
],
detail
=
res
[
2
],
orderList
=
[];
...
...
@@ -206,7 +234,8 @@ class Order extends Component {
}
else
{
http
.
get
(
`
${
api
[
'base-api'
]}
/m/order/preorder`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
!==
200
)
{
console
.
log
(
res
.
data
);
if
(
res
.
data
.
errno
!==
200
)
{
return
;
}
const
{
course
,
total
,
user_account
,
user_info
,
discount
}
=
res
.
data
.
data
;
...
...
@@ -216,7 +245,7 @@ class Order extends Component {
user_account
,
total
,
discount
,
}
}
;
this
.
setState
({
perfect
:
user_info
,
orderList
:
course
,
...
...
@@ -237,6 +266,7 @@ class Order extends Component {
}
})
}
}
};
render
()
{
const
{
...
...
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