Commit 70426bdf by FE

bargainMiddlePage modify

parent caa42759
......@@ -9,7 +9,10 @@ const VList = (props) => {
<div className="cover">
{props.status}
{/* <Link to={`/detail?id=${props.id}`}> */}
<img src={props.img} alt="" onClick={() => props.toDetail(props.id)} />
{props.toDetail
?(<img src={props.img} alt="" onClick={() => props.toDetail(props.id)} />)
:(<img src={props.img} alt="" />)
}
{/* </Link> */}
</div>
{props.info}
......
......@@ -12,6 +12,7 @@
flex: 0 0 auto;
margin-right: 16px;
position: relative;
width: 150px;
img {
width: 150px;
height: 108px;
......
......@@ -22,6 +22,7 @@ class BargainMiddlePage extends Component {
isShowOverlay: false,
isOriginator: '',
kanjiaIcon: require('./image/kanjia_icon.png'),
course: {}, // 当前砍价课程
courseList: [], // 所有砍价课程
data: '',
bargainData: '',
......@@ -53,35 +54,39 @@ class BargainMiddlePage extends Component {
http.get(`${API.home}/m/bargain/info?bargaincode=${getParam('bargaincode')}&is_originator=${getParam('is_originator')}`).then((res) => {
if (res.data.code === 200) {
this.setState({
data: res.data.data,
isOriginator: res.data.data.is_originator,
originatorUid: res.data.data.originator_uid,
limitPeople: res.data.data.course.limit_people,
bargainData: res.data.data.bargain,
width: (res.data.data.bargain.bargain_price / res.data.data.bargain.total_price).toFixed(2) * 100 + '%'
}, () => {
if (this.state.bargainData.expire_time) {
let date = this.state.bargainData.expire_time * 1000
let now = Date.now()
clearInterval(this.timer)
this.timer = setInterval(() => {
date -= 1000
let _d = new Date(date)
let s = differenceInSeconds(_d, now) % 60,
m = differenceInMinutes(_d, now) % 60,
h = differenceInHours(_d, now) % 24,
d = differenceInDays(_d, now) % 24
this.setState({
hour: h,
min: m,
sec: s,
day: d
})
this.setState(
{
data: res.data.data,
isOriginator: res.data.data.is_originator,
originatorUid: res.data.data.originator_uid,
course: res.data.data.course,
limitPeople: res.data.data.course.limit_people,
bargainData: res.data.data.bargain,
width: (res.data.data.bargain.bargain_price / res.data.data.bargain.total_price).toFixed(2) * 100 + '%'
},
() => {
if (this.state.bargainData.expire_time) {
let date = this.state.bargainData.expire_time * 1000
let now = Date.now()
clearInterval(this.timer)
this.timer = setInterval(() => {
date -= 1000
let _d = new Date(date)
let s = differenceInSeconds(_d, now) % 60,
m = differenceInMinutes(_d, now) % 60,
h = differenceInHours(_d, now) % 24,
d = differenceInDays(_d, now) % 24
this.setState({
hour: h,
min: m,
sec: s,
day: d
})
}, 1000)
}, 1000)
}
}
})
)
} else {
Toast.info(res.data.msg, 2)
}
......@@ -263,7 +268,6 @@ class BargainMiddlePage extends Component {
}
render() {
let thirdRow, btn
// is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用
if (this.state.bargainData.is_artifact === 0) {
......@@ -291,8 +295,6 @@ class BargainMiddlePage extends Component {
} else if (this.state.isOriginator === 1 && this.state.data.bargain_status === 0) {
bargainBtn = <button className='active-btn' onClick={this.shareFriendBargain}>邀请好友砍价</button>
}
return (
<div className={'bargain-middle-page'}>
<HeaderBar title='砍价详情' arrow={true} cart={true}></HeaderBar>
......@@ -306,10 +308,13 @@ class BargainMiddlePage extends Component {
<ul>
<VList
info={<CourseDes
img={this.state.course.course_img}
info={
<CourseDes
isOriginator={this.state.isOriginator}
data={this.state.data}
toCart={this.toCart}/>}
toCart={this.toCart}/>
}
/>
</ul>
<div className="bargain-detail">
......
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