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

    }
  },
  mounted() {
    this.params.status = 0
    this.fetchPrivateConsume0(this.params)
    this.params.status = 1
    this.fetchPrivateConsume1(this.params)
    this.params.status = 2
    this.fetchPrivateConsume2(this.params)



  },
  methods: {
    //请求消费记录 失败
    async fetchPrivateConsume0(params) {
      // this.WithdrawalLoading = true
      const { data } = await PrivateConsume(params)
 
      this.failData = data.rows
      // if (data.code === 200) {//提现成功
      //   this.$message({
      //     type: 'success',
      //     message: data.msg,
      //     duration: 0,
      //     showClose: true,
      //   });

      //   this.$router.push(`/personal`)
      // }

      // this.WithdrawalLoading = false
    },
    //请求消费记录 成功
    async fetchPrivateConsume1(params) {
      // this.WithdrawalLoading = true
      const { data } = await PrivateConsume(params)
      this.successData = data.rows
    
      // if (data.code === 200) {//提现成功
      //   this.$message({
      //     type: 'success',
      //     message: data.msg,
      //     duration: 0,
      //     showClose: true,
      //   });

      //   this.$router.push(`/personal`)
      // }

      // this.WithdrawalLoading = false
    },

    //请求消费记录 处理中
    async fetchPrivateConsume2(params) {
      // this.WithdrawalLoading = true
      const { data } = await PrivateConsume(params)
      this.PendingData = data.rows


      // this.WithdrawalLoading = false
    },







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



    //点击刷新
    handelRefresh: Debounce(function () {
      this.params.status = 0
      this.fetchPrivateConsume0(this.params)
      this.params.status = 1
      this.fetchPrivateConsume1(this.params)
      this.params.status = 2
      this.fetchPrivateConsume2(this.params)
    }, 1000)


  }
} 