Commit b897e3b5 by 黄日华

开门离店弹窗可配置和其余弹窗消失时间

parent 40d50d43
...@@ -23,7 +23,6 @@ export default class KeyboardModal extends React.Component { ...@@ -23,7 +23,6 @@ export default class KeyboardModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
value: '',
clickDot: true, clickDot: true,
}; };
} }
...@@ -66,33 +65,39 @@ export default class KeyboardModal extends React.Component { ...@@ -66,33 +65,39 @@ export default class KeyboardModal extends React.Component {
}; };
pressKey = index => { pressKey = index => {
let {value, clickDot} = this.state; let {clickDot} = this.state;
const {dot} = this.props; const {dot, operateCb, value, setValue} = this.props;
let numberValue = value;
if (index < 10) { if (index < 10) {
value += index; numberValue += index;
} else if (index === 10 && !dot) { } else if (index === 10 && !dot) {
value = value.substr(0, value.length - 1); numberValue = numberValue.substr(0, numberValue.length - 1);
} else if (index === 10 && dot && clickDot) { } else if (index === 10 && dot && clickDot) {
value += '.'; numberValue += '.';
clickDot = false; clickDot = false;
} else if (index === 11) { } else if (index === 11) {
value += 0; numberValue += 0;
} else if (index === 12) { } else if (index === 12) {
this.props.onSubmit(value); this.props.onSubmit(numberValue);
this.handleClose(); this.handleClose();
return; return;
} }
this.setState({value, clickDot}); this.setState({clickDot});
operateCb();
setValue(numberValue);
}; };
handleClose = () => { handleClose = clear => {
this.setState({value: '', clickDot: true}); const {onClose, setValue} = this.props;
this.props.onClose(); this.setState({clickDot: true});
setValue('');
if (!clear) {
onClose();
}
}; };
render() { render() {
const {title, visible} = this.props; const {title, visible, value} = this.props;
const {value} = this.state;
return ( return (
<Modal <Modal
styles={mStyles} styles={mStyles}
...@@ -134,7 +139,7 @@ export default class KeyboardModal extends React.Component { ...@@ -134,7 +139,7 @@ export default class KeyboardModal extends React.Component {
</Text> </Text>
</View> </View>
<Touch <Touch
onPress={() => this.setState({value: '', clickDot: true})} onPress={() => this.handleClose(true)}
style={{ style={{
position: 'absolute', position: 'absolute',
right: 30, right: 30,
......
...@@ -72,6 +72,7 @@ const CounterMixins = ComposeComponent => { ...@@ -72,6 +72,7 @@ const CounterMixins = ComposeComponent => {
noBuyModal: false, noBuyModal: false,
logoVisible: true, logoVisible: true,
nobodyVoice: false, nobodyVoice: false,
numberValue: '',
}; };
componentWillMount = async () => { componentWillMount = async () => {
...@@ -484,13 +485,26 @@ const CounterMixins = ComposeComponent => { ...@@ -484,13 +485,26 @@ const CounterMixins = ComposeComponent => {
}); });
// this.setState({voiceModal: true, voiceTitle: msg}); // this.setState({voiceModal: true, voiceTitle: msg});
if (!facepay) { if (!facepay) {
Speech.speak('付款成功'); await Speech.speak('付款成功');
} }
if (this.state.stype === 'guard') { if (this.state.stype === 'guard') {
let group = await AsyncStorage.getItem('KEY');
let {data} = await this.props.dispatch({
type: 'store/getStore',
group,
});
if (data.code === 1) {
if (data.data && data.data.payLeave) {
await this.onOpen();
} else {
this.showLeaveModal();
}
} else {
this.showLeaveModal(); this.showLeaveModal();
}
} else { } else {
this.storeSetting(goodsArr); await this.storeSetting(goodsArr);
this.onLucky(); await this.onLucky();
} }
this.clearList(); this.clearList();
}; };
...@@ -634,6 +648,52 @@ const CounterMixins = ComposeComponent => { ...@@ -634,6 +648,52 @@ const CounterMixins = ComposeComponent => {
}); });
}; };
modalResult = () => {
clearTimeout(this.mrTimeout);
this.mrTimeout = setTimeout(() => {
this.setState({
modalS: false,
numberValue: '',
});
}, 15000);
};
refreshModalResult = () => {
clearTimeout(this.mrTimeout);
this.mrTimeout = setTimeout(() => {
this.setState({
modalS: false,
numberValue: '',
});
}, 15000);
};
setNumberValue = numberValue => {
this.setState({
numberValue,
});
};
handleBarcode = () => {
this.handleScan = this.submitBarcode;
this.setState({
modalS: true,
title: '录入条码',
dot: false,
});
this.modalResult();
};
handleCodeless = () => {
this.handleScan = this.submitCodeless;
this.setState({
modalS: true,
title: '无码商品',
dot: true,
});
this.modalResult();
};
numChange = index => { numChange = index => {
this.handleScan = this.submitGoodNum; this.handleScan = this.submitGoodNum;
this.numIndex = index; this.numIndex = index;
...@@ -641,6 +701,7 @@ const CounterMixins = ComposeComponent => { ...@@ -641,6 +701,7 @@ const CounterMixins = ComposeComponent => {
modalS: true, modalS: true,
title: '修改数量', title: '修改数量',
}); });
this.modalResult();
}; };
numAdd = (num, index) => { numAdd = (num, index) => {
...@@ -1011,24 +1072,6 @@ const CounterMixins = ComposeComponent => { ...@@ -1011,24 +1072,6 @@ const CounterMixins = ComposeComponent => {
} }
}; };
handleBarcode = () => {
this.handleScan = this.submitBarcode;
this.setState({
modalS: true,
title: '录入条码',
dot: false,
});
};
handleCodeless = () => {
this.handleScan = this.submitCodeless;
this.setState({
modalS: true,
title: '无码商品',
dot: true,
});
};
clearList = () => { clearList = () => {
this.setDelay(); this.setDelay();
this.goodsMap = {}; this.goodsMap = {};
...@@ -1100,7 +1143,7 @@ const CounterMixins = ComposeComponent => { ...@@ -1100,7 +1143,7 @@ const CounterMixins = ComposeComponent => {
}); });
setTimeout(() => { setTimeout(() => {
this.setState({noBuyModal: false}); this.setState({noBuyModal: false});
}, 10000); }, 30000);
} }
this.clearList(); this.clearList();
}; };
...@@ -1113,6 +1156,15 @@ const CounterMixins = ComposeComponent => { ...@@ -1113,6 +1156,15 @@ const CounterMixins = ComposeComponent => {
Toast.success(data.msg); Toast.success(data.msg);
}; };
onNumberClose = () => {
clearTimeout(this.mrTimeout);
this.setState({
modalS: false,
dot: false,
numberValue: '',
});
};
render = () => { render = () => {
let { let {
cloudFinishModal, cloudFinishModal,
...@@ -1127,6 +1179,7 @@ const CounterMixins = ComposeComponent => { ...@@ -1127,6 +1179,7 @@ const CounterMixins = ComposeComponent => {
logoVisible, logoVisible,
qrHost, qrHost,
nobodyVoice, nobodyVoice,
numberValue,
} = this.state; } = this.state;
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
...@@ -1232,10 +1285,13 @@ const CounterMixins = ComposeComponent => { ...@@ -1232,10 +1285,13 @@ const CounterMixins = ComposeComponent => {
</Modal> </Modal>
<NumberModal <NumberModal
title={title} title={title}
onClose={() => this.setState({modalS: false, dot: false})} onClose={this.onNumberClose}
visible={this.state.modalS} visible={this.state.modalS}
onSubmit={this.handleScan} onSubmit={this.handleScan}
dot={this.state.dot} dot={this.state.dot}
operateCb={this.refreshModalResult}
value={numberValue}
setValue={this.setNumberValue}
/> />
<RedPacketModal <RedPacketModal
luckyVisible={luckyVisible} luckyVisible={luckyVisible}
...@@ -1268,8 +1324,8 @@ const CounterMixins = ComposeComponent => { ...@@ -1268,8 +1324,8 @@ const CounterMixins = ComposeComponent => {
style={{ style={{
width: 100, width: 100,
height: 100, height: 100,
marginLeft: -10, marginLeft: 0,
marginTop: -18, marginTop: -8,
resizeMode: 'contain', resizeMode: 'contain',
alignSelf: 'flex-start', alignSelf: 'flex-start',
}} }}
...@@ -1281,7 +1337,7 @@ const CounterMixins = ComposeComponent => { ...@@ -1281,7 +1337,7 @@ const CounterMixins = ComposeComponent => {
alignItems: 'center', alignItems: 'center',
flex: 1, flex: 1,
}}> }}>
<Text style={{color: '#000000', fontSize: 28}}>云值守店</Text> <Text style={{color: '#000000', fontSize: 32}}>云值守店</Text>
</View> </View>
<Touch <Touch
onPress={() => this.onCloseCloudFinish()} onPress={() => this.onCloseCloudFinish()}
...@@ -1307,14 +1363,14 @@ const CounterMixins = ComposeComponent => { ...@@ -1307,14 +1363,14 @@ const CounterMixins = ComposeComponent => {
onPress={() => this.onOpen()} onPress={() => this.onOpen()}
style={{ style={{
width: '90%', width: '90%',
height: 70, height: 80,
borderRadius: 5, borderRadius: 5,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#FC4000', backgroundColor: '#FC4000',
marginVertical: 25, marginVertical: 30,
}}> }}>
<Text style={{color: '#ffffff', fontSize: 22}}>开门离店</Text> <Text style={{color: '#ffffff', fontSize: 28}}>开门离店</Text>
</Touch> </Touch>
</View> </View>
</Modal> </Modal>
......
...@@ -354,21 +354,22 @@ class VerticalPage extends Component { ...@@ -354,21 +354,22 @@ class VerticalPage extends Component {
onCall = async () => { onCall = async () => {
const {talkCall} = this.state; const {talkCall} = this.state;
console.warn(talkCall, Date.now());
if (talkCall === 2) { if (talkCall === 2) {
Speech.speak('正在接通中请稍候');
this.talkCall();
clearInterval(this.noTalkCall);
this.noTalkCall = setInterval(() => this.talkCall(), 10000);
this.setState({ this.setState({
talkCall: 0, talkCall: 0,
}); });
clearInterval(this.callTimeout); Speech.speak('正在接通中请稍候');
this.callTimeout = setTimeout(() => { this.talkCall();
clearInterval(this.noTalkCall); // clearInterval(this.noTalkCall);
this.setState({ // this.noTalkCall = setInterval(() => this.talkCall(), 10000);
talkCall: 2, // clearInterval(this.callTimeout);
}); // this.callTimeout = setTimeout(() => {
}, 30000); // clearInterval(this.noTalkCall);
// this.setState({
// talkCall: 2,
// });
// }, 30000);
} }
this.setState({ this.setState({
hintVisible: true, hintVisible: true,
...@@ -376,7 +377,7 @@ class VerticalPage extends Component { ...@@ -376,7 +377,7 @@ class VerticalPage extends Component {
clearTimeout(this.callModalTimeout); clearTimeout(this.callModalTimeout);
this.callModalTimeout = setTimeout(() => { this.callModalTimeout = setTimeout(() => {
this.setState({hintVisible: false}); this.setState({hintVisible: false});
}, 12000); }, 60000);
}; };
onNoBuy = async () => { onNoBuy = async () => {
...@@ -387,6 +388,7 @@ class VerticalPage extends Component { ...@@ -387,6 +388,7 @@ class VerticalPage extends Component {
closeHint = () => { closeHint = () => {
this.setState({ this.setState({
hintVisible: false, hintVisible: false,
talkCall: 2,
}); });
}; };
...@@ -578,7 +580,7 @@ class VerticalPage extends Component { ...@@ -578,7 +580,7 @@ class VerticalPage extends Component {
clearTimeout(this.nobuyTimeout); clearTimeout(this.nobuyTimeout);
this.nobuyTimeout = setTimeout(() => { this.nobuyTimeout = setTimeout(() => {
this.setState({noBuyModal: false}); this.setState({noBuyModal: false});
}, 10000); }, 30000);
}; };
render() { render() {
...@@ -1259,8 +1261,8 @@ class HintPhone extends React.Component { ...@@ -1259,8 +1261,8 @@ class HintPhone extends React.Component {
<Image style={{width: '60%', height: '60%'}} source={call} /> <Image style={{width: '60%', height: '60%'}} source={call} />
<Text style={{fontSize: scaleSize(30)}}>正在呼叫客服</Text> <Text style={{fontSize: scaleSize(30)}}>正在呼叫客服</Text>
<View style={{display: 'flex', marginTop: 10}}> <View style={{display: 'flex', marginTop: 10}}>
<Text style={{fontSize: scaleSize(20), color: '#FC4000'}}> <Text style={{fontSize: scaleSize(25), color: '#FC4000'}}>
如无法接通客服,可拨打电话: {contact} 如无法接通客服可拨打电话: {contact}
</Text> </Text>
</View> </View>
<Touch onPress={closeHint}> <Touch onPress={closeHint}>
......
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