Problems encountered in using async await in vue

use async await,await "s function log to print out the data, but the async function cannot get the value, and first print out that undefined, is printing out the data

    getRechargeOrder () {
      let apiUrl = this.$api.URL.rechargeOrder
      this.$api.axiosGet(apiUrl, para).then(res => {
        if (res.data.code === 0) {
          let data = res.data.data
          if (data.payNum) {
            console.log(data)//{payTotal: 3344, payNum: 86, payPeopleNum: 65, list: Array(86)}
            return data
          }
        } 
      }).catch(error => alert("error"))
    },
    async getDau () {
      let res = await this.getRechargeOrder()
      console.log(res)//undefined 
      }

Mar.31,2021

there is no return value in your getRechargeOrder () . Of course, it is undefined . The correct thing to do is to getRechargeOrder () return a Promise , and trigger resolve

when you get the data.
getRechargeOrder() {
  return new Promise((resolve, reject) => {
    let apiUrl = this.$api.URL.rechargeOrder
    this.$api.axiosGet(apiUrl, para).then(res => {
      if (res.data.code === 0) {
        let data = res.data.data
        if (data.payNum) {
          console.log(data)//{payTotal: 3344, payNum: 86, payPeopleNum: 65, list: Array(86)}
          resolve(data);
        }
      }
    }).catch(error => {
      reject(error)
    })
  })
}
Menu