From f416636e752fff5266004f095d77b090abd2ab75 Mon Sep 17 00:00:00 2001
From: TM <923727421@qq.com>
Date: Tue, 15 Dec 2020 10:55:12 +0800
Subject: [PATCH] 修改bug
---
pages/hbfqPage/qrCode/qrCode.js | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/pages/hbfqPage/qrCode/qrCode.js b/pages/hbfqPage/qrCode/qrCode.js
index 90950c1..5986ff5 100644
--- a/pages/hbfqPage/qrCode/qrCode.js
+++ b/pages/hbfqPage/qrCode/qrCode.js
@@ -1,9 +1,9 @@
const QRCode = require('qrcode');
const app = getApp();
let $api = require('../../../utils/ajaxFn.js')
+var timer;
Page({
data: {
- timer:'',
userStyle: {},
imgSrc: '',
rateList: [
@@ -32,7 +32,6 @@
//根据字符串生成svn格式的二维码
QRCode.toString(res.data.body.payQrCodeUrl, { type: 'svg' }, function (err, url) {
let str = 'data:image/svg+xml;base64,' + Buffer(url).toString('base64');
- console.log(str)
self.setData({
imgSrc: str,
orderId:res.data.body.orderId,
@@ -43,9 +42,11 @@
{ name: '客户还款总额', rate: res.data.body.repayAmt },
{ name: '客户月还款额', rate: res.data.body.monthAmt },
{ name: '还款期数', rate: res.data.body.term + '期' }
- ],
- timer:setInterval(this.getStatus(),5000)
+ ]
})
+ timer = setInterval(()=>{
+ self.getStatus()
+ },5000)
});
},
@@ -63,7 +64,7 @@
(res)=>{
let body = res.data.body.orderStatus
if(body==1){
- clearInterval(this.data.timer)
+ clearInterval(timer)
my.showToast({
type: 'none',
content: '支付成功',
@@ -76,7 +77,7 @@
})
}
if(body==2){
- clearInterval(this.data.timer)
+ clearInterval(timer)
my.showToast({
type: 'none',
content: '支付超时',
@@ -97,5 +98,10 @@
orderId:this.data.orderId
}
)
- }
+ },
+ onUnload() {
+ // 页面隐藏
+ console.log(111)
+ clearInterval(timer)
+ },
});
--
Gitblit v1.8.0