Commit 5fd2370c by zhanghaozhe

定金bug

parent c42220e1
......@@ -3,7 +3,9 @@ import './coupon.scss'
import classnames from 'classnames'
import { http } from "@/utils"
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 {
......@@ -12,9 +14,18 @@ class Coupon extends PureComponent {
EXPAND = 4 //膨胀全
pick = () => {
let {useCoupon, invalid} = this.props
pick = (e) => {
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)
}
}
......@@ -38,8 +49,8 @@ class Coupon extends PureComponent {
.then(res => {
const {data} = res
if (data.code == 200) {
this.props.endExpansion(id)
}else {
this.props.endExpansion(id, data.data.coupon_id)
} else {
Toast.info(data.msg)
}
})
......@@ -209,4 +220,4 @@ function BaseCoupon(
)
}
export default Coupon
export default withRouter(Coupon)
......@@ -6,7 +6,6 @@ import Coupon from '../Coupon'
import { http, getParam } from '@/utils'
import { WithFullSize } from '@/HOCs'
import { Toast } from 'antd-mobile'
import { isEmpty } from 'lodash'
import { connect } from 'react-redux'
@connect()
......@@ -278,11 +277,12 @@ class UseCoupon extends PureComponent {
})
}
endExpansion = id => {
endExpansion = (id, validId) => {
this.setState({
couponList: this.state.couponList.map(item => {
valid_coupons: this.state.valid_coupons.map(item => {
if (item.id === id) {
delete item.start_amount
item.id = validId
}
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