Commit fc72d23f by 黄日华

感应进店后续前端修改

parent c9ecd7bb
......@@ -19,6 +19,8 @@ import {width, height, scaleSize} from '../utils/screen';
import EnterEvent from '../utils/EnterEvent';
import Printer from '../utils/Printer';
import AutoClick from '../utils/AutoClick';
import QRCode from 'react-native-qrcode-svg';
import {login, ossLink} from '../utils/config';
window.RN = RN;
window.Toast = Toast;
......@@ -67,6 +69,8 @@ const CounterMixins = ComposeComponent => {
printer: [],
receiptTime: 5,
cloudFinishModal: false,
noBuyModal: false,
logoVisible: true,
};
componentWillMount = async () => {
......@@ -81,6 +85,8 @@ const CounterMixins = ComposeComponent => {
adType: data.data.type,
});
}
this.initSetting();
await this.refreshLogo();
const stype = await AsyncStorage.getItem('STYPE');
const qrHost = await AsyncStorage.getItem('QRHOST');
await this.setState({qrHost, stype});
......@@ -128,6 +134,46 @@ const CounterMixins = ComposeComponent => {
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 => {
Toast.hide();
if (!cardId) return;
......@@ -945,6 +991,7 @@ const CounterMixins = ComposeComponent => {
onOpen = async () => {
const {data} = await this.props.dispatch({
type: 'store/open',
orderId: this.orderId,
});
if (data.code === 1) {
this.setState({
......@@ -952,12 +999,15 @@ const CounterMixins = ComposeComponent => {
});
Speech.speak(data.msg || '门已经打开,谢谢惠顾');
} else {
Toast.info(data.msg || '开门失败,请联系客服处理', 2);
Speech.speak(data.msg || '开门失败,请联系客服处理');
await this.setState({
cloudFinishModal: false,
});
this.setState({
noBuyModal: true,
});
setTimeout(() => {
this.setState({
cloudFinishModal: false,
});
this.setState({noBuyModal: false});
}, 10000);
}
this.clearList();
......@@ -981,9 +1031,55 @@ const CounterMixins = ComposeComponent => {
amount,
visible,
receiptTime,
noBuyModal,
logoVisible,
qrHost,
} = this.state;
return (
<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>
{/*<View style={{width,height,backgroundColor:'rgba(0,0,0,.5)'}} />*/}
<View
......@@ -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;
......@@ -52,7 +52,7 @@ class VerticalPage extends Component {
priceVisible: true,
isCard: false,
cardVisible: false,
nobuyModal: false,
noBuyModal: false,
};
async componentWillMount() {
......@@ -574,12 +574,12 @@ class VerticalPage extends Component {
}, 8000);
};
showNobuyModal = () => {
shownoBuyModal = () => {
Speech.speak('请扫码出店');
this.setState({nobuyModal: true});
this.setState({noBuyModal: true});
clearTimeout(this.nobuyTimeout);
this.nobuyTimeout = setTimeout(() => {
this.setState({nobuyModal: false});
this.setState({noBuyModal: false});
}, 10000);
};
......@@ -601,7 +601,7 @@ class VerticalPage extends Component {
priceVisible,
stype,
isCard,
nobuyModal,
noBuyModal,
} = this.state;
pageSize =
goods && goods.bags.length > 0
......@@ -642,7 +642,7 @@ class VerticalPage extends Component {
this.state.faceType === 'wxpay' ? this.wxFacepay : this.smilepay;
return (
<View style={{flex: 1, position: 'relative'}}>
<Modal visible={nobuyModal} transparent>
<Modal visible={noBuyModal} transparent>
<View>
<Touch
style={{
......@@ -650,7 +650,7 @@ class VerticalPage extends Component {
height: '100%',
backgroundColor: 'rgba(0, 0, 0, .5)',
}}
onPress={() => this.setState({nobuyModal: false})}>
onPress={() => this.setState({noBuyModal: false})}>
<View />
</Touch>
<View style={styles.HintPhone}>
......@@ -687,7 +687,7 @@ class VerticalPage extends Component {
<Text style={styles.callText}>呼叫客服</Text>
</View>
</Touch>
<Touch onPress={() => this.showNobuyModal()}>
<Touch onPress={() => this.shownoBuyModal()}>
<View style={styles.guardModal_button_nobuy}>
<Text style={styles.callText}>无购物出店</Text>
</View>
......
......@@ -35,8 +35,8 @@ export function door({userId}) {
return axios.post('/store/door', qs.stringify({userId}));
}
export function open() {
return axios.post('/store/openDoor');
export function open({orderId}) {
return axios.post('/store/openDoor', qs.stringify({orderId}));
}
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