<template>
  <view class="page-wrapper global-wrapper bgF2">
    <view class="mch-header">
      <JHeaderTitle title="提现记录" bgColor="#f2f2f2" />
      <JSearchInput
        place="搜索提现单号"
        @search="searchList"
        @resetSearch="searchList"
        @screen="scr.open()"
        :screen="true"
      />
    </view>
    <block v-for="v in useDataResult.dataList" :key="v.rid">
      <withdrawalCard v-bind="v" @toDetails="toDetail" />
    </block>
    <jeepayListNull :isShow="true" :list="useDataResult.dataList.length" />
  </view>
  <Screening ref="scr" @confirm="confirm" />
</template>

<script setup>
import { onMounted, ref } from "vue"
import { $getCashout } from "@/http/apiManager.js"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle.vue" //自定义导航栏
import JSearchInput from "@/components/newComponents/JSearchInput/JSearchInput.vue" //自定义搜索框
import jeepayListNull from "@/components/jeepayListNull/jeepayListNull"
import withdrawalCard from "./components/withdrawalCard.vue"
import Screening from "./components/Screening.vue"
import useGetList from "@/hooks/useList.js"
const { useDataResult, getList } = useGetList({
  onshow: false,
  requestFun: $getCashout,
})

const params = {
  rid: "", //订单号
  unionOrderState: "", //状态码
}
const scr = ref(null)
// 搜索回调
const searchList = (data) => {
  if (data === "reset") data = ""
  params.rid = data
  getList(params)
}
// 筛选回调
const confirm = (val) => {
  params.queryDateRange = val.time
  params.unionOrderState = val.stateType
  getList(params)
}

const toDetail = (val) => {
  console.log("val", val)
  uni.navigateTo({ url: "/pageAccount/withdrawalDetails/withdrawalDetails?rid=" + val })
}
</script>

<style lang="scss" scoped>
.page-wrapper {
  .mch-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background-color: #f2f2f2;
  }
}
</style>
