index.js 27.6 KB
Newer Older
zhanghaozhe committed
1
import React, { Component } from 'react'
zhanghaozhe committed
2
import './bargain-middle-page.scss'
zhanghaozhe committed
3 4 5 6 7
import { HeaderBar, VList } from '@common'
import { Course } from '@common'
import { api, getParam, http, browser } from "@/utils"
import { Toast } from "antd-mobile"
import { Link, withRouter } from "react-router-dom"
xuzhenghua committed
8
import Ranking from './ranking'
zhanghaozhe committed
9
import { differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays } from "date-fns"
xuzhenghua committed
10
import Overlay from '../detail/overlay'
zhanghaozhe committed
11 12
import { compose } from "redux"
import { connect } from "react-redux";
13
import {getCourses} from './../detail/actions';
14
import classnames from 'classnames';
xuzhenghua committed
15

16 17 18
@connect(state => ({
    user: state.user
}))
xuzhenghua committed
19
class BargainMiddlePage extends Component {
zhanghaozhe committed
20

zhanghaozhe committed
21 22
    timer

xuzhenghua committed
23 24 25
    constructor(props) {
        super(props)
        this.state = {
xuzhenghua committed
26
            isShowOverlay: false,
xuzhenghua committed
27
            isOriginator: '',
xuzhenghua committed
28
            kanjiaIcon: require('./image/kanjia_icon.png'),
FE committed
29
            course: {}, // 当前砍价课程
FE committed
30
            courseList: [],  // 所有砍价课程
xuzhenghua committed
31 32 33 34 35 36
            data: '',
            bargainData: '',
            limitPeople: 0,
            outList: [],
            list: [],
            width: '0',
xuzhenghua committed
37
            isShowMore: '',
xuzhenghua committed
38 39 40
            status: '',
            hour: '',
            min: '',
xuzhenghua committed
41 42 43 44 45 46
            sec: '',
            day: '',
            amount: '',
            firendBaigainPrice: true,
            isshowYindao: false,
            isLoaidng: true
xuzhenghua committed
47 48 49 50
        }
    }

    componentDidMount() {
xuzhenghua committed
51
        this.getBargainRankList(getParam('id'), 1)
xuzhenghua committed
52 53 54 55 56 57
        this.getBargainCourse()
        this.getBargainInfo()
    }

    // 获取砍价信息
    getBargainInfo = () => {
xuzhenghua committed
58

zhanghaozhe committed
59
        http.get(`${API.home}/m/bargain/info?bargaincode=${getParam('bargaincode')}&is_originator=${getParam('is_originator')}`).then((res) => {
xuzhenghua committed
60
            if (res.data.code === 200) {
FE committed
61 62 63 64 65 66 67 68 69
                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 + '%'
xuzhenghua committed
70
                    },
FE committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
                    () => {
                        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
                                })
zhanghaozhe committed
89

FE committed
90 91
                            }, 1000)
                        }
zhanghaozhe committed
92
                    }
FE committed
93
                )
xuzhenghua committed
94 95 96 97 98 99 100 101
            } else {
                Toast.info(res.data.msg, 2)
            }
        })
    }

    // 获取砍价课程
    getBargainCourse = () => {
zhanghaozhe committed
102
        http.get(`${API.home}/m/bargain/courseList`).then((res) => {
xuzhenghua committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
            if (res.data.code === 200) {
                this.setState({
                    courseList: res.data.data
                })
            } else {
                Toast.info(res.data.msg, 2)
            }
        })
    }

    // 获取助理好友
    getBargainRankList = (id, type) => {
        let data = {
            courseId: id,
            type: type
        }
zhanghaozhe committed
119
        http.post(`${API.home}/m/bargain/rankList`, data).then((res) => {
xuzhenghua committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
            if (res.data.code === 200) {
                let arr = ['刀神', '刀王', '刀霸']
                let newList = res.data.data.out_list.map((item, i) => {
                    return {
                        ...item,
                        rank: arr[i]
                    }
                })
                this.setState({
                    list: res.data.data.list,
                    outList: newList
                })
            } else {
                Toast.info(res.data.msg, 2)
            }
        })
    }

