refactor(manager): 引入 useTable 并重构采购/财务/会员等10个列表页

- 引入通用 useTable composable 实现分页与查询标准化
- 重构采购单/入库单/报损单/盘点单4个采购管理列表页
- 重构退款日志/预存款流水/会员充值/会员经验等财务与会员日志列表页
- 重构支付流水与退款流水列表页
- 统一竞态防护与 loading 状态管理,消除 150+ 行冗余样板代码
This commit is contained in:
pikachu1995@126.com
2026-10-20 14:02:03 +08:00
parent 8fd353a766
commit 6b6dc2c4f3
11 changed files with 201 additions and 241 deletions

View File

@@ -35,35 +35,18 @@
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
import { useTable } from "@/utils/useTable";
import * as API_Finance from "@/api/finance";
import { downloadBlob } from "@/utils/downloadBlob";
defineOptions({ name: "finance-refund-log" });
const loading = ref(false);
const searchForm = reactive({ pageNumber: 1, pageSize: 20, orderSn: "" });
const data = ref([]);
const total = ref(0);
const { loading, data, total, searchForm, getDataList, handleSearch } = useTable(
API_Finance.refundLogPage,
{ pageSize: 20, form: { orderSn: "" } }
);
onMounted(() => {
getDataList();
});
function handleSearch() {
searchForm.pageNumber = 1;
getDataList();
}
function getDataList() {
loading.value = true;
API_Finance.refundLogPage(searchForm).then((res) => {
loading.value = false;
if (res.success) {
data.value = res.result.records;
total.value = res.result.total;
}
});
}
function handleExport() {
const { pageNumber, pageSize, ...rest } = searchForm;
API_Finance.exportRefundFlow(rest).then((blob) => {