武田基因病B开发环境
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.

129 lines
2.6 KiB

2 weeks ago
const app = getApp<IAppOption>()
2 months ago
Page({
data: {
popupShow: false,
2 weeks ago
// popupType:'selectHostipal',
2 months ago
popupType: 'selectHostipalComplete',
2 weeks ago
popupParams: {} as any,
selectId: '',
list: [] as any[],
total: 0,
pagination: {
page: 1,
pages: 1,
count: 1,
2 months ago
},
2 weeks ago
search: '',
provinceId: '',
provinceName: '',
cityId: '',
cityName: '',
},
onLoad() {
app.waitLogin({ type: 1 }).then(() => {
this.getHospitalList()
})
},
handleSearch() {
this.getHospitalList(1)
},
handleAreaChange(e) {
const value = e.detail
this.setData({
provinceId: value[0].value,
cityId: value[1] ? value[1].value : '',
provinceName: value[0].label,
cityName: value[1] ? value[1].label : '',
})
this.getHospitalList(1)
},
getHospitalList(newPage = 1) {
const { search, provinceId, cityId } = this.data
wx.ajax({
method: 'GET',
url: '?r=wtx/common/get-hospital-list',
data: {
search,
provinceId,
cityId,
page: newPage,
},
}).then((res) => {
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list]
this.setData({
total: res.count,
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
})
})
},
onReachBottom() {
const { page, pages } = this.data.pagination
if (pages > page) {
this.getHospitalList(page + 1)
}
},
handleSelect(e) {
const { index } = e.currentTarget.dataset
const item = this.data.list[index]
this.setData({
selectId: item.hospitalId,
popupShow: true,
popupType: 'selectHostipal',
popupParams: {
...item,
},
})
},
handlePopupOk() {
const { popupType } = this.data
if (popupType === 'selectHostipal') {
this.setData({
popupShow: false,
})
wx.ajax({
method: 'POST',
url: '?r=wtx/treatment/save-d-hospital',
data: {
hospitalId: this.data.selectId,
},
}).then(() => {
this.setData({
popupShow: true,
popupType: 'selectHostipalComplete',
popupParams: {
close: true,
},
})
})
}
2 months ago
},
handlePopupCancel() {
2 weeks ago
const { popupType } = this.data
if (popupType === 'selectHostipalComplete') {
wx.navigateBack()
}
2 months ago
this.setData({
popupShow: false,
})
},
1 month ago
handleBindDoctor() {
wx.navigateTo({
url: '/patient/pages/selectDoctorList/index',
})
},
2 months ago
handleBack() {
wx.navigateBack()
},
})
export {}