import { Image, Input, Text, View } from "@tarojs/components" import empty from '@/images/empty.png' import './index.scss' import { Button } from "@nutui/nutui-react-taro" import { useState } from "react" import Taro from "@tarojs/taro" import backNav from '@/images/backNav.png' import { Picker } from "@nutui/nutui-react-taro" import { Infiniteloading } from "@nutui/nutui-react-taro" import { useEffect } from "react" import { orderList } from "../../utils/api" import { navigateTo, orderState } from "../../utils/utils" const Login = () => { const limit = 20 const [tabKey, setTabKey] = useState('0') const [chanel] = useState('all') const [page, setPage] = useState(1) const [list, setList] = useState([]) const [total, setTotal] = useState(0) // 返回页面 const backFn = () => { Taro.getCurrentPages().length > 0 && Taro.navigateBack() } useEffect(() => { const offset = (page - 1) * limit let state = tabKey if (tabKey == '0') { state = '' } orderList(chanel, { state, offset, limit }).then(re => { setList(re.items) setTotal(re.total) }) }, [tabKey, page]) return 我的订单 setTabKey('0')}>全部 setTabKey('paid')}>待发货 setTabKey('sent')}>已发货 setTabKey('received')}>已收货 { list.length > 0 && } loadIcon='loading' hasMore={total > list.length} onLoadMore={(x) => { setPage(p => p + 1) x() }} > { list.map(item => { return 订单号:{item.id} {orderState.get(item.state)} Taro.navigateTo({ url: `/pages/order-detail/index?id=${item.id}` })}> {item.product.name} ¥{item.amount} X1 已付金额: ¥{item.amount} {/* */} }) } } { !list.length && } } export default Login