Commit 79de63e3 by lhc

fix: bug

parent 5a971a0e
......@@ -866,18 +866,19 @@ class ChooseProductPage extends Component {
// 返回搜索元素
renderSearchItem() {
const { navigation } = this.props
const { leftActiveIndex, filterData, authorizations, topProcOptionList } = this.state
const { authorizations, topProcOptionList, topActiveIndex } = this.state
let cur_org_code = ''
if (navigation.state.params.selfData) {
cur_org_code = navigation.state.params.selfData.org_code
}
if (leftActiveIndex) {
// if (leftActiveIndex) {
return (
<TouchableOpacity
onPress={() => {
navigation.navigate('SearchPage', {
title: `选择产品`,
topProcOptionList,
topActiveIndex,
title: '搜索',
setTopProcOptionListCallBack: setTopProcOptionList => {
console.log('click')
......@@ -909,48 +910,48 @@ class ChooseProductPage extends Component {
</View>
</TouchableOpacity>
)
} else {
return (
<View>
<TouchableOpacity
onPress={() => {
navigation.navigate('SearchPage', {
title: `选择产品`,
topProcOptionList,
title: '搜索',
setTopProcOptionListCallBack: setTopProcOptionList => {
console.log('click')
setTopProcOptionList.then(topProcOptionList => {
console.log('addSuccess')
this.setState(
{
topProcOptionList: [...topProcOptionList],
},
// () => {
// console.log('goback')
// this.props.navigation.goBack()
// } else {
// return (
// <View>
// <TouchableOpacity
// onPress={() => {
// navigation.navigate('SearchPage', {
// title: `选择产品`,
// topProcOptionList,
// title: '搜索',
// setTopProcOptionListCallBack: setTopProcOptionList => {
// console.log('click')
// setTopProcOptionList.then(topProcOptionList => {
// console.log('addSuccess')
// this.setState(
// {
// topProcOptionList: [...topProcOptionList],
// },
)
})
},
selfData: {
org_code: cur_org_code,
authorizations,
},
})
}}
>
<View style={list_common_item.ser_cont}>
<View style={list_common_item.ser_text_input}></View>
<View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style} />
</View>
</View>
</TouchableOpacity>
<ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)} />
</View>
)
}
// // () => {
// // console.log('goback')
// // this.props.navigation.goBack()
// // },
// )
// })
// },
// selfData: {
// org_code: cur_org_code,
// authorizations,
// },
// })
// }}
// >
// <View style={list_common_item.ser_cont}>
// <View style={list_common_item.ser_text_input}></View>
// <View style={list_common_item.ser_img_box}>
// <Image source={require('../../../images/search_icon.png')} style={icon_style} />
// </View>
// </View>
// </TouchableOpacity>
// <ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)} />
// </View>
// )
// }
}
// 返回顶部厂家
......
......@@ -18,14 +18,13 @@ import LocalVariable from '../../common/LocalVariable'
import { reqGlobalSearch, reqSingleConsumSearch, reqProCategorySearch } from '../../../action/SelfAction'
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'
import { connect } from 'react-redux'
import { cloneObject } from '../../../utils/Utils'
// import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import LoadingModel from '../../common/listDataComponent/LoadingModel'
import { Width } from '../../../base/BaseStyle'
import debounce from 'debounce'
class SearchPage extends Component {
constructor(props) {
super(props)
this.state = {
defalutLeftItem: [
{
......@@ -50,20 +49,65 @@ class SearchPage extends Component {
},
],
searchValue: '',
dataList: [],
topActiveIndex: 0,
data: {
item: [],
total: 0,
},
page: 1,
}
this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 1000)
// this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 1000)
}
componentDidMount() {
const { navigation } = this.props
console.log('navigation', navigation)
const { topActiveIndex } = navigation.state.params
this.setState({
topActiveIndex,
})
// this.getSearchData()
}
initData() {
this.setState(
{
data: {
item: [],
total: 0,
},
page: 1,
},
() => {
this.getSearchData()
},
)
}
// 上拉刷新
onMomentumScrollEnd = event => {
const offSetY = event.nativeEvent.contentOffset.y // 获取滑动的距离
const contentSizeHeight = event.nativeEvent.contentSize.height // scrollView contentSize 高度
const oriageScrollHeight = event.nativeEvent.layoutMeasurement.height // scrollView高度
const { page, data } = this.state
if (offSetY + oriageScrollHeight >= contentSizeHeight - 400) {
if (data.item.length < data.total) {
this.setState(
{
page: page + 1,
},
() => {
this.getSearchData()
},
)
}
}
}
// 获取搜索数据
async getSearchData() {
const { navigation, global_domain_config, token } = this.props
const { topActiveIndex, searchValue } = this.state
const { topActiveIndex, searchValue, page, data } = this.state
const { selfData, topProcOptionList } = navigation.state.params
const { authorizations } = selfData
......@@ -77,14 +121,18 @@ class SearchPage extends Component {
manufacturerCode: topProcOptionList[topActiveIndex].supplier_code,
productLineCategory,
keyword: encodeURIComponent(searchValue),
pageSize: 9999,
page,
}
this.refs.LoadingModel.show()
const single_all_search = await reqGlobalSearch(global_domain_config, JSON.parse(JSON.stringify(params)))
this.refs.LoadingModel.hide()
console.log('single_all_search', single_all_search)
const oldData = data.item
this.setState({
dataList: single_all_search?.data?.item ? single_all_search?.data?.item : [],
data: {
...single_all_search?.data,
item: [...oldData, ...single_all_search?.data.item],
},
})
}
......@@ -260,7 +308,10 @@ class SearchPage extends Component {
}
}),
}
this.props.navigation.goBack()
// this.props.navigation.goBack()
this.setState({
topProcOptionList,
})
return Promise.resolve(topProcOptionList)
}
......@@ -321,7 +372,7 @@ class SearchPage extends Component {
topActiveIndex,
},
() => {
this.getSearchData()
this.initData()
},
)
}
......@@ -331,11 +382,11 @@ class SearchPage extends Component {
render() {
const { navigation } = this.props
const { title, topProcOptionList } = navigation.state.params
const { dataList, topActiveIndex } = this.state
const { data, topActiveIndex } = this.state
const cur_icon = 'supplier_icon'
console.log('dataList', dataList)
console.log('dataList', data.item)
return (
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
......@@ -348,7 +399,7 @@ class SearchPage extends Component {
<View style={list_common_item.ser_btn}>
<TouchableOpacity
onPress={() => {
this.getSearchData()
this.initData()
}}
>
<Text style={list_common_item.ser_text_btn}>搜索</Text>
......@@ -375,17 +426,21 @@ class SearchPage extends Component {
cardShowDefIcon={true}
/>
<ScrollView showsVerticalScrollIndicator={false}>
{dataList.length > 0 ? (
<ScrollView showsVerticalScrollIndicator={false} onScrollEndDrag={this.onMomentumScrollEnd}>
{data.item.length > 0 && (
<FlatList
keyExtractor={item => item.id}
data={dataList}
data={data.item}
extraData={this.state}
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/>
) : (
<PicListNoData />
)}
{data.item.length === data.total && data?.item?.length > 0 && (
<View>
<Text style={{ textAlign: 'center', lineHeight: 40 }}>没有更多数据了</Text>
</View>
)}
{!data?.item?.length && <PicListNoData />}
</ScrollView>
<LoadingModel ref="LoadingModel" />
</SafeAreaView>
......
......@@ -83,7 +83,7 @@ class Settlement extends React.Component<IProps, IState> {
args = filterData
}
args.header_status = 'ENTERED'
args.header_status = 'SETTLING'
const params = R.filter(isNotBlank)({
...args,
...pagination,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment