Authored by 肖亚东

Merge branch 'UFO_1.0.0' of http://git.yoho.cn/mobile/yoho-miniapp-ufo into UFO_1.0.0

... ... @@ -52,7 +52,7 @@ attached: function () {
if(timer > 0){
let interval = setInterval(() => {
timer = timer - 1;
leftTime = formatTimeByMin(timer, '00:00');
leftTime = formatTimeByMin(timer, 'm:s');
that.setData({
lefttime: leftTime,
timer: timer
... ...
... ... @@ -62,7 +62,6 @@ export default class orderService extends BaseService {
openid: openId,
payment: 3,
method:BUYER_PREPAY,
debug: 'XYZ'
},{
path: '/payment',
complete
... ...
... ... @@ -116,7 +116,7 @@ Page({
if (leftTime > 0){
interval = setInterval(() => {
leftTime = leftTime - 1;
timer = formatTimeByMin(leftTime, '00:00');
timer = formatTimeByMin(leftTime, 'm:s');
that.setData({
timer: timer,
});
... ...
... ... @@ -85,26 +85,33 @@ function formatNumber(n) {
*/
function formatTimeByMin(time, format) {
var formateArr = ['00'];
var formateArr = ['m', 's'];
var returnArr = [];
var int_day, int_hour, int_minute, int_second;
time = time * 1000;
if (time >= 0) {
// int_day = Math.floor(time / 86400000)
// time -= int_day * 86400000;
// int_hour = Math.floor(time / 3600000)
// time -= int_hour * 3600000;
int_minute = Math.floor(time / 60000)
time -= int_minute * 60000;
int_second = Math.floor(time / 1000)
}
// returnArr.push(formatNumber(int_day));
// returnArr.push(formatNumber(int_hour));
returnArr.push(formatNumber(int_minute));
returnArr.push(formatNumber(int_second));
var date = new Date(time * 1000);
returnArr.push(formatNumber(date.getMinutes()));
returnArr.push(formatNumber(date.getSeconds()));
// if (time >= 0) {
// // int_day = Math.floor(time / 86400000)
// // time -= int_day * 86400000;
// // int_hour = Math.floor(time / 3600000)
// // time -= int_hour * 3600000;
// int_minute = Math.floor(time / 60000)
// if (time < 60000) {
// int_minute = Math.floor(0);
// } else {
// time -= int_minute * 60000;
// }
// int_second = Math.floor(time / 1000)
// }
// // returnArr.push(formatNumber(int_day));
// // returnArr.push(formatNumber(int_hour));
// returnArr.push(formatNumber(int_minute));
// returnArr.push(formatNumber(int_second));
for (var i in returnArr) {
format = format.replace(formateArr[0], returnArr[i]);
format = format.replace(formateArr[i], returnArr[i]);
}
return format;
}
... ...