Commit f804bbfa by chenxu

收银台去除分页;

收银台同上商品不分开显示;
parent cdafda05
...@@ -532,8 +532,18 @@ const CounterMixins = ComposeComponent => { ...@@ -532,8 +532,18 @@ const CounterMixins = ComposeComponent => {
} // 称重计价不可修改数量 } // 称重计价不可修改数量
this.goodsMap[barcode] = data.data; this.goodsMap[barcode] = data.data;
let dataReal = data.data; let dataReal = data.data;
dataReal.num = data.data.num || 1; let t = 0;
goodsArr.push({...dataReal}); for (let i = 0; i < goodsArr.length; i++) {
if (goodsArr[i].barcode === barcode) {
goodsArr[i].num += 1;
} else {
t++;
}
}
if (t === goodsArr.length) {
dataReal.num = data.data.num || 1;
goodsArr.push({...dataReal});
}
const current = Math.ceil(goodsArr.length / window.pageSize); const current = Math.ceil(goodsArr.length / window.pageSize);
this.setState({ this.setState({
current, current,
......
...@@ -4,7 +4,6 @@ import AsyncStorage from '@react-native-community/async-storage'; ...@@ -4,7 +4,6 @@ import AsyncStorage from '@react-native-community/async-storage';
import Swiper from 'react-native-swiper'; import Swiper from 'react-native-swiper';
import QRCode from 'react-native-qrcode-svg'; import QRCode from 'react-native-qrcode-svg';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import Icons from 'react-native-vector-icons/MaterialIcons';
// import { connect } from 'react-redux'; // import { connect } from 'react-redux';
import CounterMixins from './CounterMixins'; import CounterMixins from './CounterMixins';
import NP from '../utils/np'; import NP from '../utils/np';
...@@ -327,6 +326,7 @@ class VerticalPage extends Component { ...@@ -327,6 +326,7 @@ class VerticalPage extends Component {
<View style={styles.ThStyleMoney}> <View style={styles.ThStyleMoney}>
<Text style={styles.ThText}>金额</Text> <Text style={styles.ThText}>金额</Text>
</View> </View>
<View />
</View> </View>
</View> </View>
<View <View
...@@ -484,7 +484,6 @@ class VerticalPage extends Component { ...@@ -484,7 +484,6 @@ class VerticalPage extends Component {
goods, goods,
goodsArr, goodsArr,
qrHost, qrHost,
current,
autoplayTime, autoplayTime,
imgArr, imgArr,
adType, adType,
...@@ -507,8 +506,8 @@ class VerticalPage extends Component { ...@@ -507,8 +506,8 @@ class VerticalPage extends Component {
} }
window.pageSize = pageSize; window.pageSize = pageSize;
contact = contact || '未授权'; contact = contact || '未授权';
let goodsLength = Math.ceil(parseFloat(goodsArr.length / pageSize)); // let goodsLength = Math.ceil(parseFloat(goodsArr.length / pageSize));
let gaTemp = goodsArr.slice((current - 1) * pageSize, current * pageSize); // let gaTemp = goodsArr.slice((current - 1) * pageSize, current * pageSize);
let total = 0; // 总数量 let total = 0; // 总数量
let totalPrice = 0; // 总价 let totalPrice = 0; // 总价
let totalCount = 0; // 总优惠 let totalCount = 0; // 总优惠
...@@ -549,80 +548,16 @@ class VerticalPage extends Component { ...@@ -549,80 +548,16 @@ class VerticalPage extends Component {
</View> </View>
<View style={styles.container}> <View style={styles.container}>
<View style={{flexDirection: 'row', flex: 1}}> <View style={{flexDirection: 'row', flex: 1}}>
<View style={{width: '90%'}}> <View style={{width: '100%'}}>
<FlatList <FlatList
style={styles.goodsStyle} style={styles.goodsStyle}
ListHeaderComponent={this.renderHeader} ListHeaderComponent={this.renderHeader}
keyExtractor={this.keyExtractor} keyExtractor={this.keyExtractor}
horizontal={false} horizontal={false}
data={gaTemp} data={goodsArr}
renderItem={({item, index}) => this.renderCell(item, index)} renderItem={({item, index}) => this.renderCell(item, index)}
/> />
</View> </View>
<View
style={{
width: '10%',
flexDirection: 'column',
position: 'relative',
}}>
<View
style={{
height: width > 801 ? 81 : scaleHeight(118),
backgroundColor: '#fff',
}}
/>
<View style={{height: width > 801 ? 8 : scaleHeight(17.1)}} />
<View style={styles.pagination}>
<Touch
disabled={current <= 1}
onPress={() => this.props.dropUp()}>
<Image
source={
current > 1
? require('../assets/Vertical/arrowu01.png')
: require('../assets/Vertical/arrowu02.png')
}
style={styles.imgPagination}
/>
</Touch>
<Text style={styles.paginationText}>
{goodsLength === 0 ? 0 : current}/{goodsLength}
</Text>
<Touch
disabled={current >= goodsLength}
onPress={() => this.props.dropDown(goodsLength)}>
<Image
source={
current < goodsLength
? require('../assets/Vertical/arrowd01.png')
: require('../assets/Vertical/arrowd02.png')
}
style={styles.imgPagination}
/>
</Touch>
</View>
{!admin.autoClick && (
<Touch
onPress={this.setting}
style={{
position: 'absolute',
width: scaleSize(100),
height: scaleSize(100),
bottom: scaleSize(100),
right: 0,
backgroundColor: 'rgba(0,0,0,0.1)',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 10,
zIndex: 999,
}}>
<Icons
name="accessibility"
style={{fontSize: setSpText(60), color: '#fff'}}
/>
</Touch>
)}
</View>
</View> </View>
<View <View
style={ style={
...@@ -1255,7 +1190,7 @@ const styles = { ...@@ -1255,7 +1190,7 @@ const styles = {
flexDirection: 'row', flexDirection: 'row',
}, },
firstThStyle: { firstThStyle: {
width: '33%', width: '30%',
alignItems: 'flex-start', alignItems: 'flex-start',
justifyContent: 'center', justifyContent: 'center',
paddingTop: width > 801 ? 18 : scaleHeight(30), paddingTop: width > 801 ? 18 : scaleHeight(30),
...@@ -1273,7 +1208,7 @@ const styles = { ...@@ -1273,7 +1208,7 @@ const styles = {
paddingRight: width > 801 ? 10 : scaleSize(20), paddingRight: width > 801 ? 10 : scaleSize(20),
}, },
ThStyleMoney: { ThStyleMoney: {
width: '27%', width: '30%',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
paddingTop: width > 801 ? 18 : scaleHeight(30), paddingTop: width > 801 ? 18 : scaleHeight(30),
...@@ -1293,7 +1228,7 @@ const styles = { ...@@ -1293,7 +1228,7 @@ const styles = {
backgroundColor: '#F0F0F0', backgroundColor: '#F0F0F0',
}, },
firstTdStyle: { firstTdStyle: {
width: '33%', width: '30%',
alignItems: 'flex-start', alignItems: 'flex-start',
justifyContent: 'center', justifyContent: 'center',
paddingTop: width > 801 ? 18 : scaleHeight(30), paddingTop: width > 801 ? 18 : scaleHeight(30),
...@@ -1313,7 +1248,7 @@ const styles = { ...@@ -1313,7 +1248,7 @@ const styles = {
}, },
TdStyleMoney: { TdStyleMoney: {
flexDirection: 'row', flexDirection: 'row',
width: '27%', width: '30%',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
paddingTop: width > 801 ? 18 : scaleHeight(30), paddingTop: width > 801 ? 18 : scaleHeight(30),
...@@ -1324,7 +1259,7 @@ const styles = { ...@@ -1324,7 +1259,7 @@ const styles = {
}, },
iconStyle: { iconStyle: {
position: 'absolute', position: 'absolute',
right: 0, right: 20,
}, },
TdText: { TdText: {
fontSize: width > 801 ? 25 : setSpText(30), fontSize: width > 801 ? 25 : setSpText(30),
......
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