Commit ae96442a by Confettis

fix

parent f2cfe15c
......@@ -4,7 +4,6 @@ import {FlatList, Image, Modal, ScrollView, Text, View} from 'react-native';
import {font} from '../utils/common';
import NP from '../utils/np';
import {scaleSize, setSpText} from '../utils/screen';
import Speech from '../utils/Speech';
import ModalStyles from './Modal/styles';
import Touch from './Touch';
......@@ -121,13 +120,8 @@ class OrderDetailMini extends Component {
</View>
);
onNoBuy = async () => {
const {data} = await this.props.dispatch({type: 'store/noBuyGoGoGo'});
Speech.speak(data.msg);
};
render() {
const {goodsArr, faceType, ...props} = this.props;
const {goodsArr, faceType, onGoBack, ...props} = this.props;
let totalPrice = 0; // 总价
let totalCount = 0; // 总优惠
let number = 0; // 总数量
......@@ -220,7 +214,7 @@ class OrderDetailMini extends Component {
style={styles.emptyImg}
/>
</View>
<Touch onPress={() => this.onNoBuy()}>
<Touch onPress={() => onGoBack()}>
<View
style={{
backgroundColor:
......
......@@ -33,6 +33,7 @@ class TipsModal extends Component {
faceType,
qrCode,
onMaskPress,
tryFace,
...props
} = this.props;
let flag = true;
......@@ -103,7 +104,7 @@ class TipsModal extends Component {
style={styles.tip}>
{tip}
</Text>
<Touch onPress={() => console.log('1')}>
<Touch onPress={() => tryFace()}>
<View style={styles.tryAngin}>
<Image
source={require('../assets/shualian.png')}
......
......@@ -257,11 +257,14 @@ class FacePage extends Component {
// 出门身份识别提示
Speech.speak('正在进行安全检查');
if (this.state.goodsArr.length === 0) {
Speech.speak('请点击无购物出店按钮出门');
return;
}
this.setState({orderDetailMini: false});
const facepay =
this.state.faceType === 'wxpay' ? this.wxFacepay : this.smilepay;
await facepay();
// await facepay();
// this.getOrderDetailMiniCounter();
// this.orderDetailMiniPop(30000);
// this.loading(true, 30000);
......@@ -310,6 +313,10 @@ class FacePage extends Component {
};
face = () => {
this.setState({
tipsModal: false,
goTipsModal: false,
});
this.orderDetailMiniPop(false);
const {faceType} = this.state;
if (faceType === 'wxpay') {
......@@ -855,7 +862,9 @@ class FacePage extends Component {
};
balancePay = async openid => {
if (this.barcodeBusy) return true;
Toast.loading('正在付款,请稍后~');
this.barcodeBusy = true;
const {ids, noBarcode} = this.getGoods();
const {data} = await this.props.dispatch({
type: 'goods/balancePay',
......@@ -868,17 +877,20 @@ class FacePage extends Component {
this.successPay(true);
await AutoClick.clickBackKey();
await wait(1200);
// await this.setState({orderDetailMini: false});
this.barcodeBusy = false;
return data;
}
this.barcodeBusy = false;
return data;
};
barcodePay = async (code, facepay, openid, fToken, uid) => {
if (this.barcodeBusy) return true;
Toast.loading('正在付款,请稍后');
const isWxpay = code.toString().match(/1[0-5]\d{16}/);
const isAlipay = fToken || code.toString().match(/^(2[5-9]|30)\d{14,22}$/);
if (!isWxpay && !isAlipay) return false;
this.barcodeBusy = true;
let successPay = false;
const {ids, noBarcode} = this.getGoods();
const res = await this.props.dispatch({
......@@ -894,6 +906,7 @@ class FacePage extends Component {
if (res.code !== 1) {
Toast.info(`${res.msg}`);
Speech.speak(res.msg);
this.setState({orderDetailMini: true});
}
if (res.code === 1) {
this.orderId = res.data.orderId;
......@@ -925,16 +938,25 @@ class FacePage extends Component {
}
}
} else if (res.code === 3) {
this.setState({orderDetailMini: true});
await wait(res.data.timeout);
} else {
this.setState({orderDetailMini: true});
await wait(1200);
}
this.barcodeBusy = false;
if (successPay) {
return 'SUCCESS';
}
return true;
};
onNoBuy = async () => {
console.log('noBuy');
const {data} = await this.props.dispatch({type: 'store/noBuyGoGoGo'});
Speech.speak(data.msg);
};
render() {
const {
verifyCodeModal,
......@@ -1010,6 +1032,7 @@ class FacePage extends Component {
goodsArr={goodsArr}
dispatch={dispatch}
faceType={faceType}
onGoBack={this.onNoBuy}
/>
<TipsModal
visible={tipsModal}
......@@ -1024,6 +1047,7 @@ class FacePage extends Component {
rightTouch={this.onCall}
onMaskPress={() => this.setState({tipsModal: false})}
faceType={faceType}
tryFace={this.face}
/>
<TipsModal
visible={goTipsModal}
......@@ -1033,6 +1057,7 @@ class FacePage extends Component {
tip={tip}
onMaskPress={() => this.setState({goTipsModal: false})}
faceType={faceType}
tryFace={this.face}
/>
<LoadingModal transparent visible={loadingModal} />
<View style={styles.header}>
......
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