Commit a8aeb17c by xuzhenghua

detail

parent 454affe1
......@@ -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)
......@@ -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.tobuy()
}
}}>
结算<span> ( {this.state.checkedNum} ) </span>
</div>
</div>
}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment