Authored by QC-L

更新提交订单页面去支付时的错误信息 review by 黄敬囿

@@ -51,8 +51,11 @@ attached: function () { @@ -51,8 +51,11 @@ attached: function () {
51 51
52 if(timer > 0){ 52 if(timer > 0){
53 let interval = setInterval(() => { 53 let interval = setInterval(() => {
54 - timer = timer - 1; 54 + timer = timer - 1;
55 leftTime = formatTimeByMin(timer, 'm:s'); 55 leftTime = formatTimeByMin(timer, 'm:s');
  56 + if (timer <= 0) {
  57 + leftTime = '00:00'
  58 + }
56 that.setData({ 59 that.setData({
57 lefttime: leftTime, 60 lefttime: leftTime,
58 timer: timer 61 timer: timer
@@ -122,7 +122,10 @@ Page({ @@ -122,7 +122,10 @@ Page({
122 } 122 }
123 }) 123 })
124 .catch(error => { 124 .catch(error => {
125 - console.log(error) 125 + wx.showToast({
  126 + title: error.message,
  127 + icon: 'none'
  128 + })
126 }) 129 })
127 130
128 }, 131 },
@@ -117,6 +117,9 @@ Page({ @@ -117,6 +117,9 @@ Page({
117 interval = setInterval(() => { 117 interval = setInterval(() => {
118 leftTime = leftTime - 1; 118 leftTime = leftTime - 1;
119 timer = formatTimeByMin(leftTime, 'm:s'); 119 timer = formatTimeByMin(leftTime, 'm:s');
  120 + if (timer <= 0) {
  121 + timer = '00:00'
  122 + }
120 that.setData({ 123 that.setData({
121 timer: timer, 124 timer: timer,
122 }); 125 });
@@ -92,24 +92,7 @@ function formatTimeByMin(time, format) { @@ -92,24 +92,7 @@ function formatTimeByMin(time, format) {
92 92
93 returnArr.push(formatNumber(date.getMinutes())); 93 returnArr.push(formatNumber(date.getMinutes()));
94 returnArr.push(formatNumber(date.getSeconds())); 94 returnArr.push(formatNumber(date.getSeconds()));
95 - // if (time >= 0) {  
96 - // // int_day = Math.floor(time / 86400000)  
97 - // // time -= int_day * 86400000;  
98 - // // int_hour = Math.floor(time / 3600000)  
99 - // // time -= int_hour * 3600000;  
100 - // int_minute = Math.floor(time / 60000)  
101 - // if (time < 60000) {  
102 - // int_minute = Math.floor(0);  
103 - // } else {  
104 - // time -= int_minute * 60000;  
105 - // }  
106 - // int_second = Math.floor(time / 1000)  
107 - // }  
108 - // // returnArr.push(formatNumber(int_day));  
109 - // // returnArr.push(formatNumber(int_hour));  
110 - // returnArr.push(formatNumber(int_minute));  
111 - // returnArr.push(formatNumber(int_second));  
112 - 95 +
113 for (var i in returnArr) { 96 for (var i in returnArr) {
114 format = format.replace(formateArr[i], returnArr[i]); 97 format = format.replace(formateArr[i], returnArr[i]);
115 } 98 }