xuzhenghua committed
138
    // 直接支付
xuzhenghua committed
139
    toCart = () => {
xuzhenghua committed
140 141 142
        http.get(`${API['base-api']}/m/cart/addtopreorder/[${getParam('id')}]`).then((res) => {
            if (res.data.errno === 0) {
                this.props.history.push(`/order?id=[${getParam('id')}]`, {bargain: 1});
xuzhenghua committed
143 144 145 146
            } else {
                Toast.info(res.data.msg, 2);
            }
        })
xuzhenghua committed
147 148 149 150 151 152 153 154 155 156
        // let data = {
        //     course_id: getParam('id')
        // }
        // http.post(`${API.home}/m/cart/add`, data).then((res) => {
        //     if (res.data.code === 200 || res.data.code === 15001) {
        //         this.props.history.push('/shopcart')
        //     } else {
        //         Toast.info(res.data.msg, 2);
        //     }
        // })
xuzhenghua committed
157
    }
xuzhenghua committed
158 159
    // 我要砍价列表的去支付
    toCartBottom=(id)=>{
xuzhenghua committed
160 161 162
        http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => {
            if (res.data.errno === 0) {
                this.props.history.push(`/order?id=[${getParam('id')}]`, {bargain: 1});
xuzhenghua committed
163 164 165 166
            } else {
                Toast.info(res.data.msg, 2);
            }
        })
xuzhenghua committed
167 168 169 170 171 172 173
        // http.post(`${API.home}/m/cart/add`, data).then((res) => {
        //     if (res.data.code === 200 || res.data.code === 15001) {
        //         this.props.history.push('/shopcart')
        //     } else {
        //         Toast.info(res.data.msg, 2);
        //     }
        // })
xuzhenghua committed
174
    }
xuzhenghua committed
175 176 177 178 179 180 181 182 183 184 185

    // 查看更多
    getMore = () => {
        this.setState({
            isShowMore: true
        })
    }
    // 自组件传给父组件的boxHide
    boxHide = (val) => {
        this.setState({isShowMore: val})
    }
zhanghaozhe committed
186

xuzhenghua committed
187 188 189 190 191
    // 领取砍价神器
    toArtifact = () => {
        let data = {
            courseId: getParam('id')
        }
zhanghaozhe committed
192
        http.post(`${API.home}/m/bargain/receiveLimit`, data).then((res) => {
xuzhenghua committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
            if (res.data.code === 200) {
                this.setState({
                    isShowOverlay: true,
                    status: 5,
                })
            } else {
                Toast.info(res.data.msg, 2)
            }
        })
    }

    // 使用砍价神器
    useArtifact = () => {
        this.toKanjia(getParam('id'), 2, 0)
    }
zhanghaozhe committed
208

xuzhenghua committed
209 210 211 212 213 214 215
    // 砍价接口
    toKanjia = (id, type, uid) => {
        let data = {
            course_id: id,
            type: type,  // 1 用户自己砍价 2 使用砍价神器 3 好友助力砍价 4 好友第二次助力
            parent_uid: uid // 被助力人id 【自己本人操作传0】
        }
zhanghaozhe committed
216
        http.post(`${API.home}/m/bargain/toBargain`, data).then((res) => {
xuzhenghua committed
217
            if (res.data.code === 200) {
xuzhenghua committed
218 219 220 221
                // is_success =0一切正常 =1 不能在砍了 =2关注公众号,可以再砍一刀!
                this.setState({
                    amount: res.data.data.amount
                })
xuzhenghua committed
222 223 224 225 226 227
                if (type === 2) {
                    this.setState({
                        isShowOverlay: true,
                        status: 6
                    })
                }
xuzhenghua committed
228 229

                if (res.data.data.is_success === 1) {
xuzhenghua committed
230 231
                    this.setState({
                        isShowOverlay: true,
xuzhenghua committed
232
                        status: 4
xuzhenghua committed
233
                    })
xuzhenghua committed
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
                } else if (res.data.data.is_success === 2) {
                    if (type === 3) {
                        this.setState({
                            isShowOverlay: true,
                            status: 2
                        })
                    } else if (type === 4) {
                        this.setState({
                            isShowOverlay: true,
                            status: 1,
                            firendBaigainPrice: false
                        })
                    }
                } else if (res.data.data.is_success === 0) {
                    if (type === 3) {
                        this.setState({
                            isShowOverlay: true,
                            status: 2
                        })
                    } else if (type === 4) {
                        this.setState({
                            isShowOverlay: true,
                            status: 3
                        })
                    }
xuzhenghua committed
259 260
                }

xuzhenghua committed
261
                this.getBargainInfo()
xuzhenghua committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280


            } else {
                Toast.info(res.data.msg, 2)
            }
        })
    }


    // 帮好友砍价第一刀
    friendBargainFirst = () => {
        this.toKanjia(getParam('id'), 3, this.state.originatorUid)
    }

    // 帮好友砍价第二刀
    friendBargainSecond = () => {
        this.toKanjia(getParam('id'), 4, this.state.originatorUid)
    }

