import { Pravite } from "../../api/pay"
import { GetUserAccount } from "../../api/help"
import { Debounce } from "../../util/processingData"
export default {
  data() {
    return {
      params: {
        page: "1",
        limit: "300",
        status: "",
      },
      PendingData: [],
      successData: [],
      failData: [],
      withdrawalRecords: false,
      activeName:"pending"

    }
  },
  mounted() {
    this.fetchWithdrawal0({ page: 1, limit: 300, status: 0 })
    this.fetchWithdrawal1({ page: 1, limit: 300, status: 1 })
    this.fetchWithdrawal2({ page: 1, limit: 300, status: 2 })
  },
  methods: {
    //请求失败订单
    async fetchWithdrawal0(params) {
      this.withdrawalRecords = true
      const { data } = await Pravite(params)

      this.failData = data.rows
      this.withdrawalRecords = false

    },
    //请求成功订单
    async fetchWithdrawal1(params) {

      const { data } = await Pravite(params)
      this.successData = data.rows



    },
    //请求待处理订单
    async fetchWithdrawal2(params) {
      const { data } = await Pravite(params)
      this.PendingData = data.rows

    },
    handelTime(date) {
      if (date) {
        return `${date.split("T")[0]} ${date.split("T")[1].split(".")[0]}`
      }
    },

    //点击刷新
    handelRefresh: Debounce(function(){     
      this.fetchWithdrawal0({ page: 1, limit: 300, status: 0 })
      this.fetchWithdrawal1({ page: 1, limit: 300, status: 1 })
      this.fetchWithdrawal2({ page: 1, limit: 300, status: 2 })
    }, 1000)


  }
} 