Commit 9bd8e775 by FE

discount modify in order page

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