...
|
...
|
@@ -16,9 +16,8 @@ import Tags from './Tags'; |
|
|
import GPTags from './GPTags';
|
|
|
import DeleteLineText from '../DeleteLineText';
|
|
|
import YH_Image from '../YH_Image';
|
|
|
import SimilarProductAnim from './SimilarProductAnim';
|
|
|
import SimilarProductGuider from './SimilarProductGuider';
|
|
|
import Immutable, {Map} from 'immutable';
|
|
|
import DeviceInfo from 'react-native-device-info';
|
|
|
|
|
|
export default class ProductListCell extends Component {
|
|
|
|
...
|
...
|
@@ -42,25 +41,15 @@ export default class ProductListCell extends Component { |
|
|
|
|
|
_renderTags() {
|
|
|
let {data, sourceType} = this.props;
|
|
|
let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
|
|
|
let showGPLimitTag = isGlobalProduct && data.get('is_limited') && data.get('is_limited') == 'Y'; // 全球购限量商品
|
|
|
|
|
|
let tags = data.get('tags'); // 商品标签
|
|
|
// 数据源是全球购
|
|
|
if (sourceType == 1) {
|
|
|
if (isGlobalProduct) {
|
|
|
|
|
|
} else {
|
|
|
tags = ['is_in_stock', ...tags];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let countryName = isGlobalProduct && data.get('country_name'); // 全球购国家名称
|
|
|
|
|
|
let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
|
|
|
return <Tags items={data.get('tags')}/>;
|
|
|
if (isGlobalProduct) {
|
|
|
let showGPLimitTag = data.get('is_limited') && data.get('is_limited') == 'Y'; // 全球购限量商品
|
|
|
let countryName = data.get('country_name'); // 全球购国家名称
|
|
|
|
|
|
return <GPTags title={countryName} limit={showGPLimitTag}/>;
|
|
|
} else {
|
|
|
return <Tags items={tags}/>;
|
|
|
return <Tags items={data.get('tags')}/>;
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -69,36 +58,48 @@ export default class ProductListCell extends Component { |
|
|
|
|
|
let url = data.get('default_images', '').replace('{mode}', 2)
|
|
|
.replace(/{width}/g, 290)
|
|
|
.replace(/{height}/g, 386)
|
|
|
.replace(/{height}/g, 386);
|
|
|
|
|
|
if (Platform.OS === 'ios') {
|
|
|
let systemVersion = DeviceInfo.getSystemVersion();
|
|
|
let versionArray = systemVersion.split('.');
|
|
|
let version = versionArray[0];
|
|
|
if (version == 9) {
|
|
|
url = data.get('default_images', '').replace('{mode}', 2)
|
|
|
.replace(/{width}/g, 290/2)
|
|
|
.replace(/{height}/g, 386/2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
|
|
|
|
|
|
let showGPLimitTag = isGlobalProduct && data.get('is_limited') && data.get('is_limited') == 'Y'; // 全球购限量商品
|
|
|
let showGPSoldOut = isGlobalProduct && data.get('is_stock') && data.get('is_stock') == 'Y'; // 全球购售罄
|
|
|
if (isGlobalProduct) {
|
|
|
let showGPSoldOut = isGlobalProduct && data.get('is_stock') && data.get('is_stock') == 'Y'; // 全球购售罄
|
|
|
|
|
|
let showAlmostSoldOut = !isGlobalProduct && data.get('tags', []).indexOf('is_soon_sold_out') !== -1; // 非全球购的即将售罄
|
|
|
let showSoldOut = !isGlobalProduct && data.get('tags', []).indexOf('is_solded') !== -1; // 非全球购的即将售罄
|
|
|
return (
|
|
|
<View style={styles.imageContainer}>
|
|
|
<YH_Image style={styles.image} url={url}>
|
|
|
{showGPSoldOut ? <Image style={styles.gpSoldOutImage} source={require('../../images/tag/gp_tip_SQ.png')}/> : null}
|
|
|
</YH_Image>
|
|
|
</View>
|
|
|
);
|
|
|
} else {
|
|
|
|
|
|
let showAlmostSoldOut = data.get('tags', []).indexOf('is_soon_sold_out') !== -1; // 非全球购的即将售罄
|
|
|
let showSoldOut = data.get('tags', []).indexOf('is_solded') !== -1; // 非全球购的即将售罄
|
|
|
let showOutletSoldOut = sourceType == 2 && data.get('storage_num') && data.get('storage_num') == 0; // 数据源是奥莱才显示
|
|
|
|
|
|
return (
|
|
|
<View style={styles.imageContainer}>
|
|
|
<YH_Image style={styles.image} url={url}>
|
|
|
{rowID == similarIndex?
|
|
|
<SimilarProductAnim
|
|
|
onPressFindSimilar={this.props.onPressFindSimilar}
|
|
|
product={data}
|
|
|
similarIndex={similarIndex}
|
|
|
onPressDislike={this.props.onPressDislike}
|
|
|
/>
|
|
|
:null}
|
|
|
{showAlmostSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_jjsq.png')}/> : null}
|
|
|
{showOutletSoldOut ? <Image style={styles.soldOutImage} source={require('../../images/tag/outlet_sellout_bg.png')}/> : null}
|
|
|
{showGPSoldOut ? <Image style={styles.gpSoldOutImage} source={require('../../images/tag/gp_tip_SQ.png')}/> : null}
|
|
|
{showSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_ysq.png')}/> : null}
|
|
|
{showSimilarGuider ? <SimilarProductGuider /> : null}
|
|
|
</YH_Image>
|
|
|
</View>
|
|
|
);
|
|
|
return (
|
|
|
<View style={styles.imageContainer}>
|
|
|
<YH_Image style={styles.image} url={url}>
|
|
|
{showAlmostSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_jjsq.png')}/> : null}
|
|
|
{showOutletSoldOut ? <Image style={styles.soldOutImage} source={require('../../images/tag/outlet_sellout_bg.png')}/> : null}
|
|
|
{showSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_ysq.png')}/> : null}
|
|
|
</YH_Image>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
_renderPrice() {
|
...
|
...
|
@@ -158,15 +159,8 @@ export default class ProductListCell extends Component { |
|
|
activeOpacity={1}
|
|
|
yh_exposureData={yh_exposureData}
|
|
|
onPress={() => {
|
|
|
if (rowID == similarIndex) {
|
|
|
this.props.onLongPressProduct&&this.props.onLongPressProduct(-1);
|
|
|
return;
|
|
|
}
|
|
|
this.props.onPressProduct && this.props.onPressProduct(data, rowID);
|
|
|
}}
|
|
|
onLongPress={() => {
|
|
|
this.props.onLongPressProduct&&this.props.onLongPressProduct(rowID);
|
|
|
}}
|
|
|
>
|
|
|
<View style={{overflow: 'hidden'}} >
|
|
|
|
...
|
...
|
|