Feature/0723/zr #9
@@ -1,12 +1,5 @@
|
||||
import { computed, reactive, toRef, Ref, nextTick } from 'vue';
|
||||
import {
|
||||
useDebounce,
|
||||
useThrottleFn,
|
||||
useRequest,
|
||||
usePagination,
|
||||
useEffect,
|
||||
syncPaginationTotal,
|
||||
} from '@/hooks';
|
||||
import { computed, reactive, nextTick } from 'vue';
|
||||
import { useThrottleFn, useRequest, usePagination, useEffect, syncPaginationTotal } from '@/hooks';
|
||||
import { getPaymentFlowList, type PaymentFlowVO, type PaymentFlowQueryParams } from './services';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
@@ -38,15 +31,6 @@ export function usePaymentsModel() {
|
||||
type: '',
|
||||
});
|
||||
|
||||
const { debouncedValue: debouncedNickname } = useDebounce(
|
||||
toRef(filterForm, 'nickname') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
const { debouncedValue: debouncedPhone } = useDebounce(
|
||||
toRef(filterForm, 'phone') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
|
||||
// ===== 分页 =====
|
||||
const pagination = usePagination({ defaultCurrent: 1, defaultPageSize: 10 });
|
||||
|
||||
@@ -61,8 +45,8 @@ export function usePaymentsModel() {
|
||||
if (start) params.createDateBegin = dayjs(start).format('YYYY-MM-DD');
|
||||
if (end) params.createDateEnd = dayjs(end).format('YYYY-MM-DD');
|
||||
}
|
||||
if (debouncedNickname.value.trim()) params.nickname = debouncedNickname.value.trim();
|
||||
if (debouncedPhone.value.trim()) params.phone = debouncedPhone.value.trim();
|
||||
if (filterForm.nickname.trim()) params.nickname = filterForm.nickname.trim();
|
||||
if (filterForm.phone.trim()) params.phone = filterForm.phone.trim();
|
||||
if (filterForm.type) params.type = filterForm.type;
|
||||
return params;
|
||||
};
|
||||
@@ -124,18 +108,18 @@ export function usePaymentsModel() {
|
||||
const hasFilter = computed(() => {
|
||||
return (
|
||||
filterForm.timeRange !== null ||
|
||||
debouncedNickname.value.trim() !== '' ||
|
||||
debouncedPhone.value.trim() !== '' ||
|
||||
filterForm.nickname.trim() !== '' ||
|
||||
filterForm.phone.trim() !== '' ||
|
||||
filterForm.type !== ''
|
||||
);
|
||||
});
|
||||
|
||||
// ===== 方法 =====
|
||||
|
||||
const handleSearch = () => {
|
||||
const handleSearch = useThrottleFn(() => {
|
||||
pagination.reset();
|
||||
fetchList();
|
||||
};
|
||||
}, 300);
|
||||
|
||||
const handleReset = useThrottleFn(async () => {
|
||||
filterForm.timeRange = null;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { computed, reactive, toRef, Ref, nextTick } from 'vue';
|
||||
import { computed, reactive, nextTick } from 'vue';
|
||||
import {
|
||||
useState,
|
||||
useDebounce,
|
||||
useThrottleFn,
|
||||
useRequest,
|
||||
usePagination,
|
||||
@@ -57,15 +56,6 @@ export function useWalletModel() {
|
||||
maxBalance: '',
|
||||
});
|
||||
|
||||
const { debouncedValue: debouncedNickname } = useDebounce(
|
||||
toRef(filterForm, 'nickname') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
const { debouncedValue: debouncedPhone } = useDebounce(
|
||||
toRef(filterForm, 'phone') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
|
||||
// ===== 分页 =====
|
||||
const pagination = usePagination({ defaultCurrent: 1, defaultPageSize: 10 });
|
||||
|
||||
@@ -83,8 +73,8 @@ export function useWalletModel() {
|
||||
page: String((pagination as any).current.value),
|
||||
limit: String((pagination as any).pageSize.value),
|
||||
};
|
||||
if (debouncedNickname.value.trim()) params.nickname = debouncedNickname.value.trim();
|
||||
if (debouncedPhone.value.trim()) params.phone = debouncedPhone.value.trim();
|
||||
if (filterForm.nickname.trim()) params.nickname = filterForm.nickname.trim();
|
||||
if (filterForm.phone.trim()) params.phone = filterForm.phone.trim();
|
||||
if (filterForm.minBalance) params.amountBegin = filterForm.minBalance;
|
||||
if (filterForm.maxBalance) params.amountEnd = filterForm.maxBalance;
|
||||
return params;
|
||||
@@ -150,8 +140,8 @@ export function useWalletModel() {
|
||||
// ===== 计算属性 =====
|
||||
const hasFilter = computed(() => {
|
||||
return (
|
||||
debouncedNickname.value.trim() !== '' ||
|
||||
debouncedPhone.value.trim() !== '' ||
|
||||
filterForm.nickname.trim() !== '' ||
|
||||
filterForm.phone.trim() !== '' ||
|
||||
filterForm.minBalance !== '' ||
|
||||
filterForm.maxBalance !== ''
|
||||
);
|
||||
@@ -159,10 +149,10 @@ export function useWalletModel() {
|
||||
|
||||
// ===== 方法 =====
|
||||
|
||||
const handleSearch = () => {
|
||||
const handleSearch = useThrottleFn(() => {
|
||||
pagination.reset();
|
||||
fetchList();
|
||||
};
|
||||
}, 300);
|
||||
|
||||
const handleReset = useThrottleFn(async () => {
|
||||
filterForm.nickname = '';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { computed, reactive, toRef, Ref, h, nextTick } from 'vue';
|
||||
import { computed, reactive, h, nextTick } from 'vue';
|
||||
import { StatusTag, type StatusTagTone } from '@/components';
|
||||
import {
|
||||
useState,
|
||||
useDebounce,
|
||||
useThrottleFn,
|
||||
useRequest,
|
||||
usePagination,
|
||||
@@ -87,20 +86,6 @@ export function useWithdrawModel() {
|
||||
payStatus: '',
|
||||
});
|
||||
|
||||
// 可搜索字段防抖
|
||||
const { debouncedValue: debouncedNickname } = useDebounce(
|
||||
toRef(filterForm, 'nickname') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
const { debouncedValue: debouncedPhone } = useDebounce(
|
||||
toRef(filterForm, 'phone') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
const { debouncedValue: debouncedRealName } = useDebounce(
|
||||
toRef(filterForm, 'realName') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
|
||||
// ===== 分页 =====
|
||||
const pagination = usePagination({ defaultCurrent: 1, defaultPageSize: 10 });
|
||||
|
||||
@@ -110,9 +95,9 @@ export function useWithdrawModel() {
|
||||
page: String((pagination as any).current.value),
|
||||
limit: String((pagination as any).pageSize.value),
|
||||
};
|
||||
if (debouncedNickname.value.trim()) params.nickname = debouncedNickname.value.trim();
|
||||
if (debouncedPhone.value.trim()) params.phone = debouncedPhone.value.trim();
|
||||
if (debouncedRealName.value.trim()) params.realName = debouncedRealName.value.trim();
|
||||
if (filterForm.nickname.trim()) params.nickname = filterForm.nickname.trim();
|
||||
if (filterForm.phone.trim()) params.phone = filterForm.phone.trim();
|
||||
if (filterForm.realName.trim()) params.realName = filterForm.realName.trim();
|
||||
if (filterForm.auditStatus) params.auditStatus = filterForm.auditStatus;
|
||||
if (filterForm.payStatus) params.payStatus = filterForm.payStatus;
|
||||
return params;
|
||||
@@ -169,9 +154,9 @@ export function useWithdrawModel() {
|
||||
// ===== 计算属性 =====
|
||||
const hasFilter = computed(() => {
|
||||
return (
|
||||
debouncedNickname.value.trim() !== '' ||
|
||||
debouncedPhone.value.trim() !== '' ||
|
||||
debouncedRealName.value.trim() !== '' ||
|
||||
filterForm.nickname.trim() !== '' ||
|
||||
filterForm.phone.trim() !== '' ||
|
||||
filterForm.realName.trim() !== '' ||
|
||||
filterForm.auditStatus !== '' ||
|
||||
filterForm.payStatus !== ''
|
||||
);
|
||||
@@ -179,10 +164,10 @@ export function useWithdrawModel() {
|
||||
|
||||
// ===== 方法 =====
|
||||
|
||||
const handleSearch = () => {
|
||||
const handleSearch = useThrottleFn(() => {
|
||||
pagination.reset();
|
||||
fetchList();
|
||||
};
|
||||
}, 300);
|
||||
|
||||
/** 重置(重置后自动查询) */
|
||||
const handleReset = useThrottleFn(async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { computed, reactive, toRef, Ref, nextTick } from 'vue';
|
||||
import { computed, reactive, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { useDebounce, useThrottleFn } from '@/hooks';
|
||||
import { useThrottleFn } from '@/hooks';
|
||||
import { useRequest } from '@/hooks/useRequest';
|
||||
import { useEffect } from '@/hooks/useEffect';
|
||||
import { usePagination, syncPaginationTotal } from '@/hooks/usePagination';
|
||||
@@ -48,12 +48,6 @@ export function useLogModel() {
|
||||
searchOperator: '',
|
||||
});
|
||||
|
||||
// 操作人字段防抖 300ms
|
||||
const { debouncedValue: debouncedOperator } = useDebounce(
|
||||
toRef(filterForm, 'searchOperator') as Ref<string>,
|
||||
{ delay: 300 },
|
||||
);
|
||||
|
||||
// ===== 分页 =====
|
||||
const pagination = usePagination({ defaultCurrent: 1, defaultPageSize: 10 });
|
||||
|
||||
@@ -76,9 +70,9 @@ export function useLogModel() {
|
||||
params.type = filterForm.actionType;
|
||||
}
|
||||
|
||||
// 操作人昵称(防抖后的值)
|
||||
if (debouncedOperator.value.trim()) {
|
||||
params.nickname = debouncedOperator.value.trim();
|
||||
// 操作人昵称
|
||||
if (filterForm.searchOperator.trim()) {
|
||||
params.nickname = filterForm.searchOperator.trim();
|
||||
}
|
||||
|
||||
return params;
|
||||
@@ -116,16 +110,16 @@ export function useLogModel() {
|
||||
return (
|
||||
filterForm.actionTimeRange !== null ||
|
||||
filterForm.actionType !== '' ||
|
||||
debouncedOperator.value.trim() !== ''
|
||||
filterForm.searchOperator.trim() !== ''
|
||||
);
|
||||
});
|
||||
|
||||
// ===== 方法 =====
|
||||
|
||||
const handleSearch = () => {
|
||||
const handleSearch = useThrottleFn(() => {
|
||||
pagination.reset();
|
||||
fetchList();
|
||||
};
|
||||
}, 300);
|
||||
|
||||
/** 重置(重置后自动查询) */
|
||||
const handleReset = useThrottleFn(async () => {
|
||||
|
||||
Reference in New Issue
Block a user