import http from '../../../utils/api' Page({ data: { diagnosisList: [] }, onLoad: function() { this.getwzd() }, // 问诊单 getwzd(){ http.wzd({ data:{}, success:res=>{ console.log(1111,res); this.setData({ diagnosisList:res.rows }) } }) }, // 格式化日期显示 formatDate: function(dateString) { const date = new Date(dateString); const now = new Date(); const diff = now - date; const diffDays = Math.floor(diff / (1000 * 60 * 60 * 24)); const diffHours = Math.floor(diff / (1000 * 60 * 60)); const diffMinutes = Math.floor(diff / (1000 * 60)); if (diffMinutes < 60) { return `${diffMinutes}分钟前`; } else if (diffHours < 24) { return `${diffHours}小时前`; } else if (diffDays === 1) { return '昨天'; } else if (diffDays === 2) { return '前天'; } else if (diffDays < 7) { return `${diffDays}天前`; } else { const month = date.getMonth() + 1; const day = date.getDate(); return `${month}月${day}日`; } }, // 新增问诊单 showCreateModal: function() { wx.navigateTo({ url: '/pagesA/pages/askingSyAdd/askingSyAdd', }); }, // 查看详情 viewDetail: function(e) { console.log(1111,e); const status = e.currentTarget.dataset.value.status const data = e.currentTarget.dataset.value console.log(data); if(status=='已回复'){ wx.navigateTo({ url: `/pagesA/pages/askingSyDetails/askingSyDetails?data=${encodeURIComponent(JSON.stringify(data))}`, }); }else{ wx.showToast({ title: `无回复内容`, icon: 'none', duration: 1000 }); } }, });