Commit 5fd2370c by zhanghaozhe

定金bug

parent c42220e1
...@@ -3,7 +3,9 @@ import './coupon.scss' ...@@ -3,7 +3,9 @@ import './coupon.scss'
import classnames from 'classnames' import classnames from 'classnames'
import { http } from "@/utils" import { http } from "@/utils"
import showAlert from '@common/deposit/end-expansion-alert' import showAlert from '@common/deposit/end-expansion-alert'
import {Toast} from 'antd-mobile' import { Toast } from 'antd-mobile'
import { withRouter } from "react-router-dom"
class Coupon extends PureComponent { class Coupon extends PureComponent {
...@@ -12,9 +14,18 @@ class Coupon extends PureComponent { ...@@ -12,9 +14,18 @@ class Coupon extends PureComponent {
EXPAND = 4 //膨胀全 EXPAND = 4 //膨胀全
pick = () => { pick = (e) => {
let {useCoupon, invalid} = this.props let {useCoupon, invalid, start_amount, id, location, history, code} = this.props
const {state} = location
if(state && state.from && state.from === '/my'){
history.push(`/expand/index?deposit_code=${code}`)
return
}
if (start_amount) {
this.stopExpanding(id, e)
} else {
!invalid && useCoupon && useCoupon(this.props.id) !invalid && useCoupon && useCoupon(this.props.id)
}
} }
...@@ -38,8 +49,8 @@ class Coupon extends PureComponent { ...@@ -38,8 +49,8 @@ class Coupon extends PureComponent {
.then(res => { .then(res => {
const {data} = res const {data} = res
if (data.code == 200) { if (data.code == 200) {
this.props.endExpansion(id) this.props.endExpansion(id, data.data.coupon_id)
}else { } else {
Toast.info(data.msg) Toast.info(data.msg)
} }
}) })
...@@ -209,4 +220,4 @@ function BaseCoupon( ...@@ -209,4 +220,4 @@ function BaseCoupon(
) )
} }
export default Coupon export default withRouter(Coupon)
...@@ -6,7 +6,6 @@ import Coupon from '../Coupon' ...@@ -6,7 +6,6 @@ import Coupon from '../Coupon'
import { http, getParam } from '@/utils' 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 { connect } from 'react-redux' import { connect } from 'react-redux'
@connect() @connect()
...@@ -278,11 +277,12 @@ class UseCoupon extends PureComponent { ...@@ -278,11 +277,12 @@ class UseCoupon extends PureComponent {
}) })
} }
endExpansion = id => { endExpansion = (id, validId) => {
this.setState({ this.setState({
couponList: this.state.couponList.map(item => { valid_coupons: this.state.valid_coupons.map(item => {
if (item.id === id) { if (item.id === id) {
delete item.start_amount delete item.start_amount
item.id = validId
} }
return item return item
}) })
......
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