Commit 97a06a3d by 姜雷

修改部分样式以及类型问题

parent c4d9eb65
...@@ -8,3 +8,7 @@ declare module '*.less'; ...@@ -8,3 +8,7 @@ declare module '*.less';
declare module '*.scss'; declare module '*.scss';
declare module '*.sass'; declare module '*.sass';
declare module '*.styl'; declare module '*.styl';
interface Window {
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (option) => any;
}
...@@ -76,7 +76,7 @@ class Vcode extends Component { ...@@ -76,7 +76,7 @@ class Vcode extends Component {
} }
} }
closeImageBox() { closeImageBox() {
const ctx = Taro.createCanvasContext('Vcode', this); const ctx = Taro.createCanvasContext('Vcode', this.$scope);
ctx.setFillStyle('#6180f4'); ctx.setFillStyle('#6180f4');
ctx.fillRect(0, 0, 73, 38); ctx.fillRect(0, 0, 73, 38);
ctx.draw(); ctx.draw();
...@@ -86,7 +86,7 @@ class Vcode extends Component { ...@@ -86,7 +86,7 @@ class Vcode extends Component {
} }
renderImg(vcode: number) { renderImg(vcode: number) {
const ctx = Taro.createCanvasContext('Vcode', this); const ctx = Taro.createCanvasContext('Vcode', this.$scope);
ctx.setFillStyle('#6180f4'); ctx.setFillStyle('#6180f4');
ctx.fillRect(0, 0, 73, 38); ctx.fillRect(0, 0, 73, 38);
ctx.font = '26px arial'; ctx.font = '26px arial';
......
...@@ -14,12 +14,12 @@ import OrderInfo from '../Order/components/OrderInfo/OrderInfo'; ...@@ -14,12 +14,12 @@ 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';
import { import {
ConsumeOrder,
PaymentAndActiveInfo, PaymentAndActiveInfo,
CustomerBeanAccountVo, CustomerBeanAccountVo,
} from '../../api/baseClass'; } from '../../api/baseClass';
import { Customer } from '../../types/Customer/Customer'; import { Customer } from '../../types/Customer/Customer';
import { refreshCodeBar } from '../../api/customer'; import { refreshCodeBar } from '../../api/customer';
import Order from '@/types/Order/Order';
type PageStateProps = { type PageStateProps = {
userinfo: Customer; userinfo: Customer;
...@@ -34,7 +34,7 @@ type PageState = { ...@@ -34,7 +34,7 @@ type PageState = {
showPayOrder: boolean; showPayOrder: boolean;
showBig: boolean; showBig: boolean;
accounts: CustomerBeanAccountVo[]; accounts: CustomerBeanAccountVo[];
orderInfo: ConsumeOrder; orderInfo: Order;
payInfos: { payInfos: {
paymentAndActiveInfos: PaymentAndActiveInfo[]; paymentAndActiveInfos: PaymentAndActiveInfo[];
paymentConfId: number; paymentConfId: number;
...@@ -77,20 +77,20 @@ class BarCode extends Component { ...@@ -77,20 +77,20 @@ class BarCode extends Component {
showBig: false, showBig: false,
accounts: [], accounts: [],
orderInfo: { orderInfo: {
actualMoney: undefined, actualMoney: 0,
areaId: undefined, areaId: 0,
areaName: '', areaName: '',
consumeType: '', consumeType: '',
createAt: '', createAt: '',
customerCellphone: '', customerCellphone: '',
customerId: undefined, customerId: 0,
customerName: '', customerName: '',
deductionBean: undefined, deductionBean: 0,
deductionMoney: undefined, deductionMoney: 0,
equipmentNum: '', equipmentNum: '',
equipmentPosition: '', equipmentPosition: '',
id: undefined, id: 0,
operateId: undefined, operateId: 0,
operateName: '', operateName: '',
operationMode: '', operationMode: '',
orderName: '', orderName: '',
...@@ -98,10 +98,10 @@ class BarCode extends Component { ...@@ -98,10 +98,10 @@ class BarCode extends Component {
orderState: '', orderState: '',
outTradeNo: '', outTradeNo: '',
payType: '', payType: '',
payableMoney: undefined, payableMoney: 0,
serviceId: undefined, serviceId: 0,
serviceName: '', serviceName: '',
thirdDiscountMoney: undefined, thirdDiscountMoney: 0,
thirdTradeNumber: '', thirdTradeNumber: '',
updateDate: '', updateDate: '',
}, },
......
...@@ -24,9 +24,10 @@ import { ...@@ -24,9 +24,10 @@ import {
import { fetchBeanCount } from '../../api/bean'; import { fetchBeanCount } from '../../api/bean';
import { fetchAnn, SectionItem } from '../../api/announcement'; import { fetchAnn, SectionItem } from '../../api/announcement';
import { appLogout } from '../../api/customer'; import { appLogout } from '../../api/customer';
import { Customer } from '@/types/Customer/Customer';
type PageStateProps = { type PageStateProps = {
userinfo: UserState; userinfo: Customer;
}; };
type PageDispatchProps = { type PageDispatchProps = {
updateUserInfo: (e: UserState) => void; updateUserInfo: (e: UserState) => void;
...@@ -79,7 +80,29 @@ class Home extends Component { ...@@ -79,7 +80,29 @@ class Home extends Component {
componentWillMount() { componentWillMount() {
this.getInitData(); this.getInitData();
} }
componentDidShow() {
this.getBeanCountData();
}
getInitData() { getInitData() {
this.getBeanCountData();
const { userinfo } = this.props;
fetchAnn({
campusId: userinfo.areaId,
customerId: userinfo.customerId,
})
.then(res => {
if (res) {
this.setState({
annItem: res,
});
}
})
.catch(err => {
console.error(err);
});
}
getBeanCountData() {
const { userinfo } = this.props; const { userinfo } = this.props;
fetchBeanCount({ fetchBeanCount({
id: userinfo.customerId, id: userinfo.customerId,
...@@ -99,20 +122,6 @@ class Home extends Component { ...@@ -99,20 +122,6 @@ class Home extends Component {
}); });
}) })
.catch(console.error); .catch(console.error);
fetchAnn({
campusId: userinfo.areaId,
customerId: userinfo.customerId,
})
.then(res => {
if (res) {
this.setState({
annItem: res,
});
}
})
.catch(err => {
console.error(err);
});
} }
goSetting() { goSetting() {
......
...@@ -15,13 +15,12 @@ import { ...@@ -15,13 +15,12 @@ import {
} from './actions'; } from './actions';
import { StoreState } from './store'; import { StoreState } from './store';
import { fetchAllOrder, fetchPayOrder } from '../../../api/order'; import { fetchAllOrder, fetchPayOrder } from '../../../api/order';
import { UserState } from '../../../store/rootReducers/userinfo';
import { ConsumeOrder } from '../../../api/baseClass';
import Order, { AllOrderItem } from '../../../types/Order/Order'; import Order, { AllOrderItem } from '../../../types/Order/Order';
import { Customer } from '@/types/Customer/Customer';
type PageStateProps = { type PageStateProps = {
orderList: StoreState; orderList: StoreState;
userinfo: UserState; userinfo: Customer;
}; };
type PageDispatchProps = { type PageDispatchProps = {
toggleOrderState: (state: String) => void; toggleOrderState: (state: String) => void;
...@@ -52,7 +51,7 @@ interface OrderList { ...@@ -52,7 +51,7 @@ interface OrderList {
updateAllOrder(data) { updateAllOrder(data) {
dispatch(updateAllOrderList(data)); dispatch(updateAllOrderList(data));
}, },
}) }),
) )
class OrderList extends Component { class OrderList extends Component {
config: Config = { config: Config = {
...@@ -66,6 +65,10 @@ class OrderList extends Component { ...@@ -66,6 +65,10 @@ class OrderList extends Component {
componentWillMount() { componentWillMount() {
this.getPayOrderHandle(); this.getPayOrderHandle();
} }
componentDidShow() {
this.getPayOrderHandle();
this.getAllOrderHandle();
}
onPullDownRefresh() { onPullDownRefresh() {
console.log('in onPullDownRefresh'); console.log('in onPullDownRefresh');
...@@ -95,7 +98,7 @@ class OrderList extends Component { ...@@ -95,7 +98,7 @@ class OrderList extends Component {
: { : {
customerId: userinfo.customerId, customerId: userinfo.customerId,
pageSize: 10, pageSize: 10,
} },
) )
.then(res => { .then(res => {
console.log(res); console.log(res);
...@@ -119,7 +122,7 @@ class OrderList extends Component { ...@@ -119,7 +122,7 @@ class OrderList extends Component {
: { : {
customerId: customerId, customerId: customerId,
pageSize: 10, pageSize: 10,
} },
) )
.then(res => { .then(res => {
console.log(res); console.log(res);
...@@ -187,14 +190,12 @@ class OrderList extends Component { ...@@ -187,14 +190,12 @@ class OrderList extends Component {
<View className='Tab'> <View className='Tab'>
<Text <Text
className={`Tab-item ${orderState === '1' ? 'active' : ''}`} className={`Tab-item ${orderState === '1' ? 'active' : ''}`}
onClick={() => this.toggleStateHandle('1')} onClick={() => this.toggleStateHandle('1')}>
>
待付款 待付款
</Text> </Text>
<Text <Text
className={`Tab-item ${orderState === 'all' ? 'active' : ''}`} className={`Tab-item ${orderState === 'all' ? 'active' : ''}`}
onClick={() => this.toggleStateHandle('all')} onClick={() => this.toggleStateHandle('all')}>
>
全部 全部
</Text> </Text>
</View> </View>
...@@ -206,8 +207,7 @@ class OrderList extends Component { ...@@ -206,8 +207,7 @@ class OrderList extends Component {
upperThreshold={-100} upperThreshold={-100}
lowerThreshold={70} lowerThreshold={70}
scrollWithAnimation scrollWithAnimation
scrollTop={0} scrollTop={0}>
>
{orderState === '1' {orderState === '1'
? payList.map(order => ( ? payList.map(order => (
<OrderItem <OrderItem
......
...@@ -109,6 +109,7 @@ class OrderPay extends Component { ...@@ -109,6 +109,7 @@ class OrderPay extends Component {
payDoneHandle() { payDoneHandle() {
Taro.navigateBack(); Taro.navigateBack();
} }
render() { render() {
......
.OrderDetail-info, .OrderDetail-info {
.OrderDetail-payinfo {
display: flex; display: flex;
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
justify-content: space-between; justify-content: space-between;
font-size: 28px; font-size: 28px;
color: #666; color: #666;
.OrderDetail-info-title {
width: 120px;
}
.OrderDetail-info-content {
text-align: right;
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
} }
...@@ -47,28 +47,32 @@ class OrderInfo extends Component { ...@@ -47,28 +47,32 @@ class OrderInfo extends Component {
return ( return (
<View> <View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>商品说明</Text> <Text className='OrderDetail-info-title'>商品说明</Text>
<Text>{serviceName ? serviceName : ''}</Text> <Text className='OrderDetail-info-content'>
{serviceName ? serviceName : ''}
</Text>
</View> </View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>消费时间</Text> <Text className='OrderDetail-info-title'>消费时间</Text>
<Text>{createAt}</Text> <Text className='OrderDetail-info-content'>{createAt}</Text>
</View> </View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>订单号</Text> <Text className='OrderDetail-info-title'>订单号</Text>
<Text>{orderNumber}</Text> <Text className='OrderDetail-info-content'>{orderNumber}</Text>
</View> </View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>所属区域</Text> <Text className='OrderDetail-info-title'>所属区域</Text>
<Text>{areaName}</Text> <Text className='OrderDetail-info-content'>{areaName}</Text>
</View> </View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>设备编号</Text> <Text className='OrderDetail-info-title'>设备编号</Text>
<Text>{equipmentNum}</Text> <Text className='OrderDetail-info-content'>{equipmentNum}</Text>
</View> </View>
<View className='OrderDetail-info'> <View className='OrderDetail-info'>
<Text>设备位置</Text> <Text className='OrderDetail-info-title'>设备位置</Text>
<Text>{equipmentPosition ? equipmentPosition : ''}</Text> <Text className='OrderDetail-info-content'>
{equipmentPosition ? equipmentPosition : ''}
</Text>
</View> </View>
</View> </View>
); );
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
border: 6px solid #c8c8c8; border: 6px solid #c8c8c8;
border-radius: 50%; border-radius: 50%;
} }
.OrderPay-check.disabled {
background-color: #c8c8c8;
}
.checked { .checked {
border-color: #ffd506; border-color: #ffd506;
background-color: #ffd506; background-color: #ffd506;
...@@ -48,7 +51,7 @@ ...@@ -48,7 +51,7 @@
.OrderPay-DeductionInfo::before { .OrderPay-DeductionInfo::before {
content: ''; content: '';
position: absolute; position: absolute;
top: -12px; top: -10px;
left: 120px; left: 120px;
border-bottom: 12px solid #ffe4e4; border-bottom: 12px solid #ffe4e4;
border-left: 11px solid transparent; border-left: 11px solid transparent;
......
import Taro, { Component } from '@tarojs/taro'; import Taro, { Component } from '@tarojs/taro';
import { ComponentClass } from 'react'; import { ComponentClass } from 'react';
import { Button, View, Image, Text } from '@tarojs/components'; import { Button, View, Image, Text } from '@tarojs/components';
import { UserState } from '../../../../store/rootReducers/userinfo';
import { import {
PaymentAndActiveInfo, PaymentAndActiveInfo,
CustomerBeanAccountVo, CustomerBeanAccountVo,
ConsumeOrder,
} from '../../../../api/baseClass'; } from '../../../../api/baseClass';
import { confirmPay, fetchDeductionInfo } from '../../../../api/order'; import { confirmPay, fetchDeductionInfo } from '../../../../api/order';
...@@ -20,11 +18,13 @@ import Utf8 from 'crypto-js/enc-utf8'; ...@@ -20,11 +18,13 @@ import Utf8 from 'crypto-js/enc-utf8';
import ECBmode from 'crypto-js/mode-ecb'; import ECBmode from 'crypto-js/mode-ecb';
import PaddingPkcs7 from 'crypto-js/pad-pkcs7'; import PaddingPkcs7 from 'crypto-js/pad-pkcs7';
import { getPayType } from '../../../../utils/payType'; import { getPayType } from '../../../../utils/payType';
import Order from '../../../../types/Order/Order';
import { Customer } from '../../../../types/Customer/Customer';
type PageOwnProps = { type PageOwnProps = {
onPayDoneCallback: () => void; onPayDoneCallback: () => void;
userinfo: UserState; userinfo: Customer;
orderInfo: ConsumeOrder; orderInfo: Order;
accounts: CustomerBeanAccountVo[]; accounts: CustomerBeanAccountVo[];
payInfos: { payInfos: {
paymentAndActiveInfos: PaymentAndActiveInfo[]; paymentAndActiveInfos: PaymentAndActiveInfo[];
...@@ -146,8 +146,10 @@ class OrderPayway extends Component { ...@@ -146,8 +146,10 @@ class OrderPayway extends Component {
const { payWay } = this.state; const { payWay } = this.state;
confirmPay({ confirmPay({
orderId: id, orderId: id,
payType: payWay.payType, payType: payWay ? payWay.payType : '',
[payWay.activeId ? 'activeId' : 'notUse']: payWay.activeId, [payWay && payWay.activeId ? 'activeId' : 'notUse']: payWay
? payWay.activeId
: 0,
returnUrl: '', returnUrl: '',
callType: '3', callType: '3',
paymentConfId: payInfos.paymentConfId, paymentConfId: payInfos.paymentConfId,
...@@ -207,9 +209,6 @@ class OrderPayway extends Component { ...@@ -207,9 +209,6 @@ class OrderPayway extends Component {
item.payType === '7' || item.payType === '7' ||
item.payType === '8', item.payType === '8',
); );
const payInfo = prePay
? null
: payInfoList.find(item => item.payType === payWay.payType);
const useAmi = accountsInfo && accountsInfo['6'] >= orderInfo.payableMoney; const useAmi = accountsInfo && accountsInfo['6'] >= orderInfo.payableMoney;
const useCom = accountsInfo && accountsInfo['8'] >= orderInfo.payableMoney; const useCom = accountsInfo && accountsInfo['8'] >= orderInfo.payableMoney;
const useBean = accountsInfo && accountsInfo['7'] >= orderInfo.payableMoney; const useBean = accountsInfo && accountsInfo['7'] >= orderInfo.payableMoney;
...@@ -244,9 +243,9 @@ class OrderPayway extends Component { ...@@ -244,9 +243,9 @@ class OrderPayway extends Component {
<Image className='OrderPay-icon' src={payWayAimiLogo} /> <Image className='OrderPay-icon' src={payWayAimiLogo} />
<Text className='OrderPay-text'> <Text className='OrderPay-text'>
{getPayType(payway.payType)}(余额: {getPayType(payway.payType)}(余额:
{accountsInfo && {accountsInfo && accountsInfo['6']
accountsInfo['6'] && ? accountsInfo['6'].toFixed(2)
accountsInfo['6'].toFixed(2)} : '0.00'}
) )
</Text> </Text>
<View <View
...@@ -254,7 +253,7 @@ class OrderPayway extends Component { ...@@ -254,7 +253,7 @@ class OrderPayway extends Component {
payWay && payWay.payType === payway.payType payWay && payWay.payType === payway.payType
? 'checked' ? 'checked'
: '' : ''
}`} } ${useAmi ? '' : 'disabled'}`}
/> />
</View> </View>
) : payway.payType === '7' ? ( ) : payway.payType === '7' ? (
...@@ -264,7 +263,7 @@ class OrderPayway extends Component { ...@@ -264,7 +263,7 @@ class OrderPayway extends Component {
onClick={() => this.changePayWay(payway, !useBean)}> onClick={() => this.changePayWay(payway, !useBean)}>
<Image className='OrderPay-icon' src={payWayHairLogo} /> <Image className='OrderPay-icon' src={payWayHairLogo} />
<Text className='OrderPay-text'> <Text className='OrderPay-text'>
{getPayType(payway.payType)}(余额: {orderInfo.serviceName}(余额:
{accountsInfo && accountsInfo['7'] {accountsInfo && accountsInfo['7']
? accountsInfo['7'].toFixed(2) ? accountsInfo['7'].toFixed(2)
: '0.00'} : '0.00'}
...@@ -275,7 +274,7 @@ class OrderPayway extends Component { ...@@ -275,7 +274,7 @@ class OrderPayway extends Component {
payWay && payWay.payType === payway.payType payWay && payWay.payType === payway.payType
? 'checked' ? 'checked'
: '' : ''
}`} } ${useBean ? '' : 'disabled'}`}
/> />
</View> </View>
) : payway.payType === '8' ? ( ) : payway.payType === '8' ? (
...@@ -296,7 +295,7 @@ class OrderPayway extends Component { ...@@ -296,7 +295,7 @@ class OrderPayway extends Component {
payWay && payWay.payType === payway.payType payWay && payWay.payType === payway.payType
? 'checked' ? 'checked'
: '' : ''
}`} } ${useCom ? '' : 'disabled'}`}
/> />
</View> </View>
) : null, ) : null,
......
type INITIAL_STATE = { type ConstantState = {
APP_ID: string; APP_ID: string;
}; };
const INITIAL_STATE = { const INITIAL_STATE = {
APP_ID: 'wxf5912b79bba23663', APP_ID: 'wxf5912b79bba23663',
}; };
export default function counter(state = INITIAL_STATE) { export default function counter(state: ConstantState = INITIAL_STATE) {
return state; return state;
} }
import Action from '../../types/Store/Actions'; import Action from '../../types/Store/Actions';
import { Customer } from '../../types/Customer/Customer';
export type UserState = { export type UserState = StoreState<Customer>;
login?: boolean;
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;
};
export const INITIAL_STATE = { export const INITIAL_STATE = {
login: false, login: false,
...@@ -68,6 +36,7 @@ export const INITIAL_STATE = { ...@@ -68,6 +36,7 @@ export const INITIAL_STATE = {
updateAt: '', updateAt: '',
updateLoginDate: '', updateLoginDate: '',
version: '', version: '',
wxToken: '',
}; };
export const updateUserInfo = (entity: UserState): Action => ({ export const updateUserInfo = (entity: UserState): Action => ({
...@@ -76,9 +45,9 @@ export const updateUserInfo = (entity: UserState): Action => ({ ...@@ -76,9 +45,9 @@ export const updateUserInfo = (entity: UserState): Action => ({
}); });
export default function userinfo( export default function userinfo(
state: UserState = INITIAL_STATE, state: Customer = INITIAL_STATE,
actions: Action, actions: Action,
): UserState { ): Customer {
switch (actions.type) { switch (actions.type) {
case 'UPDATE_USERINFO': case 'UPDATE_USERINFO':
return { return {
......
...@@ -15,6 +15,7 @@ type Order = { ...@@ -15,6 +15,7 @@ type Order = {
operateId: number; operateId: number;
operateName: string; operateName: string;
operationMode: string; operationMode: string;
orderName: string;
orderNumber: string; orderNumber: string;
orderState: string; orderState: string;
outTradeNo: string; outTradeNo: string;
......
type StoreState<T> = { [P in keyof T]?: T[P] };
...@@ -15,16 +15,14 @@ ...@@ -15,16 +15,14 @@
"sourceMap": true, "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"rootDir": ".", "rootDir": ".",
"paths": {
"@/*": ["./src/*"]
},
"jsx": "preserve", "jsx": "preserve",
"jsxFactory": "Taro.createElement", "jsxFactory": "Taro.createElement",
"allowJs": true, "allowJs": true,
"typeRoots": [ "typeRoots": ["node_modules/@types"]
"node_modules/@types"
]
}, },
"exclude": [ "exclude": ["node_modules", "dist"],
"node_modules",
"dist"
],
"compileOnSave": false "compileOnSave": false
} }
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