Commit 4ce9a942 by 修福龙

收银台界面袋子可分为两行

parent a14b0e8f
...@@ -365,7 +365,19 @@ class VerticalPage extends Component { ...@@ -365,7 +365,19 @@ class VerticalPage extends Component {
render() { render() {
let {admin, goods, goodsArr, qrHost, current} = this.props; let {admin, goods, goodsArr, qrHost, current} = this.props;
let {contact} = this.state; let {contact} = this.state;
pageSize = goods && goods.bags.length > 0 ? 7 : pageSize; pageSize =
goods && goods.bags.length > 0
? goods && goods.bags.length > 6
? 6
: 7
: pageSize;
let bagsData = [];
if (goods && goods.bags) {
let num = Math.ceil(goods.bags.length / 3);
for (let i = 0; i < num; i++) {
bagsData.push(goods.bags.slice(i * 3, i * 3 + 3));
}
}
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));
...@@ -473,22 +485,44 @@ class VerticalPage extends Component { ...@@ -473,22 +485,44 @@ class VerticalPage extends Component {
<Text style={styles.btnText}>清除商品</Text> <Text style={styles.btnText}>清除商品</Text>
</Touch> </Touch>
</View> </View>
<View style={styles.bag}> {bagsData.map((v1, k) => {
{goods.bags.map((v, k) => { return (
return ( <View
<Touch key={k} onPress={() => this.props.pushBag(k)}> key={k}
<View style={styles.btnBag}> style={goods.bags.length <= 3 ? styles.bag : styles.bagMore}>
<Image {v1.map((v2, i) => {
source={require('../assets/Vertical/buy.png')} return (
style={styles.btnImage} <Touch key={i} onPress={() => this.props.pushBag(i)}>
/> <View style={styles.btnBag}>
<Text style={styles.textBag}>{v.name}</Text> <Image
<Text style={styles.textBag}>{v.price}</Text> source={require('../assets/Vertical/buy.png')}
</View> style={styles.btnImage}
</Touch> />
); <Text style={styles.textBag}>{v2.name}</Text>
})} <Text style={styles.textBag}>{v2.price}</Text>
</View> </View>
</Touch>
);
})}
</View>
);
})}
{/*<View style={styles.bag}>*/}
{/* {goods.bags.map((v, k) => {*/}
{/* return (*/}
{/* <Touch key={k} onPress={() => this.props.pushBag(k)}>*/}
{/* <View style={styles.btnBag}>*/}
{/* <Image*/}
{/* source={require('../assets/Vertical/buy.png')}*/}
{/* style={styles.btnImage}*/}
{/* />*/}
{/* <Text style={styles.textBag}>{v.name}</Text>*/}
{/* <Text style={styles.textBag}>{v.price}</Text>*/}
{/* </View>*/}
{/* </Touch>*/}
{/* );*/}
{/* })}*/}
{/*</View>*/}
<View style={styles.shadow} /> <View style={styles.shadow} />
<Touch onPress={this.wxFacepay}> <Touch onPress={this.wxFacepay}>
<View style={styles.guide}> <View style={styles.guide}>
...@@ -740,6 +774,14 @@ const styles = { ...@@ -740,6 +774,14 @@ const styles = {
backgroundColor: '#F0F0F0', backgroundColor: '#F0F0F0',
// paddingBottom: 20, // paddingBottom: 20,
}, },
bagMore: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-start',
backgroundColor: '#F0F0F0',
marginLeft: '5%',
// paddingBottom: 20,
},
btnBag: { btnBag: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
......
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