|
|
import React, { Component } from 'react';
|
|
|
import { Dimensions, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
|
import { Dimensions, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
|
import { connect } from 'react-redux';
|
|
|
import Immutable, { List } from 'immutable';
|
|
|
|
|
|
import Focus from './floor/Focus';
|
|
|
|
|
|
const { width } = Dimensions.get('window');
|
|
|
const DEVICE_WIDTH_RATIO = width / 375;
|
|
|
|
|
|
export default class ShareDetail extends Component {
|
|
|
function mapStateToProps(store) {
|
|
|
const { shareDetail } = store;
|
|
|
return {
|
|
|
shareDetail
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class ShareDetail extends Component {
|
|
|
state = { opacity: 0 }
|
|
|
render() {
|
|
|
let productInfo = this.props.shareDetail.get('productInfo').toJS();
|
|
|
let { goodsList: [ goodsInfo = {} ], productPriceBo = {} } = productInfo;
|
|
|
let { goodsImagesList } = goodsInfo;
|
|
|
let imgList = goodsImagesList && goodsImagesList.map(item => ({src: item.imageUrl}));
|
|
|
imgList = Immutable.fromJS(imgList);
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<View style={[styles.navigatorBackground, {opacity: this.state.opacity}]}>
|
|
|
</View>
|
|
|
<View style={styles.navigatorContainer}>
|
|
|
<View style={[styles.navigatorBtn, {opacity: 0.4 - this.state.opacity}]} />
|
|
|
<View style={[styles.navigatorBtn, styles.center, {opacity: 0.4 - this.state.opacity}]} >
|
|
|
<TouchableOpacity onPress={() => this.props.goBack()}>
|
|
|
<Image source={require('../images/home_drawer_back.png')} />
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
<View style={styles.navigatorBtnRightContainer}>
|
|
|
<View style={[styles.navigatorBtn,styles.navigatorBtnRight, {opacity: 0.4 - this.state.opacity}]} />
|
|
|
<View style={[styles.navigatorBtn,styles.navigatorBtnRight, {opacity: 0.4 - this.state.opacity}]}>
|
|
|
<TouchableOpacity onPress={() => null}>
|
|
|
<Image source={require('../images/yh_prd_more_icon.png')} />
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
<ScrollView
|
...
|
...
|
@@ -22,21 +46,26 @@ export default class ShareDetail extends Component { |
|
|
showsVerticalScrollIndicator={false}
|
|
|
onScroll={(e) => this.changeOpacity(e)}>
|
|
|
<View style={[styles.imgContainer]}>
|
|
|
<Focus
|
|
|
data={imgList}
|
|
|
height={480}
|
|
|
resourceJumpWithUrl={this.props.resourceJumpWithUrl}
|
|
|
/>
|
|
|
</View>
|
|
|
<View style={styles.infoContainer}>
|
|
|
<Text style={styles.name}>CHRISTINA DADA</Text>
|
|
|
<Text style={styles.name}>{productInfo.productName}</Text>
|
|
|
<View style={styles.priceContainer}>
|
|
|
<View style={styles.alignBottom}>
|
|
|
<Text style={styles.priceUnit}>¥</Text>
|
|
|
<Text style={styles.price}>99.9</Text>
|
|
|
<Text style={styles.price}>{productPriceBo.salesPrice}</Text>
|
|
|
<Text style={styles.origpriceUnit}>¥</Text>
|
|
|
<Text style={styles.origPrice}>2999</Text>
|
|
|
<Text style={styles.origPrice}>{productPriceBo.marketPrice}</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
<View style={styles.divider} />
|
|
|
<View style={styles.promContainer}>
|
|
|
<Text style={styles.proDesc}>新客订单返现10%,老客订单返现3%(预计最高返现¥9.9)</Text>
|
|
|
<Text style={styles.proDesc}>{productInfo.phrase}</Text>
|
|
|
</View>
|
|
|
<View style={styles.recommendContainer}>
|
|
|
<View style={styles.solid} />
|
...
|
...
|
@@ -46,10 +75,16 @@ export default class ShareDetail extends Component { |
|
|
</ScrollView>
|
|
|
<View style={styles.bottomBar}>
|
|
|
<View style={[styles.favContainer, styles.center]}>
|
|
|
<TouchableOpacity onPress={() => null} style={styles.favorite} />
|
|
|
<TouchableOpacity onPress={() => null} style={[styles.center]}>
|
|
|
<Image
|
|
|
style={styles.favorite}
|
|
|
resizeMode="center"
|
|
|
source={productInfo.isCollect === 'Y' ? require('../../recorder/images/brand/heart_ic_h.png') : require('../../recorder/images/brand/heart_ic_n.png')} />
|
|
|
<Text style={styles.favText}>收藏</Text>
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
<View style={styles.buttonContainer}>
|
|
|
<TouchableOpacity onPress={() => null}>
|
|
|
<TouchableOpacity onPress={() => this.props.jumpWithUrl()}>
|
|
|
<View style={[styles.button, styles.center]}>
|
|
|
<Text style={styles.btnText}>查看商品详情</Text>
|
|
|
</View>
|
...
|
...
|
@@ -66,7 +101,7 @@ export default class ShareDetail extends Component { |
|
|
}
|
|
|
|
|
|
changeOpacity(e) {
|
|
|
let opacity = 1 - (600 - e.nativeEvent.contentOffset.y) / 600;
|
|
|
let opacity = 1 - (500 - e.nativeEvent.contentOffset.y) / 500;
|
|
|
this.setState({opacity: opacity < 0.4 ? opacity : 0.4});
|
|
|
console.log(e.nativeEvent.contentOffset.y);
|
|
|
}
|
...
|
...
|
@@ -82,9 +117,9 @@ const styles = StyleSheet.create({ |
|
|
width,
|
|
|
position: 'absolute',
|
|
|
top: 0,
|
|
|
zIndex: 10
|
|
|
},
|
|
|
navigatorContainer: {
|
|
|
backgroundColor: 'transparent',
|
|
|
height: 44 * DEVICE_WIDTH_RATIO,
|
|
|
flexDirection: 'row',
|
|
|
alignItems: 'center',
|
...
|
...
|
@@ -139,7 +174,7 @@ const styles = StyleSheet.create({ |
|
|
priceUnit: {
|
|
|
fontSize: 14,
|
|
|
color: '#D0021B',
|
|
|
lineHeight: 14,
|
|
|
lineHeight: 22,
|
|
|
},
|
|
|
price: {
|
|
|
fontSize: 22,
|
...
|
...
|
@@ -206,11 +241,12 @@ const styles = StyleSheet.create({ |
|
|
marginHorizontal: 8 * DEVICE_WIDTH_RATIO,
|
|
|
},
|
|
|
favorite: {
|
|
|
height: 24,
|
|
|
width: 24,
|
|
|
borderWidth: 1,
|
|
|
borderRadius: 12,
|
|
|
marginHorizontal: 25
|
|
|
width: 26 * DEVICE_WIDTH_RATIO,
|
|
|
height: 26 * DEVICE_WIDTH_RATIO,
|
|
|
},
|
|
|
favText: {
|
|
|
fontSize: 9,
|
|
|
color: '#B0B0B0'
|
|
|
},
|
|
|
buttonContainer: {
|
|
|
flex: 1,
|
...
|
...
|
@@ -232,4 +268,6 @@ const styles = StyleSheet.create({ |
|
|
fontSize: 15,
|
|
|
lineHeight: 21,
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
|
|
})
|
|
|
|
|
|
export default connect(mapStateToProps)(ShareDetail); |
|
|
\ No newline at end of file |
...
|
...
|
|