商城测试版v5
This commit is contained in:
@@ -33,7 +33,8 @@ export default () => {
|
||||
width: '',
|
||||
weight_density: '',
|
||||
product_kind_id: '',
|
||||
component: ''
|
||||
component: '',
|
||||
abstract_sort_key: ''
|
||||
})
|
||||
|
||||
//获取面料列表
|
||||
@@ -132,6 +133,26 @@ export default () => {
|
||||
usePullDownRefresh(() => {
|
||||
setSearchField({...searchField ,size : 10})
|
||||
})
|
||||
|
||||
//排序
|
||||
type sortParam = 'none'|'top'|'bottom'
|
||||
const sortComprehensiveRef = useRef<any>(null)
|
||||
const sortCollectionRef = useRef<any>(null)
|
||||
const [sortStatus, setSortStatus] = useState<{comprehensive:sortParam, collection:sortParam}>({
|
||||
comprehensive: 'none',
|
||||
collection: 'none'
|
||||
})
|
||||
const changeSort = (val) => {
|
||||
if(val == 1) {
|
||||
const {status, value} = sortComprehensiveRef.current.changeSort()
|
||||
setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'}))
|
||||
setSearchField((e) => ({...e, abstract_sort_key: value}))
|
||||
} else {
|
||||
const {status, value} = sortCollectionRef.current.changeSort()
|
||||
setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'}))
|
||||
setSearchField((e) => ({...e, abstract_sort_key: value}))
|
||||
}
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.search}>
|
||||
@@ -148,13 +169,13 @@ export default () => {
|
||||
</View>
|
||||
<View className={styles.filter}>
|
||||
<View className={styles.filter_all}>
|
||||
<View className={styles.text_zh}>
|
||||
<View className={styles.text_zh} onClick={() => changeSort(1)}>
|
||||
<Text>综合</Text>
|
||||
<SortBtn status="top"/>
|
||||
<SortBtn status={sortStatus.comprehensive} ref={sortComprehensiveRef} sortValue={{desc: '1', asc: '-1'}}/>
|
||||
</View>
|
||||
<View className={styles.text_sc} >
|
||||
<View className={styles.text_sc} onClick={() => changeSort(2)}>
|
||||
<Text>收藏</Text>
|
||||
<SortBtn status="top"/>
|
||||
<SortBtn status={sortStatus.collection} ref={sortCollectionRef} sortValue={{desc: '2', asc: '-2'}}/>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
|
||||
@@ -118,18 +118,24 @@ export default () => {
|
||||
}
|
||||
|
||||
//排序
|
||||
const [sortStatus, setSortStatus] = useState<{comprehensive:'none'|'top'|'bottom', collection:'none'|'top'|'bottom'}>({
|
||||
type sortParam = 'none'|'top'|'bottom'
|
||||
const sortComprehensiveRef = useRef<any>(null)
|
||||
const sortCollectionRef = useRef<any>(null)
|
||||
const [sortStatus, setSortStatus] = useState<{comprehensive:sortParam, collection:sortParam}>({
|
||||
comprehensive: 'none',
|
||||
collection: 'none'
|
||||
})
|
||||
const changeSort = (val) => {
|
||||
if(val == 1) {
|
||||
|
||||
const {status, value} = sortComprehensiveRef.current.changeSort()
|
||||
setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'}))
|
||||
setSearchField((e) => ({...e, abstract_sort_key: value}))
|
||||
} else {
|
||||
|
||||
const {status, value} = sortCollectionRef.current.changeSort()
|
||||
setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'}))
|
||||
setSearchField((e) => ({...e, abstract_sort_key: value}))
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.search}>
|
||||
@@ -139,11 +145,11 @@ export default () => {
|
||||
<View className={styles.filter_all}>
|
||||
<View className={styles.text_zh} onClick={() => changeSort(1)}>
|
||||
<Text>综合</Text>
|
||||
<SortBtn status={sortStatus.comprehensive}/>
|
||||
<SortBtn status={sortStatus.comprehensive} ref={sortComprehensiveRef} sortValue={{desc: '1', asc: '-1'}}/>
|
||||
</View>
|
||||
<View className={styles.text_sc} onClick={() => changeSort(2)}>
|
||||
<Text>收藏</Text>
|
||||
<SortBtn status="none"/>
|
||||
<SortBtn status={sortStatus.collection} ref={sortCollectionRef} sortValue={{desc: '2', asc: '-2'}}/>
|
||||
</View>
|
||||
<View className={styles.text_ss} onClick={() => goLink('/pages/searchList/hightSearchList')}>
|
||||
<Text>高级搜索</Text>
|
||||
|
||||
Reference in New Issue
Block a user