Commit 5c6fedd7 by 姜雷

处理日期格式和豆余额显示

parent f1f712a6
import { CustomerBeanAccountVo, AccountParams } from './baseClass';
import { CustomerBeanAccountVo } from './baseClass';
import { customerFetch, ResponseDataEntity } from '.';
type Params = {
areaId: number;
/** 会员电话 */
customerPhone: string;
/** 会员id */
id: number;
/** 服务id */
serviceIdList: string[];
};
export const fetchBeanCount = (
data: AccountParams,
data: Params,
): Promise<ResponseDataEntity<CustomerBeanAccountVo[]>> =>
customerFetch({
url: '/customerAccount/queryAccount',
......
export const APP_ID = 'wxf5912b79bba23663';
export const BASE_SERVER_URL = 'https://ex-test-dcxy-base-app.168cad.top';
export const BASE_SERVER_URL = 'https://ex-dev-dcxy-base-app.168cad.top';
export const CUSTOMER_SERVER_URL =
'https://ex-test-dcxy-customer-app.168cad.top';
'https://ex-dev-dcxy-customer-app.168cad.top';
export const SCHOOL_MAIN_URL =
'https://internal-test-school-home-bg.168cad.top';
export const ANN_LINK_URL = 'https://ex-test-wx.168cad.top/announcement/';
'https://internal-dev-school-main.168cad.top';
export const ANN_LINK_URL = 'https://ex-dev-wx.168cad.top/announcement/';
......@@ -7,13 +7,9 @@ import RefreshIcon from '../../images/barcode/icon_shuaxin@2x.png';
import wxbarcode from 'wxbarcode';
import './BarCode.scss';
import { UserState } from '../../store/rootReducers/userinfo';
import { UserState, updateUserInfo } from '../../store/rootReducers/userinfo';
import { connect } from '@tarojs/redux';
import {
fetchPayOrder,
fetchOrderDetailAndPay,
fetchDeductionInfo,
} from '../../api/order';
import { fetchPayOrder, fetchOrderDetailAndPay } from '../../api/order';
import OrderInfo from '../Order/components/OrderInfo/OrderInfo';
import OrderTitle from '../Order/components/OrderTitle/OrderTitle';
import OrderPayway from '../Order/components/OrderPayway/OrderPayway';
......@@ -22,10 +18,15 @@ import {
PaymentAndActiveInfo,
CustomerBeanAccountVo,
} from '../../api/baseClass';
import { Customer } from '../../types/Customer/Customer';
type PageStateProps = {
userinfo: UserState;
userinfo: Customer;
};
type PageDispatchProps = {
updateUserInfo: (e: UserState) => void;
};
type PageOwnProps = {};
type PageState = {
showPayOrder: boolean;
......@@ -49,15 +50,22 @@ type PageState = {
};
};
type IProps = PageStateProps & PageOwnProps;
type IProps = PageStateProps & PageOwnProps & PageDispatchProps;
interface BarCode {
props: IProps;
state: PageState;
}
@connect(({ userinfo }) => ({
userinfo,
}))
@connect(
({ userinfo }) => ({
userinfo,
}),
dispatch => ({
updateUserInfo(entity: UserState) {
dispatch(updateUserInfo(entity));
},
}),
)
class BarCode extends Component {
constructor(props: PageOwnProps) {
super(props);
......@@ -177,6 +185,13 @@ class BarCode extends Component {
showBig: !showBig,
});
}
refreshCodeBar() {
const { updateUserInfo } = this.props;
updateUserInfo({
idBar: '',
});
this.drawBarCode(false);
}
render() {
const { userinfo } = this.props;
......@@ -207,7 +222,11 @@ class BarCode extends Component {
<Image className='bg' src={BarCodeBoxBg} />
)}
{!showBig && (
<Image className='BarCodeBox-refresh' src={RefreshIcon} />
<Image
className='BarCodeBox-refresh'
src={RefreshIcon}
onClick={this.refreshCodeBar}
/>
)}
<View className={`BarCodeImg ${showBig ? 'BarCodeImgBig' : ''}`}>
{showPayOrder ? null : (
......
......@@ -90,7 +90,7 @@ class Home extends Component {
.then(res => {
const data = res.data;
let commBeanItem = data.find(item => item.serviceId === '1');
let hairDryerBeanItem = data.find(item => item.serviceId === '1');
let hairDryerBeanItem = data.find(item => item.serviceId === '4');
let commBean = commBeanItem ? commBeanItem.money : 0.0;
let hairDryerBean = hairDryerBeanItem ? hairDryerBeanItem.money : 0.0;
this.setState({
......
......@@ -4,7 +4,7 @@ import { View } from '@tarojs/components';
import OrderTitle from '../components/OrderTitle/OrderTitle';
import OrderInfo from '../components/OrderInfo/OrderInfo';
import { fetchOrderDetailAndPay, fetchDeductionInfo } from '../../../api/order';
import { fetchOrderDetailAndPay } from '../../../api/order';
import './OrderPay.scss';
import {
......@@ -13,7 +13,7 @@ import {
PaymentAndActiveInfo,
} from '../../../api/baseClass';
import { connect } from '@tarojs/redux';
import { UserState } from 'src/store/rootReducers/userinfo';
import { UserState } from '../../../store/rootReducers/userinfo';
import OrderPayway from '../components/OrderPayway/OrderPayway';
type PageStateProps = {
......@@ -116,7 +116,9 @@ class OrderPay extends Component {
const { orderInfo, payInfos, accounts } = this.state;
return (
<View className='OrderPay topBr'>
<OrderTitle price={orderInfo.payableMoney} />
<OrderTitle
price={orderInfo.payableMoney ? orderInfo.payableMoney : 0}
/>
<OrderInfo orderInfo={orderInfo} />
<View className='OrderPay-line' />
<OrderPayway
......
......@@ -11,14 +11,23 @@ import radioIcon from '../../images/login/pc_nor_icon@2x.png';
import radioCheckIcon from '../../images/login/pc_sel_icon@2x.png';
import './UserSetting.scss';
import { connect } from '@tarojs/redux';
import { UserState, updateUserInfo } from '../../store/rootReducers/userinfo';
import { updateUserInfo } from '../../store/rootReducers/userinfo';
import { perfectionUserInfo } from '../../api/customer';
import { Customer } from '../../types/Customer/Customer';
type UpdateParams = {
customerId: number;
customerName: string;
customerSex: string;
birthDay: string;
studentNo: string;
entranceDate: string;
};
type PageStateProps = {
userinfo: UserState;
userinfo: Customer;
};
type PageDispatchProps = {
updateUserInfo: (e: UserState) => void;
updateUserInfo: (e: UpdateParams) => void;
};
type PageOwnProps = {};
type PageState = {
......@@ -40,7 +49,7 @@ interface UserSetting {
userinfo,
}),
dispatch => ({
updateUserInfo(entity: UserState) {
updateUserInfo(entity: UpdateParams) {
dispatch(updateUserInfo(entity));
},
}),
......@@ -63,12 +72,12 @@ class UserSetting extends Component {
},
} = props;
this.state = {
birthDay: birthDay,
customerHead: customerHead,
customerName: customerName,
customerSex: customerSex,
entranceDate: entranceDate,
studentNo: studentNo,
birthDay: birthDay ? birthDay.split(' ')[0] : '',
customerHead: customerHead ? customerHead : '',
customerName: customerName ? customerName : '',
customerSex: customerSex ? customerSex : '',
entranceDate: entranceDate ? entranceDate.split(' ')[0] : '',
studentNo: studentNo ? studentNo : '',
};
}
......
import Action from '../../types/Store/Actions';
export class UserState {
export type 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;
......@@ -33,17 +33,17 @@ export class UserState {
updateAt?: string;
updateLoginDate?: string;
version?: string;
}
};
export const INITIAL_STATE = {
login: false,
areaId: undefined,
areaId: 0,
areaName: '',
birthDay: '',
createAt: '',
createLoginDate: '',
customerHead: '',
customerId: undefined,
customerId: 0,
customerName: '',
customerPhone: '',
customerSex: '',
......@@ -56,7 +56,7 @@ export const INITIAL_STATE = {
hardwarelastDate: '',
idBar: '',
idCard: '',
isFirstRecharge: undefined,
isFirstRecharge: 0,
lastLoginDate: '',
loginAccount: '',
loginPwd: '',
......
export type Customer = {
areaId: number;
areaName: string;
birthDay: string;
createAt: string;
createLoginDate: string;
customerHead: string;
customerId: number;
customerName: string;
customerPhone: string;
customerSex: string;
customerType: string;
email: string;
entranceDate: string;
hardwareAccount: string;
hardwarePwd: string;
hardwareState: string;
hardwarelastDate: string;
idBar: string;
idCard: string;
isFirstRecharge: number;
lastLoginDate: string;
loginAccount: string;
loginPwd: string;
loginPwdSalt: string;
loginState: string;
state: string;
studentNo: string;
token: string;
updateAt: string;
updateLoginDate: string;
version: string;
wxToken: string;
};
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