Commit 53062673 by zhanghaozhe

coupon-bug

parent ffaaaa03
...@@ -8,7 +8,7 @@ import './coupons.scss' ...@@ -8,7 +8,7 @@ import './coupons.scss'
class coupons extends Component { class coupons extends Component {
render() { render() {
const {match} = this.props; const {match, location} = this.props;
return ( return (
<div className={'coupons-box'}> <div className={'coupons-box'}>
<HeaderBar title='优惠券' arrow={true}/> <HeaderBar title='优惠券' arrow={true}/>
...@@ -32,7 +32,7 @@ class coupons extends Component { ...@@ -32,7 +32,7 @@ class coupons extends Component {
<div className="coupons-container"> <div className="coupons-container">
<Switch> <Switch>
<Redirect exact from='/coupons' to={{ <Redirect exact from='/coupons' to={{
pathname: 'coupons/my-coupon', state: { pathname: 'coupons/my-coupon', search: location.search, state: {
from: this.props.location.state && this.props.location.state.from from: this.props.location.state && this.props.location.state.from
} }
}}/> }}/>
......
...@@ -7,7 +7,7 @@ import { http, getParam } from '@/utils' ...@@ -7,7 +7,7 @@ import { http, getParam } from '@/utils'
import { WithFullSize } from '@/HOCs' import { WithFullSize } from '@/HOCs'
import { Toast } from 'antd-mobile' import { Toast } from 'antd-mobile'
import { isEmpty } from 'lodash' import { isEmpty } from 'lodash'
import {connect} from 'react-redux'; import { connect } from 'react-redux';
@connect() @connect()
class UseCoupon extends PureComponent { class UseCoupon extends PureComponent {
...@@ -48,7 +48,7 @@ class UseCoupon extends PureComponent { ...@@ -48,7 +48,7 @@ class UseCoupon extends PureComponent {
} }
exchange = () => { exchange = () => {
const { location: { state = {}} } = this.props; const {location: {state = {}}} = this.props;
if (this.state.redeemCode !== '') { if (this.state.redeemCode !== '') {
http.post(`${API.home}/m/coupon/exchange`, { http.post(`${API.home}/m/coupon/exchange`, {
code: this.state.redeemCode code: this.state.redeemCode
...@@ -86,7 +86,7 @@ class UseCoupon extends PureComponent { ...@@ -86,7 +86,7 @@ class UseCoupon extends PureComponent {
if (state.from === '/my') { if (state.from === '/my') {
this.getMyCoupons() this.getMyCoupons()
} }
if(state.from === '/order') { if (state.from === '/order') {
this.getAllCoupons() this.getAllCoupons()
} }
} else { } else {
......
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