formatSeconds:
function(value) {
let that =
this;var chetheTime = parseInt(value);
// value是时间戳
var timestamp = (
new Date()).getTime();
var date3 = chetheTime -
timestamp;
//计算出相差天数
var days = Math.floor(date3 / (24 * 3600 * 1000
))
//计算出小时数
var leave1 = date3 % (24 * 3600 * 1000)
//计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000
))
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000)
//计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000
))
//计算相差秒数
var leave3 = leave2 % (60 * 1000)
//计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000
)
that.setData({
endtimeNow: (days > 0 ? (days + "天 ") : '') + (hours > 0 ? (hours + "小时 ") : '') + (minutes>0? (minutes + " 分钟" ):'')+ seconds + " 秒"
})
},
// 再次购买
aginBuy:
function(e) {
console.log(e)
let item =
e.currentTarget.dataset.item;
let orderd =
this.data.orderd;
let shopId =
orderd.shopId;
if (item.type == 0
) {
wx.navigateTo({
url: '/page/home/pages/shops/shops?cheid=' +
shopId
})
} else {
wx.navigateTo({
url: '/page/near/pages/shops/shops?cheid=' +
shopId
})
}
},
转载于:https://www.cnblogs.com/dianzan/p/11504752.html