Showing
1 changed file
with
21 additions
and
4 deletions
| @@ -34,7 +34,6 @@ Page({ | @@ -34,7 +34,6 @@ Page({ | ||
| 34 | */ | 34 | */ |
| 35 | onLoad: function (options) { | 35 | onLoad: function (options) { |
| 36 | this.options=options | 36 | this.options=options |
| 37 | - this.getOrderInfo(); | ||
| 38 | }, | 37 | }, |
| 39 | 38 | ||
| 40 | /** | 39 | /** |
| @@ -48,21 +47,27 @@ Page({ | @@ -48,21 +47,27 @@ Page({ | ||
| 48 | * 生命周期函数--监听页面显示 | 47 | * 生命周期函数--监听页面显示 |
| 49 | */ | 48 | */ |
| 50 | onShow: function () { | 49 | onShow: function () { |
| 51 | - | 50 | + this.getOrderInfo(); |
| 52 | }, | 51 | }, |
| 53 | 52 | ||
| 54 | /** | 53 | /** |
| 55 | * 生命周期函数--监听页面隐藏 | 54 | * 生命周期函数--监听页面隐藏 |
| 56 | */ | 55 | */ |
| 57 | onHide: function () { | 56 | onHide: function () { |
| 58 | - | 57 | + if(this.getOrderInfoFlushInterval){ |
| 58 | + clearInterval(this.getOrderInfoFlushInterval) | ||
| 59 | + this.getOrderInfoFlushInterval=null; | ||
| 60 | + } | ||
| 59 | }, | 61 | }, |
| 60 | 62 | ||
| 61 | /** | 63 | /** |
| 62 | * 生命周期函数--监听页面卸载 | 64 | * 生命周期函数--监听页面卸载 |
| 63 | */ | 65 | */ |
| 64 | onUnload: function () { | 66 | onUnload: function () { |
| 65 | - | 67 | + if(this.getOrderInfoFlushInterval){ |
| 68 | + clearInterval(this.getOrderInfoFlushInterval) | ||
| 69 | + this.getOrderInfoFlushInterval=null; | ||
| 70 | + } | ||
| 66 | }, | 71 | }, |
| 67 | 72 | ||
| 68 | /** | 73 | /** |
| @@ -96,6 +101,7 @@ Page({ | @@ -96,6 +101,7 @@ Page({ | ||
| 96 | }).then(async res=>{ | 101 | }).then(async res=>{ |
| 97 | let qrcode='' | 102 | let qrcode='' |
| 98 | if(res.data.order_info.status==2){ | 103 | if(res.data.order_info.status==2){ |
| 104 | + this.getOrderInfoFlush(); | ||
| 99 | qrcode=util.http_build_query({ | 105 | qrcode=util.http_build_query({ |
| 100 | path:'pages/writeoff/setmeal', | 106 | path:'pages/writeoff/setmeal', |
| 101 | //path:'pages/me/s_index', | 107 | //path:'pages/me/s_index', |
| @@ -106,6 +112,10 @@ Page({ | @@ -106,6 +112,10 @@ Page({ | ||
| 106 | },util.cgi('App.System.GetWxLiteCodeScene')) | 112 | },util.cgi('App.System.GetWxLiteCodeScene')) |
| 107 | }else{ | 113 | }else{ |
| 108 | qrcode=orderStatusStr[res.data.order_info.status].qrcode | 114 | qrcode=orderStatusStr[res.data.order_info.status].qrcode |
| 115 | + if(this.getOrderInfoFlushInterval){ | ||
| 116 | + clearInterval(this.getOrderInfoFlushInterval) | ||
| 117 | + this.getOrderInfoFlushInterval=null; | ||
| 118 | + } | ||
| 109 | } | 119 | } |
| 110 | this.setData({ | 120 | this.setData({ |
| 111 | order_info:{...res.data.order_info,...res.data.seller_info}, | 121 | order_info:{...res.data.order_info,...res.data.seller_info}, |
| @@ -115,4 +125,11 @@ Page({ | @@ -115,4 +125,11 @@ Page({ | ||
| 115 | }) | 125 | }) |
| 116 | }) | 126 | }) |
| 117 | }, | 127 | }, |
| 128 | + getOrderInfoFlushInterval:null, | ||
| 129 | + getOrderInfoFlush(){ | ||
| 130 | + if(this.getOrderInfoFlushInterval) return; | ||
| 131 | + this.getOrderInfoFlushInterval=setInterval(()=>{ | ||
| 132 | + this.getOrderInfo() | ||
| 133 | + },3000) | ||
| 134 | + } | ||
| 118 | }) | 135 | }) |
-
Please register or login to post a comment