Commit 6f366566 by wangshuo

特训营支付流程迁移完成版初版

parent df3df07d
...@@ -14,7 +14,7 @@ import {Link} from "react-router-dom"; ...@@ -14,7 +14,7 @@ import {Link} from "react-router-dom";
*/ */
const OrderItem = ({ info, tab, children, src,id, ...restProps }) => { const OrderItem = ({ info, tab, children, src,id, isaist, ...restProps }) => {
return ( return (
<div className='public-list-item'> <div className='public-list-item'>
<div className="public-content"> <div className="public-content">
...@@ -23,6 +23,11 @@ const OrderItem = ({ info, tab, children, src,id, ...restProps }) => { ...@@ -23,6 +23,11 @@ const OrderItem = ({ info, tab, children, src,id, ...restProps }) => {
<Link to={`/detail?id=${id}`}> <Link to={`/detail?id=${id}`}>
<img src={src} alt="" /> <img src={src} alt="" />
</Link> </Link>
{
(isaist &&
<span className='return_cash'></span>
)
}
</div> </div>
{info} {info}
</div> </div>
......
...@@ -21,6 +21,15 @@ ...@@ -21,6 +21,15 @@
border-radius: 3px; border-radius: 3px;
} }
} }
.return_cash {
position: absolute;
top: 0;
right: 0;
width: 31px;
height: 18px;
background: url("./image/return.icon.png") no-repeat;
background-size: 100% 100%;
}
} }
......
...@@ -6,6 +6,7 @@ import { getCourses } from "@/components/detail/actions" ...@@ -6,6 +6,7 @@ import { getCourses } from "@/components/detail/actions"
import { connect } from "react-redux" import { connect } from "react-redux"
import './index.scss' import './index.scss'
import Overlay from '../overlay' import Overlay from '../overlay'
import axios from "axios";
class BtnStatus extends Component { class BtnStatus extends Component {
...@@ -19,11 +20,11 @@ class BtnStatus extends Component { ...@@ -19,11 +20,11 @@ class BtnStatus extends Component {
countdown: 0, countdown: 0,
barInfo: '' barInfo: ''
} }
console.log(props);
} }
componentDidMount() { componentDidMount() {
this.getBargainInfo() // this.getBargainInfo()
} }
...@@ -38,6 +39,9 @@ class BtnStatus extends Component { ...@@ -38,6 +39,9 @@ class BtnStatus extends Component {
// } // }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if(nextProps.data && nextProps.data.is_bargain) {
this.getBargainInfo()
}
this.setState({ this.setState({
...nextProps.data.course_info, ...nextProps.data.course_info,
countdown: nextProps.countdown, countdown: nextProps.countdown,
...@@ -75,10 +79,10 @@ class BtnStatus extends Component { ...@@ -75,10 +79,10 @@ class BtnStatus extends Component {
}else{ }else{
let cidArr = JSON.stringify([Number(getParam('id'))]); let cidArr = JSON.stringify([Number(getParam('id'))]);
console.log(cidArr); console.log(cidArr);
http.get(`${api['base-api']}/m/cart/addtopreorder/${cidArr}?type=1`).then((res) => { http.get(`${API['base-api']}/m/cart/addtopreorder/${cidArr}?type=1`).then((res) => {
console.log(res); console.log(res);
if (res.data.errno === 0) { if (res.data.errno === 0) {
this.props.history.push({pathname: '/order?id=' + res.data.data[0], state: {type: 1}}); this.props.history.push("/order?id=" + res.data.data[0], {type: 1});
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
} }
...@@ -145,7 +149,7 @@ class BtnStatus extends Component { ...@@ -145,7 +149,7 @@ class BtnStatus extends Component {
type: 1, // 1 用户自己砍价 2 使用砍价神器 3 好友助力砍价 4 好友第二次助力 type: 1, // 1 用户自己砍价 2 使用砍价神器 3 好友助力砍价 4 好友第二次助力
parent_uid: 0 // 被助力人id 【自己本人操作传0】 parent_uid: 0 // 被助力人id 【自己本人操作传0】
} }
http.post(`${api.home}/m/bargain/toBargain`, data).then((res) => { http.post(`${API.home}/m/bargain/toBargain`, data).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
// this.props.getBargainInfo() // this.props.getBargainInfo()
document.location.reload() document.location.reload()
......
...@@ -11,7 +11,7 @@ import BtnStatus from "./btnstatus" ...@@ -11,7 +11,7 @@ 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, browser} from "@/utils" import {getParam, http, browser} from "@/utils"
import {Toast} from 'antd-mobile' import {Toast} from 'antd-mobile'
import {compose} from "redux"; import {compose} from "redux";
...@@ -251,14 +251,14 @@ class Detail extends Component { ...@@ -251,14 +251,14 @@ class Detail extends Component {
{/*拼团*/} {/*拼团*/}
{ {
(courseInfo.group_status === 3 || courseInfo.group_status === 4) && (!courseInfo.is_aist && (courseInfo.group_status === 3 || courseInfo.group_status === 4)) &&
<Group history={this.props.history} countdown={countdown}/> <Group history={this.props.history} countdown={countdown}/>
} }
{/*砍价*/} {/*砍价*/}
{ {
this.props.courseInfo && this.props.courseInfo.is_bargain && (!courseInfo.is_aist) && this.props.courseInfo && this.props.courseInfo.is_bargain &&
<Bargain/> <Bargain/>
} }
...@@ -298,13 +298,9 @@ class Detail extends Component { ...@@ -298,13 +298,9 @@ class Detail extends Component {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
courseInfo: state.courseInfo, courseInfo: state.courseInfo,
<<<<<<< HEAD
user: { user: {
...state.user ...state.user
} }
=======
user: state.user
>>>>>>> master
} }
} }
......
...@@ -17,7 +17,6 @@ function OrderList(props) { ...@@ -17,7 +17,6 @@ function OrderList(props) {
<div> <div>
{ {
listData.map((item, index) => { listData.map((item, index) => {
console.log(item);
const { is_coupon, course_id, image_name, price1, price0, simpledescription, course_title, coupon_num, coupon_desc } = item; const { is_coupon, course_id, image_name, price1, price0, simpledescription, course_title, coupon_num, coupon_desc } = item;
const Info = ( const Info = (
<div className="order-info"> <div className="order-info">
...@@ -25,7 +24,7 @@ function OrderList(props) { ...@@ -25,7 +24,7 @@ function OrderList(props) {
<p className='order-content' style={{ WebkitBoxOrient: 'vertical', WebkitLineClamp: '2', wordBreak: 'break-all', overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box' }}>{simpledescription}</p> <p className='order-content' style={{ WebkitBoxOrient: 'vertical', WebkitLineClamp: '2', wordBreak: 'break-all', overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box' }}>{simpledescription}</p>
<p className='order-des'> <p className='order-des'>
{ {
props.courseId === undefined ? (<span className='order-newprice'>¥{price1}</span>) : (<span className='order-newprice'>¥{item.pdd_group_info.price}</span>) props.courseId === undefined ? (<span className='order-newprice'>¥{price1}</span>) : (<span className='order-newprice'>¥{price0}</span>)
} }
<span className='order-price'>¥{price0}</span> <span className='order-price'>¥{price0}</span>
</p> </p>
...@@ -33,7 +32,7 @@ function OrderList(props) { ...@@ -33,7 +32,7 @@ function OrderList(props) {
); );
return ( return (
<OrderItem {...item} src={image_name} id={course_id} key={index} info={Info}> <OrderItem {...item} src={image_name} id={course_id} key={index} info={Info} isaist={props.isaist}>
{ {
is_coupon === 1 ? ( is_coupon === 1 ? (
<div className="order-prefer"> <div className="order-prefer">
...@@ -93,9 +92,14 @@ class Order extends Component { ...@@ -93,9 +92,14 @@ class Order extends Component {
if (!this.state.perfect) { if (!this.state.perfect) {
Toast.info('请完善报名信息!'); Toast.info('请完善报名信息!');
} }
let url = `${API['base-api']}/m/v34/cart/order?ischeck=${this.state.useBalance}`;
http.post(`${API.home}/m/order/submitOrder`, { is_deduction: this.state.useBalance }).then(res => { if(this.props.location.state.type === 1) {
if(res.data.code !== 200) { url += '&type=1'
}
http.get(url).then(res => {
console.log(res);
if(res.data.errno !== 0) {
Toast.info(res.data.msg, 2);
return; return;
} }
sessionStorage.removeItem('orderUseCacheObj'); sessionStorage.removeItem('orderUseCacheObj');
...@@ -111,7 +115,7 @@ class Order extends Component { ...@@ -111,7 +115,7 @@ class Order extends Component {
if (!useBalanceFlag) { if (!useBalanceFlag) {
this.cacheObj = { this.cacheObj = {
...this.state ...this.state
} };
sessionStorage.setItem('orderUseCacheObj', JSON.stringify(this.state)); sessionStorage.setItem('orderUseCacheObj', JSON.stringify(this.state));
}else{ }else{
sessionStorage.removeItem('orderUseCacheObj'); sessionStorage.removeItem('orderUseCacheObj');
...@@ -174,7 +178,7 @@ class Order extends Component { ...@@ -174,7 +178,7 @@ class Order extends Component {
let _this = this; let _this = this;
console.log(this.props.location.state); console.log(this.props.location.state);
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['home']}/m/order/preorder/`).then((res) => { http.get(`${API['base-api']}/m/order/preorder?type=1`).then((res) => {
if(res.data.errno === 200) { if(res.data.errno === 200) {
const { course, total, user_account, user_info, discount } = res.data.data; const { course, total, user_account, user_info, discount } = res.data.data;
this.cacheObj = { this.cacheObj = {
...@@ -191,14 +195,24 @@ class Order extends Component { ...@@ -191,14 +195,24 @@ class Order extends Component {
total, total,
discount, discount,
}); });
if(this.props.history.action === 'PUSH') {
sessionStorage.removeItem('orderUseCacheObj');
} else{
const cacheObj = sessionStorage.getItem('orderUseCacheObj');
if(cacheObj !== null) {
this.setState({
useBalance: true
});
this.computedMoneyByCache();
}
}
}else{ }else{
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
return;
} }
}) })
}else { }else {
if(getParam('id')) { if(getParam('id')) {
Promise.all([http.get(`${api.home}/m/del_cart_order/${getParam('id')}`), http.get(`${api.home}/m/order/preorder`), http.get(`${api.home}/m/course/detail/${getParam('id')}`)]).then(res => { Promise.all([http.get(`${API.home}/m/del_cart_order/${getParam('id')}`), http.get(`${API.home}/m/order/preorder`), http.get(`${API.home}/m/course/detail/${getParam('id')}`)]).then(res => {
console.log(res); console.log(res);
let preorder = res[1], let preorder = res[1],
detail = res[2], detail = res[2],
...@@ -231,7 +245,7 @@ class Order extends Component { ...@@ -231,7 +245,7 @@ class Order extends Component {
}); });
}) })
}else{ }else{
http.get(`${api['base-api']}/m/order/preorder`).then((res) => { http.get(`${API['base-api']}/m/order/preorder`).then((res) => {
console.log(res.data); console.log(res.data);
if (res.data.errno !== 200) { if (res.data.errno !== 200) {
return; return;
...@@ -282,10 +296,14 @@ class Order extends Component { ...@@ -282,10 +296,14 @@ class Order extends Component {
<div className="order-wrapper"> <div className="order-wrapper">
<Flex> <Flex>
<Flex.Item> <Flex.Item>
<HeaderBar title='课程报名' arrow={true}></HeaderBar> <HeaderBar title='课程报名' arrow={true} />
{ {
!this.state.perfect && !this.state.perfect &&
<Link to='/orderinfo' className="order-information"> <Link to={{
pathname: '/orderinfo',
state: {type: this.props.location.state.type, id: getParam('id')}
}}
className="order-information">
<i className="iconfont iconiconfront-6 order-addsize"></i> <i className="iconfont iconiconfront-6 order-addsize"></i>
<div className="order-infotext">完善报名信息</div> <div className="order-infotext">完善报名信息</div>
<i className="iconfont iconiconfront-70 order-next"></i> <i className="iconfont iconiconfront-70 order-next"></i>
...@@ -297,7 +315,11 @@ class Order extends Component { ...@@ -297,7 +315,11 @@ class Order extends Component {
<WingBlank> <WingBlank>
<Link to={{ <Link to={{
pathname: '/orderinfo', pathname: '/orderinfo',
state: this.state.perfect state: {
...this.state.perfect,
type: this.props.location.state.type,
id: getParam('id')
}
} }
} > } >
<Flex align='center' justify='between' style={{ height: '80px' }}> <Flex align='center' justify='between' style={{ height: '80px' }}>
...@@ -318,7 +340,7 @@ class Order extends Component { ...@@ -318,7 +340,7 @@ class Order extends Component {
</div> </div>
} }
<div className="order-list"> <div className="order-list">
<OrderList list={orderList} compute={this.computedMoney} courseId={getParam('id')} /> <OrderList list={orderList} compute={this.computedMoney} courseId={getParam('id')} isaist={this.props.location.state.type}/>
</div> </div>
<div className="order-balance"> <div className="order-balance">
<List> <List>
......
...@@ -78,36 +78,43 @@ const MyForm = withFormik({ ...@@ -78,36 +78,43 @@ const MyForm = withFormik({
Toast.info('请输入正确QQ号!', undefined, undefined, false); Toast.info('请输入正确QQ号!', undefined, undefined, false);
return; return;
} }
let same = false; let same = 0;
if(FormBag.props.userInfo) { if(FormBag.props.userInfo) {
const userInfo = FormBag.props.userInfo; const userInfo = FormBag.props.userInfo;
if(userInfo.real_name === real_name) { if(userInfo.real_name === real_name) {
same = true; same += 1;
} }
if(userInfo.cellphone === cellphone) { if(userInfo.cellphone === cellphone) {
same = true; same += 1;
} }
if(userInfo.qq === qq) { if(userInfo.qq === qq) {
same = true; same += 1;
} }
} }
if(same) { let pathName = '/order';
FormBag.props.history.replace({ if(FormBag.props.userInfo.id) {
pathname: '/order', pathName = pathName + '?id=' + FormBag.props.userInfo.id;
state: values }
}); if(same === 3) {
FormBag.props.history.replace(
pathName,
{
...values,
}
);
return; return;
} }
http.post(`${API.home}/m/order/saveUserInfo`, {real_name: values.real_name, cellphone: (`${values.cellphone}`).replace(/\s+/g, ''), qq: values.qq}).then(res=>{ http.post(`${API['base-api']}/m/order/saveUserInfo`, {real_name: values.real_name, cellphone: (`${values.cellphone}`).replace(/\s+/g, ''), qq: values.qq}).then(res=>{
if(res.data.code !== 200) { console.log(res);
if(res.data.errno !== 200) {
Toast.info(res.data.msg, undefined, undefined, false); Toast.info(res.data.msg, undefined, undefined, false);
return; return;
} }
Toast.info('保存成功!', undefined, undefined, false); Toast.info('保存成功!', undefined, undefined, false);
FormBag.props.history.replace({ FormBag.props.history.replace(
pathname: '/order', pathName,
state: values values
}); );
}); });
}, },
})(InnerForm); })(InnerForm);
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Flex, WingBlank, WhiteSpace, List, Radio } from 'antd-mobile'; import {Flex, WingBlank, WhiteSpace, List, Radio, Toast} from 'antd-mobile';
import { api, http, getParam, is_weixin } from '@/utils'; import {http, getParam, is_weixin } from '@/utils';
import { OrderItem, HeaderBar } from '@/common/index'; import { OrderItem, HeaderBar } from '@/common/index';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import './PayOrder.scss'; import './PayOrder.scss';
...@@ -51,7 +51,6 @@ export default class PayOrder extends Component { ...@@ -51,7 +51,6 @@ export default class PayOrder extends Component {
console.log(item); console.log(item);
this.setState({ this.setState({
huabei: false, huabei: false,
checkPeriod: true,
stageNumber: item.value, stageNumber: item.value,
singleMoney: item.everyTotal, singleMoney: item.everyTotal,
periodNumber: item.stage, periodNumber: item.stage,
...@@ -168,9 +167,10 @@ export default class PayOrder extends Component { ...@@ -168,9 +167,10 @@ export default class PayOrder extends Component {
} }
componentDidMount() { componentDidMount() {
http.post(`${API.home}/m/order/detail`, { order_id: this.state.orderId }).then((res) => { http.post(`${API['base-api']}/m/order/detail`, { order_id: this.state.orderId }).then((res) => {
console.log(res); console.log(res);
if (res.data.code !== 200) { if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2);
return; return;
} }
const { course, pay_amount } = res.data.data; const { course, pay_amount } = res.data.data;
......
import React, {Component} from 'react'; import React, {Component} from 'react';
import {api, getParam, http, browser} from "@/utils"; import {getParam, http, browser} from "@/utils";
import './camp.scss'; import './camp.scss';
import {CampTitle, Header, TestItem, ChangeQuestion, Resolve} from './common/common'; import {CampTitle, Header, TestItem, ChangeQuestion, Resolve} from './common/common';
import {Toast} from "antd-mobile"; import {Toast} from "antd-mobile";
...@@ -43,7 +43,7 @@ class CampResolve extends Component { ...@@ -43,7 +43,7 @@ class CampResolve extends Component {
this.qidP = getParam('qid'); this.qidP = getParam('qid');
let _this = this; let _this = this;
// 获取问题列表 // 获取问题列表
http.get(`${api.home}/m/aist/analysis/${this.keshi_id}/${this.qidP}`).then(res => { http.get(`${API.home}/m/aist/analysis/${this.keshi_id}/${this.qidP}`).then(res => {
console.log(res); console.log(res);
if(res.data.code === 4040) { if(res.data.code === 4040) {
Toast.info(res.data.msg, 2, () => { Toast.info(res.data.msg, 2, () => {
......
import React, {Component} from 'react'; import React, {Component} from 'react';
import {api, getParam, http, browser} from "@/utils"; import {getParam, http, browser} from "@/utils";
import './camp.scss'; import './camp.scss';
import {connect} from "react-redux"; import {connect} from "react-redux";
import {Header, CampTitle, TestItem, ChangeQuestion} from './common/common'; import {Header, CampTitle, TestItem, ChangeQuestion} from './common/common';
...@@ -24,7 +24,7 @@ class CampTest extends Component { ...@@ -24,7 +24,7 @@ class CampTest extends Component {
this.qidP = getParam('qid'); this.qidP = getParam('qid');
let _this = this; let _this = this;
// 获取问题列表 // 获取问题列表
http.get(`${api.home}/m/aist/get_questions/${this.keshi_id}/${this.qidP}`).then(res => { http.get(`${API.home}/m/aist/get_questions/${this.keshi_id}/${this.qidP}`).then(res => {
if(res.data.code === 4040) { if(res.data.code === 4040) {
Toast.info(res.data.msg, 2, () => { Toast.info(res.data.msg, 2, () => {
this.props.history.push('/passport'); this.props.history.push('/passport');
...@@ -133,7 +133,7 @@ class CampTest extends Component { ...@@ -133,7 +133,7 @@ class CampTest extends Component {
data.cost_time = this.time; data.cost_time = this.time;
data.uid = this.props.user.data.uid; data.uid = this.props.user.data.uid;
data.answer_record = this.answerList; data.answer_record = this.answerList;
http.post(`${api.home}/m/aist/submit`, data).then((res) => { http.post(`${API.home}/m/aist/submit`, data).then((res) => {
if(res.data.code === 200) { if(res.data.code === 200) {
this.props.history.push(`/campResolve?keshi_id=${this.keshi_id}&qid=${this.qid}`) this.props.history.push(`/campResolve?keshi_id=${this.keshi_id}&qid=${this.qid}`)
}else{ }else{
......
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