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
39937e45
Commit
39937e45
authored
Aug 19, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solve question that info of course in order page when click btn of pintuan to order
parent
2c845752
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
src/components/order/index.js
+26
-18
No files found.
src/components/order/index.js
View file @
39937e45
...
...
@@ -100,6 +100,7 @@ class Order extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
groupPrice
:
''
,
perfect
:
this
.
props
.
location
.
state
,
user_account
:
0.00
,
// 账户余额
total
:
0.00
,
// 需要支付总金额
...
...
@@ -217,9 +218,10 @@ class Order extends Component {
};
// 公共方法 存储数据
publicGetData
=
(
res
)
=>
{
let
{
course
,
total
,
user_account
,
user_info
,
discount
}
=
res
.
data
.
data
;
let
{
course
,
total
,
user_account
,
user_info
,
discount
}
=
res
;
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
group
===
1
)
{
total
=
this
.
groupPrice
;
console
.
log
(
this
.
state
);
total
=
this
.
state
.
groupPrice
;
}
this
.
cacheObj
=
{
perfect
:
user_info
,
...
...
@@ -253,52 +255,57 @@ class Order extends Component {
componentDidMount
()
{
let
_this
=
this
;
console
.
log
(
this
.
props
.
location
.
state
);
console
.
log
(
0
);
// type: 1,返现课程,simple: 1,正常购买
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
type
===
1
)
{
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder?type=1`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
===
200
)
{
this
.
publicGetData
(
res
);
this
.
publicGetData
(
res
.
data
.
data
);
this
.
publicLocalStorage
();
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
}
else
if
(
this
.
props
.
location
.
state
&&
(
this
.
props
.
location
.
state
.
simple
===
1
||
this
.
props
.
location
.
state
.
bargain
===
1
))
{
console
.
log
(
1
);
// 普通课程立即报名 不带 type = 1
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder`
).
then
(
res
=>
{
if
(
res
.
data
.
errno
===
200
)
{
this
.
publicGetData
(
res
);
this
.
publicGetData
(
res
.
data
.
data
);
this
.
publicLocalStorage
();
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
});
}
else
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
group
===
1
){
console
.
log
(
2
);
// 获取一键开团的课程
Promise
.
all
([
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder`
),
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
getParam
(
'id'
)}
`
)]).
then
(
resList
=>
{
console
.
log
(
resList
);
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder`
)]).
then
(
resList
=>
{
let
courseInfo
=
resList
[
0
],
orderInfo
=
resList
[
1
];
console
.
log
(
courseInfo
.
data
);
console
.
log
(
orderInfo
.
data
);
if
(
courseInfo
.
data
.
errno
===
200
)
{
let
newData
=
{};
if
(
orderInfo
.
data
.
errno
===
200
)
{
newData
=
Object
.
assign
({},
orderInfo
.
data
.
data
,
{
course
:
[]});
}
else
{
Toast
.
info
(
courseInfo
.
data
.
msg
,
2
);
return
;
}
if
(
orderInfo
.
data
.
code
===
200
)
{
if
(
courseInfo
.
data
.
code
===
200
)
{
newData
.
course
.
push
(
courseInfo
.
data
.
data
.
course_info
);
this
.
setState
({
groupPrice
:
courseInfo
.
data
.
data
.
course_info
.
pdd_group_info
.
price
})
}
else
{
Toast
.
info
(
courseInfo
.
data
.
msg
,
2
);
return
;
}
this
.
groupPrice
=
orderInfo
.
data
.
data
.
course_info
.
pdd_group_info
.
price
;
if
(
courseInfo
.
data
.
data
.
course
.
length
===
0
)
{
courseInfo
.
data
.
data
.
course
.
push
(
orderInfo
.
data
.
data
.
course_info
)
}
this
.
publicGetData
(
courseInfo
);
//
this.groupPrice = orderInfo.data.data.course_info.pdd_group_info.price;
//
if(courseInfo.data.data.course.length === 0) {
//
courseInfo.data.data.course.push(orderInfo.data.data.course_info)
//
}
this
.
publicGetData
(
newData
);
this
.
publicLocalStorage
();
});
}
else
{
...
...
@@ -323,7 +330,7 @@ class Order extends Component {
return
;
}
this
.
publicGetData
(
res
);
this
.
publicGetData
(
res
.
data
.
data
);
this
.
publicLocalStorage
();
})
// }
...
...
@@ -347,6 +354,7 @@ class Order extends Component {
useBalance
,
info
,
offset
,
groupPrice
}
=
this
.
state
;
return
(
...
...
@@ -402,7 +410,7 @@ class Order extends Component {
compute
=
{
this
.
computedMoney
}
courseId
=
{
getParam
(
'id'
)}
locationState
=
{
this
.
props
.
location
.
state
}
groupPrice
=
{
this
.
groupPrice
}
groupPrice
=
{
groupPrice
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
<
/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