xuzhenghua committed
281 282 283 284 285 286 287 288
    // 邀请好友砍价
    shareFriendBargain = () => {
        this.setState({
            isShowOverlay: true,
            status: 7,
            isshowYindao: browser.isWeixin ? true : false
        })
    }
xuzhenghua committed
289 290 291 292 293 294 295 296 297

    // 关闭弹窗
    close = () => {
        this.setState({
            isShowOverlay: false,
            status: '',
        })
    }

298 299
    toCourseDetail = (id) => {
        const { dispatch, history } = this.props;
300
        // dispatch(getCourses(id, () => {
301 302
            history.push(`/detail?id=${id}`);
            return false;
303
        // }));
304 305
    }

zhanghaozhe committed
306
    render() {
xuzhenghua committed
307 308 309 310 311 312 313 314
        let thirdRow, btn
        // is_artifact	 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用
        if (this.state.bargainData.is_artifact === 0) {
            thirdRow =
                <div>再邀请<span className={'indicator'}>{this.state.bargainData.invite_num}</span>位好友助力即可获得<span
                    className={'indicator'}>【砍价神器】</span></div>
        } else if (this.state.bargainData.is_artifact === 1) {
            thirdRow = <div>恭喜你获得<span className={'indicator'}>【砍价神器】</span></div>
xuzhenghua committed
315
            btn = <button className={'artifact-btn'} onClick={this.toArtifact}>立即领取</button>
xuzhenghua committed
316 317
        } else if (this.state.bargainData.is_artifact === 2) {
            thirdRow = <div>恭喜你获得<span className={'indicator'}>【砍价神器】</span></div>
xuzhenghua committed
318
            btn = <button className={'artifact-btn'} onClick={this.useArtifact}>立即使用</button>
xuzhenghua committed
319 320 321 322
        }


        let bargainBtn
xuzhenghua committed
323 324 325 326 327
        if (this.state.isOriginator !== 1 && this.state.data.assist_status === 0 && this.state.data.bargain_status === 0) {
            bargainBtn = <button className='active-btn' onClick={this.friendBargainFirst}>帮好友砍一刀</button>
        } else if (this.state.isOriginator !== 1 && this.state.data.assist_status === 1) {
            bargainBtn = <button className='active-btn' onClick={this.friendBargainSecond}>再砍一刀</button>
        } else if (this.state.isOriginator !== 1 && this.state.data.assist_status === 2) {
xuzhenghua committed
328 329 330
            bargainBtn = <button className={'invalid-btn'}>已帮好友助力</button>
        } else if (this.state.data.bargain_status === 1 || this.state.data.bargain_status === 2) {
            bargainBtn = <button className={'invalid-btn'}>砍价结束</button>
xuzhenghua committed
331 332
        } else if (this.state.isOriginator === 1 && this.state.data.bargain_status === 0) {
            bargainBtn = <button className='active-btn' onClick={this.shareFriendBargain}>邀请好友砍价</button>
xuzhenghua committed
333
        }
zhanghaozhe committed
334 335
        return (
            <div className={'bargain-middle-page'}>
xuzhenghua committed
336
                <HeaderBar title='砍价详情' arrow={true} cart={true}></HeaderBar>
xuzhenghua committed
337
                {/*<Loading isLoading={this.state.isLoaidng}>*/}
zhanghaozhe committed
338 339
                <div className="top">
                    <div className="bargain-area">
xuzhenghua committed
340
                        {
xuzhenghua committed
341
                            this.state.isOriginator !== 1 &&
xuzhenghua committed
342 343 344
                            <p className='bargain-tip'>你的好友发现一门精品课程,快来一起帮他砍价:</p>
                        }

zhanghaozhe committed
345 346
                        <ul>
                            <VList
FE committed
347 348 349
                                img={this.state.course.course_img}
                                info={
                                <CourseDes
xuzhenghua committed
350 351
                                    isOriginator={this.state.isOriginator}
                                    data={this.state.data}
FE committed
352 353
                                    toCart={this.toCart}/>
                                }
zhanghaozhe committed
354 355 356 357 358
                            />
                        </ul>
                        <div className="bargain-detail">
                            <div className="top">
                                <div>
xuzhenghua committed
359
                                    已砍<span className={'reduced-price'}>{this.state.bargainData.bargain_price}</span>
zhanghaozhe committed
360
                                </div>
xuzhenghua committed
361 362 363
                                {
                                    this.state.data.bargain_status === 0 &&
                                    <div>
xuzhenghua committed
364 365 366 367 368
                                        <span
                                            className={'time hour'}>{String(this.state.hour).padStart(2, 0)}</span> :&nbsp;
                                        <span
                                            className={'time min'}>{String(this.state.min).padStart(2, 0)}</span> :&nbsp;
                                        <span className={'time sec'}>{String(this.state.sec).padStart(2, 0)}</span>
xuzhenghua committed
369 370 371
                                        <span className={'inactive'}> 后砍价结束</span>
                                    </div>
                                }
xuzhenghua committed
372
                                {
xuzhenghua committed
373
                                    this.state.data.bargain_status === 1 && this.state.isOriginator === 1 &&
xuzhenghua committed
374 375
                                    <span className={'inactive'}>砍价结束</span>
                                }
xuzhenghua committed
376

zhanghaozhe committed
377 378
                            </div>
                            <div className="middle">
xuzhenghua committed
379
                                <span style={{width: this.state.width}}></span>
zhanghaozhe committed
380
                            </div>
xuzhenghua committed
381
                            {
xuzhenghua committed
382
                                this.state.isOriginator === 1 && this.state.data.bargain_status === 0 &&
xuzhenghua committed
383
                                <div>
xuzhenghua committed
384 385
                                    {thirdRow}
                                    {btn}
xuzhenghua committed
386 387
                                </div>
                            }
xuzhenghua committed
388 389

                            {
xuzhenghua committed
390
                                this.state.isOriginator === 1 && this.state.data.bargain_status === 1 &&
xuzhenghua committed
391 392
                                <div>
                                    砍价金额将于
xuzhenghua committed
393 394 395 396 397 398
                                    <span className={'time hour'}>{String(this.state.day).padStart(2, 0)}</span><span
                                    className={'unit'}>  </span>
                                    <span className={'time min'}>{String(this.state.hour).padStart(2, 0)}</span><span
                                    className={'unit'}>  </span>
                                    <span className={'time sec'}>{String(this.state.min).padStart(2, 0)}</span><span
                                    className={'unit'}></span>
xuzhenghua committed
399 400 401 402
                                    后清零,请尽快完成支付
                                </div>
                            }

zhanghaozhe committed
403
                            <div className={'button'}>
xuzhenghua committed
404
                                {bargainBtn}
zhanghaozhe committed
405
                            </div>
xuzhenghua committed
406

zhanghaozhe committed
407 408 409 410 411 412
                        </div>
                    </div>
                    <div className="bargain-records">
                        <div className="title">砍价记录</div>
                        <ul>
                            {
xuzhenghua committed
413
                                this.state.outList && this.state.outList.length > 0 && this.state.outList.map((item, index) => {
zhanghaozhe committed
414 415 416
                                    return (
                                        <li key={index}>
                                            <div className="left">
xuzhenghua committed
417 418
                                                <img className='avatar' src={item.avatar_file} alt=""/>
                                                <span className={'nickname'}>{item.user_name}</span>
zhanghaozhe committed
419 420 421
                                                <span className="rank-tag">{item.rank}</span>
                                            </div>
                                            <div className="right">
xuzhenghua committed
422 423
                                                <img className='kanjia-icon' src={this.state.kanjiaIcon} alt=""/>
                                                砍掉<span className={'price'}>{item.amount}</span>
zhanghaozhe committed
424 425 426 427 428 429 430 431
                                            </div>
                                        </li>
                                    )
                                })

                            }

                        </ul>
xuzhenghua committed
432
                        <div className="more" onClick={this.getMore}>查看更多>></div>
zhanghaozhe committed
433 434
                    </div>
                </div>
xuzhenghua committed
435
                <div className="bargain-course-list" id='bargainCourse'>
zhanghaozhe committed
436 437
                    <div className="title-wrapper">
                        <div className="title">我要砍价</div>
xuzhenghua committed
438
                        <div className="subtitle">邀请{this.state.limitPeople}位以上好友帮忙砍价可获得【砍价神器】</div>
zhanghaozhe committed
439 440 441
                    </div>
                    <ul>
                        {
xuzhenghua committed
442
                            this.state.courseList && this.state.courseList.length > 0 && this.state.courseList.map((item, index) => {
zhanghaozhe committed
443
                                return <Course
xuzhenghua committed
444
                                    className={'text-overflow-2'}
zhanghaozhe committed
445
                                    key={index}
xuzhenghua committed
446 447 448
                                    id={item.course_id}
                                    img={item.image_name}
                                    title={item.course_title}
449 450 451
                                    toDetail={this.toCourseDetail}
                                    bottom={
                                    <CourseBottom
xuzhenghua committed
452
                                        item={item}
xuzhenghua committed
453
                                        toCartBottom={this.toCartBottom.bind(this,item.course_id)}
454
                                        toDetail={this.toCourseDetail}
xuzhenghua committed
455 456
                                    />
                                    }
zhanghaozhe committed
457 458 459 460 461
                                />
                            })
                        }
                    </ul>
                </div>
462
                <Link to={'/classify'} className={'preferential'}>查看更多精品课程 >></Link>
xuzhenghua committed
463 464 465


                {/*更多好友砍价*/}
xuzhenghua committed
466 467 468 469 470 471 472 473
                <Ranking list={this.state.list} icon={this.state.kanjiaIcon} limitPeople={this.state.limitPeople}
                         isShowMore={this.state.isShowMore} boxHide={this.boxHide}></Ranking>


                {
                    this.state.isShowOverlay &&
                    <Overlay>

xuzhenghua committed
474 475 476 477 478 479 480 481
                        {/*砍价成功去分享*/}
                        {
                            this.state.status === 7 &&
                            <BargainSuccess isshowYindao={this.state.isshowYindao} limitPeople={this.state.limitPeople}
                                            close={this.close}/>
                        }


xuzhenghua committed
482 483 484
                        {/*引导关注公众号*/}
                        {
                            this.state.status === 1 &&
xuzhenghua committed
485 486 487 488
                            <PublicNumber
                                money={this.state.amount}
                                avatar={this.props.user.data.avatar}
                                firendBaigainPrice={this.state.firendBaigainPrice}/>
xuzhenghua committed
489 490 491 492 493
                        }

                        {/*好友成功砍第一刀*/}
                        {
                            this.state.status === 2 &&
xuzhenghua committed
494 495 496 497
                            <BargainFirst
                                bargainSecond={this.friendBargainSecond}
                                money={this.state.amount}
                            />
xuzhenghua committed
498 499 500 501
                        }
                        {/*好友成功砍第二刀*/}
                        {
                            this.state.status === 3 &&
xuzhenghua committed
502
                            <BargainSecond close={this.close} money={this.state.amount}/>
xuzhenghua committed
503 504 505 506
                        }
                        {/*不能在砍了*/}
                        {
                            this.state.status === 4 &&
xuzhenghua committed
507
                            <NotBargain close={this.close} limitPeople={this.state.limitPeople}/>
xuzhenghua committed
508
                        }
xuzhenghua committed
509 510 511 512 513 514 515 516
                        {/*领取砍价神器*/}
                        {
                            this.state.status === 5 &&
                            <Artifact useArtifact={this.useArtifact}/>
                        }
                        {/*使用砍价神器*/}
                        {
                            this.state.status === 6 &&
xuzhenghua committed
517 518
                            <UseArtifact toCart={this.toCart} money={this.state.amount}
                                         allMoney={this.state.bargainData.bargain_price}/>
xuzhenghua committed
519
                        }
xuzhenghua committed
520 521

                        {
xuzhenghua committed
522
                            this.state.status !== 7 &&
xuzhenghua committed
523 524 525 526 527
                            <i onClick={this.close} className={'iconfont iconiconfront-2 bargain-close'}></i>
                        }
                    </Overlay>

                }
xuzhenghua committed
528
                {/*</Loading>*/}
xuzhenghua committed
529

zhanghaozhe committed
530 531 532 533 534
            </div>
        );
    }
}

