Commit 891cc42d by xuzhenghua

detail

parent 426bfa05
...@@ -68,12 +68,15 @@ ...@@ -68,12 +68,15 @@
} }
.v-list-item { .v-list-item {
padding-right: 7px; padding: 15px 7px 10px 10px;
margin-bottom: 7px;
margin-top: 0;
.cover { .cover {
margin-right: 10px; margin-right: 10px;
img {
width: 125px;
height: 90px;
}
} }
.content { .content {
...@@ -155,6 +158,7 @@ ...@@ -155,6 +158,7 @@
.button { .button {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 10px;
} }
button { button {
...@@ -166,6 +170,7 @@ ...@@ -166,6 +170,7 @@
border: none; border: none;
color: $bg_ff3131; color: $bg_ff3131;
-webkit-appearance: none; -webkit-appearance: none;
font-size: 16px;
} }
.invalid-btn { .invalid-btn {
...@@ -339,3 +344,112 @@ ...@@ -339,3 +344,112 @@
} }
} }
.bargain-public-number, .bargain-first, .bargain-second, .not-bargain {
width: 300px;
padding: 20px 0;
background-color: $bg_fff;
border-radius: 3px;
text-align: center;
margin: 200px auto 20px auto;
position: relative;
.ff4 {
color: $color_FF4000;
}
.status-title {
font-size: 16px;
height: 16px;
line-height: 16px;
}
.status-dec {
font-size: 12px;
color: $color_666;
height: 12px;
line-height: 12px;
}
button {
width: 260px;
height: 30px;
background-color: $bg_FADD29;
color: $color_FF4000;
font-size: 16px;
border: none;
position: absolute;
bottom: 20px;
left: 20px;
}
.top-img {
position: absolute;
width: 135px;
height: 67px;
top: -67px;
margin-left: -67px;
}
}
.bargain-public-number {
height: 185px;
.avait {
position: absolute;
top: -20px;
margin-left: -20px;
width: 40px;
height: 40px;
border-radius: 50%;
}
.status-title {
margin-top: 10px;
}
.status-dec {
margin-top: 10px;
}
.public-number-img {
width: 86px;
height: 86px;
margin-top: 15px;
}
}
.bargain-first {
height: 145px;
.status-dec {
margin-top: 15px;
}
}
.bargain-second {
height: 105px;
}
.not-bargain {
height: 205px;
padding: 15px 20px 20px 20px;
.middle-img {
width: 51px;
height: 51px;
}
.status-title {
height: 37px;
line-height: 20px;
font-size: 15px;
margin-top: 10px;
}
.status-dec {
margin-top: 15px;
}
}
\ No newline at end of file
...@@ -82,13 +82,34 @@ ...@@ -82,13 +82,34 @@
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
line-height: 48px; line-height: 48px;
.time {
display: inline-block;
width: 20px;
height: 18px;
background: $bg_666;
border-radius: 2px;
text-align: center;
line-height: 18px;
font-size: $font_12;
color: $white;
}
.hour {
margin-left: 7px;
}
.sec {
margin-right: 5px;
}
} }
} }
.status-inner { .status-inner {
width: 350px; width: 350px;
height: 124px; height: 130px;
padding: 0 10px; padding: 0 10px;
background: $white; background: $white;
border-radius: 3px; border-radius: 3px;
...@@ -111,6 +132,10 @@ ...@@ -111,6 +132,10 @@
color: $white; color: $white;
} }
.over {
color: $color_999;
}
.time { .time {
display: inline-block; display: inline-block;
width: 20px; width: 20px;
...@@ -332,6 +357,15 @@ ...@@ -332,6 +357,15 @@
border-radius: 3px; border-radius: 3px;
text-align: center; text-align: center;
margin: 200px auto 20px auto; margin: 200px auto 20px auto;
position: relative;
.top-img {
position: absolute;
width: 135px;
height: 67px;
top: -67px;
margin-left: -67px;
}
.top-tip { .top-tip {
font-size: 16px; font-size: 16px;
...@@ -398,3 +432,4 @@ ...@@ -398,3 +432,4 @@
} }
} }
.bargain-info { .bargain-bind-iphone {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
......
import React, {Component} from 'react'; import React, {Component} from 'react'
import {api, getParam, http} from "@/utils"; import {api, getParam, http} from "@/utils"
import {Toast} from 'antd-mobile'; import {Toast} from 'antd-mobile'
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
import {getCourses} from "@/components/detail/actions"; import {getCourses} from "@/components/detail/actions"
import {connect} from "react-redux"; import {connect} from "react-redux"
import './index.scss' import './index.scss'
...@@ -17,27 +15,37 @@ class BtnStatus extends Component { ...@@ -17,27 +15,37 @@ class BtnStatus extends Component {
} }
} }
// 加入购物车 // 加入购物车 type:1 加入购物车,2加入购物车并跳转到购物车页面去支付
toCart = () => { toCart = (type) => {
console.log(type)
let data = { let data = {
course_id: getParam('id') course_id: getParam('id')
} }
http.post(`${api.home}/m/cart/add`, data).then((res) => { http.post(`${api.home}/m/cart/add`, data).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
Toast.info('已加入购物车', 2); if (type === 1) {
// window.location.reload() Toast.info('已加入购物车', 2)
this.props.getCourses(); this.props.getCourses()
} else {
// window.location.href = '/shopcart'
}
} else if (res.data.code === 15001) {
// window.location.href = '/shopcart'
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
} }
}) })
} }
render() { render() {
let info = '' let info = ''
if (this.props.data && this.props.data.course_info) { if (this.props.data && this.props.data.course_info) {
info = this.props.data.course_info info = this.props.data.course_info
} }
let barInfo = this.props.barInfo && this.props.barInfo
return ( return (
<div> <div>
...@@ -55,7 +63,7 @@ class BtnStatus extends Component { ...@@ -55,7 +63,7 @@ class BtnStatus extends Component {
} }
{ {
!info.in_cart && !info.in_cart &&
<button className='btn btn-s bg-FCCD05' onClick={this.toCart}>加入购物车</button> <button className='btn btn-s bg-FCCD05' onClick={e => this.toCart(1)}>加入购物车</button>
} }
<Link to='/order' className='btn btn-s bg-FD7700'>立即报名</Link> <Link to='/order' className='btn btn-s bg-FD7700'>立即报名</Link>
...@@ -75,7 +83,7 @@ class BtnStatus extends Component { ...@@ -75,7 +83,7 @@ class BtnStatus extends Component {
} }
{/*拼团 未开团*/} {/*拼团 未开团*/}
{ {
info.is_baoming === 0 && info.group_status === 4&& info.is_baoming === 0 && info.group_status === 4 &&
<div className='btns-box'> <div className='btns-box'>
<a className='consult consult-s' href="https://q.url.cn/AB8aue?_type=wpa&qidian=true"> <a className='consult consult-s' href="https://q.url.cn/AB8aue?_type=wpa&qidian=true">
<i className='iconfont iconerji'></i> <i className='iconfont iconerji'></i>
...@@ -107,27 +115,27 @@ class BtnStatus extends Component { ...@@ -107,27 +115,27 @@ class BtnStatus extends Component {
{/*砍价*/} {/*砍价*/}
{ {
this.props.status === 3 && this.props.data && this.props.data.is_bargain &&
<div className='btns-box'> <div className='btns-box'>
<a className='consult consult-s' href="https://q.url.cn/AB8aue?_type=wpa&qidian=true"> <a className='consult consult-s' href="https://q.url.cn/AB8aue?_type=wpa&qidian=true">
<i className='iconfont iconerji'></i> <i className='iconfont iconerji'></i>
<span>课程咨询</span> <span>课程咨询</span>
</a> </a>
<button className='btn btn-s bg-F4AAA7'> <button className='btn btn-s bg-F4AAA7'>
<span>¥149</span> <span>¥{info.price1}</span>
<span>直接购买</span> <span onClick={e => this.toCart(2)}>直接购买</span>
</button> </button>
{ {
this.state.isbuy === 0 && barInfo.bargain_status === 2 &&
<button className='btn btn-s bg-E02E24'> <button className='btn btn-s bg-E02E24' >
我要砍价 我要砍价
</button> </button>
} }
{ {
this.state.isbuy === 1 && (barInfo.bargain_status === 0 || barInfo.bargain_status === 1) &&
<button className='btn btn-s bg-E02E24'> <button className='btn btn-s bg-E02E24'>
<span>¥1</span> <span>¥1</span>
<span>去支付</span> <span onClick={e => this.toCart(2)}>去支付</span>
</button> </button>
} }
</div> </div>
...@@ -151,4 +159,4 @@ class BtnStatus extends Component { ...@@ -151,4 +159,4 @@ class BtnStatus extends Component {
export default connect( export default connect(
null, null,
{getCourses} {getCourses}
)(BtnStatus); )(BtnStatus)
\ No newline at end of file
...@@ -11,6 +11,8 @@ import BtnStatus from "./btnstatus" ...@@ -11,6 +11,8 @@ import BtnStatus from "./btnstatus"
import Carouselw from "./carousel" import Carouselw from "./carousel"
import {connect} from "react-redux" import {connect} from "react-redux"
import {fetchCoursesListIfNeeded} from "./actions" import {fetchCoursesListIfNeeded} from "./actions"
import {api, getParam, http} from "@/utils";
import {Toast} from "antd-mobile";
class Detail extends Component { class Detail extends Component {
...@@ -23,12 +25,14 @@ class Detail extends Component { ...@@ -23,12 +25,14 @@ class Detail extends Component {
auditionBox: false, auditionBox: false,
singleBox: false, singleBox: false,
shareRank: false, shareRank: false,
singMess: '' singMess: '',
barInfo: '',
} }
} }
componentDidMount() { componentDidMount() {
this.props.fetchCoursesListIfNeeded() this.props.fetchCoursesListIfNeeded()
this.getBargainInfo()
} }
componentDidUpdate() { componentDidUpdate() {
...@@ -53,6 +57,23 @@ class Detail extends Component { ...@@ -53,6 +57,23 @@ class Detail extends Component {
} }
//获取砍价信息
getBargainInfo = () => {
let data = {
courseId: getParam('id')
}
http.post(`${api.home}/m/bargain/courseDetail`, data).then((res) => {
if (res.data.code === 200) {
this.setState({
barInfo: res.data.data
})
} else {
Toast.info(res.data.msg, 2)
}
})
}
// 自组件传给父组件的boxHide // 自组件传给父组件的boxHide
boxHide = (val) => { boxHide = (val) => {
this.setState({auditionBox: val, singleBox: val}) this.setState({auditionBox: val, singleBox: val})
...@@ -152,7 +173,7 @@ class Detail extends Component { ...@@ -152,7 +173,7 @@ class Detail extends Component {
<OutLine data={this.props.courseInfo} toAudition={this.toAudition} toSingleset={this.toSingleset}/> <OutLine data={this.props.courseInfo} toAudition={this.toAudition} toSingleset={this.toSingleset}/>
{/*课程按钮*/} {/*课程按钮*/}
<BtnStatus data={this.props.courseInfo}></BtnStatus> <BtnStatus data={this.props.courseInfo} barInfo={this.state.barInfo} ></BtnStatus>
</div> </div>
) )
} }
......
...@@ -106,7 +106,7 @@ class Preferential extends Component { ...@@ -106,7 +106,7 @@ class Preferential extends Component {
</p> </p>
<p className='contact text-overflow-2'>{item.course_desc}</p> <p className='contact text-overflow-2'>{item.course_desc}</p>
<div className='des'> <div className='des'>
{item.is_buy && {!item.is_buy &&
<p className="course-price"> <p className="course-price">
{this.state.courseStatus === 0 && {this.state.courseStatus === 0 &&
<span className='price'>特惠价:</span> <span className='price'>特惠价:</span>
...@@ -115,7 +115,7 @@ class Preferential extends Component { ...@@ -115,7 +115,7 @@ class Preferential extends Component {
<span className="old">¥{item.price0}</span> <span className="old">¥{item.price0}</span>
</p> </p>
} }
{!item.is_buy && {item.is_buy &&
<a href="/#" className="isbuy">已购买</a> <a href="/#" className="isbuy">已购买</a>
} }
</div> </div>
......
...@@ -12,7 +12,7 @@ module.exports = function (app) { ...@@ -12,7 +12,7 @@ module.exports = function (app) {
pathRewrite: { pathRewrite: {
[`^${config[item]['development']}`]: '' [`^${config[item]['development']}`]: ''
}, },
// cookieDomainRewrite: 'localhost', cookieDomainRewrite: 'localhost',
...config[item]['proxy'] ...config[item]['proxy']
} }
)) ))
......
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