<template>
  <div>

    <van-pull-refresh v-model="loadingUp" @refresh="onRefresh">
      <van-list
          v-model:loading="loadingDown"
          :finished="finished"
          finished-text=""
          @load="onLoad"
      >
        <div style="min-height: 78vh">
          123


          <van-empty v-if="orderList?.length <= 0" description="没有暂时还没有内容~"/>
        </div>
      </van-list>
    </van-pull-refresh>

  </div>
</template>

<script lang="ts" setup>
import {ref} from "vue";
import {onMounted, reactive} from "vue";

const baseProps = defineProps({
  orderList: {
    type: Array,
    default: []
  },
  serviceStatus: {
    type: String,
    default: ''
  }
})

const emit = defineEmits([
  'cancelOrder',
  'removeOrder',
  'refundOrder',
  'commitOrder',
  'goInfo',
])

const orderList: any[] = reactive([])


const loadingUp = ref(false);
const loadingDown = ref(false);
const finished = ref(false);
const page = reactive({
  pageNum: 1,
  pageSize: 5,
  total: 20,
})

const onRefresh = () => {
  page.pageNum = 1
  finished.value = true
  orderList.clear()
  _getUserOrderPage()
};
const onLoad = () => {
  if (finished.value) {
    return
  }
  page.pageNum = page.pageNum + 1
  _getUserOrderPage()
};


defineExpose({
  onRefresh
})

const _getUserOrderPage = () => {

}

const cancelOrderBtn = (order) => {
  emit('cancelOrder', order)
}

const removeOrderBtn = (order) => {
  emit('removeOrder', order)
}


const refundOrderBtn = (order) => {
  emit('refundOrder', order)
}


const commitOrderBtn = (order) => {
  emit('commitOrder', order)
}

const goInfoBtn = (order) => {
  emit('goInfo', order)
}

onMounted(() => {
  _getUserOrderPage()
})
</script>

<style lang="scss" scoped>

</style>