Commit 264a3d9a by xuzhenghua

pull

parents c7210be4 7c092772
...@@ -231,16 +231,22 @@ class CollectBlessing extends Component { ...@@ -231,16 +231,22 @@ class CollectBlessing extends Component {
<i className="collect-blessing__num">{index+1}</i> <i className="collect-blessing__num">{index+1}</i>
<p className="collect-blessing__title">{item}</p> <p className="collect-blessing__title">{item}</p>
{ {
index === 0 && (isLogin && isSign) && index === 0 &&
<>
{
(isLogin && isSign)
? (
<a className="collect-blessing__content" data-status="done"> <a className="collect-blessing__content" data-status="done">
+5<br/>福气值 +5<br/>福气值
</a> </a>
} )
{ : (
index === 0 && (!isLogin || !isSign) &&
<span onClick={toLogin} className="collect-blessing__content"> <span onClick={toLogin} className="collect-blessing__content">
点击<br/>签到 点击<br/>签到
</span> </span>
)
}
</>
} }
{ {
index === 1 && index === 1 &&
...@@ -281,7 +287,9 @@ class CollectBlessing extends Component { ...@@ -281,7 +287,9 @@ class CollectBlessing extends Component {
index === 4 && index === 4 &&
<a className="collect-blessing__content" onClick={handleToShowInvite}> <a className="collect-blessing__content" onClick={handleToShowInvite}>
<span>邀请链接</span> <span>邀请链接</span>
<i>已加{inviteBlessing}</i> {
inviteBlessing > 0 && <i>已加{inviteBlessing}</i>
}
</a> </a>
} }
{ {
...@@ -290,7 +298,9 @@ class CollectBlessing extends Component { ...@@ -290,7 +298,9 @@ class CollectBlessing extends Component {
className="collect-blessing__content" className="collect-blessing__content"
onClick={toSection}> onClick={toSection}>
<span>去选课</span> <span>去选课</span>
<i>已加{buyBlessing}</i> {
buyBlessing > 0 && <i>已加{buyBlessing}</i>
}
</a> </a>
} }
</div> </div>
......
...@@ -115,6 +115,7 @@ class Live extends Component { ...@@ -115,6 +115,7 @@ class Live extends Component {
tabBarInactiveTextColor={'#FFF604'} tabBarInactiveTextColor={'#FFF604'}
tabBarUnderlineStyle={{display: 'none'}} tabBarUnderlineStyle={{display: 'none'}}
initialPage={today} initialPage={today}
swipeable={false}
> >
{ {
this.props.isFormal this.props.isFormal
......
...@@ -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()
...@@ -110,19 +109,13 @@ class UseCoupon extends PureComponent { ...@@ -110,19 +109,13 @@ class UseCoupon extends PureComponent {
getMyCoupons = () => { getMyCoupons = () => {
Promise.all([ Promise.all([
http.get(`${API.home}/m/coupon/all`), http.get(`${API.home}/m/coupon/expansion`),
http.get(`${API.home}/m/coupon/expansion`) http.get(`${API.home}/m/coupon/all`)
]).then((coupons) => { ]).then((coupons) => {
let myCoupons = [] let myCoupons = []
const [allCoupons, expansionCoupons] = coupons const [expansionCoupons, allCoupons] = coupons
const {data: all} = allCoupons const {data: all} = allCoupons
const {data: expansion} = expansionCoupons const {data: expansion} = expansionCoupons
if (all.code == 200) {
Array.isArray(all.data) && (myCoupons = myCoupons.concat(all.data))
} else {
Toast.info(all.msg)
}
if (expansion.code == 200) { if (expansion.code == 200) {
Array.isArray(expansion.data) Array.isArray(expansion.data)
&& (expansion.data = expansion.data.map(item => (item.ctype = 4, item))) && (expansion.data = expansion.data.map(item => (item.ctype = 4, item)))
...@@ -130,6 +123,11 @@ class UseCoupon extends PureComponent { ...@@ -130,6 +123,11 @@ class UseCoupon extends PureComponent {
} else { } else {
Toast.info(expansion.msg) Toast.info(expansion.msg)
} }
if (all.code == 200) {
Array.isArray(all.data) && (myCoupons = myCoupons.concat(all.data))
} else {
Toast.info(all.msg)
}
this.setState({ this.setState({
couponList: myCoupons couponList: myCoupons
...@@ -139,12 +137,21 @@ class UseCoupon extends PureComponent { ...@@ -139,12 +137,21 @@ class UseCoupon extends PureComponent {
getAllCoupons = () => { getAllCoupons = () => {
Promise.all([ Promise.all([
http.post(`${API.home}/m/coupon/select`, {course_id: this.state.courseId}), http.get(`${API.home}/m/coupon/expansion`),
http.get(`${API.home}/m/coupon/expansion`) http.post(`${API.home}/m/coupon/select`, {course_id: this.state.courseId})
]).then((coupons) => { ]).then((coupons) => {
const [selectCoupons, expansionCoupons] = coupons const [expansionCoupons, selectCoupons] = coupons
const {data: select} = selectCoupons const {data: select} = selectCoupons
const {data: expansion} = expansionCoupons const {data: expansion} = expansionCoupons
if (expansion.code == 200) {
Array.isArray(expansion.data)
&& (expansion.data = expansion.data.map(item => (item.ctype = 4, item)))
&& (this.setState({
valid_coupons: this.state.valid_coupons.concat(expansion.data)
}))
} else {
Toast.info(expansion.msg)
}
if (select.code === 200) { if (select.code === 200) {
const inuse_coupon = select.data['inuse_coupon'] const inuse_coupon = select.data['inuse_coupon']
this.setState({ this.setState({
...@@ -158,15 +165,6 @@ class UseCoupon extends PureComponent { ...@@ -158,15 +165,6 @@ class UseCoupon extends PureComponent {
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
} }
if (expansion.code == 200) {
Array.isArray(expansion.data)
&& (expansion.data = expansion.data.map(item => (item.ctype = 4, item)))
&& (this.setState({
valid_coupons: this.state.valid_coupons.concat(expansion.data)
}))
} else {
Toast.info(expansion.msg)
}
}) })
...@@ -278,11 +276,12 @@ class UseCoupon extends PureComponent { ...@@ -278,11 +276,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
}) })
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
font-size: 14px; font-size: 14px;
color: $color_666; color: $color_666;
margin-top: 10px; margin-top: 10px;
line-height: 16px;
} }
.des { .des {
......
...@@ -164,8 +164,7 @@ class ExpandShare extends Component { ...@@ -164,8 +164,7 @@ class ExpandShare extends Component {
step: 2, step: 2,
helpData: data helpData: data
}) })
this.getListorData()
console.log(data)
} else if (errno === 17018 || errno === 17020) { } else if (errno === 17018 || errno === 17020) {
this.setState({ this.setState({
isShow: true, isShow: true,
......
...@@ -569,6 +569,7 @@ ...@@ -569,6 +569,7 @@
color: #fff; color: #fff;
font-size: 15px; font-size: 15px;
margin-top: 20px; margin-top: 20px;
border: none;
} }
} }
...@@ -596,6 +597,7 @@ ...@@ -596,6 +597,7 @@
border-radius: 17px; border-radius: 17px;
color: #fff; color: #fff;
font-size: 15px; font-size: 15px;
border: none;
} }
} }
......
...@@ -193,7 +193,7 @@ function PayInfo(props) { ...@@ -193,7 +193,7 @@ function PayInfo(props) {
</p> </p>
<p> <p>
<span className='payable'>已优惠:</span> <span className='payable'>已优惠:</span>
<span className='price'>¥{props.item.deposit_cut}</span> <span className='price'>¥{props.item.discount}</span>
</p> </p>
</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