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.
115 lines
2.4 KiB
115 lines
2.4 KiB
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
list: [] as any, |
|
unReadCount: 0, |
|
pagination: { |
|
page: 1, |
|
pages: 1, |
|
count: 1, |
|
}, |
|
active: '', |
|
search: '', |
|
}, |
|
onShow() { |
|
app.waitLogin().then((_res) => { |
|
this.getList() |
|
app.setTabbarNoticeMessage() |
|
}) |
|
}, |
|
handleTapSearch() { |
|
}, |
|
handleSearch() { |
|
this.setData({ |
|
list: [], |
|
pagination: { |
|
page: 1, |
|
pages: 1, |
|
count: 1, |
|
}, |
|
}) |
|
this.getList() |
|
}, |
|
handleNav(e) { |
|
const { active } = e.currentTarget.dataset |
|
this.setData({ |
|
active, |
|
}) |
|
this.getList() |
|
}, |
|
getList(newPage = 1) { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=igg4/doctor/message-interact/get-interact-patient-list', |
|
data: { |
|
page: newPage, |
|
search: this.data.search, |
|
readStatus: this.data.active, |
|
}, |
|
}).then((res) => { |
|
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list] |
|
this.setData({ |
|
list, |
|
unReadCount: res.unReadCount, |
|
pagination: { |
|
page: res.page, |
|
pages: res.pages, |
|
count: res.count, |
|
}, |
|
}) |
|
}) |
|
}, |
|
onReachBottom() { |
|
const { page, pages } = this.data.pagination |
|
if (pages > page) { |
|
this.getList(page + 1) |
|
} |
|
}, |
|
handleDetail(e) { |
|
const { index } = e.currentTarget.dataset |
|
const { list } = this.data |
|
const listItem: any = list[index] |
|
wx.navigateTo({ |
|
url: `/doctor/pages/d_interactiveDoctor/index?patientId=${listItem.patientId}`, |
|
}) |
|
}, |
|
hancleClaer() { |
|
if (Number(this.data.unReadCount) === 0) { |
|
wx.showToast({ |
|
title: '暂无未读消息', |
|
icon: 'none', |
|
}) |
|
return |
|
} |
|
wx.showModal({ |
|
title: '提示', |
|
content: '确认清空消息吗?', |
|
confirmColor: '#8c75d0', |
|
success: (res) => { |
|
if (res.confirm) { |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=igg4/doctor/message-interact/read-history', |
|
data: {}, |
|
}).then((_res) => { |
|
this.setData({ |
|
unReadCount: 0, |
|
list: this.data.list.map((item: any) => { |
|
return { |
|
...item, |
|
msgReadStatus: '1', |
|
} |
|
}), |
|
}) |
|
}) |
|
} |
|
}, |
|
}) |
|
}, |
|
handleSendGroup() { |
|
wx.navigateTo({ |
|
url: '/doctor/pages/d_taskList/index', |
|
}) |
|
}, |
|
})
|
|
|