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
a8aeb17c
Commit
a8aeb17c
authored
Jun 14, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail
parent
454affe1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
29 deletions
+22
-29
src/components/my/edit.js
+4
-2
src/components/shopCart/index.js
+18
-27
No files found.
src/components/my/edit.js
View file @
a8aeb17c
...
...
@@ -4,6 +4,8 @@ import {connect} from "react-redux"
import
{
Toast
}
from
'antd-mobile'
import
{
api
,
http
}
from
"@/utils"
import
{
HeaderBar
}
from
"@/common"
// import {logout} from '@/store/userAction'
class
MyEdut
extends
PureComponent
{
...
...
@@ -37,7 +39,7 @@ class MyEdut extends PureComponent {
}
// 退出登录
outLogin
=
()
=>
{
// this.props.logout()
}
// 确定修改
...
...
@@ -106,5 +108,5 @@ class MyEdut extends PureComponent {
export
default
connect
(
state
=>
({
user
:
state
.
user
}),
null
// {logout}
)(
MyEdut
)
src/components/shopCart/index.js
View file @
a8aeb17c
...
...
@@ -18,7 +18,6 @@ class Cart extends Component {
super
(
props
)
this
.
state
=
{
data
:
[],
deleteAll
:
false
,
checkedNum
:
0
,
allPrice
:
0
,
cartNmu
:
0
,
...
...
@@ -111,11 +110,12 @@ class Cart extends Component {
let
allPrice
=
0
;
let
checkedNum
=
0
;
let
cartNmu
=
0
;
let
arr
=
[]
newData
.
forEach
((
item
,
i
)
=>
{
if
(
item
.
check
)
{
i
++
;
arr
.
push
(
item
)
cartNmu
+=
1
;
checkedNum
=
i
;
checkedNum
=
arr
.
length
;
allPrice
+=
parseFloat
(
item
.
price1
);
}
})
...
...
@@ -126,6 +126,19 @@ class Cart extends Component {
})
}
// 去结算
tobuy
=
()
=>
{
http
.
get
(
`
${
api
[
'pay-api'
]}
/m/cart/addtopreorder/[
${
this
.
state
.
courseIdarr
}
]`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
==
0
)
{
this
.
props
.
history
.
push
(
'/order'
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
}
// 删除
todelete
=
()
=>
{
if
(
this
.
state
.
courseIdarr
.
length
>
0
)
{
...
...
@@ -161,28 +174,6 @@ class Cart extends Component {
<
div
className
=
"cart-body"
>
<
ShopCart
checkChange
=
{
this
.
checkChange
.
bind
(
this
)}
data
=
{
this
.
state
.
data
}
/
>
{
this
.
state
.
deleteAll
?
<
div
className
=
"cart-footer"
>
<
div
>
<
Checkbox
onChange
=
{(
e
)
=>
{
this
.
allChange
(
e
)
}}
/
>
<
div
>
全选
<
/div
>
<
/div
>
<
div
><
/div
>
<
div
className
=
{
classnames
({
'active'
:
this
.
state
.
cartNmu
>
0
})}
onClick
=
{()
=>
{
if
(
this
.
state
.
cartNmu
>
0
)
{
this
.
delete
()
}
}}
>
删除
<
span
>
({
this
.
state
.
cartNmu
})
<
/span
>
<
/div
>
<
/div
>
:
<
div
className
=
"cart-footer"
>
<
div
className
=
"cart-label"
>
<
Checkbox
onChange
=
{(
e
)
=>
{
...
...
@@ -200,13 +191,13 @@ class Cart extends Component {
'active'
:
this
.
state
.
checkedNum
>
0
})}
onClick
=
{()
=>
{
if
(
this
.
state
.
checkedNum
>
0
)
{
this
.
buy
()
this
.
to
buy
()
}
}}
>
结算
<
span
>
(
{
this
.
state
.
checkedNum
}
)
<
/span
>
<
/div
>
<
/div
>
}
<
/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