xuzhenghua committed
535 536
function CourseDes(props) {
    const data = props.data && props.data.course
zhanghaozhe committed
537 538
    return (
        <div className={'des'}>
xuzhenghua committed
539 540
            <div className="course-title text-overflow-2">
                {data.course_title}
zhanghaozhe committed
541 542
            </div>
            <div className="price-bar">
xuzhenghua committed
543 544 545 546 547 548 549
                <span className={'discount-price'}>{data.course_price}</span>
                {
                    props.isOriginator === 1 &&
                    <button className={'purchase-btn'}
                            onClick={props.toCart}>¥{data.pay_price}去支付
                    </button>
                }
zhanghaozhe committed
550 551 552 553 554
            </div>
        </div>
    )
}

xuzhenghua committed
555
function CourseBottom(props) {
zhanghaozhe committed
556
    let Buttons
xuzhenghua committed
557
    if (props.item.bargain_status === 2) {
558
        // Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link>
xuzhenghua committed
559
        Buttons = <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain bargian-study'}>我要砍价</a>
xuzhenghua committed
560
    } else if (props.item.bargain_status === 3) {
561
        Buttons = <Link to={`/play/video?id=${props.item.v_course_id}`} className={classnames('bargain', 'button--study')}>去学习</Link>
zhanghaozhe committed
562 563 564
    } else {
        Buttons = (
            <div className="btns">
xuzhenghua committed
565 566 567 568 569 570 571 572 573
                {/*<button className={classnames('bargain-btn', {invalid: props.item.bargain_status === 2})}>*/}
                {/*{props.item.bargain_status === 2 ? '砍价结束' : '继续砍价'}*/}
                {/*</button>*/}
                {
                    props.item.bargain_status === 1 &&
                    <button className='invalid'>砍价结束</button>
                }
                {
                    props.item.bargain_status === 0 &&
xuzhenghua committed
574
                    <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain-btn'}>我要砍价</a>
xuzhenghua committed
575 576 577 578

                }


xuzhenghua committed
579
                <button onClick={() => props.toCartBottom(props.item.course_id)}
xuzhenghua committed
580 581
                        className={'purchase-btn'}>¥{props.item.pay_price}去支付
                </button>
zhanghaozhe committed
582 583 584 585 586 587
            </div>
        )
    }
    return (
        <div className="course-bottom">
            <div className={'course-price'}>
xuzhenghua committed
588 589
                <span className={'discount-price'}>¥{props.item.price1}</span>
                <span className={'original-price'}>¥{props.item.price0}</span>
zhanghaozhe committed
590 591 592 593 594 595
            </div>
            {Buttons}
        </div>
    )
}

