|
|
@@ -6,6 +6,7 @@ import { CSSProperties, useState } from "react";
|
|
|
import './index.less';
|
|
|
import { ArrowDown, Filter, ArrowTransfer } from "@nutui/icons-react-taro";
|
|
|
import EmptyShow from "@/components/EmptyShow";
|
|
|
+import { listTransferApi } from "@/services/apis";
|
|
|
|
|
|
const InfiniteUlStyle: CSSProperties = {
|
|
|
height: '100%',
|
|
|
@@ -22,11 +23,21 @@ export default function TransferRecord() {
|
|
|
const [refreshHasMore, setRefreshHasMore] = useState(true)
|
|
|
const [refreshLoading, setRefreshLoading] = useState(false)
|
|
|
|
|
|
- const [options] = useState([
|
|
|
- { text: '全部状态', value: 0 },
|
|
|
- { text: '转账成功', value: 1 },
|
|
|
- { text: '转账失败', value: 2 },
|
|
|
+ const [searchData, setSearchData] = useState<{ status: string, orderNo: string, pageNo: number, pageSize: number }>({
|
|
|
+ status: '',
|
|
|
+ orderNo: '',
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [statusOptions] = useState([
|
|
|
+ { text: '全部状态', value: '' },
|
|
|
+ { text: '处理中', value: 'DEALING' },
|
|
|
+ { text: '成功', value: 'SUCCESS' },
|
|
|
+ { text: '失败', value: 'FAIL' },
|
|
|
+ { text: '退票', value: 'REFUND' },
|
|
|
])
|
|
|
+
|
|
|
const [options1] = useState([
|
|
|
{ text: '默认排序', value: 'a' },
|
|
|
{ text: '时间倒序', value: 'b' },
|
|
|
@@ -40,6 +51,7 @@ export default function TransferRecord() {
|
|
|
init()
|
|
|
});
|
|
|
|
|
|
+
|
|
|
const isEmpty = refreshList.length === 0
|
|
|
|
|
|
const showData = !refreshLoading && !isEmpty
|
|
|
@@ -47,10 +59,11 @@ export default function TransferRecord() {
|
|
|
|
|
|
|
|
|
const init = () => {
|
|
|
- for (let i = 0; i < 10; i++) {
|
|
|
- refreshList.push(`${i}`)
|
|
|
- }
|
|
|
- setRefreshList([...refreshList])
|
|
|
+ // for (let i = 0; i < 10; i++) {
|
|
|
+ // refreshList.push(`${i}`)
|
|
|
+ // }
|
|
|
+ // setRefreshList([...refreshList])
|
|
|
+ refresh()
|
|
|
}
|
|
|
|
|
|
const refreshLoadMore = async () => {
|
|
|
@@ -66,8 +79,12 @@ export default function TransferRecord() {
|
|
|
}
|
|
|
|
|
|
const refresh = async () => {
|
|
|
- // await sleep(1000)
|
|
|
- // toastShow('刷新成功')
|
|
|
+ await listTransferApi({
|
|
|
+ pageNo: searchData.pageNo,
|
|
|
+ pageSize: searchData.pageSize,
|
|
|
+ status: searchData.status,
|
|
|
+ orderNo: searchData.orderNo,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
@@ -76,6 +93,8 @@ export default function TransferRecord() {
|
|
|
<View className="custom-nav" style={{ paddingTop: `${statusBarHeight}px` }}>
|
|
|
<View className="custom-title-bar">
|
|
|
<SearchBar
|
|
|
+ value={searchData.orderNo}
|
|
|
+ onChange={(v) => setSearchData({ ...searchData, orderNo: v })}
|
|
|
placeholder="搜索"
|
|
|
shape="round"
|
|
|
rightIn={
|
|
|
@@ -95,6 +114,7 @@ export default function TransferRecord() {
|
|
|
shape="round"
|
|
|
// fill="outline"
|
|
|
icon={<ArrowTransfer color="white" />}
|
|
|
+ onClick={() => Taro.redirectTo({ url: '/pages/transfer/index' })}
|
|
|
>
|
|
|
转账
|
|
|
</Button>
|
|
|
@@ -110,8 +130,9 @@ export default function TransferRecord() {
|
|
|
} as any}
|
|
|
>
|
|
|
<Menu.Item
|
|
|
- options={options}
|
|
|
- defaultValue={0}
|
|
|
+ options={statusOptions}
|
|
|
+ value={searchData.status}
|
|
|
+ onChange={(v) => setSearchData({ ...searchData, status: v })}
|
|
|
// icon={<Star />}
|
|
|
titleIcon={<Filter />}
|
|
|
/>
|