🐞 fix(购物页面): 取消筛选客户的分页功能
This commit is contained in:
parent
db6b2e4f26
commit
625616cc0e
@ -40,8 +40,6 @@ export const Shopping: FC = memo(() => {
|
|||||||
|
|
||||||
interface SearchOptions {
|
interface SearchOptions {
|
||||||
short_name_or_phone?: string
|
short_name_or_phone?: string
|
||||||
page?: number
|
|
||||||
size?: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ShoppingCartContainer: FC = () => {
|
const ShoppingCartContainer: FC = () => {
|
||||||
@ -65,11 +63,7 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
|
|
||||||
const { fetchData, state } = ShoppingCartListApi()
|
const { fetchData, state } = ShoppingCartListApi()
|
||||||
|
|
||||||
const [searchOptions, setSearchOptions] = useState<SearchOptions>({
|
const [searchOptions, setSearchOptions] = useState<SearchOptions>({})
|
||||||
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
|
||||||
})
|
|
||||||
|
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
// 第二次进入该页面时触发
|
// 第二次进入该页面时触发
|
||||||
@ -90,8 +84,7 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
// 输入了搜索关键字
|
// 输入了搜索关键字
|
||||||
const getSearchData = useCallback(e => {
|
const getSearchData = useCallback(e => {
|
||||||
console.log('getSearchData===>',e);
|
console.log('getSearchData===>',e);
|
||||||
pageNum.current.page = 1
|
setSearchOptions({ short_name_or_phone: e })
|
||||||
setSearchOptions(prev => ({ ...prev, short_name_or_phone: e, size: 10 }))
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const [shoppingCartData, setShoppingCartData] = useState<{
|
const [shoppingCartData, setShoppingCartData] = useState<{
|
||||||
@ -99,17 +92,6 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
total: number
|
total: number
|
||||||
}>({ list: [], total: 0 })
|
}>({ list: [], total: 0 })
|
||||||
|
|
||||||
//上拉加载数据
|
|
||||||
const pageNum = useRef({ size: searchOptions.size, page: searchOptions.page })
|
|
||||||
// 上拉加载
|
|
||||||
const getScrollToLower = useCallback(() => {
|
|
||||||
if (shoppingCartData.list.length < shoppingCartData.total) {
|
|
||||||
pageNum.current.page!++
|
|
||||||
const size = pageNum.current.size! * pageNum.current.page!
|
|
||||||
setSearchOptions((e) => ({ ...e, size }))
|
|
||||||
console.log(searchOptions, 11111)
|
|
||||||
}
|
|
||||||
}, [shoppingCartData])
|
|
||||||
|
|
||||||
//数据加载状态
|
//数据加载状态
|
||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
@ -230,7 +212,6 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
|
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
const handleRefresh = async () => {
|
const handleRefresh = async () => {
|
||||||
pageNum.current.page = 1
|
|
||||||
setRefreshStatus(true)
|
setRefreshStatus(true)
|
||||||
const res = await fetchData(getFilterData(searchOptions))
|
const res = await fetchData(getFilterData(searchOptions))
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
@ -258,7 +239,7 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={classnames('flex-item', 'flex-col', styles['shopping--context'])}>
|
<View className={classnames('flex-item', 'flex-col', styles['shopping--context'])}>
|
||||||
<View id='shoppingListContainer' className={classnames(styles.shopping__list__container, 'flex-item')} style={{ height: listHeightRef.current }}>
|
<View id='shoppingListContainer' className={classnames(styles.shopping__list__container, 'flex-item')} style={{ height: listHeightRef.current }}>
|
||||||
<InfiniteScroll statusMore={statusMore} refresherEnabled={true} selfOnRefresherRefresh={handleRefresh} refresherTriggered={refreshStatus} selfonScrollToLower={getScrollToLower}>
|
<InfiniteScroll statusMore={statusMore} refresherEnabled={true} selfOnRefresherRefresh={handleRefresh} refresherTriggered={refreshStatus}>
|
||||||
{
|
{
|
||||||
!!shoppingCartData?.list?.length &&
|
!!shoppingCartData?.list?.length &&
|
||||||
shoppingCartData?.list?.map((item, index) => {
|
shoppingCartData?.list?.map((item, index) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user