xuzhenghua committed
596

xuzhenghua committed
597
function PublicNumber(props) {
xuzhenghua committed
598 599
    return (
        <div className='bargain-public-number'>
xuzhenghua committed
600 601 602 603 604 605 606

            <img className='avait' src={props.avatar} alt=""/>

            {
                props.firendBaigainPrice &&
                <p className='status-title ff4'>谢谢你帮我砍了{props.money}元!</p>
            }
xuzhenghua committed
607 608 609 610 611 612 613
            <p className='status-dec'>关注公众号,可以再砍一刀哦~</p>
            <img className='public-number-img'
                 src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/tinypng-common/right_weixin.png" alt=""/>
        </div>
    )
}

xuzhenghua committed
614
function BargainFirst(props) {
xuzhenghua committed
615 616 617
    return (
        <div className='bargain-first'>
            <img className='top-img' src={require('./image/kanjia_cg_icon.png')} alt=""/>
xuzhenghua committed
618
            <p className='status-title'>谢谢你帮我砍了<span className='ff4'>{props.money}</span>!</p>
xuzhenghua committed
619
            <p className='status-dec'>你还可以帮我再砍一刀哦~</p>
xuzhenghua committed
620
            <button className='bargain-href' onClick={props.bargainSecond}>再砍一刀</button>
xuzhenghua committed
621 622 623 624
        </div>
    )
}

