Commit 50fa246e by 姜雷

修改订单逻辑

parent 64a695e5
......@@ -22,9 +22,8 @@ class Response {
}
export const fetchAnn = (data: Parmas) =>
schoolMainFetch({
url: `/dcxy/app/homepage/campus/${data.campusId}/publishedSections/${
data.customerId
}`,
url: '/dcxy/wechat/homepage/campus/publishedSections',
data: data,
}).then((res: ResponseDataEntity<Response>) => {
const data = res.data;
return data.sections.find(item => item.styleType == 'ANNOUNCEMENT');
......@@ -64,7 +63,6 @@ export const fetchAllAnn = (
data: AllParmas,
): Promise<ResponseDataEntity<AllResponse>> =>
schoolMainFetch({
url: `/dcxy/app/homepage/campus/${data.campusId}/publishedItems/${
data.sectionId
}`,
url: '/dcxy/wechat/homepage/campus/publishedItems',
data: data,
});
import { customerFetch, ResponseDataEntity } from '.';
import { LoginInfoVo } from './baseClass';
import { customerFetch } from '.';
export class LoginParams {
/** 登陆标识 */
......@@ -18,7 +17,7 @@ export const appLogin = (data: LoginParams) =>
export const appLogout = () =>
customerFetch({
url: '/app/customer/login/out',
url: '/dcxy/wechat/applet/login/out',
});
export class PwdParams {
......@@ -33,6 +32,7 @@ export const changePwdByCellphone = (data: PwdParams) =>
customerFetch({
url: '/app/customer/forget/pwd',
method: 'POST',
data: data,
});
type RegisiterPramas = {};
......@@ -59,7 +59,7 @@ type perfectionCustomerParams = {
export const perfectionUserInfo = (entity: perfectionCustomerParams) =>
customerFetch({
url: '/app/customer/perfection/customer',
url: '/dcxy/wechat/applet/perfection/customer',
method: 'POST',
data: entity,
});
import { ConsumeOrderResponse, ConsumeOrder } from './baseClass';
import { customerFetch, ResponseDataEntity } from './index';
import { customerFetch } from './index';
export class Params {
/** 会员id */
......
......@@ -4,4 +4,5 @@ export const OLD_BASE_SERVER_URL = 'https://ex-dev-selfbase.168cad.top';
export const BASE_SERVER_URL = 'https://ex-dev-dcxy-base-app.168cad.top';
export const CUSTOMER_SERVER_URL =
'https://ex-dev-dcxy-customer-app.168cad.top';
export const SCHOOL_MAIN_URL = 'http://internal-dev-school-main.168cad.top';
export const SCHOOL_MAIN_URL = 'https://internal-dev-school-main.168cad.top';
export const ANN_LINK_URL = 'https://internal-dev-school-homepage.168cad.top/';
import { Component } from '@tarojs/taro';
import { ComponentClass } from 'react';
import { View, ScrollView, Image, Text } from '@tarojs/components';
import { View, ScrollView, Image, Text, WebView } from '@tarojs/components';
import AnnIcon from '../../images/icon/ann_tongzhi_icon@2x.png';
import { fetchAllAnn, AnnItem } from '../../api/announcement';
......@@ -8,6 +8,7 @@ import { connect } from '@tarojs/redux';
import { UserState } from '../../store/rootReducers/userinfo';
import './Announcement.scss';
import { ANN_LINK_URL } from '../../constants';
type PageStateProps = {
userinfo: UserState;
......@@ -17,6 +18,7 @@ type PageState = {
pageNum: number;
pageSize: number;
list: AnnItem[];
linkUrl: string;
};
interface Announcement {
......@@ -34,6 +36,7 @@ class Announcement extends Component {
pageNum: 1,
pageSize: 10,
list: [],
linkUrl: '',
};
}
componentWillMount() {
......@@ -51,63 +54,24 @@ class Announcement extends Component {
})
.catch(err => {
console.log(err);
this.setState({
pageNum: 1,
pageSize: 10,
pages: 1,
total: 2,
list: [
{
id: 301070,
title: 'ASFDSGSD大苏打',
multiImageType: 'SINGLE',
source: '关机开不开地方',
linkUrls: ['sqwerqwerqwefsf'],
linkType: 'DEFAULT',
jumpUrl: '',
urlParameters: {},
sort: 1,
enabled: true,
loadAd: false,
mandatoryPrompt: false,
effectTime: 1529431320000,
expirationTime: 1530129600000,
createTime: '2018-06-01 10:41:11',
updateTime: '2019-01-25 09:43:17',
},
{
id: 301073,
title: '啊实打实的阿斯顿',
multiImageType: 'SINGLE',
source: '个撒大',
linkUrls: ['sqwerqwerqwefsf'],
linkType: 'DEFAULT',
jumpUrl: '',
urlParameters: {},
sort: 2,
enabled: true,
loadAd: false,
mandatoryPrompt: false,
createTime: '2018-06-12 10:52:15',
updateTime: '2019-01-25 09:47:39',
},
],
});
});
}
geAnnDetail(id: number) {
geAnnDetail(id: number, title: string) {
console.log(id);
this.setState({
linkUrl: `${ANN_LINK_URL}/Content/${id}?title=${title}`,
});
}
render() {
const { list } = this.state;
const { list, linkUrl } = this.state;
return (
<ScrollView className='Announcement' scroll-y>
{linkUrl && <WebView src={linkUrl} />}
{list.map(annItem => (
<View
key={annItem.id}
className='Announcement-item'
onClick={() => this.geAnnDetail(annItem.id)}
>
onClick={() => this.geAnnDetail(annItem.id, annItem.title)}>
<Image
className='Announcement-item-img'
src={annItem.linkUrls[0]}
......
......@@ -5,7 +5,7 @@
width: 100%;
height: 100%;
padding: 0 32px;
z-index: 2;
z-index: 100;
background-color: rgba(255, 255, 255, 0.5);
}
.blur {
......@@ -23,6 +23,8 @@
height: 436px;
}
.BarCodeImg {
position: relative;
z-index: 1;
flex: 1;
margin: 26px 52px 46px;
background-color: #fff;
......
......@@ -17,7 +17,11 @@ import {
import OrderInfo from '../Order/components/OrderInfo/OrderInfo';
import OrderTitle from '../Order/components/OrderTitle/OrderTitle';
import OrderPayway from '../Order/components/OrderPayway/OrderPayway';
import { ConsumeOrder, PaymentAndActiveInfo } from '../../api/baseClass';
import {
ConsumeOrder,
PaymentAndActiveInfo,
CustomerBeanAccountVo,
} from '../../api/baseClass';
type PageStateProps = {
userinfo: UserState;
......@@ -26,6 +30,7 @@ type PageOwnProps = {};
type PageState = {
showPayOrder: boolean;
showBig: boolean;
accounts: CustomerBeanAccountVo[];
orderInfo: ConsumeOrder;
payInfos: {
paymentAndActiveInfos: PaymentAndActiveInfo[];
......@@ -59,6 +64,7 @@ class BarCode extends Component {
this.state = {
showPayOrder: false,
showBig: false,
accounts: [],
orderInfo: {
actualMoney: undefined,
areaId: undefined,
......@@ -115,12 +121,13 @@ class BarCode extends Component {
if (res.data.length) {
this.fetchOrder(res.data[0].id);
this.setState({ showPayOrder: true });
} else {
this.drawBarCode(false);
}
})
.catch(err => {
console.log(err);
});
wxbarcode.barcode('BarCode', userinfo.idBar, 646, 188);
}
fetchOrder(id: number) {
......@@ -134,23 +141,6 @@ class BarCode extends Component {
orderInfo: orderInfo,
payInfos: payInfos,
});
fetchDeductionInfo({
orderId: orderInfo.id,
payType: '',
paymentConfId: payInfos.paymentConfId,
})
.then(res => {
this.setState({
deductionInfos: res.data,
});
})
.catch(err => {
console.log(err);
Taro.showToast({
title: '获取抵扣信息失败',
icon: 'none',
});
});
})
.catch(err => {
console.log(err);
......@@ -158,9 +148,15 @@ class BarCode extends Component {
}
payDoneHandle() {
this.setState({
showPayOrder: false,
});
const { showBig } = this.state;
this.setState(
{
showPayOrder: false,
},
() => {
this.drawBarCode(showBig);
},
);
}
drawBarCode(showBig: boolean) {
const { userinfo } = this.props;
......@@ -181,13 +177,7 @@ class BarCode extends Component {
render() {
const { userinfo } = this.props;
const {
showPayOrder,
showBig,
orderInfo,
payInfos,
deductionInfos,
} = this.state;
const { showPayOrder, showBig, orderInfo, payInfos, accounts } = this.state;
return (
<View className='BarCode'>
{showPayOrder && (
......@@ -195,11 +185,11 @@ class BarCode extends Component {
<OrderTitle price={orderInfo.payableMoney} />
<OrderInfo orderInfo={orderInfo} />
<OrderPayway
payDoneCallback={this.payDoneHandle}
onPayDoneCallback={this.payDoneHandle}
userinfo={userinfo}
orderId={orderInfo.id}
accounts={accounts}
orderInfo={orderInfo}
payInfos={payInfos}
deductionInfos={deductionInfos}
/>
</View>
)}
......@@ -207,8 +197,7 @@ class BarCode extends Component {
<View
className={`BarCodeBox ${showPayOrder ? 'blur' : ''} ${
showBig ? 'BarCodeBoxBig' : ''
}`}
>
}`}>
{showBig ? (
<Image className='bg' src={BarCodeBoxBigBg} />
) : (
......@@ -218,7 +207,9 @@ class BarCode extends Component {
<Image className='BarCodeBox-refresh' src={RefreshIcon} />
)}
<View className={`BarCodeImg ${showBig ? 'BarCodeImgBig' : ''}`}>
<Canvas className='BarCodeCav' canvasId='BarCode' />
{showPayOrder ? null : (
<Canvas className='BarCodeCav' canvasId='BarCode' />
)}
</View>
<View className='toggleBtn' onClick={this.toggleBigBarCode}>
{showBig ? '缩小' : '放大'}
......
......@@ -95,51 +95,51 @@ class Home extends Component {
}
})
.catch(err => {
this.setState({
annItem: {
id: 896,
styleType: 'ANNOUNCEMENT',
name: '公告1',
titleTypeRemark: '无',
titleType: 'NONE',
titleContent: '',
sort: 3,
updateTime: 1528770103000,
itemsCount: 10,
items: [
{
id: 301070,
title: 'ASFDSGSD大苏打',
multiImageType: 'SINGLE',
source: '关机开不开地方',
linkUrls: ['sqwerqwerqwefsf'],
linkType: 'DEFAULT',
jumpUrl: '',
urlParameters: {},
sort: 1,
loadAd: false,
mandatoryPrompt: false,
createTime: '2018-06-01 10:41:11',
updateTime: '2019-01-25 09:43:17',
},
{
id: 301073,
title: '啊实打实的阿斯顿',
multiImageType: 'SINGLE',
source: '个撒大',
linkUrls: ['sqwerqwerqwefsf'],
linkType: 'DEFAULT',
jumpUrl: '',
urlParameters: {},
sort: 2,
loadAd: false,
mandatoryPrompt: false,
createTime: '2018-06-12 10:52:15',
updateTime: '2019-01-25 09:47:39',
},
],
},
});
// this.setState({
// annItem: {
// id: 896,
// styleType: 'ANNOUNCEMENT',
// name: '公告1',
// titleTypeRemark: '无',
// titleType: 'NONE',
// titleContent: '',
// sort: 3,
// updateTime: 1528770103000,
// itemsCount: 10,
// items: [
// {
// id: 301070,
// title: 'ASFDSGSD大苏打',
// multiImageType: 'SINGLE',
// source: '关机开不开地方',
// linkUrls: ['sqwerqwerqwefsf'],
// linkType: 'DEFAULT',
// jumpUrl: '',
// urlParameters: {},
// sort: 1,
// loadAd: false,
// mandatoryPrompt: false,
// createTime: '2018-06-01 10:41:11',
// updateTime: '2019-01-25 09:43:17',
// },
// {
// id: 301073,
// title: '啊实打实的阿斯顿',
// multiImageType: 'SINGLE',
// source: '个撒大',
// linkUrls: ['sqwerqwerqwefsf'],
// linkType: 'DEFAULT',
// jumpUrl: '',
// urlParameters: {},
// sort: 2,
// loadAd: false,
// mandatoryPrompt: false,
// createTime: '2018-06-12 10:52:15',
// updateTime: '2019-01-25 09:47:39',
// },
// ],
// },
// });
console.error(err);
});
}
......
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Button, Text, Input, Navigator } from '@tarojs/components';
import { View, Button, Input, Navigator } from '@tarojs/components';
import './Login.scss';
import { appLogin } from '../../api/customer';
......
......@@ -27,6 +27,9 @@ page {
justify-content: space-between;
font-size: 28px;
color: #333;
.deduction {
color: #ff1010;
}
}
.OrderDetail-line {
margin: 10px auto;
......
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Text, Image } from '@tarojs/components';
import { View, Text } from '@tarojs/components';
import OrderTitle from '../components/OrderTitle/OrderTitle';
import OrderInfo from '../components/OrderInfo/OrderInfo';
import comLogo from '../../../images/order/pay_logo_icon@2x.png';
import './OrderDetail.scss';
import { fetchOrderDetail, fetchOrderDetailAndPay } from '../../../api/order';
import { fetchOrderDetailAndPay } from '../../../api/order';
import { PayType, getPayType } from '../../../utils/payType';
type pageProps = {};
type PageState = {
actualMoney: 0;
areaId: 0;
actualMoney: number;
areaId: number;
areaName: string;
consumeType: string;
createAt: string;
customerCellphone: string;
customerId: 0;
customerId: number;
customerName: string;
deductionBean: 0;
deductionMoney: 0;
deductionBean: number;
deductionMoney: number;
equipmentNum: string;
equipmentPosition: string;
id: 0;
operateId: 0;
id: number;
operateId: number;
operateName: string;
operationMode: string;
orderName: string;
......@@ -33,10 +32,10 @@ type PageState = {
orderState: string;
outTradeNo: string;
payType: PayType;
payableMoney: 0;
serviceId: 0;
payableMoney: number;
serviceId: number;
serviceName: string;
thirdDiscountMoney: 0;
thirdDiscountMoney: number;
thirdTradeNumber: string;
updateDate: string;
};
......@@ -96,6 +95,9 @@ class OrderDetail extends Component {
id: id,
})
.then(res => {
this.setState({
...res.data,
});
console.log(res);
})
.catch(err => {
......@@ -122,12 +124,14 @@ class OrderDetail extends Component {
<View className='OrderDetail'>
<OrderTitle price={payableMoney} />
<OrderInfo
serviceName={serviceName}
createAt={createAt}
orderNumber={orderNumber}
areaName={areaName}
equipmentNum={equipmentNum}
equipmentPosition={equipmentPosition}
orderInfo={{
serviceName,
createAt,
orderNumber,
areaName,
equipmentNum,
equipmentPosition,
}}
/>
<View className='OrderDetail-line' />
<View className='OrderDetail-payinfo'>
......@@ -137,13 +141,13 @@ class OrderDetail extends Component {
{deductionBean ? (
<View className='OrderDetail-payinfo'>
<Text>通用豆抵扣</Text>
<Text>{deductionBean.toFixed(2)}</Text>
<Text className='deduction'>{deductionBean.toFixed(2)}</Text>
</View>
) : null}
{deductionMoney ? (
<View className='OrderDetail-payinfo'>
<Text>艾米抵扣</Text>
<Text>{deductionMoney.toFixed(2)}</Text>
<Text className='deduction'>{deductionMoney.toFixed(2)}</Text>
</View>
) : null}
......
......@@ -30,17 +30,6 @@ type PageState = {
paymentAndActiveInfos: PaymentAndActiveInfo[];
paymentConfId: number;
};
deductionInfos: {
amiAccount: number;
beanAccount: number;
deductionMoney: number;
deductionType: string;
orderMoney: number;
payMoney: number;
payType: string;
remainAccount: number;
titlePerfix: string;
};
};
interface OrderPay {
......@@ -91,17 +80,6 @@ class OrderPay extends Component {
paymentAndActiveInfos: [],
paymentConfId: 0,
},
deductionInfos: {
amiAccount: 0,
beanAccount: 0,
deductionMoney: 0,
deductionType: '',
orderMoney: 0,
payMoney: 0,
payType: '',
remainAccount: 0,
titlePerfix: '',
},
};
}
......@@ -123,23 +101,6 @@ class OrderPay extends Component {
orderInfo: orderInfo,
payInfos: payInfos,
});
fetchDeductionInfo({
orderId: orderInfo.id,
payType: '',
paymentConfId: payInfos.paymentConfId,
})
.then(res => {
this.setState({
deductionInfos: res.data,
});
})
.catch(err => {
console.log(err);
Taro.showToast({
title: '获取抵扣信息失败',
icon: 'none',
});
});
})
.catch(err => {
console.log(err);
......@@ -152,18 +113,18 @@ class OrderPay extends Component {
render() {
const { userinfo } = this.props;
const { orderInfo, payInfos, deductionInfos } = this.state;
const { orderInfo, payInfos, accounts } = this.state;
return (
<View className='OrderPay topBr'>
<OrderTitle price={orderInfo.payableMoney} />
<OrderInfo orderInfo={orderInfo} />
<View className='OrderPay-line' />
<OrderPayway
payDoneCallback={this.payDoneHandle}
onPayDoneCallback={this.payDoneHandle}
userinfo={userinfo}
orderId={orderInfo.id}
orderInfo={orderInfo}
accounts={accounts}
payInfos={payInfos}
deductionInfos={deductionInfos}
/>
</View>
);
......
......@@ -19,6 +19,20 @@ interface OrderInfo {
props: PageProps;
}
class OrderInfo extends Component {
static defaultProps = {
orderInfo: {
serviceName: '',
createAt: '',
orderNumber: '',
areaName: '',
equipmentNum: '',
equipmentPosition: '',
},
};
constructor(props) {
super(props);
}
render() {
const {
orderInfo: {
......
......@@ -24,6 +24,9 @@
background-color: #ffd506;
}
}
.OrderPay-payway.disabled {
color: #666;
}
.OrderPay-payinfo {
display: flex;
height: 60px;
......
......@@ -16,7 +16,6 @@ import agreeIcon from '../../images/login/icon_zhuce_sel@2x.png';
import agreeNotIcon from '../../images/login/icon_zhuce_nor@2x.png';
import { connect } from '@tarojs/redux';
import { UserState, updateUserInfo } from '../../store/rootReducers/userinfo';
import { getVcode, fetchWxUserRegister } from '../../api/wx';
import { wxUserRegister } from '../../api/customer';
type PageStateProps = {
......
......@@ -3,7 +3,7 @@ import Taro, { Component, Config } from '@tarojs/taro';
import { View } from '@tarojs/components';
import './index.scss';
import { LoginReponse, login } from '../../api/wx';
import { LoginReponse } from '../../api/wx';
import { connect } from '@tarojs/redux';
import { updateUserInfo, UserState } from '../../store/rootReducers/userinfo';
......
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