Commit 5c6fedd7 by 姜雷

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

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