Commit 4734a33d by xuzhenghua

pull

parents dfe9d9a2 264a3d9a
......@@ -62,8 +62,34 @@ class ReserveCourse extends Component {
}
}
// 立即付尾款
expandPaywk = (courseId, day) => {
Toast.info("付尾款时间将在" + day + "开启", 2);
expandPaywk = (courseId, time,day) => {
const {user, history} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
if (!getParam('version')) {
this.props.history.push('/passport/login')
} else {
SendMessageToApp("toLogin");
}
} else {
let timeStamp = Date.parse(new Date()) / 1000;
if (timeStamp >= time) {
if (!getParam('version')) {
this.props.history.push(
'/final-deposit-order?source=1',
{
id: courseId,
sourcenum: 1
}
)
} else {
SendMessageToApp("TailMoney");
}
} else {
Toast.info("付尾款时间将在" + day + "开启", 2);
}
}
}
// 去学习
tostudy = (courseId) => {
......@@ -138,7 +164,7 @@ function CourseList(props) {
{
item.is_buy === 1 &&
<button className="to-expand-buy2"
onClick={() => expandPaywk(item.course_id, item.final_start_time)}>立即付尾款</button>
onClick={() => expandPaywk(item.course_id, item.start_timestamp,item.final_start_time)}>立即付尾款</button>
}
{
item.is_buy === 2 &&
......
......@@ -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) &&
<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 === 0 &&
<>
{
(isLogin && isSign)
? (
<a className="collect-blessing__content" data-status="done">
+5<br/>福气值
</a>
)
: (
<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,210 +3,221 @@ 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 {
VOUCHER = 1 //代金券
FREE = 2 //免单券
EXPAND = 4 //膨胀全
class Coupon extends PureComponent {
pick = () => {
let {useCoupon, invalid} = this.props
!invalid && useCoupon && useCoupon(this.props.id)
VOUCHER = 1 //代金券
FREE = 2 //免单券
EXPAND = 4 //膨胀全
}
GoToUse = () => {
this.props.useCoupon(this.props.id)
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
}
ExchangeCourse = (e) => {
this.props.toExchangeCourse(e, this.props.code)
if (start_amount) {
this.stopExpanding(id, e)
} else {
!invalid && useCoupon && useCoupon(this.props.id)
}
stopExpanding = (id, e) => {
const {amount, limit_amount} = this.props
e.stopPropagation()
showAlert({
amount,
limit_amount,
onConfirm: () => {
http.post(`${API.home}/m/end_expansion`, {
id
})
.then(res => {
const {data} = res
if (data.code == 200) {
this.props.endExpansion(id)
}else {
Toast.info(data.msg)
}
})
}
}
GoToUse = () => {
this.props.useCoupon(this.props.id)
}
ExchangeCourse = (e) => {
this.props.toExchangeCourse(e, this.props.code)
}
stopExpanding = (id, e) => {
const {amount, limit_amount} = this.props
e.stopPropagation()
showAlert({
amount,
limit_amount,
onConfirm: () => {
http.post(`${API.home}/m/end_expansion`, {
id
})
.then(res => {
const {data} = res
if (data.code == 200) {
this.props.endExpansion(id, data.data.coupon_id)
} else {
Toast.info(data.msg)
}
})
}
})
}
render() {
let {
ctype,
amount,
course_title,
showUseButton,
id,
format_expire_time,
start_amount,
limit_amount
} = this.props
let top, bottom
switch (ctype) {
case this.VOUCHER:
top = (
<>
<p className='denomination'>{amount} <span></span></p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
}
)
bottom = (
<>
<span className={'limit'}>可用于大于代金券金额的课程</span>
{
showUseButton && ctype == this.VOUCHER &&
<button
className='use'
onClick={this.GoToUse}
>立即使用
</button>
}
</>
)
break
case this.FREE:
top = (
<>
<p className='course-title'>{course_title}</p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
)
bottom = (
<>
<span className={'limit'}>{`仅适用于《${course_title}》`}</span>
{
showUseButton && ctype == this.FREE &&
<button
className='use'
onClick={(e) => this.ExchangeCourse(e)}
>立即兑换
</button>
}
</>
render() {
let {
ctype,
amount,
course_title,
showUseButton,
id,
format_expire_time,
start_amount,
limit_amount
} = this.props
let top, bottom
switch (ctype) {
case this.VOUCHER:
top = (
<>
<p className='denomination'>{amount} <span></span></p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
)
bottom = (
<>
<span className={'limit'}>可用于大于代金券金额的课程</span>
{
showUseButton && ctype == this.VOUCHER &&
<button
className='use'
onClick={this.GoToUse}
>立即使用
</button>
}
</>
)
break
case this.FREE:
top = (
<>
<p className='course-title'>{course_title}</p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
)
bottom = (
<>
<span className={'limit'}>{`仅适用于《${course_title}》`}</span>
{
showUseButton && ctype == this.FREE &&
<button
className='use'
onClick={(e) => this.ExchangeCourse(e)}
>立即兑换
</button>
}
</>
)
break
case this.EXPAND:
if (!start_amount) {
top = (
<>
<p className='denomination'>{amount} <span></span></p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
)
} else {
top = (
<>
<div className="progress-container">
<p className='denomination'>{amount} <span></span></p>
<div className={'progress-bar-container'}>
)
break
case this.EXPAND:
if (!start_amount) {
top = (
<>
<p className='denomination'>{amount} <span></span></p>
<p className='expire'>有效期至:{format_expire_time}</p>
</>
)
} else {
top = (
<>
<div className="progress-container">
<p className='denomination'>{amount} <span></span></p>
<div className={'progress-bar-container'}>
<span className={'progress-bar'}
style={{width: `${Math.round((amount - start_amount) / limit_amount * 100)}%`}}
></span>
</div>
<div className={'money'}>
<span>{start_amount}</span>
<span>{limit_amount}</span>
</div>
</div>
</>
)
}
bottom = (
<>
<span className={'limit'}>全场通用</span>
{
start_amount
&& <button className='stop-expanding'
onClick={this.stopExpanding.bind(this, id)}>立即结束膨胀</button>
}
</>
)
break
</div>
<div className={'money'}>
<span>{start_amount}</span>
<span>{limit_amount}</span>
</div>
</div>
</>
)
}
bottom = (
<>
<span className={'limit'}>全场通用</span>
{
start_amount
&& <button className='stop-expanding'
onClick={this.stopExpanding.bind(this, id)}>立即结束膨胀</button>
}
</>
return (
<BaseCoupon
{...this.props}
top={top}
VOUCHER={this.VOUCHER}
FREE={this.FREE}
EXPAND={this.EXPAND}
pick={this.pick}
bottom={bottom}
/>
)
break
}
}
function BaseCoupon(
{
pick,
ctype,
invalid,
top,
VOUCHER,
FREE,
EXPAND,
selectedCouponId,
id,
bottom
}) {
let couponTypes = {
[VOUCHER]: '代金券',
[FREE]: '课程券',
[EXPAND]: '膨胀券'
}
return (
<li className='coupon' onClick={pick}>
<div className={classnames('coupon-info', invalid ? 'invalid' : `coupon-type${ctype}`)}>
<p className='type'>{couponTypes[ctype]}</p>
{top}
{
selectedCouponId === id &&
<i className={classnames('iconfont icondanseshixintubiao-5', {
check: !invalid
})}
/>
}
<ul>
{
new Array(19).fill('a').map((item, index) => {
return <li key={index}/>
})
}
</ul>
</div>
<div className="coupon-des">
{bottom}
</div>
</li>
<BaseCoupon
{...this.props}
top={top}
VOUCHER={this.VOUCHER}
FREE={this.FREE}
EXPAND={this.EXPAND}
pick={this.pick}
bottom={bottom}
/>
)
}
}
function BaseCoupon(
{
pick,
ctype,
invalid,
top,
VOUCHER,
FREE,
EXPAND,
selectedCouponId,
id,
bottom
}) {
let couponTypes = {
[VOUCHER]: '代金券',
[FREE]: '课程券',
[EXPAND]: '膨胀券'
}
return (
<li className='coupon' onClick={pick}>
<div className={classnames('coupon-info', invalid ? 'invalid' : `coupon-type${ctype}`)}>
<p className='type'>{couponTypes[ctype]}</p>
{top}
{
selectedCouponId === id &&
<i className={classnames('iconfont icondanseshixintubiao-5', {
check: !invalid
})}
/>
}
<ul>
{
new Array(19).fill('a').map((item, index) => {
return <li key={index}/>
})
}
</ul>
</div>
<div className="coupon-des">
{bottom}
</div>
</li>
)
}
export default Coupon
export default withRouter(Coupon)
......@@ -6,389 +6,388 @@ 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()
class UseCoupon extends PureComponent {
state = {
selectedCouponId: 0,
redeemCode: '',
couponList: [],
valid_coupons: [],
invalid_coupons: [],
courseId: getParam('id'),
showUseButton: false,
courseCouponExchange: false, // 课程券兑换弹窗
courseCouponData: '' // 兑换课程信息
state = {
selectedCouponId: 0,
redeemCode: '',
couponList: [],
valid_coupons: [],
invalid_coupons: [],
courseId: getParam('id'),
showUseButton: false,
courseCouponExchange: false, // 课程券兑换弹窗
courseCouponData: '' // 兑换课程信息
}
componentDidMount() {
const {history, location} = this.props
const {state} = this.props.location
if (state && state.from) {
if (state.from === '/my') {
this.getMyCoupons()
this.setState({
showUseButton: true
})
} else {
if (!this.state.courseId) {
location.state && location.state.from ? history.replace(location.state.from) : history.goBack()
}
this.getAllCoupons()
}
}
}
handleChange = e => {
let value = e ? e.target.value : ''
this.setState({redeemCode: value})
}
// 兑换
exchange = () => {
const {location: {state = {}}} = this.props
if (this.state.redeemCode !== '') {
http.post(`${API.home}/m/coupon/exchange`, {
code: this.state.redeemCode,
type: state.from.substr(1)
})
.then(res => {
const data = res.data
if (data.code === 200) {
// 如果从我的页面进来,点击兑换直接兑换成功课程,弹出弹窗
// 如果从订单页面进来,点击兑换兑换成券
const coupon = data.data
componentDidMount() {
const {history, location} = this.props
const {state} = this.props.location
if (state && state.from) {
if (state.from === '/my') {
this.getMyCoupons()
if (coupon['ctype'] == 2) {
this.setState({
showUseButton: true
courseCouponData: coupon,
courseCouponExchange: true,
redeemCode: ''
})
} else {
if (!this.state.courseId) {
location.state && location.state.from ? history.replace(location.state.from) : history.goBack()
}
this.getAllCoupons()
}
}
}
handleChange = e => {
let value = e ? e.target.value : ''
this.setState({redeemCode: value})
}
// 兑换
exchange = () => {
const {location: {state = {}}} = this.props
if (this.state.redeemCode !== '') {
http.post(`${API.home}/m/coupon/exchange`, {
code: this.state.redeemCode,
type: state.from.substr(1)
})
.then(res => {
const data = res.data
if (data.code === 200) {
// 如果从我的页面进来,点击兑换直接兑换成功课程,弹出弹窗
// 如果从订单页面进来,点击兑换兑换成券
const coupon = data.data
if (state.from === '/my') {
if (coupon['ctype'] == 2) {
this.setState({
courseCouponData: coupon,
courseCouponExchange: true,
redeemCode: ''
})
} else {
this.setState({
couponList: [...this.state.couponList, coupon],
redeemCode: ''
})
Toast.info('兑换成功')
this.getMyCoupons()
}
}
if (state.from === '/order') {
const coupon = data.data
if (coupon['ctype'] == 2
&& coupon['limit_course'] != this.state.courseId) {
this.setState({
invalid_coupons: [...this.state.invalid_coupons, coupon],
showUseButton: null,
redeemCode: ''
})
} else {
this.setState({
valid_coupons: [...this.state.valid_coupons, coupon],
redeemCode: ''
})
}
Toast.info('兑换成功')
this.getAllCoupons()
}
} else {
Toast.info(data.msg)
}
} else {
this.setState({
couponList: [...this.state.couponList, coupon],
redeemCode: ''
})
} else {
Toast.info('请输入兑换码')
}
}
getMyCoupons = () => {
Promise.all([
http.get(`${API.home}/m/coupon/all`),
http.get(`${API.home}/m/coupon/expansion`)
]).then((coupons) => {
let myCoupons = []
const [allCoupons, expansionCoupons] = 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)))
&& (myCoupons = myCoupons.concat(expansion.data))
} else {
Toast.info(expansion.msg)
Toast.info('兑换成功')
this.getMyCoupons()
}
}
if (state.from === '/order') {
const coupon = data.data
this.setState({
couponList: myCoupons
})
})
}
getAllCoupons = () => {
Promise.all([
http.post(`${API.home}/m/coupon/select`, {course_id: this.state.courseId}),
http.get(`${API.home}/m/coupon/expansion`)
]).then((coupons) => {
const [selectCoupons, expansionCoupons] = coupons
const {data: select} = selectCoupons
const {data: expansion} = expansionCoupons
if (select.code === 200) {
const inuse_coupon = select.data['inuse_coupon']
if (coupon['ctype'] == 2
&& coupon['limit_course'] != this.state.courseId) {
this.setState({
valid_coupons: inuse_coupon
? [...inuse_coupon, ...select.data.valid_coupons]
: select.data.valid_coupons,
invalid_coupons: select.data.invalid_coupons,
selectedCouponId: inuse_coupon.length ? inuse_coupon[0].id : 0
invalid_coupons: [...this.state.invalid_coupons, coupon],
showUseButton: null,
redeemCode: ''
})
} 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)
}
})
}
// 立即兑换课程
toExchangeCourse = (e, code) => {
e.stopPropagation()
http.post(`${API['base-api']}/pay/miandan/${code}`, {}).then(res => {
const data = res.data
if (data.errno === 200) {
} else {
this.setState({
courseCouponExchange: true,
courseCouponData: res.data.data
valid_coupons: [...this.state.valid_coupons, coupon],
redeemCode: ''
})
this.getMyCoupons()
} else {
Toast.info(data.msg)
}
Toast.info('兑换成功')
this.getAllCoupons()
}
} else {
Toast.info(data.msg)
}
})
} else {
Toast.info('请输入兑换码')
}
}
getMyCoupons = () => {
Promise.all([
http.get(`${API.home}/m/coupon/expansion`),
http.get(`${API.home}/m/coupon/all`)
]).then((coupons) => {
let myCoupons = []
const [expansionCoupons, allCoupons] = coupons
const {data: all} = allCoupons
const {data: expansion} = expansionCoupons
if (expansion.code == 200) {
Array.isArray(expansion.data)
&& (expansion.data = expansion.data.map(item => (item.ctype = 4, item)))
&& (myCoupons = myCoupons.concat(expansion.data))
} 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
})
})
}
getAllCoupons = () => {
Promise.all([
http.get(`${API.home}/m/coupon/expansion`),
http.post(`${API.home}/m/coupon/select`, {course_id: this.state.courseId})
]).then((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({
valid_coupons: inuse_coupon
? [...inuse_coupon, ...select.data.valid_coupons]
: select.data.valid_coupons,
invalid_coupons: select.data.invalid_coupons,
selectedCouponId: inuse_coupon.length ? inuse_coupon[0].id : 0
})
useCoupon = val => {
const {history} = this.props
const coupon = this.state.couponList.find(item => item.id === val)
if (val) {
if (this.state.showUseButton) {
if (coupon['limit_course'] === 0) {
history.push(`/classify`)
} else {
history.push(`/detail?id=${coupon['limit_course']}`)
return false
}
} else {
Toast.info(data.msg)
}
} else {
const {courseId, selectedCouponId} = this.state
})
}
if (selectedCouponId === val) {
// 立即兑换课程
toExchangeCourse = (e, code) => {
e.stopPropagation()
http.post(`${API['base-api']}/pay/miandan/${code}`, {}).then(res => {
const data = res.data
if (data.errno === 200) {
this.setState({
courseCouponExchange: true,
courseCouponData: res.data.data
})
this.getMyCoupons()
} else {
Toast.info(data.msg)
}
})
}
useCoupon = val => {
const {history} = this.props
const coupon = this.state.couponList.find(item => item.id === val)
if (val) {
if (this.state.showUseButton) {
if (coupon['limit_course'] === 0) {
history.push(`/classify`)
} else {
history.push(`/detail?id=${coupon['limit_course']}`)
return false
}
} else {
http.post(`${API.home}/m/coupon/cancel`, {
course_id: courseId
}).then(res => {
const data = res.data
if (data.code === 200) {
const {courseId, selectedCouponId} = this.state
if (selectedCouponId === val) {
this.setState({
selectedCouponId: 0
})
http.post(`${API.home}/m/coupon/cancel`, {
course_id: courseId
}).then(res => {
const data = res.data
if (data.code === 200) {
} else {
Toast.info(data.msg)
}
})
this.setState({
selectedCouponId: 0
})
} else {
http.post(`${API.home}/m/coupon/use`, {
course_id: this.state.courseId,
coupon_id: val
})
.then(res => {
const data = res && res.data
if (data.code === 200) {
this.setState({selectedCouponId: val})
this.props.history.goBack()
} else {
Toast.info(data.msg)
}
})
} else {
Toast.info(data.msg)
}
})
} else {
http.post(`${API.home}/m/coupon/use`, {
course_id: this.state.courseId,
coupon_id: val
})
.then(res => {
const data = res && res.data
if (data.code === 200) {
}
this.setState({selectedCouponId: val})
this.props.history.goBack()
}
} else {
Toast.info(data.msg)
}
})
} else {
Toast.info('未知错误')
location.reload()
}
}
// 开始学习
toStudy = (vCourseId, isHaveVideo) => {
const {history} = this.props
if (isHaveVideo == 0) {
Toast.info('尚未开课,开课后立即上传课程~', 2)
} else {
history.push(`/play/video?id=${vCourseId}`)
}
this.setState({
courseCouponExchange: false
})
}
}
// 关闭弹窗
closeFreeCourse = () => {
this.setState({
courseCouponExchange: false
})
} else {
Toast.info('未知错误')
location.reload()
}
endExpansion = id => {
this.setState({
couponList: this.state.couponList.map(item => {
if (item.id === id) {
delete item.start_amount
}
return item
})
})
}
// 开始学习
toStudy = (vCourseId, isHaveVideo) => {
const {history} = this.props
if (isHaveVideo == 0) {
Toast.info('尚未开课,开课后立即上传课程~', 2)
} else {
history.push(`/play/video?id=${vCourseId}`)
}
this.setState({
courseCouponExchange: false
})
}
// 关闭弹窗
closeFreeCourse = () => {
this.setState({
courseCouponExchange: false
})
}
endExpansion = (id, validId) => {
this.setState({
valid_coupons: this.state.valid_coupons.map(item => {
if (item.id === id) {
delete item.start_amount
item.id = validId
}
return item
})
})
}
render() {
const {state} = this.props.location
const {showUseButton, selectedCouponId} = this.state
return (
<div className='use-coupon'>
<RedeemBar onChange={this.handleChange}
exchange={this.exchange}
redeemCode={this.state.redeemCode}/>
<div className="coupons-area">
<Content
coupons={
state
&& state.from
&& state.from === '/my'
? this.state.couponList
: this.state.valid_coupons
}
showUseButton={showUseButton}
selectedCouponId={selectedCouponId}
select={this.select}
useCoupon={this.useCoupon}
toExchangeCourse={this.toExchangeCourse}
endExpansion={this.endExpansion}
/>
{
this.state.invalid_coupons.length > 0 &&
(
<>
<div className='invalid-title'>- 不可使用的优惠券 -</div>
<Content
coupons={this.state.invalid_coupons}
selectedCouponId={selectedCouponId}
select={this.select}
purpose={'use'}
invalid={'invalid'}
/>
</>
)
}
</div>
{
this.state.courseCouponExchange &&
<FreeCouponCourse toStudy={this.toStudy} closeFreeCourse={this.closeFreeCourse}
courseCouponData={this.state.courseCouponData}/>
}
</div>
)
}
render() {
const {state} = this.props.location
const {showUseButton, selectedCouponId} = this.state
return (
<div className='use-coupon'>
<RedeemBar onChange={this.handleChange}
exchange={this.exchange}
redeemCode={this.state.redeemCode}/>
<div className="coupons-area">
<Content
coupons={
state
&& state.from
&& state.from === '/my'
? this.state.couponList
: this.state.valid_coupons
}
showUseButton={showUseButton}
selectedCouponId={selectedCouponId}
select={this.select}
useCoupon={this.useCoupon}
toExchangeCourse={this.toExchangeCourse}
endExpansion={this.endExpansion}
/>
{
this.state.invalid_coupons.length > 0 &&
(
<>
<div className='invalid-title'>- 不可使用的优惠券 -</div>
<Content
coupons={this.state.invalid_coupons}
selectedCouponId={selectedCouponId}
select={this.select}
purpose={'use'}
invalid={'invalid'}
/>
</>
)
}
</div>
{
this.state.courseCouponExchange &&
<FreeCouponCourse toStudy={this.toStudy} closeFreeCourse={this.closeFreeCourse}
courseCouponData={this.state.courseCouponData}/>
}
</div>
)
}
}
function Content({coupons, ...rest}) {
if (coupons.length === 0) {
return (
<div className='empty'>
<p>暂无可使用的优惠券</p>
</div>
)
}
if (coupons.length === 0) {
return (
<ul>
{
coupons.map(item => {
return (
<Coupon
key={item.id}
{...item}
id={item.id}
{...rest}
/>
)
})
}
</ul>
<div className='empty'>
<p>暂无可使用的优惠券</p>
</div>
)
}
return (
<ul>
{
coupons.map(item => {
return (
<Coupon
key={item.id}
{...item}
id={item.id}
{...rest}
/>
)
})
}
</ul>
)
}
function FreeCouponCourse(props) {
const {toStudy, closeFreeCourse, courseCouponData} = props
return (
<div className="free-coupon-box">
<div className="free-coupon-content">
<div className="coures-content-success"><i className={'iconfont icondanseshixintubiao-5'}/></div>
<div className="coures-content-title">恭喜你课程兑换成功!赶快去学习吧~</div>
<img className="coures-content-img" src={courseCouponData.image_name} alt=""/>
{
courseCouponData.course_expire != 0 &&
<div className="coures-content-tip"><i
className={'iconfont icondanseshixintubiao-8'}/><span>课程有效期:自今日起{courseCouponData.course_expire}天内,请在有效期内学习该课程哦~</span>
</div>
}
<a className='toStudy'
onClick={() => toStudy(courseCouponData.v_course_id, courseCouponData.is_is_start)}>去学习</a>
</div>
<div className="free-coupon-close">
<i className={'iconfont iconiconfront-2'} onClick={() => closeFreeCourse()}/>
</div>
</div>
)
const {toStudy, closeFreeCourse, courseCouponData} = props
return (
<div className="free-coupon-box">
<div className="free-coupon-content">
<div className="coures-content-success"><i className={'iconfont icondanseshixintubiao-5'}/></div>
<div className="coures-content-title">恭喜你课程兑换成功!赶快去学习吧~</div>
<img className="coures-content-img" src={courseCouponData.image_name} alt=""/>
{
courseCouponData.course_expire != 0 &&
<div className="coures-content-tip"><i
className={'iconfont icondanseshixintubiao-8'}/><span>课程有效期:自今日起{courseCouponData.course_expire}天内,请在有效期内学习该课程哦~</span>
</div>
}
<a className='toStudy'
onClick={() => toStudy(courseCouponData.v_course_id, courseCouponData.is_is_start)}>去学习</a>
</div>
<div className="free-coupon-close">
<i className={'iconfont iconiconfront-2'} onClick={() => closeFreeCourse()}/>
</div>
</div>
)
}
export default WithFullSize(UseCoupon)
......@@ -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;
}
}
......
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