import * as echarts from "echarts";
import { msgBoradTabel, msgBoradNum, responMsg } from "../../api/messageBoard"
import { privateOrder } from "../../api/pay"
import { Debounce } from "../../util/processingData"
export default {
    data() {
        return {
            from: [{
                id: 0,
                userDate: "",
                userName: "",
                msgPage: "",
                userMsg: ""


            }],
            successData:[{
                id: 0,
                userDate: "",
                userName: "",
                msgPage: "",
                userMsg: ""


            }],
            failData:[{
                id: 0,
                userDate: "",
                userName: "",
                msgPage: "",
                userMsg: ""


            }],
            params: {
                page: 1,
                limit: "300",
                status: ""
            },
            payHistories: false,
            activeName:"pending",


        }
    },
    mounted() {
        this.params.status=2
        this.fetchPrivateOrder2(this.params)
        this.params.status=0
        this.fetchPrivateOrder0(this.params)
        this.params.status=1
        this.fetchPrivateOrder1(this.params)
    },
    methods: {

        //请求支付历史 待处理
        async fetchPrivateOrder2(params) {
            this.payHistories = true
            const { data } = await privateOrder(params)
            this.from = data.rows
            this.payHistories = false

        },
        //请求支付历史 成功
        async fetchPrivateOrder1(params) {
            this.payHistories = true
            const { data } = await privateOrder(params)
            this.successData = data.rows
            this.payHistories = false

        },
         //请求支付历史 失败
         async fetchPrivateOrder0(params) {
            this.payHistories = true
            const { data } = await privateOrder(params)
            this.failData = data.rows
            this.payHistories = false

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


        //点击刷新
        handelRefresh: Debounce(function () {
            this.params.status=2
            this.fetchPrivateOrder2(this.params)
            this.params.status=0
            this.fetchPrivateOrder0(this.params)
            this.params.status=1
            this.fetchPrivateOrder1(this.params)
        }, 1000)


    }
}