data: function () {
    return {
      countdown: 1800,
      payTimeout: '30:00 后超时',
    };
  },

    // 二维码30分钟失效倒计时
    payTimeoutCount() {
      let _this = this;
      if(this.countdown >= 0){
        let minutes = Math.floor(this.countdown/60);
        let seconds = Math.floor(this.countdown%60);
        if(minutes < 10){
          minutes = '0' + minutes;
        }
        if(seconds < 10){
          seconds = '0' + seconds;
        }
        this.payTimeout = minutes + ":" + seconds + ' 后超时';
        if(this.countdown == 0){
          this.payTimeout = '支付超时';
        }
        --this.countdown;
      }else{
        window.clearInterval(_this.paytimerout);
        this.payTimeout = '支付超时';
      }
    },

    //开始倒计时
    goPay() {
      let _this = this;
      _this.paytimerout = window.setInterval(function(){
        _this.payTimeoutCount();
      },1000); 
    },


// 清空计时器  
    closeCodeMask(){
      let _this = this;
     window.clearInterval(_this.paytimerout);
    },

相关文章:

  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-09
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-29
  • 2021-11-12
  • 2021-06-02
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案