Commit 7f26b12b by 姜雷

添加订单逻辑

parent 72200187
......@@ -31,6 +31,7 @@
"@tarojs/taro-swan": "1.2.13",
"@tarojs/taro-tt": "1.2.13",
"@tarojs/taro-weapp": "1.2.13",
"crypto-js": "^3.1.9-1",
"jsbarcode": "^3.11.0",
"nerv-devtools": "^1.3.9",
"nervjs": "^1.3.9",
......
import { schoolMainFetch, ResponseDataEntity } from '.';
class Parmas {
campusId: number;
customerId: number;
}
export class SectionItem {
id: number;
styleType: string;
name: string;
titleTypeRemark: string;
titleType: string;
titleContent: string;
sort: number;
updateTime: number;
itemsCount: number;
items: AnnItem[];
}
class Response {
campusId: number;
sections: SectionItem[];
}
export const fetchAnn = (data: Parmas) =>
schoolMainFetch({
url: `/dcxy/app/homepage/campus/${data.campusId}/publishedSections/${
data.customerId
}`,
}).then((res: ResponseDataEntity<Response>) => {
const data = res.data;
return data.sections.find(item => item.styleType == 'ANNOUNCEMENT');
});
class AllParmas {
campusId: number;
sectionId: number;
}
class AnnItem {
id: number;
title: string;
multiImageType: '';
source: string;
linkUrls: string[];
linkType: 'DEFAULT';
jumpUrl: string;
urlParameters: {};
sort: number;
enabled?: boolean;
loadAd: boolean;
mandatoryPrompt: boolean;
effectTime?: number;
expirationTime?: number;
createTime: string;
updateTime: string;
}
class AllResponse {
pageNum: number;
pageSize: number;
pages: number;
total: number;
list: AnnItem[];
attached: null;
}
export const fetchAllAnn = (
data: AllParmas,
): Promise<ResponseDataEntity<AllResponse>> =>
schoolMainFetch({
url: `/dcxy/app/homepage/campus/${data.campusId}/publishedItems/${
data.sectionId
}`,
});
......@@ -2015,3 +2015,259 @@ declare namespace API {
}
}
}
declare namespace defs {
export class BarrageEntity {
/** createdate */
createdate?: string;
/** deletestate */
deletestate?: string;
/** id */
id?: number;
/** picurl */
picurl?: string;
/** time */
time?: number;
/** type */
type?: string;
/** updatedate */
updatedate?: string;
/** url */
url?: string;
}
export class JtSynchronOrderVo {
/** 订单内容 */
orderContent?: string;
/** 订单金额 */
orderMoney?: number;
/** 订单编号 */
orderNum?: string;
}
export class JtSynchronPwdVo {
/** 会员电话 */
cellphone?: string;
/** 会员密码 */
password?: string;
}
}
declare namespace API {
/**
* 校区页面管理
*/
export namespace campusPageSection {
/**
* 获取动态码
* /dcxy/app/homepage/campus/getDynamicCode
*/
export namespace getDynamicCode {
export class Params {
/** 账号 */
account: string;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 获取会员APP的版本信息
* /dcxy/app/homepage/campus/getcustomerAppVersion
*/
export namespace getcustomerAppVersion {
export class Params {
/** 会员ID,必须为大于0的整数 */
campusId: string;
/** 会员ID,必须为大于0的整数 */
customerId: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 校区模式
* /dcxy/app/homepage/campus/model/{customerId}
*/
export namespace getModel {
export class Params {
/** 会员ID,必须为大于0的整数 */
customerId: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 版块条目页面上的广告点击接口
* /dcxy/app/homepage/campus/section/itemAd/click
*/
export namespace clickItemAd {
export class Params {
/** 访问页名称,必填项 */
pageName: string;
}
export type Response = any;
export const init: Response;
export function request(params: Params): Promise<any>;
}
/**
* 校园页面版块条目点击接口
* /dcxy/app/homepage/campus/section/{itemId}/click
*/
export namespace clickItem {
export class Params {
/** 版块条目ID,必须为大于0的整数 */
itemId: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 校区页面公告强弹禁用接口
* /dcxy/app/homepage/campus/{campusId}/disableMandatoryPrompt/{customerId}/section/{itemId}/{disable}
*/
export namespace disableMandatoryPrompt {
export class Params {
/** 校区ID,必须为大于0的整数 */
campusId: number;
/** 用户ID,必须为大于0的整数 */
customerId: number;
/** 条目ID,必须为大于0的整数 */
itemId: number;
/** 公告强弹禁用标志,必须为布尔类型 */
disable: boolean;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 获取校区下的app闪图接口
* /dcxy/app/homepage/campus/{campusId}/getBarrage
*/
export namespace getBarrage {
export class Params {
/** 校区ID,必须为大于0的整数 */
campusId: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 校区页面已发布版块所有可用条目列表获取接口
* /dcxy/app/homepage/campus/{campusId}/publishedItems/{sectionId}
*/
export namespace publishedItems {
export class Params {
/** 校区ID,必须为大于0的整数 */
campusId: number;
/** 版块ID,必须为大于0的整数 */
sectionId: number;
/** 首页公告版块ID,必须为大于0的整数 */
pageSectionId?: number;
/** 页码,必须为大于0的整数 */
pageNum?: number;
/** 页大小,必须为大于0的整数 */
pageSize?: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
/**
* 校区页面已发布版块列表获取接口
* /dcxy/app/homepage/campus/{campusId}/publishedSections/{customerId}
*/
export namespace publishedSections {
export class Params {
/** 校区ID,必须为大于0的整数 */
campusId: number;
/** 用户ID,必须为大于0的整数 */
customerId: number;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
}
/**
* 精图接口
*/
export namespace jt {
/**
* 精图订单同步接口
* /dcxy/app/jt/order/data
*/
export namespace synOrder {
export class Params {}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(
params: Params,
bodyParams: defs.JtSynchronOrderVo,
): Promise<defs.ServerResponse>;
}
/**
* 精图RSA密码同步接口
* /dcxy/app/jt/password/data
*/
export namespace synJtPwd {
export class Params {}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(
params: Params,
bodyParams: defs.JtSynchronPwdVo,
): Promise<defs.ServerResponse>;
}
/**
* 校区页面已发布版块列表获取接口
* /dcxy/app/jt/urlAdress/{customerId}
*/
export namespace urlAdress {
export class Params {
/** customerId必须为大于0的整数 */
customerId: string;
}
export type Response = defs.ServerResponse;
export const init: Response;
export function request(params: Params): Promise<defs.ServerResponse>;
}
}
}
......@@ -981,3 +981,47 @@ export class SingleOrderRspData {
/** settleTime */
settleTime = '';
}
export class BarrageEntity {
/** createdate */
createdate = '';
/** deletestate */
deletestate = '';
/** id */
id = undefined;
/** picurl */
picurl = '';
/** time */
time = undefined;
/** type */
type = '';
/** updatedate */
updatedate = '';
/** url */
url = '';
}
export class JtSynchronOrderVo {
/** 订单内容 */
orderContent = '';
/** 订单金额 */
orderMoney = undefined;
/** 订单编号 */
orderNum = '';
}
export class JtSynchronPwdVo {
/** 会员电话 */
cellphone = '';
/** 会员密码 */
password = '';
}
......@@ -3,18 +3,24 @@ import { LoginInfoVo } from './baseClass';
export class LoginParams {
/** 登陆标识 */
token?: string;
code?: string;
/** 账号 */
loginAccount?: string;
/** 密码 */
passWord?: string;
password?: string;
}
export const appLogin = (data: LoginParams) =>
customerFetch({
url: '/app/customer/login',
url: '/dcxy/wechat/applet/login/',
method: 'POST',
data: data,
});
export const appLogout = () =>
customerFetch({
url: '/app/customer/login/out',
});
export class PwdParams {
/** 账号 */
loginAccount: string;
......@@ -30,3 +36,13 @@ export const changePwdByCellphone = (data: PwdParams) =>
}`,
method: 'PUT',
});
type RegisiterPramas = {};
// type RegisiterReponseData = {};
export const wxUserRegister = (entity: RegisiterPramas) =>
customerFetch({
url: '/dcxy/wechat/applet/register/',
method: 'POST',
data: entity,
});
......@@ -4,6 +4,7 @@ import {
OLD_BASE_SERVER_URL,
BASE_SERVER_URL,
CUSTOMER_SERVER_URL,
SCHOOL_MAIN_URL,
} from '../constants/index';
export type ResponseDataEntity<T> = {
......@@ -45,5 +46,6 @@ const createFetch = (basePath: string) => {
export const oldBaseFetch = createFetch(OLD_BASE_SERVER_URL);
export const baseFetch = createFetch(BASE_SERVER_URL);
export const customerFetch = createFetch(CUSTOMER_SERVER_URL);
export const schoolMainFetch = createFetch(SCHOOL_MAIN_URL);
export default createFetch;
import { ConsumeOrderResponse } from './baseClass';
import { ConsumeOrderResponse, ConsumeOrder } from './baseClass';
import { customerFetch, ResponseDataEntity } from './index';
export class Params {
......@@ -20,7 +20,7 @@ export const fetchAllOrder = (params: Params) =>
export const fetchPayOrder = (
params: Params,
): Promise<ResponseDataEntity<ConsumeOrderResponse>> =>
): Promise<ResponseDataEntity<ConsumeOrder[]>> =>
customerFetch({
url: '/consumeOrder/pageList',
data: {
......@@ -37,3 +37,35 @@ export const fetchOrderDetail = (data: DetailParams) =>
url: '/consumeOrder/getDetail',
data: data,
});
export const fetchOrderDetailAndPay = (data: DetailParams) =>
customerFetch({
url: '/consumeOrder/getOrderDetailAndPay',
data: data,
});
type DeductionParams = {
orderId: number;
payType: string;
paymentConfId: number;
};
export const fetchDeductionInfo = (data: DeductionParams) =>
customerFetch({
url: '/consumeOrder/getDeductionInfo',
data: data,
});
type ConfirmpayParams = {
orderId: number;
payType: string;
activeId?: number;
callType: string;
paymentConfId: number;
returnUrl: string;
[propName: string]: any;
};
export const confirmPay = (data: ConfirmpayParams) =>
customerFetch({
url: '/consumeOrder/confirmPay',
data: data,
});
import { oldBaseFetch, baseFetch, ResponseDataEntity } from './index';
import { UserState } from '../store/rootReducers/userinfo';
type LoginPramas = {
code: string;
};
type LoginReponseData = {
registed: boolean;
token: string;
};
register: boolean;
wxToken: string;
} & UserState;
export interface LoginReponse extends ResponseDataEntity<LoginReponseData> {
data: LoginReponseData;
}
......@@ -46,7 +47,7 @@ type RegisiterPramas = {};
export const fetchWxUserRegister = (entity: RegisiterPramas) =>
baseFetch({
url: '/wx/api/user/regisiter2',
url: '/dcxy/wechat/applet/register/',
method: 'POST',
data: entity,
});
......@@ -4,3 +4,4 @@ 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';
......@@ -18,6 +18,8 @@ import './Home.scss';
import { connect } from '@tarojs/redux';
import { UserState } from '../../store/rootReducers/userinfo';
import { fetchBeanCount } from '../../api/bean';
import { fetchAnn, SectionItem } from '../../api/announcement';
import { appLogout } from '../../api/customer';
type PageStateProps = {
userinfo: UserState;
......@@ -25,6 +27,7 @@ type PageStateProps = {
type PageState = {
commBean: number;
hairDryerBean: number;
annItem: SectionItem;
};
interface Home {
......@@ -40,10 +43,25 @@ class Home extends Component {
this.state = {
commBean: 0.0,
hairDryerBean: 0.0,
annItem: {
id: 0,
styleType: '',
name: '',
titleTypeRemark: '',
titleType: '',
titleContent: '',
sort: 0,
updateTime: 0,
itemsCount: 0,
items: [],
},
};
}
componentWillMount() {
this.getInitData();
}
getInitData() {
const { userinfo } = this.props;
fetchBeanCount({
id: userinfo.customerId,
......@@ -63,6 +81,18 @@ class Home extends Component {
});
})
.catch(console.error);
fetchAnn({
campusId: userinfo.areaId,
customerId: userinfo.customerId,
})
.then(res => {
if (res) {
this.setState({
annItem: res,
});
}
})
.catch(console.error);
}
goSetting() {
......@@ -87,17 +117,26 @@ class Home extends Component {
url: '/pages/BarCode/BarCode',
});
}
logoutHandle() {
appLogout()
.then(() => {
Taro.redirectTo({
url: '/pages/index/index',
});
})
.catch(console.log);
}
render() {
const { userinfo } = this.props;
const { commBean, hairDryerBean } = this.state;
const { commBean, hairDryerBean, annItem } = this.state;
return (
<View className='Home'>
<View className='Home-UserBox'>
<Image
className='Home-UserBox-Setting'
src={SettingIcon}
onClick={this.goSetting}
onClick={this.logoutHandle}
/>
<Image className='bg' src={UserBoxBg} />
<View className='Home-UserBox-info'>
......@@ -107,9 +146,9 @@ class Home extends Component {
<View className='Home-UserBox-addr'>{userinfo.areaName}</View>
</View>
{userinfo.customerSex === '2' ? (
<Image className='Home-UserBox-headimg' src={UserHeaderM} />
) : (
<Image className='Home-UserBox-headimg' src={UserHeaderF} />
) : (
<Image className='Home-UserBox-headimg' src={UserHeaderM} />
)}
</View>
<View className='Home-UserBox-line' />
......@@ -140,20 +179,22 @@ class Home extends Component {
<Image className='Home-HairDryer-arrow' src={HairDryerArr} />
</View>
</View>
<View className='Home-Announcement'>
<Image className='bg' src={AnnouncementBg} />
<View className='Home-Announcement-title'>
<Text>最新公告</Text>
<View className='Home-Announcement-more' onClick={this.goAnn}>
更多
<Image className='more-icon' src={MoreIcon} />
{annItem.id ? (
<View className='Home-Announcement'>
<Image className='bg' src={AnnouncementBg} />
<View className='Home-Announcement-title'>
<Text>最新公告</Text>
<View className='Home-Announcement-more' onClick={this.goAnn}>
更多
<Image className='more-icon' src={MoreIcon} />
</View>
</View>
<View className='Home-Announcement-Content'>
<Text>元宵节感恩回馈</Text>
<Text className='ContentDate'>2019-02-22</Text>
</View>
</View>
<View className='Home-Announcement-Content'>
<Text>元宵节感恩回馈</Text>
<Text className='ContentDate'>2019-02-22</Text>
</View>
</View>
) : null}
</View>
);
}
......
......@@ -38,8 +38,8 @@ class Login extends Component {
constructor(props) {
super(props);
this.state = {
account: '',
pwd: '',
account: '15928189723',
pwd: '123456',
};
}
......@@ -68,7 +68,7 @@ class Login extends Component {
console.log('in loginHandle');
appLogin({
loginAccount: account,
passWord: pwd,
password: pwd,
})
.then(res => {
const data = res.data;
......
......@@ -7,42 +7,163 @@ 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 { PayType, getPayType } from '../../../utils/payType';
type pageProps = {};
type PageState = {
actualMoney: 0;
areaId: 0;
areaName: string;
consumeType: string;
createAt: string;
customerCellphone: string;
customerId: 0;
customerName: string;
deductionBean: 0;
deductionMoney: 0;
equipmentNum: string;
equipmentPosition: string;
id: 0;
operateId: 0;
operateName: string;
operationMode: string;
orderName: string;
orderNumber: string;
orderState: string;
outTradeNo: string;
payType: PayType;
payableMoney: 0;
serviceId: 0;
serviceName: string;
thirdDiscountMoney: 0;
thirdTradeNumber: string;
updateDate: string;
};
interface OrderDetail {
props: pageProps;
state: PageState;
}
class OrderDetail extends Component {
config: Config = {
navigationBarTitleText: '订单详情',
};
constructor(props) {
super(props);
this.state = {
actualMoney: 0,
areaId: 0,
areaName: '',
consumeType: '',
createAt: '',
customerCellphone: '',
customerId: 0,
customerName: '',
deductionBean: 0,
deductionMoney: 0,
equipmentNum: '',
equipmentPosition: '',
id: 0,
operateId: 0,
operateName: '',
operationMode: '',
orderName: '',
orderNumber: '',
orderState: '',
outTradeNo: '',
payType: '',
payableMoney: 0,
serviceId: 0,
serviceName: '',
thirdDiscountMoney: 0,
thirdTradeNumber: '',
updateDate: '',
};
}
componentWillMount() {
console.log('preload: ', this.$router.preload);
const data = this.$router.preload;
this.setState({
...data,
});
// this.getDetailInfo(id);
}
getDetailInfo(id: number) {
return fetchOrderDetailAndPay({
id: id,
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
}
render() {
const {
actualMoney,
payableMoney,
deductionBean,
payType,
createAt,
thirdTradeNumber,
serviceName,
orderNumber,
areaName,
equipmentNum,
equipmentPosition,
deductionMoney,
} = this.state;
const payTypeName = getPayType(payType);
return (
<View className='OrderDetail'>
<OrderTitle />
<OrderInfo />
<OrderTitle price={payableMoney} />
<OrderInfo
serviceName={serviceName}
createAt={createAt}
orderNumber={orderNumber}
areaName={areaName}
equipmentNum={equipmentNum}
equipmentPosition={equipmentPosition}
/>
<View className='OrderDetail-line' />
<View className='OrderDetail-payinfo'>
<Text>支付金额</Text>
<Text>0.08</Text>
</View>
<View className='OrderDetail-payinfo'>
<Text>通用豆抵扣</Text>
<Text>0.03</Text>
<Text>{actualMoney.toFixed(2)}</Text>
</View>
{deductionBean ? (
<View className='OrderDetail-payinfo'>
<Text>通用豆抵扣</Text>
<Text>{deductionBean.toFixed(2)}</Text>
</View>
) : null}
{deductionMoney ? (
<View className='OrderDetail-payinfo'>
<Text>艾米抵扣</Text>
<Text>{deductionMoney.toFixed(2)}</Text>
</View>
) : null}
<View className='OrderDetail-payinfo'>
<Text>支付方式</Text>
<Text>微信</Text>
<Text>{payTypeName}</Text>
</View>
<View className='OrderDetail-payinfo'>
<Text>支付时间</Text>
<Text>2018-12-05 </Text>
</View>
<View className='OrderDetail-payinfo'>
<Text>交易单号</Text>
<Text>1256456165158485146</Text>
<Text>{createAt}</Text>
</View>
{thirdTradeNumber ? (
<View className='OrderDetail-payinfo'>
<Text>交易单号</Text>
<Text>{thirdTradeNumber}</Text>
</View>
) : null}
</View>
);
}
}
export default OrderDetail as ComponentClass<pageProps>;
export default OrderDetail as ComponentClass<pageProps, PageState>;
......@@ -29,4 +29,28 @@
padding-top: 80px;
background-color: #eee;
}
.OrderList-Group {
margin-bottom: 22px;
.OrderList-GroupTitle {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 22px;
color: #666;
padding: 0 24px;
}
.OrderList-GroupName {
padding: 0 26px;
height: 44px;
line-height: 44px;
margin-bottom: 10px;
background-color: #fff;
border-radius: 8px;
font-size: 24px;
color: #333;
}
}
.OrderList-Group:first-child {
margin-top: 9px;
}
}
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Button, Text, ScrollView } from '@tarojs/components';
import { View, Text, ScrollView } from '@tarojs/components';
import { connect } from '@tarojs/redux';
import OrderItem from '../components/OrderItem/OrderItem';
import './OrderList.scss';
import { toggleOrderState } from './actions';
import {
toggleOrderState,
updatePayOrderList,
updateAllOrderList,
} from './actions';
import { StoreState } from './store';
import { fetchAllOrder, fetchPayOrder } from '../../../api/order';
import { UserState } from '../../../store/rootReducers/userinfo';
import { ConsumeOrder } from '../../../api/baseClass';
import Order, { AllOrderItem } from '../../../types/Order/Order';
type PageStateProps = {
orderList: StoreState;
......@@ -18,6 +24,8 @@ type PageStateProps = {
};
type PageDispatchProps = {
toggleOrderState: (state: String) => void;
updatePayOrder: (list: Order[]) => void;
updateAllOrder: (list: AllOrderItem[]) => void;
};
type PageOwnProps = {};
......@@ -37,6 +45,12 @@ interface OrderList {
toggleOrderState(state: String) {
dispatch(toggleOrderState(state));
},
updatePayOrder(data: Order[]) {
dispatch(updatePayOrderList(data));
},
updateAllOrder(data: AllOrderItem[]) {
dispatch(updateAllOrderList(data));
},
}),
)
class OrderList extends Component {
......@@ -52,7 +66,7 @@ class OrderList extends Component {
}
getPayOrderHandle(lastOrderId?: number) {
const { userinfo } = this.props;
const { userinfo, updatePayOrder } = this.props;
fetchPayOrder(
lastOrderId
? {
......@@ -67,23 +81,65 @@ class OrderList extends Component {
)
.then(res => {
console.log(res);
updatePayOrder(res.data);
})
.catch(console.error);
}
getAllOrderHandle() {}
getAllOrderHandle(lastOrderId?: number) {
const {
userinfo: { customerId },
updateAllOrder,
} = this.props;
fetchAllOrder(
lastOrderId
? {
customerId: customerId,
pageSize: 10,
lastOrderId,
}
: {
customerId: customerId,
pageSize: 10,
},
)
.then(res => {
console.log(res);
updateAllOrder(res.data);
})
.catch(console.error);
}
goPayPage(data) {
this.$preload(data);
this.$preload({ id: data.id });
Taro.navigateTo({
url: '/pages/Order/OrderPay/OrderPay',
});
}
goDetail(data) {
this.$preload(data);
Taro.navigateTo({
url: '/pages/Order/OrderDetail/OrderDetail',
});
}
render() {
toggleStateHandle(type: string) {
const {
orderList: { orderState },
toggleOrderState,
orderList: { payList, allList },
} = this.props;
if (type === '1' && payList.length === 0) {
this.getPayOrderHandle();
}
if (type === 'all' && allList.length === 0) {
this.getAllOrderHandle();
}
toggleOrderState(type);
}
render() {
const {
orderList: { orderState, payList, allList },
} = this.props;
return (
......@@ -91,12 +147,12 @@ class OrderList extends Component {
<View className='Tab'>
<Text
className={`Tab-item ${orderState === '1' ? 'active' : ''}`}
onClick={() => toggleOrderState('1')}>
onClick={() => this.toggleStateHandle('1')}>
待付款
</Text>
<Text
className={`Tab-item ${orderState === 'all' ? 'active' : ''}`}
onClick={() => toggleOrderState('all')}>
onClick={() => this.toggleStateHandle('all')}>
全部
</Text>
</View>
......@@ -105,42 +161,33 @@ class OrderList extends Component {
scrollY
scrollWithAnimation
scrollTop={0}>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>{' '}
<OrderItem
data={{ id: 1, orderState: 'all' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: 'all' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>{' '}
<OrderItem
data={{ id: 1, orderState: 'all' }}
onPayHandle={this.goPayPage}
/>
<OrderItem
data={{ id: 1, orderState: '1' }}
onPayHandle={this.goPayPage}
/>
{orderState === '1'
? payList.map(order => (
<OrderItem
key={order.id}
data={order}
onGoDetail={this.goDetail}
onPayHandle={this.goPayPage}
/>
))
: allList.map((allItem, index) => (
<View key={index} className='OrderList-Group'>
<View className='OrderList-GroupTitle'>
<View className='OrderList-GroupName'>
{allItem.groupName}
</View>
{index === 0 && <Text>只保留最近三个月消费订单数据</Text>}
</View>
{allItem.data.map(order => (
<OrderItem
key={order.id}
data={order}
onGoDetail={this.goDetail}
onPayHandle={this.goPayPage}
/>
))}
</View>
))}
</ScrollView>
</View>
);
......
import Actions from '../../../types/Store/Actions';
import Order, { AllOrderItem } from '../../../types/Order/Order';
export const TOGGLE_ORDER_STATE = 'TOGGLE_ORDER_STATE';
export const UPDATE_PAY_LIST = 'UPDATE_PAY_LIST';
export const UPDATE_ALL_LIST = 'UPDATE_ALL_LIST';
export const toggleOrderState = (state: String): Actions => ({
type: TOGGLE_ORDER_STATE,
payload: state,
});
export const updatePayOrderList = (state: Order[]): Actions => ({
type: UPDATE_PAY_LIST,
payload: state,
});
export const updateAllOrderList = (state: AllOrderItem[]): Actions => ({
type: UPDATE_ALL_LIST,
payload: state,
});
import Actions from '../../../types/Store/Actions';
import Order from '../../../types/Order/Order';
import { TOGGLE_ORDER_STATE } from './actions';
import {
TOGGLE_ORDER_STATE,
UPDATE_PAY_LIST,
UPDATE_ALL_LIST,
} from './actions';
export interface StoreState {
orderState: String;
......@@ -24,7 +28,16 @@ export default function OrderList(
...state,
orderState: actions.payload,
};
case UPDATE_PAY_LIST:
return {
...state,
payList: actions.payload,
};
case UPDATE_ALL_LIST:
return {
...state,
allList: actions.payload,
};
default:
return state;
}
......
......@@ -4,21 +4,73 @@ import { View, Text, Image, Button } from '@tarojs/components';
import OrderTitle from '../components/OrderTitle/OrderTitle';
import OrderInfo from '../components/OrderInfo/OrderInfo';
import payWayLogo from '../../../images/order/pay_wechat_icon@2x.png';
import { fetchOrderDetail } from '../../../api/order';
import payWayWxLogo from '../../../images/order/pay_wechat_icon@2x.png';
import payWayAimiLogo from '../../../images/order/pay_aimi_icon@2x.png';
import payWayHairLogo from '../../../images/order/pay_chuifengdou_icon@2x.png';
import payWayComLogo from '../../../images/order/pay_tongyongdou_icon@2x.png';
import {
fetchOrderDetail,
fetchOrderDetailAndPay,
fetchDeductionInfo,
confirmPay,
} from '../../../api/order';
import './OrderPay.scss';
import {
ConsumeOrder,
PaymentAndActiveVo,
CustomerBeanAccountVo,
PaymentAndActiveInfo,
ConsumeOrderDeductionInfoVo,
} from '../../../api/baseClass';
import { getPayType } from '../../../utils/payType';
import { connect } from '@tarojs/redux';
import { UserState } from 'src/store/rootReducers/userinfo';
import AES from 'crypto-js/aes';
import Utf8 from 'crypto-js/enc-utf8';
import ECBmode from 'crypto-js/mode-ecb';
import PaddingPkcs7 from 'crypto-js/pad-pkcs7';
type PageStateProps = {
userinfo: UserState;
};
type PageProps = {};
type PageState = {
prePay: boolean;
payWay: {
activeId: number | undefined;
amount: number | undefined;
avtiveComment: string;
deductionValue: number | undefined;
isDeduction: number | undefined;
payType: string;
payVersion: string;
};
accounts: CustomerBeanAccountVo[];
orderInfo: ConsumeOrder;
payInfos: {
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 {
props: PageProps;
props: PageProps & PageStateProps;
state: PageState;
}
@connect(({ userinfo }) => ({ userinfo }))
class OrderPay extends Component {
config: Config = {
navigationBarTitleText: '订单支付',
......@@ -27,50 +79,298 @@ class OrderPay extends Component {
super(props);
this.state = {
prePay: true,
payWay: {
activeId: undefined,
amount: undefined,
avtiveComment: '',
deductionValue: 0,
isDeduction: undefined,
payType: '',
payVersion: '',
},
accounts: [],
orderInfo: {
actualMoney: undefined,
areaId: undefined,
areaName: '',
consumeType: '',
createAt: '',
customerCellphone: '',
customerId: undefined,
customerName: '',
deductionBean: undefined,
deductionMoney: undefined,
equipmentNum: '',
equipmentPosition: '',
id: undefined,
operateId: undefined,
operateName: '',
operationMode: '',
orderName: '',
orderNumber: '',
orderState: '',
outTradeNo: '',
payType: '',
payableMoney: undefined,
serviceId: undefined,
serviceName: '',
thirdDiscountMoney: undefined,
thirdTradeNumber: '',
updateDate: '',
},
payInfos: {
paymentAndActiveInfos: [],
paymentConfId: 0,
},
deductionInfos: {
amiAccount: 0,
beanAccount: 0,
deductionMoney: 0,
deductionType: '',
orderMoney: 0,
payMoney: 0,
payType: '',
remainAccount: 0,
titlePerfix: '',
},
};
}
componentWillMount() {
console.log('preload: ', this.$router.preload);
// const { id } = this.$router.preload;
const data = this.$router.preload;
fetchOrderDetailAndPay({
id: data.id,
})
.then(res => {
const { accounts, orderInfo, payInfos } = res;
this.setState({
accounts: accounts,
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);
});
}
changePayState() {
const { payWay, orderInfo, payInfos } = this.state;
if (payWay) {
this.setState({
prePay: false,
});
} else {
Taro.showToast({
title: '请选择支付方式',
icon: 'none',
});
}
}
changePayWay(payWay: PaymentAndActiveInfo) {
this.setState({
prePay: false,
payWay: payWay,
});
}
callNativePay() {}
callNativePay() {
const {
userinfo: { customerId },
} = this.props;
const { orderInfo, payWay, payInfos } = this.state;
confirmPay({
orderId: orderInfo.id,
payType: payWay.payType,
[payWay.activeId ? 'activeId' : 'notUse']: payWay.activeId,
returnUrl: '',
callType: '1',
paymentConfId: payInfos.paymentConfId,
})
.then(res => {
console.log(res);
const { payStr } = res;
const key = customerId.toString().padEnd(16, '0');
console.log(key);
const payData = JSON.parse(
AES.decrypt(payStr, Utf8.parse(key), {
mode: ECBmode,
padding: PaddingPkcs7,
}).toString(Utf8),
);
console.log(payData);
Taro.requestPayment({
timeStamp: payData.msg.timestamp.toString(),
nonceStr: payData.msg.noncestr,
package: payData.msg.package,
signType: 'MD5',
paySign: payData.msg.sign,
success(res) {
console.log(res);
},
fail(res) {
Taro.showToast({
title: res.msg || '发起支付失败',
icon: 'none',
});
},
});
})
.catch(err => {
console.log(err);
Taro.showToast({
title: err.msg || '发起支付失败',
icon: 'none',
});
});
}
render() {
const { prePay } = this.state;
const {
prePay,
payWay,
orderInfo: {
payableMoney,
serviceName,
createAt,
orderNumber,
areaName,
equipmentNum,
equipmentPosition,
},
payInfos: { paymentAndActiveInfos },
deductionInfos: {
payMoney,
deductionType,
titlePerfix,
deductionMoney,
beanAccount,
amiAccount,
},
} = this.state;
const payInfoList = paymentAndActiveInfos.filter(
item =>
item.payType === '2' ||
item.payType === '6' ||
item.payType === '7' ||
item.payType === '8',
);
const payInfo = prePay
? {}
: payInfoList.find(item => item.payType === payWay.payType);
return (
<View className='OrderPay topBr'>
<OrderTitle />
<OrderInfo />
<OrderTitle price={payableMoney} />
<OrderInfo
serviceName={serviceName}
createAt={createAt}
orderNumber={orderNumber}
areaName={areaName}
equipmentNum={equipmentNum}
equipmentPosition={equipmentPosition}
/>
<View className='OrderPay-line' />
{prePay ? (
<View className='OrderPay-payway'>
<Image className='OrderPay-icon' src={payWayLogo} />
<Text className='OrderPay-text'>微信支付</Text>
<View className='OrderPay-check checked' />
</View>
payInfoList.length ? (
payInfoList.map((payway, index) => (
<View
key={index}
className='OrderPay-payway'
onClick={() => this.changePayWay(payway)}>
{payway.payType === '2' ? (
<Image className='OrderPay-icon' src={payWayWxLogo} />
) : payway.payType === '6' ? (
<Image className='OrderPay-icon' src={payWayAimiLogo} />
) : payway.payType === '7' ? (
<Image className='OrderPay-icon' src={payWayHairLogo} />
) : payway.payType === '8' ? (
<Image className='OrderPay-icon' src={payWayComLogo} />
) : null}
{payway.payType === '2' ? (
<Text className='OrderPay-text'>
{getPayType(payway.payType)}
</Text>
) : payway.payType === '6' ? (
<Text className='OrderPay-text'>
{getPayType(payway.payType)}(余额:{amiAccount.toFixed(2)})
</Text>
) : (
<Text className='OrderPay-text'>
{getPayType(payway.payType)}(余额:
{beanAccount ? beanAccount.toFixed(2) : '0.00'})
</Text>
)}
<View
className={`OrderPay-check ${
payWay.payType === payway.payType ? 'checked' : ''
}`}
/>
</View>
))
) : null
) : (
<View>
<View className='OrderPay-payinfo'>
<Text>订单金额</Text>
<Text>0.12</Text>
</View>
<View className='OrderPay-payinfo'>
<Text>吹风豆抵扣金额(余额:8.00)</Text>
<Text>0.12</Text>
</View>
<View className='OrderPay-DeductionInfo'>
豆抵扣总消费额的20%,不满0.01元,累计算1分
<Text>{payMoney}</Text>
</View>
{deductionType === '1' ? (
<View>
<View className='OrderPay-payinfo'>
<Text>
{titlePerfix}豆抵扣金额(余额:{beanAccount.toFixed(2)}
</Text>
<Text>{deductionMoney.toFixed(2)}</Text>
</View>
<View className='OrderPay-DeductionInfo'>
豆抵扣总消费额的
{payWay.deductionValue ? payWay.deductionValue * 100 : 0}
%,不满0.01元,累计算1分
</View>
</View>
) : deductionType === '2' ? (
<View>
<View className='OrderPay-payinfo'>
<Text>通用豆抵扣金额(余额:{beanAccount.toFixed(2)}</Text>
<Text>{deductionMoney.toFixed(2)}</Text>
</View>
<View className='OrderPay-DeductionInfo'>
豆抵扣总消费额的
{payWay.deductionValue ? payWay.deductionValue * 100 : 0}
%,不满0.01元,累计算1分
</View>
</View>
) : deductionType === '3' ? (
<View className='OrderPay-payinfo'>
<Text>艾米抵扣金额(余额:{amiAccount.toFixed(2)}</Text>
<Text>{deductionMoney.toFixed(2)}</Text>
</View>
) : null}
<View className='OrderPay-payinfo'>
<Text>微信支付金额</Text>
<Text>0.09</Text>
<Text>{payInfo.payTypeName}金额</Text>
<Text>{payMoney}</Text>
</View>
</View>
)}
......
......@@ -4,37 +4,57 @@ import { View, Text } from '@tarojs/components';
import './OrderInfo.scss';
type PageProps = {
serviceName: string;
createAt: string;
orderNumber: string;
areaName: string;
equipmentNum: string;
equipmentPosition: string;
};
interface OrderInfo {
props: PageProps;
}
class OrderInfo extends Component {
render() {
const {
serviceName,
createAt,
orderNumber,
areaName,
equipmentNum,
equipmentPosition,
} = this.props;
return (
<View>
<View className='OrderDetail-info'>
<Text>商品说明</Text>
<Text>吹风消费</Text>
<Text>{serviceName ? serviceName : ''}</Text>
</View>
<View className='OrderDetail-info'>
<Text>消费时间</Text>
<Text>2018-12-05 23:59:59</Text>
<Text>{createAt}</Text>
</View>
<View className='OrderDetail-info'>
<Text>订单号</Text>
<Text>gfj23oi234kjf34ihruih</Text>
<Text>{orderNumber}</Text>
</View>
<View className='OrderDetail-info'>
<Text>所属区域</Text>
<Text>成都师范学院</Text>
<Text>{areaName}</Text>
</View>
<View className='OrderDetail-info'>
<Text>设备编号</Text>
<Text>SN10000089078</Text>
<Text>{equipmentNum}</Text>
</View>
<View className='OrderDetail-info'>
<Text>设备位置</Text>
<Text>天信元A幢1栋2302门口</Text>
<Text>{equipmentPosition ? equipmentPosition : ''}</Text>
</View>
</View>
);
}
}
export default OrderInfo as ComponentClass;
export default OrderInfo as ComponentClass<PageProps>;
......@@ -3,15 +3,12 @@ import Taro, { Component } from '@tarojs/taro';
import { View, Text, Image } from '@tarojs/components';
import payDoneImg from '../../../../images/order/dingdan_yiwancheng_img@2x.png';
import './OrderItem.scss';
type OrderItemProps = {
id: number;
orderState: string;
};
import Order from '../../../../types/Order/Order';
type PageOwnProps = {
data: OrderItemProps;
onPayHandle: (data: OrderItemProps) => void;
data: Order;
onPayHandle: (data: Order) => void;
onGoDetail: (data: Order) => void;
};
type PageState = {};
......@@ -24,29 +21,60 @@ class OrderItem extends Component {
static defaultProps = {
data: {
id: 0,
orderNumber: '',
orderName: '',
customerId: 0,
customerName: '',
customerCellphone: '',
serviceId: 0,
serviceName: '',
areaId: 0,
areaName: '',
operateId: 0,
operateName: '',
equipmentNum: '',
equipmentPosition: '',
orderState: '1',
payableMoney: 0,
actualMoney: 0,
thirdDiscountMoney: 0,
deductionBean: 0,
deductionMoney: 0,
payType: '',
consumeType: '',
operationMode: '1',
thirdTradeNumber: '',
outTradeNo: '',
createAt: '',
updateDate: '',
},
};
clickHandle() {
payHandle() {
const { onPayHandle, data } = this.props;
onPayHandle(data);
}
detailHandle() {
const { onGoDetail, data } = this.props;
if (data.orderState === '1') return;
onGoDetail(data);
}
render() {
const {
data: { orderState },
data: { orderState, createAt, serviceName, payableMoney },
} = this.props;
return (
<View className='OrderItem'>
<View className='OrderItem' onClick={this.detailHandle}>
<View className='OrderItem-text'>
<Text>消费说明:</Text>
<Text>饮水消费</Text>
<Text>{serviceName ? serviceName : ''}</Text>
</View>
<View className='OrderItem-text'>
<Text>消费时间:</Text>
<Text>2018-12-01 17:30:23</Text>
<Text>{createAt}</Text>
{orderState === '1' ? (
<View className='OrderItem-toPay' onClick={this.clickHandle}>
<View className='OrderItem-toPay' onClick={this.payHandle}>
去支付 >
</View>
) : (
......@@ -55,7 +83,7 @@ class OrderItem extends Component {
</View>
<View
className={`OrderItem-price ${orderState === '1' ? 'topay' : ''}`}>
0.12
{payableMoney}
</View>
</View>
);
......
......@@ -5,17 +5,23 @@ import { View, Text, Image } from '@tarojs/components';
import comLogo from '../../../../images/order/pay_logo_icon@2x.png';
import './OrderTitle.scss';
type PageProps = {};
type PageProps = {
price: number;
};
interface OrderTitle {
props: PageProps;
}
class OrderTitle extends Component {
render() {
const { price } = this.props;
return (
<View className='OrderTitle'>
<View className='OrderTitle-name'>
<Image className='OrderTitle-icon' src={comLogo} />
<Text>成都多彩任意门科技有限公司</Text>
</View>
<View className='OrderTitle-price'>-0.12</View>
<View className='OrderTitle-price'>-{price}</View>
</View>
);
}
......
......@@ -15,14 +15,15 @@ import './Register.scss';
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 } from '../../store/rootReducers/userinfo';
import { UserState, updateUserInfo } from '../../store/rootReducers/userinfo';
import { getVcode, fetchWxUserRegister } from '../../api/wx';
import { wxUserRegister } from '../../api/customer';
type PageStateProps = {
userinfo: UserState;
};
type PageDispatchProps = {
// updateUserInfo: (e: User) => void;
updateUserInfo: (e: UserState) => void;
};
type PageState = {
......@@ -43,9 +44,16 @@ interface Register {
state: PageState;
}
@connect(({ userinfo }) => ({
userinfo,
}))
@connect(
({ userinfo }) => ({
userinfo,
}),
dispatch => ({
updateUserInfo(entity: UserState) {
dispatch(updateUserInfo(entity));
},
}),
)
class Register extends Component {
config: Config = {
navigationBarTitleText: '注册',
......@@ -59,7 +67,7 @@ class Register extends Component {
vcode: '',
pwd: '123456',
checkPwd: '123456',
sex: 'Male',
sex: '1',
agree: false,
showPwd: false,
showCheckPwd: false,
......@@ -98,7 +106,7 @@ class Register extends Component {
validateRegisterEntity(): boolean {
const { name, cellphone, pwd, checkPwd } = this.state;
const {
userinfo: { campusId },
userinfo: { areaId },
} = this.props;
if (!name) {
Taro.showToast({
......@@ -135,7 +143,7 @@ class Register extends Component {
});
return false;
}
if (!campusId) {
if (!areaId) {
Taro.showToast({
title: '请选择所属校区',
icon: 'none',
......@@ -147,18 +155,35 @@ class Register extends Component {
getRegister() {
if (this.validateRegisterEntity()) {
const { name, cellphone, pwd, sex } = this.state;
const { name, cellphone, pwd, sex, vcode } = this.state;
const {
userinfo: { campusId, schoolId },
userinfo: { areaId, areaName },
} = this.props;
fetchWxUserRegister({
cellphone,
campusId,
name,
pwd,
schoolId,
sex,
});
wxUserRegister({
areaId: areaId,
areaName: areaName,
customerName: name,
customerPhone: cellphone,
customerSex: sex,
password: pwd,
verificationCode: vcode,
})
.then(res => {
const { register, wxToken, ...userInfo } = res.data;
updateUserInfo({
...userInfo,
token: wxToken,
});
Taro.showToast({
title: '注册成功',
});
setTimeout(() => {
Taro.redirectTo({
url: '/pages/Home/Home',
});
}, 2000);
})
.catch(console.log);
}
}
......@@ -221,18 +246,16 @@ class Register extends Component {
maxLength={20}
/>
<View className='loginBox-input sexBox'>
<View
className='sexBox-item'
onClick={() => this.setSex('Female')}>
{sex === 'Female' ? (
<View className='sexBox-item' onClick={() => this.setSex('2')}>
{sex === '2' ? (
<Image className='sexBox-icon' src={radioCheckIcon} />
) : (
<Image className='sexBox-icon' src={radioIcon} />
)}
<Text></Text>
</View>
<View className='sexBox-item' onClick={() => this.setSex('Male')}>
{sex === 'Male' ? (
<View className='sexBox-item' onClick={() => this.setSex('1')}>
{sex === '1' ? (
<Image className='sexBox-icon' src={radioCheckIcon} />
) : (
<Image className='sexBox-icon' src={radioIcon} />
......@@ -264,6 +287,12 @@ class Register extends Component {
placeholder='请输入验证码'
maxLength={6}
value={vcode}
onInput={({ detail: { value } }) => {
this.setState({
vcode: value,
});
return value;
}}
/>
<Vcode
vcode-classname='registerBox-getVcode'
......@@ -322,8 +351,8 @@ class Register extends Component {
<Text className='registerBox-text'>区域信息</Text>
</View>
<View className='registerBox-item' onClick={this.navToCampus}>
{userinfo.campusId ? (
<Text>{userinfo.campusName}</Text>
{userinfo.areaId ? (
<Text>{userinfo.areaName}</Text>
) : (
<Text className='noVlaue'>请填写真实区域信息</Text>
)}
......
......@@ -3,18 +3,21 @@ import Taro, { Component, Config } from '@tarojs/taro';
import { View } from '@tarojs/components';
import './index.scss';
import { login, LoginReponse } from '../../api/wx';
import { LoginReponse, login } from '../../api/wx';
import { connect } from '@tarojs/redux';
import { updateUserInfo, UserState } from '../../store/rootReducers/userinfo';
import { appLogin } from '../../api/customer';
type PageDispatchProps = {
updateUserInfo: (e: UserState) => void;
updateUserInfo: (e: UserState | { token: string }) => void;
};
type PageOwnProps = {};
type PageState = {};
type PageState = {
errorText: string;
};
type IProps = PageDispatchProps & PageOwnProps;
......@@ -36,11 +39,14 @@ class Index extends Component {
constructor(props: IProps) {
super(props);
this.state = {
errorText: '',
};
}
componentWillMount() {
Taro.showLoading();
this.checkUser();
this.loginHandle();
}
checkUser() {
......@@ -49,7 +55,6 @@ class Index extends Component {
})
.then(res => {
const data = res.data;
const userInfo = Taro.getStorageSync('userInfo');
console.log('token ' + data);
})
.catch(() => {
......@@ -62,20 +67,24 @@ class Index extends Component {
Taro.login()
.then(res => {
console.log(res);
login({
appLogin({
code: res.code,
})
.then((res: LoginReponse) => {
const { registed, token } = res.data;
if (registed) {
Taro.setStorage({ key: 'token', data: token });
Taro.setStorage({ key: 'userInfo', data: token });
const { register, wxToken, ...userInfo } = res.data;
console.log(wxToken);
if (register) {
updateUserInfo({
...userInfo,
token: wxToken,
});
Taro.redirectTo({
url: '/pages/Home/Home',
});
} else {
updateUserInfo({
token: token,
token: wxToken,
});
Taro.hideLoading();
Taro.redirectTo({
......@@ -85,6 +94,9 @@ class Index extends Component {
})
.catch(err => {
console.log(err);
this.setState({
errorText: err.msg,
});
});
})
.catch(err => {
......@@ -93,7 +105,8 @@ class Index extends Component {
}
render() {
return <View className='Index' />;
const { errorText } = this.state;
return <View className='Index'>{errorText}</View>;
}
}
......
......@@ -2,13 +2,13 @@ import Action from '../../types/Store/Actions';
export class UserState {
login?: boolean;
areaId?: number;
areaId: number;
areaName?: string;
birthDay?: string;
createAt?: string;
createLoginDate?: string;
customerHead?: string;
customerId?: number;
customerId: number;
customerName?: string;
customerPhone?: string;
customerSex?: string;
......@@ -19,7 +19,7 @@ export class UserState {
hardwarePwd?: string;
hardwareState?: string;
hardwarelastDate?: string;
idBar?: string;
idBar: string;
idCard?: string;
isFirstRecharge?: number;
lastLoginDate?: string;
......
type Order = {
actualMoney: Number;
areaId: Number;
areaName: String;
consumeType: String;
createAt: String;
customerCellphone: String;
customerId: Number;
customerName: String;
deductionBean: Number;
deductionMoney: Number;
equipmentNum: String;
equipmentPosition: String;
id: Number;
operateId: Number;
operateName: String;
operationMode: String;
orderNumber: String;
orderState: String;
outTradeNo: String;
payType: String;
payableMoney: Number;
serviceId: Number;
serviceName: String;
thirdDiscountMoney: Number;
thirdTradeNumber: String;
updateDate: String;
actualMoney: number;
areaId: number;
areaName: string;
consumeType: string;
createAt: string;
customerCellphone: string;
customerId: number;
customerName: string;
deductionBean: number;
deductionMoney: number;
equipmentNum: string;
equipmentPosition: string;
id: number;
operateId: number;
operateName: string;
operationMode: string;
orderNumber: string;
orderState: string;
outTradeNo: string;
payType: string;
payableMoney: number;
serviceId: number;
serviceName: string;
thirdDiscountMoney: number;
thirdTradeNumber: string;
updateDate: string;
};
export type AllOrderItem = {
groupName: string;
data: Order[];
};
export default Order;
/**
* 1:线下支付 2:微信支付 3 :支付宝支付 4:京东支付 5:招行一网通支付 6:艾米币 7:专用豆 8通用豆
*/
export type PayType = '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
const payTypeList = [
{ value: '1', name: '线下支付' },
{ value: '2', name: '微信支付' },
{ value: '3', name: '支付宝支付' },
{ value: '4', name: '京东支付' },
{ value: '5', name: '招行一网通支付' },
{ value: '6', name: '艾米币' },
{ value: '7', name: '专用豆' },
{ value: '8', name: '通用豆' },
{ value: '9', name: '系统计扣' },
];
export const getPayType = (type: string) => {
let item = payTypeList.find(item => item.value === type);
return item ? item.name : '';
};
......@@ -2044,6 +2044,10 @@ crypto-browserify@^3.11.0:
randombytes "^2.0.0"
randomfill "^1.0.3"
crypto-js@^3.1.9-1:
version "3.1.9-1"
resolved "http://registry.npm.taobao.org/crypto-js/download/crypto-js-3.1.9-1.tgz#fda19e761fc077e01ffbfdc6e9fdfc59e8806cd8"
crypto-random-string@^1.0.0:
version "1.0.0"
resolved "http://registry.npm.taobao.org/crypto-random-string/download/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e"
......@@ -2179,7 +2183,7 @@ debug@^3.1.0, debug@^3.2.5, debug@^3.2.6:
dependencies:
ms "^2.1.1"
debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "http://registry.npm.taobao.org/debuglog/download/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
......@@ -3555,7 +3559,7 @@ import-local@^2.0.0:
pkg-dir "^3.0.0"
resolve-cwd "^2.0.0"
imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
......@@ -4131,7 +4135,7 @@ libnpm@^2.0.1:
read-package-json "^2.0.13"
stringify-package "^1.0.0"
libnpmaccess@*, libnpmaccess@^3.0.1:
libnpmaccess@^3.0.1:
version "3.0.1"
resolved "http://registry.npm.taobao.org/libnpmaccess/download/libnpmaccess-3.0.1.tgz#5b3a9de621f293d425191aa2e779102f84167fa8"
dependencies:
......@@ -4157,7 +4161,7 @@ libnpmhook@^5.0.2:
get-stream "^4.0.0"
npm-registry-fetch "^3.8.0"
libnpmorg@*, libnpmorg@^1.0.0:
libnpmorg@^1.0.0:
version "1.0.0"
resolved "http://registry.npm.taobao.org/libnpmorg/download/libnpmorg-1.0.0.tgz#979b868c48ba28c5820e3bb9d9e73c883c16a232"
dependencies:
......@@ -4180,7 +4184,7 @@ libnpmpublish@^1.1.0:
semver "^5.5.1"
ssri "^6.0.1"
libnpmsearch@*, libnpmsearch@^2.0.0:
libnpmsearch@^2.0.0:
version "2.0.0"
resolved "http://registry.npm.taobao.org/libnpmsearch/download/libnpmsearch-2.0.0.tgz#de05af47ada81554a5f64276a69599070d4a5685"
dependencies:
......@@ -4188,7 +4192,7 @@ libnpmsearch@*, libnpmsearch@^2.0.0:
get-stream "^4.0.0"
npm-registry-fetch "^3.8.0"
libnpmteam@*, libnpmteam@^1.0.1:
libnpmteam@^1.0.1:
version "1.0.1"
resolved "http://registry.npm.taobao.org/libnpmteam/download/libnpmteam-1.0.1.tgz#ff704b1b6c06ea674b3b1101ac3e305f5114f213"
dependencies:
......@@ -4288,10 +4292,6 @@ lodash._basecopy@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36"
lodash._baseindexof@*:
version "3.1.0"
resolved "http://registry.npm.taobao.org/lodash._baseindexof/download/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "http://registry.npm.taobao.org/lodash._baseuniq/download/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
......@@ -4299,14 +4299,10 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"
lodash._bindcallback@*, lodash._bindcallback@^3.0.0:
lodash._bindcallback@^3.0.0:
version "3.0.1"
resolved "http://registry.npm.taobao.org/lodash._bindcallback/download/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
lodash._cacheindexof@*:
version "3.0.2"
resolved "http://registry.npm.taobao.org/lodash._cacheindexof/download/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
lodash._createassigner@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11"
......@@ -4315,17 +4311,11 @@ lodash._createassigner@^3.0.0:
lodash._isiterateecall "^3.0.0"
lodash.restparam "^3.0.0"
lodash._createcache@*:
version "3.1.2"
resolved "http://registry.npm.taobao.org/lodash._createcache/download/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
dependencies:
lodash._getnative "^3.0.0"
lodash._createset@~4.0.0:
version "4.0.3"
resolved "http://registry.npm.taobao.org/lodash._createset/download/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
lodash._getnative@*, lodash._getnative@^3.0.0:
lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
......@@ -4388,7 +4378,7 @@ lodash.mergewith@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
lodash.restparam@*, lodash.restparam@^3.0.0:
lodash.restparam@^3.0.0:
version "3.6.1"
resolved "http://registry.npm.taobao.org/lodash.restparam/download/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
......@@ -5045,7 +5035,7 @@ npm-pick-manifest@^2.2.3:
npm-package-arg "^6.0.0"
semver "^5.4.1"
npm-profile@*, npm-profile@^4.0.1:
npm-profile@^4.0.1:
version "4.0.1"
resolved "http://registry.npm.taobao.org/npm-profile/download/npm-profile-4.0.1.tgz#d350f7a5e6b60691c7168fbb8392c3603583f5aa"
dependencies:
......@@ -6047,7 +6037,7 @@ readable-stream@~1.1.10:
isarray "0.0.1"
string_decoder "~0.10.x"
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
readdir-scoped-modules@^1.0.0:
version "1.0.2"
resolved "http://registry.npm.taobao.org/readdir-scoped-modules/download/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
dependencies:
......
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