diff --git a/manager/src/views/promotions/points-goods-category/points-goods-category.vue b/manager/src/views/promotions/points-goods-category/points-goods-category.vue index da6246d4..b11b3e64 100644 --- a/manager/src/views/promotions/points-goods-category/points-goods-category.vue +++ b/manager/src/views/promotions/points-goods-category/points-goods-category.vue @@ -22,6 +22,20 @@ + + + { + getPointsGoodsCategoryList(this.searchForm).then((res) => { this.loading = false; if (res.success) { - this.tableData = res.result.records; + const records = res.result.records || []; + const sortFn = (a, b) => (a.sortOrder || 0) - (b.sortOrder || 0); + const sortRecursively = (list = []) => { + list.sort(sortFn); + list.forEach((item) => { + if (Array.isArray(item.children) && item.children.length) { + sortRecursively(item.children); + } + }); + return list; + }; + this.tableData = sortRecursively(records); + this.total = res.result.total || 0; } }); }, + changePage(v) { + this.searchForm.pageNumber = v; + this.getAllList(); + }, + changePageSize(v) { + this.searchForm.pageNumber = 1; + this.searchForm.pageSize = v; + this.getAllList(); + } }, mounted() { this.init();