import * as echarts from "echarts";
import { AddNewAddress } from "../../api/pay"
export default {
    data() {
        return {
            activeName: "second",
            labelPosition: 'top',
            params: {
                addresses: []
            },
            dialogVisible: false,
            inputText: "",
            num: "",
            AddLoading:false,
            address:""
        }
    },
    mounted() {


    },
    methods: {
        //请求新增用户可用地址
        async fetchAddNewAddress(params) {
            this.AddLoading = true
            const { data } = await AddNewAddress(params)
            console.log(data,"54545");
            if (data.code === 200) {//提现成功
                this.$message({
                    type: 'success',
                    message: data.msg,
                    duration: 3000,
                    showClose: true,
                });

                this.dialogVisible =false
                this.params.addresses=[]
                this.address=""
            }

            this.AddLoading = false
        },




        handelValue() {
            // let num = document.getElementById('lines').value
            // console.log(num.split("\n"), "看i哦分积分");
        },
        handelAddress() {
         
            this.params.addresses = this.address.split("\n")
          
            this.params.addresses = this.params.addresses.filter(item => item !== null && item !== undefined && item !== "");
            this.num = this.params.addresses.length

            if (!this.num) {

                this.$message({
                    type: 'error',
                    message:this.$t(`pay.empty`),
                    duration: 5000,
                    showClose: true,
                });


                return
            }


            this.dialogVisible = true
        },
        //确认新增 发起请求
        handelConfirm(){
         
            this.fetchAddNewAddress(this.params)
        }






    }
}