Commit b1a39847 by 王崇仁

更改了扫码进出门的页面

parent db675adb
...@@ -34,9 +34,11 @@ class FacePage extends Component { ...@@ -34,9 +34,11 @@ class FacePage extends Component {
tip: '', tip: '',
tipsModal: false, tipsModal: false,
faceType: 'wxpay', faceType: 'wxpay',
sleep: true, sleep: false,
loadingModal: false, loadingModal: false,
qrCode: '', qrCode: '',
goTipsModal: false,
type: '',
}; };
async componentWillMount() { async componentWillMount() {
...@@ -213,6 +215,9 @@ class FacePage extends Component { ...@@ -213,6 +215,9 @@ class FacePage extends Component {
}; };
handleDoorLogin = async ret => { handleDoorLogin = async ret => {
this.setState({
type: ret.type,
});
if (ret) { if (ret) {
if (ret.code < 0 || ret.code === 401) { if (ret.code < 0 || ret.code === 401) {
// 未授权,提示用户扫码验证 // 未授权,提示用户扫码验证
...@@ -265,13 +270,14 @@ class FacePage extends Component { ...@@ -265,13 +270,14 @@ class FacePage extends Component {
} }
}; };
setQrcode = ({action, tip}) => { setQrcode = ({action, tip, qrcode}) => {
const state = { const state = {
qrCode: `${qrHost}/#/store-${action}-j${this.storeKey}`, qrCode: `${qrHost}/#/store-${action}-j${this.storeKey}`,
}; };
if (tip) { if (tip) {
state.tip = tip; state.tip = tip;
state.tipsModal = true; if (qrcode) state.goTipsModal = true;
else state.tipsModal = true;
state.loadingModal = false; state.loadingModal = false;
} }
this.setState(state); this.setState(state);
...@@ -318,7 +324,7 @@ class FacePage extends Component { ...@@ -318,7 +324,7 @@ class FacePage extends Component {
// res = (await WxFacepay.faceinfo(params)) || {}; // res = (await WxFacepay.faceinfo(params)) || {};
// 返回错误出现二维码扫码 // 返回错误出现二维码扫码
Speech.speak('请扫码开门'); Speech.speak('请扫码开门');
this.setQrcode({action: this.action, tip: '请扫码开门'}); this.setQrcode({action: this.action, tip: '请扫码开门', qrcode: true});
} }
if (window.socket) { if (window.socket) {
// 返回结果,立即重新连接socket // 返回结果,立即重新连接socket
...@@ -370,7 +376,7 @@ class FacePage extends Component { ...@@ -370,7 +376,7 @@ class FacePage extends Component {
if (res.code !== '1000') { if (res.code !== '1000') {
Toast.show(res.msg); Toast.show(res.msg);
Speech.speak('请扫码开门'); Speech.speak('请扫码开门');
this.setQrcode({action: this.action, tip: '请扫码开门'}); this.setQrcode({action: this.action, tip: '请扫码开门', qrcode: true});
return; return;
} }
this.loading(true); this.loading(true);
...@@ -391,6 +397,10 @@ class FacePage extends Component { ...@@ -391,6 +397,10 @@ class FacePage extends Component {
// 语音通话请求 // 语音通话请求
onCall = async () => { onCall = async () => {
await this.setState({
tipsModal: false,
type: '',
});
const {talkCall} = this.state; const {talkCall} = this.state;
if (talkCall === 2) { if (talkCall === 2) {
Speech.speak('正在接通中请稍候'); Speech.speak('正在接通中请稍候');
...@@ -438,13 +448,18 @@ class FacePage extends Component { ...@@ -438,13 +448,18 @@ class FacePage extends Component {
this.setState({sleep: false}); this.setState({sleep: false});
clearTimeout(this.wakeUpTimeout); clearTimeout(this.wakeUpTimeout);
this.wakeUpTimeout = setTimeout(() => { this.wakeUpTimeout = setTimeout(() => {
this.setState({sleep: true}); this.setState({sleep: true, tipsModal: false});
}, 18888); }, 18888);
}; };
closeTips = async () => { goTips = async () => {
await this.setState({tipsModal: false}); Speech.speak('请扫码确认');
await this.face(); await this.setState({tipsModal: false, goTipsModal: true, type: ''});
};
goToo = async () => {
await this.setState({tipsModal: false, goTipsModal: false, type: ''});
window.socket.emit('jokerOpen', true, 'enter');
}; };
render() { render() {
...@@ -464,7 +479,21 @@ class FacePage extends Component { ...@@ -464,7 +479,21 @@ class FacePage extends Component {
faceType, faceType,
loadingModal, loadingModal,
qrCode, qrCode,
goTipsModal,
type,
} = this.state; } = this.state;
let flag = '';
let flags = '';
if (type === 'over') {
flags = '回店付款';
flag = '我已付款';
} else if (type === 'loss') {
flag = '确认出店';
flags = '回到店里';
} else {
flags = '回到店里';
flag = '呼叫客服';
}
let {dispatch} = this.props; let {dispatch} = this.props;
if (faceType === 'alipay') { if (faceType === 'alipay') {
styles.header = {...styles.header, backgroundColor: '#1b7dc7'}; styles.header = {...styles.header, backgroundColor: '#1b7dc7'};
...@@ -511,14 +540,24 @@ class FacePage extends Component { ...@@ -511,14 +540,24 @@ class FacePage extends Component {
transparent transparent
title={'开门失败'} title={'开门失败'}
tip={tip} tip={tip}
qrCode={qrCode} leftText={flags}
leftText={'呼叫客服'} rightText={flag}
rightText={'重新识别'} leftTouch={this.goToo}
leftTouch={this.onCall} rightTouch={
rightTouch={this.closeTips} type === 'over' || type === 'loss' ? this.goTips : this.onCall
}
onMaskPress={() => this.setState({tipsModal: false})} onMaskPress={() => this.setState({tipsModal: false})}
faceType={faceType} faceType={faceType}
/> />
<TipsModal
visible={goTipsModal}
transparent
title={'扫码开门'}
qrCode={qrCode}
tip="请扫码确认"
onMaskPress={() => this.setState({goTipsModal: false})}
faceType={faceType}
/>
<LoadingModal transparent visible={loadingModal} /> <LoadingModal transparent visible={loadingModal} />
<View style={styles.header}> <View style={styles.header}>
<View style={styles.title}> <View style={styles.title}>
......
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