xuzhenghua committed
625
function BargainSecond(props) {
xuzhenghua committed
626 627 628
    return (
        <div className='bargain-second'>
            <img className='top-img' src={require('./image/kanjia_cg_icon.png')} alt=""/>
xuzhenghua committed
629
            <p className='status-title'>厉害了,又帮好友砍掉<span className='ff4'>{props.money}</span>!</p>
xuzhenghua committed
630
            <Link className='bargain-href' to='#bargainCourse' onClick={props.close}>我也要砍价</Link>
xuzhenghua committed
631 632 633 634
        </div>
    )
}

xuzhenghua committed
635
function NotBargain(props) {
xuzhenghua committed
636 637 638 639
    return (
        <div className='not-bargain'>
            <img className='middle-img' src={require('./image/kanjia_no_iccon.png')} alt=""/>
            <p className='status-title'>你的好友用【砍价神器】把我砍蒙圈了<br/>不能再砍了哦~</p>
xuzhenghua committed
640
            <p className='status-dec'>邀请{props.limitPeople}位以上好友帮忙砍价可获得【砍价神器】</p>
xuzhenghua committed
641
            <Link className='bargain-href' to='#bargainCourse' onClick={props.close}>我也要砍价</Link>
xuzhenghua committed
642 643 644 645
        </div>
    )
}

