This commit is contained in:
@zuopngfei 2025-08-12 15:31:30 +08:00
parent 4491ed5548
commit 4d2f74c0e1

View File

@ -8,15 +8,15 @@ Page({
list: []
},
toPath(){
toPath() {
wx.navigateTo({
url: '/pages/AddTherapeuticRegimen/index',
})
},
async toPathDetails(e){
const data = this.data.list[e.currentTarget.dataset.index]
await wx.setStorageSync('therapeuticRegimen',JSON.stringify(data));
async toPathDetails(e) {
const data = this.data.list[e.currentTarget.dataset.index]
await wx.setStorageSync('therapeuticRegimen', JSON.stringify(data));
wx.navigateTo({
url: `/pages/AddTherapeuticRegimen/index?id=${data.id}`,
})
@ -25,30 +25,31 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async getList(){
async getList() {
const res = await request('patient/medicine_schemes', 'get', {
page: 1,
page_size: 30,
})
const today = new Date()
today.setHours(0, 0, 0, 0)
const today = new Date();
const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
const list = res.list.map(item => {
const startDate = new Date(item.start_date)
const endDate = new Date(item.end_date)
if (today > endDate) {
item.status = '已结束'
} else if (today < startDate) {
item.status = '未开始'
} else if (today >= startDate && today <= endDate) {
item.status = '进行中'
const startDate = new Date(item.start_date + 'T00:00:00'); // 将时间设置为午夜
const endDate = new Date(item.end_date + 'T00:00:00'); // 将时间设置为午夜
if (todayDate > endDate) {
item.status = '已结束';
} else if (todayDate < startDate) {
item.status = '未开始';
} else {
item.status = '进行中';
}
item.detail = JSON.parse(item.detail)
return item
})
item.detail = JSON.parse(item.detail);
return item;
});
this.setData({
list: list
})
@ -58,7 +59,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**