Commit 9bd8e775 by FE

discount modify in order page

parent 2f4d90b4
......@@ -120,17 +120,25 @@ class Index extends Component {
return (
<div className='index-box'>
<div className='header'>
<img className="logo"
src="http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png" alt=""/>
<CallApp className='to-app' text='在APP打开'></CallApp>
<i className='iconfont iconiconfront- search' onClick={this.toSearch.bind(this)}></i>
<img
className="logo"
src="http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png"
alt=""
/>
<CallApp
className='to-app'
text='在APP打开'
/>
<i
className='iconfont iconiconfront- search'
onClick={this.toSearch.bind(this)}
/>
</div>
<div className='index-swiper'>
{
this.state.banner && this.state.banner.length > 0 &&
<TopSwiper bannerList={this.state.banner}/>
<TopSwiper bannerList={this.state.banner} />
}
</div>
......@@ -141,7 +149,7 @@ class Index extends Component {
return (
<li key={index}>
<a href={item.href}>
<img src={item.src} alt=""/>
<img src={item.src} alt="" />
<span>{item.name}</span>
</a>
</li>
......@@ -151,14 +159,17 @@ class Index extends Component {
</ul>
</div>
<p className="borderTop"></p>
<p className="borderTop" />
{
(this.state.lives && this.state.lives.length > 0) ?
<div className='lives'>
<h2 className="title">近期直播</h2>
<ScrollBox livesList={this.state.lives} liveCourse={this.liveCourse}/>
<ScrollBox
livesList={this.state.lives}
liveCourse={this.liveCourse}
/>
</div> : null
}
......@@ -166,8 +177,11 @@ class Index extends Component {
(this.state.modules && this.state.modules.length > 0) ? this.state.modules.map((item, index) => {
return (
<div key={index}>
<CourseList modules={item} toDetail={this.toCourseDetail}/>
<p className="borderTop"></p>
<CourseList
modules={item}
toDetail={this.toCourseDetail}
/>
<p className="borderTop" />
</div>
)
}) : null
......@@ -178,16 +192,18 @@ class Index extends Component {
<p>查看全部课程</p>
<span>数学基础、数学结构、大数据实战、Python...</span>
</Link>
</div>
{/* 直播间预约 */}
{
this.state.islive &&
<LiveRoom isShow={this.state.isShow} colseBox={this.colseBox}
roomMess={this.state.roomMess} getIndexData={this.getIndexData}></LiveRoom>
<LiveRoom
isShow={this.state.isShow}
colseBox={this.colseBox}
roomMess={this.state.roomMess}
getIndexData={this.getIndexData}
/>
}
</div>
)
}
......@@ -197,17 +213,34 @@ class Index extends Component {
function TopSwiper({bannerList}) {
return (
<Swiper type={animateTypes.CARD} loop={true} height={168} autoPlay={true} typePro createStyle={createStyle}>
<Swiper
type={animateTypes.CARD}
loop={true}
height={168}
autoPlay={true}
typePro
createStyle={createStyle}
>
{bannerList && bannerList.length > 0 && bannerList.map((item, index) => {
return (
Number.isNaN(parseInt(item.jump_url)) ?
<a href={item.jump_url} key={index}>
{/* <Link to={item.jump_url} key={index}> */}
<img className="item" src={item.name} alt=""/>
<img className="item" src={item.name} alt="" />
{/* </Link> */}
</a> :
<Link to={{pathname: '/detail', search: `?id=${item.jump_url}`}} key={index}>
<img className="item" src={item.name} alt=""/>
<Link
to={{
pathname: '/detail',
search: `?id=${item.jump_url}`
}}
key={index}
>
<img
className="item"
src={item.name}
alt=""
/>
</Link>
)
})
......
......@@ -13,7 +13,6 @@ import "./order.scss"
const Item = List.Item;
function OrderList(props) {
console.log(props);
const listData = props.list;
return (
<div>
......@@ -77,8 +76,20 @@ function OrderList(props) {
}}}>
{/* <Link to='coupons' query={{id: course_id}} state={{from: '/order'}}> */}
<Flex justify='between'>
<span style={{ color: '#333', fontSize: '15px' }}>优惠券</span>
<span style={{ fontSize: '14px', color: '#999999' }}>{!coupon_desc ? (coupon_num === 0 ? '无' : `${coupon_num}张可用`) : (coupon_desc)}</span>
<span
style={{
color: '#333',
fontSize: '15px'
}}
>优惠券</span>
<span
style={{
fontSize: '14px',
color: '#999999'
}}
>
{!coupon_desc ? (coupon_num === 0 ? '无' : `${coupon_num}张可用`) : (coupon_desc)}
</span>
</Flex>
</Link>
</Item>
......@@ -234,11 +245,11 @@ class Order extends Component {
info: !prevState.info
}));
};
// 公共方法 存储数据
publicGetData = (res) => {
let { course, total, user_account, user_info, discount } = res;
if(this.props.location.state && this.props.location.state.group === 1) {
console.log(this.state);
total = this.state.groupPrice;
}
this.cacheObj = {
......@@ -260,6 +271,9 @@ class Order extends Component {
publicLocalStorage = () => {
if(this.props.history.action === 'PUSH') {
sessionStorage.removeItem('orderUseCacheObj');
this.setState({
discount: 0.00,
});
} else{
const cacheObj = sessionStorage.getItem('orderUseCacheObj');
if(cacheObj !== null) {
......@@ -272,8 +286,6 @@ class Order extends Component {
};
componentDidMount() {
let _this = this;
console.log(this.props.location.state);
console.log(0);
// type: 1,返现课程,simple: 1,正常购买
if(this.props.location.state && this.props.location.state.type === 1) {
http.get(`${API['base-api']}/m/order/preorder?type=1`).then((res) => {
......@@ -285,7 +297,6 @@ class Order extends Component {
}
})
} else if (this.props.location.state && (this.props.location.state.simple === 1 || this.props.location.state.bargain === 1)) {
console.log(1);
// 普通课程立即报名 不带 type = 1
http.get(`${API['base-api']}/m/order/preorder`).then(res => {
if(res.data.errno === 200) {
......@@ -300,8 +311,6 @@ class Order extends Component {
Promise.all([http.get(`${API.home}/m/course/detail/${getParam('id')}`),http.get(`${API['base-api']}/m/order/preorder`)]).then(resList => {
let courseInfo = resList[0],
orderInfo = resList[1];
console.log(courseInfo.data);
console.log(orderInfo.data);
let newData = {};
if(orderInfo.data.errno === 200) {
newData = Object.assign({}, orderInfo.data.data, {course: []});
......
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