Commit 0fb65816 by 黄日华

设置无码商品,刷卡切换

parent 468dc578
...@@ -53,6 +53,9 @@ export default { ...@@ -53,6 +53,9 @@ export default {
? yield call(api.token, action) ? yield call(api.token, action)
: yield call(api.refreshToken); : yield call(api.refreshToken);
if (data && data.code === 1) { if (data && data.code === 1) {
if (data.data && data.data.closeNoBarcode) {
yield call(AsyncStorage.setItem, 'closeNoBarcode', '1');
}
if (data.data && data.data.type) { if (data.data && data.data.type) {
// 设备类型 // 设备类型
yield call(AsyncStorage.setItem, 'STYPE', data.data.type); yield call(AsyncStorage.setItem, 'STYPE', data.data.type);
......
...@@ -76,6 +76,7 @@ const CounterMixins = ComposeComponent => { ...@@ -76,6 +76,7 @@ const CounterMixins = ComposeComponent => {
numberValue: '', numberValue: '',
human: false, human: false,
totalNum: 0, totalNum: 0,
hasCard: false,
}; };
componentWillMount = async () => { componentWillMount = async () => {
...@@ -187,8 +188,9 @@ const CounterMixins = ComposeComponent => { ...@@ -187,8 +188,9 @@ const CounterMixins = ComposeComponent => {
const state = {priceVisible: data.data.priceVisible}; const state = {priceVisible: data.data.priceVisible};
if (data.data.cardCounter) { if (data.data.cardCounter) {
// 是否支持刷卡 // 是否支持刷卡
state.isCard = true; // state.isCard = true;
window.cardCounter = data.data.cardCounter; // window.cardCounter = data.data.cardCounter;
state.hasCard = true;
} }
if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`; if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`;
this.setState(state); this.setState(state);
......
...@@ -39,6 +39,8 @@ window.restart = Restart.restartApp; ...@@ -39,6 +39,8 @@ window.restart = Restart.restartApp;
let pageSize = 8; // 分页大小 let pageSize = 8; // 分页大小
window.pageSize = pageSize; window.pageSize = pageSize;
let cardCount = 0;
class VerticalPage extends Component { class VerticalPage extends Component {
state = { state = {
contact: '', contact: '',
...@@ -51,17 +53,20 @@ class VerticalPage extends Component { ...@@ -51,17 +53,20 @@ class VerticalPage extends Component {
logoVisible: true, logoVisible: true,
logo: '', logo: '',
priceVisible: true, priceVisible: true,
isCard: false, isCard: 0,
cardVisible: false, cardVisible: false,
noBuyModal: false, noBuyModal: false,
hasCard: false,
closeNoBarcode: 0,
}; };
async componentWillMount() { async componentWillMount() {
let stype = await AsyncStorage.getItem('STYPE'); let stype = await AsyncStorage.getItem('STYPE');
let contact = await AsyncStorage.getItem('CONTACT'); let contact = await AsyncStorage.getItem('CONTACT');
let closeNoBarcode = await AsyncStorage.getItem('closeNoBarcode');
// let lock = await AsyncStorage.getItem('settingLock'); // let lock = await AsyncStorage.getItem('settingLock');
// if (lock) this.props.dispatch({ type: 'app/lock', lock }); // if (lock) this.props.dispatch({ type: 'app/lock', lock });
this.setState({stype, contact}); this.setState({stype, contact, closeNoBarcode: Number(closeNoBarcode)});
this.storeKey = await AsyncStorage.getItem('KEY'); this.storeKey = await AsyncStorage.getItem('KEY');
if (!this.init) { if (!this.init) {
this.init = await WxFacepay.initialize(10000); this.init = await WxFacepay.initialize(10000);
...@@ -154,8 +159,14 @@ class VerticalPage extends Component { ...@@ -154,8 +159,14 @@ class VerticalPage extends Component {
const state = {priceVisible: data.data.priceVisible}; const state = {priceVisible: data.data.priceVisible};
if (data.data.cardCounter) { if (data.data.cardCounter) {
// 是否支持刷卡 // 是否支持刷卡
state.isCard = true; // state.isCard = true;
window.cardCounter = data.data.cardCounter; // window.cardCounter = data.data.cardCounter;
this.hasCardCounter = data.data.cardCounter;
state.hasCard = true;
state.isCard = Number((await AsyncStorage.getItem('isCard')) || 0);
if (state.isCard) {
window.cardCounter = this.hasCardCounter;
}
} }
if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`; if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`;
this.setState(state); this.setState(state);
...@@ -586,6 +597,36 @@ class VerticalPage extends Component { ...@@ -586,6 +597,36 @@ class VerticalPage extends Component {
}, 30000); }, 30000);
}; };
cardFirstStep = () => {
cardCount++;
if (cardCount === 3 && this.state.hasCard) {
this.setState({
isCard: 1,
});
window.cardCounter = this.hasCardCounter;
AsyncStorage.setItem('isCard', '1');
cardCount = 0;
}
setTimeout(() => {
cardCount = 0;
}, 2000);
};
cardSecondStep = () => {
cardCount++;
if (cardCount === 3 && this.state.hasCard) {
this.setState({
isCard: 0,
});
window.cardCounter = null;
AsyncStorage.setItem('isCard', '0');
cardCount = 0;
}
setTimeout(() => {
cardCount = 0;
}, 2000);
};
render() { render() {
let { let {
admin, admin,
...@@ -606,6 +647,7 @@ class VerticalPage extends Component { ...@@ -606,6 +647,7 @@ class VerticalPage extends Component {
stype, stype,
isCard, isCard,
noBuyModal, noBuyModal,
closeNoBarcode,
} = this.state; } = this.state;
pageSize = pageSize =
goods && goods.bags.length > 0 goods && goods.bags.length > 0
...@@ -722,6 +764,7 @@ class VerticalPage extends Component { ...@@ -722,6 +764,7 @@ class VerticalPage extends Component {
justifyContent: 'flex-end', justifyContent: 'flex-end',
alignItems: 'center', alignItems: 'center',
}}> }}>
{!closeNoBarcode ? (
<Touch onPress={() => this.props.handleCodeless()}> <Touch onPress={() => this.props.handleCodeless()}>
<View <View
style={[ style={[
...@@ -731,6 +774,14 @@ class VerticalPage extends Component { ...@@ -731,6 +774,14 @@ class VerticalPage extends Component {
<Text style={styles.callText}>无码商品</Text> <Text style={styles.callText}>无码商品</Text>
</View> </View>
</Touch> </Touch>
) : (
<View
style={[
styles.guardModal_button_nobuy,
{marginRight: 50, opacity: 0},
]}
/>
)}
<Touch onPress={() => this.props.handleBarcode()}> <Touch onPress={() => this.props.handleBarcode()}>
<View style={styles.guardModal_button_nobuy}> <View style={styles.guardModal_button_nobuy}>
<Text style={styles.callText}>输入条码</Text> <Text style={styles.callText}>输入条码</Text>
...@@ -1006,7 +1057,7 @@ class VerticalPage extends Component { ...@@ -1006,7 +1057,7 @@ class VerticalPage extends Component {
style={{backgroundColor: '#fc4000', marginRight: 50}}> style={{backgroundColor: '#fc4000', marginRight: 50}}>
<Text style={styles.btnText}>输入条码</Text> <Text style={styles.btnText}>输入条码</Text>
</Touch> </Touch>
{priceVisible && ( {priceVisible && !closeNoBarcode && (
<Touch <Touch
onPress={() => this.props.handleCodeless()} onPress={() => this.props.handleCodeless()}
style={{ style={{
...@@ -1138,10 +1189,12 @@ class VerticalPage extends Component { ...@@ -1138,10 +1189,12 @@ class VerticalPage extends Component {
</View> </View>
<View style={styles.paymentRight}> <View style={styles.paymentRight}>
{isCard ? ( {isCard ? (
<Touch onPress={() => this.cardSecondStep()}>
<Image <Image
style={{width: scaleSize(200), height: scaleSize(200)}} style={{width: scaleSize(200), height: scaleSize(200)}}
source={require('../assets/logo2.png')} source={require('../assets/logo2.png')}
/> />
</Touch>
) : ( ) : (
<View style={styles.paymentRightTitle}> <View style={styles.paymentRightTitle}>
<View style={styles.paymentRightContents}> <View style={styles.paymentRightContents}>
...@@ -1158,6 +1211,7 @@ class VerticalPage extends Component { ...@@ -1158,6 +1211,7 @@ class VerticalPage extends Component {
alt="" alt=""
/> />
</View> </View>
<Touch onPress={() => this.cardFirstStep()}>
<View style={styles.paymentRightCode}> <View style={styles.paymentRightCode}>
<QRCode <QRCode
logoSize={width > 801 ? 60 : scaleSize(75)} logoSize={width > 801 ? 60 : scaleSize(75)}
...@@ -1169,6 +1223,7 @@ class VerticalPage extends Component { ...@@ -1169,6 +1223,7 @@ class VerticalPage extends Component {
}`} }`}
/> />
</View> </View>
</Touch>
</View> </View>
)} )}
</View> </View>
......
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