|
|
'use strict';
|
|
|
'use strict';
|
|
|
|
|
|
import React from 'react';
|
|
|
import ReactNative from 'react-native';
|
...
|
...
|
@@ -33,10 +33,10 @@ export default class BrandProductFilter extends React.Component { |
|
|
key: 'default',
|
|
|
name: '默认',
|
|
|
value: {
|
|
|
asc: '',
|
|
|
desc: '',
|
|
|
normal: '',
|
|
|
popular: 'h_v_desc',
|
|
|
},
|
|
|
isAsc: false,
|
|
|
isPopular: false,
|
|
|
radio: true,
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -47,7 +47,7 @@ export default class BrandProductFilter extends React.Component { |
|
|
desc: 's_t_desc',
|
|
|
},
|
|
|
isAsc: false,
|
|
|
radio: true,
|
|
|
radio: false,
|
|
|
},
|
|
|
{
|
|
|
key: 'price',
|
...
|
...
|
@@ -92,6 +92,8 @@ export default class BrandProductFilter extends React.Component { |
|
|
down_normal:require('../../../../image/filter/brandstore_filter_arrow_down_normal.png'),
|
|
|
up:require('../../../../image/filter/brandstore_filter_arrow_up.png'),
|
|
|
up_normal:require('../../../../image/filter/brandstore_filter_arrow_up_normal.png'),
|
|
|
default_normal:require('../../../../image/filter/3_down_h.png'),
|
|
|
default_selected:require('../../../../image/filter/3_down.png'),
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -105,13 +107,14 @@ export default class BrandProductFilter extends React.Component { |
|
|
|
|
|
_renderImage(rowData, rowID) {
|
|
|
let img;
|
|
|
if(rowID==0||rowID==1){
|
|
|
// if (rowID == this.state.selectedIndex) {
|
|
|
// img = this.props.moreFilter ? this.images.up : this.images.down;
|
|
|
// }else{
|
|
|
// img = this.props.moreFilter ? this.images.up_normal : this.images.down_normal;
|
|
|
// }
|
|
|
img = null;
|
|
|
if(rowID==0){
|
|
|
if (rowID == this.state.selectedIndex) {
|
|
|
img = this.images.default_selected;
|
|
|
}else{
|
|
|
img = this.images.default_normal;
|
|
|
}
|
|
|
}else if(rowID==1){
|
|
|
return null;
|
|
|
}else if(rowID==4){
|
|
|
img = this.props.lastSelected ? this.images.up : this.images.down_normal;
|
|
|
}else{
|
...
|
...
|
@@ -131,11 +134,13 @@ export default class BrandProductFilter extends React.Component { |
|
|
}
|
|
|
|
|
|
if(rowID==0){
|
|
|
// if(this.props.selectOrder=='s_t_desc'){
|
|
|
// rowData.name='最新';
|
|
|
// }else{
|
|
|
// rowData.name='默认';
|
|
|
// }
|
|
|
if(this.props.selectOrder=='h_v_desc'){
|
|
|
this.lastSelectedPopular = true;
|
|
|
rowData.name='人气';
|
|
|
}else if (this.props.selectOrder == '') {
|
|
|
this.lastSelectedPopular = false;
|
|
|
rowData.name='默认';
|
|
|
}
|
|
|
}
|
|
|
return (
|
|
|
<View style={{backgroundColor: 'white'}}>
|
...
|
...
|
@@ -143,10 +148,22 @@ export default class BrandProductFilter extends React.Component { |
|
|
|
|
|
let filters = this.state.filters;
|
|
|
let filter = this.state.filters[rowID];
|
|
|
// if (filter.radio) {
|
|
|
// this.props.onPressFilter && this.props.onPressFilter(filters[0].key);
|
|
|
// return;
|
|
|
// }
|
|
|
if (rowID == 1 && this.state.selectedIndex == 1) {
|
|
|
return;
|
|
|
}
|
|
|
if (filter.radio) {
|
|
|
if (this.state.selectedIndex > 0) {
|
|
|
this.setState({
|
|
|
selectedIndex: rowID,
|
|
|
});
|
|
|
let value = this.lastSelectedPopular ? filter.value['popular'] : filter.value['normal'];
|
|
|
this.props.onPressFilter && this.props.onPressFilter(value);
|
|
|
} else {
|
|
|
this.props.onPressFilter && this.props.onPressFilter(filters[0].key);
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (rowID == 4) {
|
|
|
let value = 'filter';
|
|
|
this.props.onPressFilter && this.props.onPressFilter(value);
|
...
|
...
|
|