Commit fc72d23f by 黄日华

感应进店后续前端修改

parent c9ecd7bb
...@@ -19,6 +19,8 @@ import {width, height, scaleSize} from '../utils/screen'; ...@@ -19,6 +19,8 @@ import {width, height, scaleSize} from '../utils/screen';
import EnterEvent from '../utils/EnterEvent'; import EnterEvent from '../utils/EnterEvent';
import Printer from '../utils/Printer'; import Printer from '../utils/Printer';
import AutoClick from '../utils/AutoClick'; import AutoClick from '../utils/AutoClick';
import QRCode from 'react-native-qrcode-svg';
import {login, ossLink} from '../utils/config';
window.RN = RN; window.RN = RN;
window.Toast = Toast; window.Toast = Toast;
...@@ -67,6 +69,8 @@ const CounterMixins = ComposeComponent => { ...@@ -67,6 +69,8 @@ const CounterMixins = ComposeComponent => {
printer: [], printer: [],
receiptTime: 5, receiptTime: 5,
cloudFinishModal: false, cloudFinishModal: false,
noBuyModal: false,
logoVisible: true,
}; };
componentWillMount = async () => { componentWillMount = async () => {
...@@ -81,6 +85,8 @@ const CounterMixins = ComposeComponent => { ...@@ -81,6 +85,8 @@ const CounterMixins = ComposeComponent => {
adType: data.data.type, adType: data.data.type,
}); });
} }
this.initSetting();
await this.refreshLogo();
const stype = await AsyncStorage.getItem('STYPE'); const stype = await AsyncStorage.getItem('STYPE');
const qrHost = await AsyncStorage.getItem('QRHOST'); const qrHost = await AsyncStorage.getItem('QRHOST');
await this.setState({qrHost, stype}); await this.setState({qrHost, stype});
...@@ -128,6 +134,46 @@ const CounterMixins = ComposeComponent => { ...@@ -128,6 +134,46 @@ const CounterMixins = ComposeComponent => {
this.listen(); this.listen();
}; };
initSetting = () => {
AutoClick.isSettingsOn().then(setting => {
if (!setting) this.setState({setting: true}); // 展示辅助按钮
});
AsyncStorage.getItem('hideLogo').then(hide => {
if (hide === 'true') this.setState({logoVisible: false}); // 隐藏LOGO
});
};
refreshLogo = async () => {
let group = await AsyncStorage.getItem('KEY');
let {data} = await this.props.dispatch({
type: 'store/findModuleSetting',
group,
});
if (data.code === 1 && data.data) {
const state = {priceVisible: data.data.priceVisible};
if (data.data.cardCounter) {
// 是否支持刷卡
state.isCard = true;
window.cardCounter = data.data.cardCounter;
}
if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`;
this.setState(state);
}
};
hideLogo = async () => {
if (!this.num) this.num = 0;
this.num++;
if (this.num >= 10) {
this.num = 0;
let {logoVisible} = this.state;
AsyncStorage.setItem('hideLogo', String(logoVisible));
this.setState({
logoVisible: !logoVisible,
});
}
};
handleCard = async cardId => { handleCard = async cardId => {
Toast.hide(); Toast.hide();
if (!cardId) return; if (!cardId) return;
...@@ -945,6 +991,7 @@ const CounterMixins = ComposeComponent => { ...@@ -945,6 +991,7 @@ const CounterMixins = ComposeComponent => {
onOpen = async () => { onOpen = async () => {
const {data} = await this.props.dispatch({ const {data} = await this.props.dispatch({
type: 'store/open', type: 'store/open',
orderId: this.orderId,
}); });
if (data.code === 1) { if (data.code === 1) {
this.setState({ this.setState({
...@@ -952,12 +999,15 @@ const CounterMixins = ComposeComponent => { ...@@ -952,12 +999,15 @@ const CounterMixins = ComposeComponent => {
}); });
Speech.speak(data.msg || '门已经打开,谢谢惠顾'); Speech.speak(data.msg || '门已经打开,谢谢惠顾');
} else { } else {
Toast.info(data.msg || '开门失败,请联系客服处理', 2);
Speech.speak(data.msg || '开门失败,请联系客服处理'); Speech.speak(data.msg || '开门失败,请联系客服处理');
await this.setState({
cloudFinishModal: false,
});
this.setState({
noBuyModal: true,
});
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({noBuyModal: false});
cloudFinishModal: false,
});
}, 10000); }, 10000);
} }
this.clearList(); this.clearList();
...@@ -981,9 +1031,55 @@ const CounterMixins = ComposeComponent => { ...@@ -981,9 +1031,55 @@ const CounterMixins = ComposeComponent => {
amount, amount,
visible, visible,
receiptTime, receiptTime,
noBuyModal,
logoVisible,
qrHost,
} = this.state; } = this.state;
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<RN.Modal
style={{margin: 0, padding: 0}}
visible={noBuyModal}
transparent>
<View
style={{
width: '100%',
height: '100%',
margin: 0,
position: 'relative',
}}>
<Touch
style={{
width: '100%',
height: '100%',
backgroundColor: '#000',
opacity: 0.5,
}}
onPress={() => this.setState({noBuyModal: false})}>
<View />
</Touch>
<View style={styles.HintPhone}>
<Image
source={require('../assets/Vertical/realname.png')}
style={{left: 20, position: 'absolute'}}
/>
<Image
source={require('../assets/Vertical/police.png')}
style={{right: 20, position: 'absolute'}}
/>
<Text style={{fontSize: scaleSize(50), marginBottom: 20}}>
请扫码出店
</Text>
<QRCode
logoSize={width > 801 ? 50 : scaleSize(100)}
// logoBackgroundColor="#fc4000"
logo={logoVisible && require('../assets/logo2.png')}
size={width > 801 ? 200 : scaleSize(400)}
value={`${qrHost || login}/#/store-leave-g${this.storeKey}`}
/>
</View>
</View>
</RN.Modal>
<Modal visible={visible} transparent> <Modal visible={visible} transparent>
{/*<View style={{width,height,backgroundColor:'rgba(0,0,0,.5)'}} />*/} {/*<View style={{width,height,backgroundColor:'rgba(0,0,0,.5)'}} />*/}
<View <View
...@@ -1156,4 +1252,19 @@ const CloseButton = ({onClose, style}) => { ...@@ -1156,4 +1252,19 @@ const CloseButton = ({onClose, style}) => {
); );
}; };
const styles = {
HintPhone: {
width: width > 801 ? '50%' : '80%',
height: width > 801 ? '25%' : '40%',
backgroundColor: '#ffffff',
position: 'absolute',
top: '20%',
left: width > 801 ? '25%' : '10%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
opacity: 40,
},
};
export default CounterMixins; export default CounterMixins;
...@@ -52,7 +52,7 @@ class VerticalPage extends Component { ...@@ -52,7 +52,7 @@ class VerticalPage extends Component {
priceVisible: true, priceVisible: true,
isCard: false, isCard: false,
cardVisible: false, cardVisible: false,
nobuyModal: false, noBuyModal: false,
}; };
async componentWillMount() { async componentWillMount() {
...@@ -574,12 +574,12 @@ class VerticalPage extends Component { ...@@ -574,12 +574,12 @@ class VerticalPage extends Component {
}, 8000); }, 8000);
}; };
showNobuyModal = () => { shownoBuyModal = () => {
Speech.speak('请扫码出店'); Speech.speak('请扫码出店');
this.setState({nobuyModal: true}); this.setState({noBuyModal: true});
clearTimeout(this.nobuyTimeout); clearTimeout(this.nobuyTimeout);
this.nobuyTimeout = setTimeout(() => { this.nobuyTimeout = setTimeout(() => {
this.setState({nobuyModal: false}); this.setState({noBuyModal: false});
}, 10000); }, 10000);
}; };
...@@ -601,7 +601,7 @@ class VerticalPage extends Component { ...@@ -601,7 +601,7 @@ class VerticalPage extends Component {
priceVisible, priceVisible,
stype, stype,
isCard, isCard,
nobuyModal, noBuyModal,
} = this.state; } = this.state;
pageSize = pageSize =
goods && goods.bags.length > 0 goods && goods.bags.length > 0
...@@ -642,7 +642,7 @@ class VerticalPage extends Component { ...@@ -642,7 +642,7 @@ class VerticalPage extends Component {
this.state.faceType === 'wxpay' ? this.wxFacepay : this.smilepay; this.state.faceType === 'wxpay' ? this.wxFacepay : this.smilepay;
return ( return (
<View style={{flex: 1, position: 'relative'}}> <View style={{flex: 1, position: 'relative'}}>
<Modal visible={nobuyModal} transparent> <Modal visible={noBuyModal} transparent>
<View> <View>
<Touch <Touch
style={{ style={{
...@@ -650,7 +650,7 @@ class VerticalPage extends Component { ...@@ -650,7 +650,7 @@ class VerticalPage extends Component {
height: '100%', height: '100%',
backgroundColor: 'rgba(0, 0, 0, .5)', backgroundColor: 'rgba(0, 0, 0, .5)',
}} }}
onPress={() => this.setState({nobuyModal: false})}> onPress={() => this.setState({noBuyModal: false})}>
<View /> <View />
</Touch> </Touch>
<View style={styles.HintPhone}> <View style={styles.HintPhone}>
...@@ -687,7 +687,7 @@ class VerticalPage extends Component { ...@@ -687,7 +687,7 @@ class VerticalPage extends Component {
<Text style={styles.callText}>呼叫客服</Text> <Text style={styles.callText}>呼叫客服</Text>
</View> </View>
</Touch> </Touch>
<Touch onPress={() => this.showNobuyModal()}> <Touch onPress={() => this.shownoBuyModal()}>
<View style={styles.guardModal_button_nobuy}> <View style={styles.guardModal_button_nobuy}>
<Text style={styles.callText}>无购物出店</Text> <Text style={styles.callText}>无购物出店</Text>
</View> </View>
......
...@@ -35,8 +35,8 @@ export function door({userId}) { ...@@ -35,8 +35,8 @@ export function door({userId}) {
return axios.post('/store/door', qs.stringify({userId})); return axios.post('/store/door', qs.stringify({userId}));
} }
export function open() { export function open({orderId}) {
return axios.post('/store/openDoor'); return axios.post('/store/openDoor', qs.stringify({orderId}));
} }
export function wxdoor({ export function wxdoor({
......
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