Authored by 孙凯

add 收藏的店铺页面 自动曝光 review by daiqiang

... ... @@ -73,7 +73,7 @@ export default class Brand extends Component {
style={styles.bottomImage}
source={require('../../images/brand/shared_bottom.png')}
/>;
}
}
} else {
return <LoadMoreIndicator
isVisible={isLoadingMore}
... ... @@ -99,6 +99,7 @@ export default class Brand extends Component {
<View style={styles.container}>
<ListView
enableEmptySections={true}
yh_viewVisible = {true}
dataSource={this.dataSource.cloneWithRows(dataSource)}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
... ...
... ... @@ -35,7 +35,7 @@ export default class BrandCell extends Component{
renderRow(rowData, sectionID, rowID, highlightRow) {
let marginLeft = rowID == 0 ? 5 : 0;
let marginRight = rowID == this.productCount - 1 ? 10 : 35;
let prdImage = YH_Image.getSlicedUrl(rowData.get('default_images', ''), 113, 150, 2);
let salePrice = 0; // 售卖价
... ... @@ -50,15 +50,18 @@ export default class BrandCell extends Component{
salePriceStr = '¥' + salePrice.toFixed(2);
originPriceStr = '¥' + originPrice.toFixed(2);
let yh_exposureData = rowData && rowData.get('yh_exposureData') ? rowData.get('yh_exposureData').toJS() : {};
if (!originPrice || (salePrice == originPrice)) {
showOriginPrice = false;
salePriceColor = '#444444';
}
return (
<TouchableOpacity
<TouchableOpacity
key={'row' + rowID}
activeOpacity={1}
activeOpacity={1}
yh_exposureData={yh_exposureData}
style={[styles.rowContainer, {marginLeft, marginRight}]}
onPress={() => {
this.props.onPressProduct && this.props.onPressProduct(rowData);
... ... @@ -92,21 +95,21 @@ export default class BrandCell extends Component{
{newNum + ' '}
<Text style={{color: '#d62927'}}>{'折扣 '}</Text>
{discountNum}
</Text>
</Text>
);
} else if (newNum > 0 && discountNum == 0) {
return (
<Text style={styles.desc} numberOfLines={1}>
<Text style={{color: '#86bf4a'}}>{'上新 '}</Text>
{newNum + ' '}
</Text>
</Text>
);
} else if (newNum == 0 && discountNum > 0) {
return (
<Text style={styles.desc} numberOfLines={1}>
<Text style={{color: '#d62927'}}>{'折扣 '}</Text>
{discountNum}
</Text>
</Text>
);
}
... ... @@ -132,19 +135,19 @@ export default class BrandCell extends Component{
<YH_Image style={styles.icon} url={icon} />
<View>
<Text style={styles.name} numberOfLines={1}>{data.get('brand_name')}</Text>
{this.renderDesc()}
{this.renderDesc()}
</View>
</View>
<View style={styles.right}>
<TouchableOpacity
activeOpacity={1}
<TouchableOpacity
activeOpacity={1}
style={styles.optTouch}
onPress={this.props.onPressLike}
>
<View><Image style={styles.optIcon} source={heartIcon} /></View>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={1}
<TouchableOpacity
activeOpacity={1}
style={styles.optTouch}
onPress={this.props.onPressHome}
>
... ... @@ -155,6 +158,7 @@ export default class BrandCell extends Component{
{this.productCount > 0 ? <ListView
enableEmptySections={true}
yh_viewVisible = {true}
contentContainerStyle={styles.listViewContainer}
dataSource={this.dataSource.cloneWithRows(dataSource)}
renderRow={this.renderRow}
... ... @@ -224,7 +228,7 @@ let styles = StyleSheet.create({
alignItems: 'center',
},
optTouch: {
width: 44,
width: 44,
height: 44,
},
optIcon: {
... ...
... ... @@ -117,9 +117,23 @@ function parseBrandList(json) {
let list = json && json.brand_list ? json.brand_list : [];
list.map((item, index) => {
let new_product = item ? item.new_product : [];
new_product && new_product.map((subItem, subIndex) => {
//有shop_id 传 shop_id 没有shop_id传brand_id,再没有传空
//不论是brand_id还是有shop_id 都传到SHOP_ID字段中---与黄敬囿沟通过
let shop_id = item.shop_id ? item.shop_id : '';
shop_id = shop_id ? shop_id : item.brand_id;
let param = {
SHOP_ID: shop_id ? shop_id : '',
PRD_SKN: subItem.product_skn ? subItem.product_skn : '',
L_INDEX: index + 1,
I_INDEX: subIndex + 1,
exposureEnd : 1,
};
subItem.yh_exposureData = param;
});
item.is_favorite = true;
});
return {
list,
currentPage,
... ... @@ -222,7 +236,7 @@ export function cancelFavorite(brandId, type, index) {
dispatch(cancelFavoriteRequest());
dispatch(cancelFavoriteSuccess(index));
dispatch(showPromt('取消收藏成功'))
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
return new BrandService(app.host).cancelFavorite(brandId, uid, type)
... ... @@ -238,4 +252,3 @@ export function cancelFavorite(brandId, type, index) {
});
};
}
... ...