Commit dcdb8adf by wangshuo

单集购买

parent 91713bf6
...@@ -41,6 +41,7 @@ class Detail extends Component { ...@@ -41,6 +41,7 @@ class Detail extends Component {
nowPrice: 0, nowPrice: 0,
laterPrice: 0, laterPrice: 0,
isPdd: 0, // 是否是拼团课程 控制首次单集购买后的 全集购买 接口: 拼团课程走拼团接口,否则直接走购买接口
} }
} }
...@@ -97,6 +98,7 @@ class Detail extends Component { ...@@ -97,6 +98,7 @@ class Detail extends Component {
nowPrice: res.data.data.data.now_price, nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price, laterPrice: res.data.data.data.three_day_later_price,
singleType: 2, singleType: 2,
isPdd: res.data.data.data.is_pdd,
}) })
} else { } else {
Toast.info(res.data.data.msg, 2) Toast.info(res.data.data.msg, 2)
...@@ -159,6 +161,7 @@ class Detail extends Component { ...@@ -159,6 +161,7 @@ class Detail extends Component {
nowPrice: res.data.data.data.now_price, nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price, laterPrice: res.data.data.data.three_day_later_price,
singleType: 2, singleType: 2,
isPdd: res.data.data.data.is_pdd,
}) })
} else { } else {
Toast.info(res.data.data.msg, 2) Toast.info(res.data.data.msg, 2)
...@@ -218,6 +221,7 @@ class Detail extends Component { ...@@ -218,6 +221,7 @@ class Detail extends Component {
nowPrice: res.data.data.data.now_price, nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price, laterPrice: res.data.data.data.three_day_later_price,
singleType: 2, singleType: 2,
isPdd: res.data.data.data.is_pdd,
}) })
} else { } else {
...@@ -543,6 +547,7 @@ class Detail extends Component { ...@@ -543,6 +547,7 @@ class Detail extends Component {
vcourseId={course_info.v_course_id} vcourseId={course_info.v_course_id}
videoId={this.state.singMess.video_id} videoId={this.state.singMess.video_id}
nowPrice={this.state.nowPrice} nowPrice={this.state.nowPrice}
isPdd={this.state.isPdd}
laterPrice={this.state.laterPrice} laterPrice={this.state.laterPrice}
courseId={course_info.course_id} courseId={course_info.course_id}
/> />
......
...@@ -89,14 +89,19 @@ class Single extends Component { ...@@ -89,14 +89,19 @@ class Single extends Component {
// 特价购买全集 // 特价购买全集
toBuyAll = (vcourseId) => { toBuyAll = (vcourseId) => {
http.get(`${API['base-api']}/m/cart/addtopreorder/${vcourseId}`).then((res) => { if(Number(this.props.isPdd) === 1) {
this.props.history.push(`/order?id=${this.props.courseId}`, {group: 1})
}else{
let cidArr = JSON.stringify([Number(vcourseId)]);
http.get(`${API['base-api']}/m/cart/addtopreorder/${cidArr}`).then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
this.props.history.push("/order?id=" + res.data.data[0], {type: 1}); this.props.history.push("/order?id=" + res.data.data[0], {simple: 1});
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
} }
}) })
} }
}
// 0元购买全集 // 0元购买全集
zerobuyReceive = () => { zerobuyReceive = () => {
Toast.success('购买全集成功', 3) Toast.success('购买全集成功', 3)
...@@ -193,7 +198,7 @@ class Single extends Component { ...@@ -193,7 +198,7 @@ class Single extends Component {
<div className="dec">· 3天内购买全集,可直接抵扣该集费用,{this.props.nowPrice}元购买。</div> <div className="dec">· 3天内购买全集,可直接抵扣该集费用,{this.props.nowPrice}元购买。</div>
<div className="dec">· 超过3天,按照未购集数/全部集数等比例计费,{this.props.laterPrice}元购买全集。</div> <div className="dec">· 超过3天,按照未购集数/全部集数等比例计费,{this.props.laterPrice}元购买全集。</div>
<Link to={`/play/video?id=${this.props.vcourseId}&video_id=${videoID}`} className='btn btn-18B4ED'>开始学习</Link> <Link to={`/play/video?id=${this.props.vcourseId}&video_id=${videoID}`} className='btn btn-18B4ED'>开始学习</Link>
<div className='btn btn-FF4000' onClick={()=>{this.toBuyAll(this.props.vcourseId)}}>{this.props.nowPrice}购买全集 <div className='btn btn-FF4000' onClick={()=>{this.toBuyAll(this.props.courseId)}}>{this.props.nowPrice}购买全集
</div> </div>
</div> </div>
} }
......
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