Commit b897e3b5 by 黄日华

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

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