信达小程序
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.

99 lines
2.0 KiB

const app = getApp<IAppOption>()
Page({
data: {
bannerList: [],
provinceName: '',
provinceId: '',
cityName: '',
cityId: '',
hostipalName: '',
hostipalId: '',
hospitalPolicyId: '',
hostipalList: [] as any[],
},
onLoad() {
app.waitLogin({ type: [1] }).then(() => {
this.getBanner()
})
},
getBanner() {
wx.ajax({
method: 'GET',
url: '?r=xd/hospital-policy/get-intro-list',
data: {},
}).then((res) => {
this.setData({
bannerList: res,
})
})
},
handleChangeSite(e: WechatMiniprogram.CustomEvent) {
const detail = e.detail
this.setData({
provinceId: detail.ProvinceId,
provinceName: detail.ProvinceName,
cityId: detail.CityId,
cityName: detail.CityName,
})
this.getHosList()
},
getHosList() {
const { provinceId, cityId } = this.data
wx.ajax({
method: 'GET',
url: '?r=xd/hospital-policy/get-hospital-list',
data: {
provinceId,
cityId,
},
}).then((res) => {
this.setData({
hostipalList: res.map((item) => {
return { id: item.hospitalId, name: item.hospitalName, pId: item.hospitalPolicyId }
}),
})
})
},
handleChange(e) {
const { hostipalList } = this.data
const hItem = hostipalList[e.detail.value]
this.setData({
hostipalName: hItem.name,
hostipalId: hItem.id,
hospitalPolicyId: hItem.pId,
})
},
handleHostipalDisable() {
wx.showToast({
title: '请先选择所在城市',
icon: 'none',
})
},
handleSubmit() {
if (!this.data.hostipalId) {
wx.showToast({
icon: 'none',
title: '请先选择医院',
})
return
}
wx.navigateTo({
url: `/patient/pages/medicalDetail/index?id=${this.data.hospitalPolicyId}`,
})
},
handleInfo(e) {
const { id } = e.currentTarget.dataset
wx.navigateTo({
url: `/patient/pages/repositoryDetail/index?id=${id}`,
})
},
handleBack() {
wx.navigateBack()
},
})
export {}