Commit ae96442a by Confettis

fix

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