xuzhenghua committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
function Artifact(props) {
    return (
        <div className='artifact-box'>
            <p className='top-tip'>恭喜你获得【砍价神器】!</p>
            <p className='middle-tip'>
                您可以使用
                <span className={'indicator'}>【砍价神器】</span>
                再砍一刀
            </p>
            <button className='use-artifact' onClick={props.useArtifact}>立即使用</button>
        </div>
    )
}

function UseArtifact(props) {
    return (
        <div className='use-artifact-box'>
            <img className='top-img' src={require('./image/kanjia_cg_icon.png')} alt=""/>
xuzhenghua committed
664
            <p className='top-tip'>厉害了,又砍掉了{props.money}元!</p>
xuzhenghua committed
665 666
            <p className='middle-tip'>
                你已经砍了
xuzhenghua committed
667
                <span className={'indicator'}>{props.allMoney}</span>
xuzhenghua committed
668 669 670 671 672 673 674 675 676 677 678
                没见过你这么能砍的人...
            </p>
            <p className='btm-tip'>
                不能再砍了哦~
            </p>
            <button className='tubuy' onClick={props.toCart}>去支付</button>
        </div>
    )
}


xuzhenghua committed
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697
function BargainSuccess(props) {
    return (
        <div>
            <div className='close-bargain-success' onClick={props.close}></div>

            <div className="bargain-success">
                {
                    props.isshowYindao &&
                    <i className='iconfont iconyindao'></i>
                }
                <p>分享到微信群邀请更多好友帮忙砍价</p>
                <p>超过{props.limitPeople}位好友助力可获得<span className={'indicator'} style={{color: '#FF4000'}}>【砍价神器】</span>
                </p>
            </div>
        </div>
    )
}


698
export default withRouter(BargainMiddlePage);