|
@@ -107,13 +107,17 @@ const column = computed(() => {
|
|
|
const pages = ref({
|
|
|
current: 1,
|
|
|
pageSize: 10,
|
|
|
- total: 0,
|
|
|
+ total: null,
|
|
|
})
|
|
|
async function getList(type) {
|
|
|
+ console.log("TCL: getList -> type", type)
|
|
|
try {
|
|
|
|
|
|
console.log(data.value.length, pages.value.total);
|
|
|
-
|
|
|
+ if(type === 'top'){
|
|
|
+ data.value = [];
|
|
|
+ pages.value.total = 0;
|
|
|
+ }
|
|
|
if(type ==='bottom' ){
|
|
|
if(data.value.length < pages.value.total){
|
|
|
listRef.value && listRef.value.handleBottom(true);
|
|
@@ -128,6 +132,7 @@ async function getList(type) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+
|
|
|
const listApi = userType === 1 ? userMainOrderList : getVolunteerOrderList
|
|
|
const res = await listApi({
|
|
|
orderStatus: tab.value,
|
|
@@ -138,6 +143,8 @@ async function getList(type) {
|
|
|
pages.value.total = res.total;
|
|
|
|
|
|
type ==='bottom'&& listRef.value && listRef.value.handleBottom(false);
|
|
|
+
|
|
|
+
|
|
|
} catch (error) {
|
|
|
console.log('error', error)
|
|
|
uni.showToast({
|
|
@@ -148,6 +155,14 @@ async function getList(type) {
|
|
|
if(listRef.value && listRef.value.handleRefreshing && type ==='top'){
|
|
|
listRef.value.handleRefreshing(false)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ if (data.value.length === pages.value.total && pages.value.total > 0) {
|
|
|
+ listRef.value && listRef.value.handleBottom(false)
|
|
|
+ }
|
|
|
+ }, 500)
|
|
|
+
|
|
|
type !=='bottom' && uni.hideLoading()
|
|
|
}
|
|
|
}
|