From 79d69cef3bd5594d16cd87093b8dd28304377fe5 Mon Sep 17 00:00:00 2001 From: maclien <421129572@qq.com> Date: Mon, 30 Jun 2025 22:59:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=A2=E6=88=B7=E9=A1=B5=E9=9D=A2):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=B9=B6=E5=BA=94=E7=94=A8=E4=BA=8E=E5=89=A9?= =?UTF-8?q?=E4=BD=99=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在客户页面添加WXS时间格式化工具,将秒数转换为"天小时分秒"格式显示,提升时间展示的可读性 --- pages/customer/index.wxml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index deda417..a383322 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -1,3 +1,19 @@ + + var formatTime = function(time) { + // 总秒数 + var totalSecond = Math.floor(time); + //天 + var day = Math.floor(totalSecond / 3600 / 24); + // 小时 + var hour = Math.floor(totalSecond / 3600); + // 分钟 + var minute = Math.floor(totalSecond / 60) % 60; + // 秒 + var second = totalSecond % 60; + return day + '天' + hour + '小时' + minute + '分' + second + '秒'; + } + exports.formatTime = formatTime; + @@ -75,7 +91,7 @@ ({{item.mobile}}) - {{'距转派还剩'+item.left_time+'秒'}} + {{'距转派还剩'+tool.formatTime(item.left_time)}}