You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.5 KiB
73 lines
1.5 KiB
import http from '../../../utils/api'
|
|
Page({
|
|
data: {
|
|
diagnosisList: []
|
|
},
|
|
|
|
onLoad: function () {
|
|
|
|
},
|
|
|
|
onShow: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) {
|
|
const data = e.currentTarget.dataset.value
|
|
wx.navigateTo({
|
|
url: `/pagesA/pages/askingSyDetails/askingSyDetails?data=${encodeURIComponent(JSON.stringify(data))}`,
|
|
});
|
|
|
|
},
|
|
|
|
});
|