Commit 264a3d9a by xuzhenghua

pull

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