const app = getApp() Component({ properties: { show: { type: Boolean, value: false, }, type: String, params: { type: Object, value() { return {} }, }, top: { type: Number, value: 50, }, }, observers: { show(val) { if (val) { if (this.data.type === 'TCenter') { this.setData({ TCenterId: this.data.params.hospitalId, }) } if (this.data.type === 'inhibitors') { this.setData({ inhibitorsId: this.data.params.drugId || '', inhibitorsName: this.data.params.drugName || '', inhibitorsContent: this.data.params.content || '', }) } if (this.data.type === 'publicCard') { this.getCodeImg() } } }, }, data: { popup1Check1: false, TCenterId: '', inhibitorsId: '', inhibitorsName: '', inhibitorsContent: '', selectDoctorId: '', codeImg: '', imageUrl: app.globalData.imageUrl, Timestamp: app.globalData.Timestamp, }, methods: { handleOk() { const { type, inhibitorsId, inhibitorsName, inhibitorsContent } = this.data if (type === 'argument' && !this.data.popup1Check1) { wx.showToast({ title: '请同意隐私政策', icon: 'none', }) return } if (type === 'TCenter') { if (!this.data.TCenterId) { wx.showToast({ title: '请选择治疗中心', icon: 'none', }) return } this.triggerEvent('ok', { id: this.data.TCenterId }) return } if (type === 'inhibitors') { if (!inhibitorsId) { wx.showToast({ title: '请选择抑制剂', icon: 'none', }) return } if (inhibitorsName === '其他' && !inhibitorsContent) { wx.showToast({ title: '请填写其他抑制剂', icon: 'none', }) return } this.triggerEvent('ok', { id: inhibitorsId, name: inhibitorsName, content: inhibitorsContent }) return } if (type === 'selectDoctor') { if (!this.data.selectDoctorId) { wx.showToast({ title: '请选择医生', icon: 'none', }) return } this.triggerEvent('ok', { id: this.data.selectDoctorId }) return } this.triggerEvent('ok') }, handleCancel() { this.triggerEvent('cancel') }, routerTo(e: any) { const { url } = e.currentTarget.dataset wx.navigateTo({ url, }) }, handlePopup1Check1() { if (this.data.popup1Check1) { app.mpBehavior({ PageName: 'BTN_PATIENTPRIVACY' }) } }, handleSelectStatus(e) { const { status } = e.currentTarget.dataset this.triggerEvent('ok', { type: 'selectStatusComplete', status }) }, handleSelectTCenter(e) { const { id } = e.currentTarget.dataset this.setData({ TCenterId: id, }) }, handleSelectDoctor(e) { const { id } = e.currentTarget.dataset this.setData({ selectDoctorId: id, }) }, handleSelectInhibitors(e) { const { id, name } = e.currentTarget.dataset this.setData({ inhibitorsId: id, inhibitorsName: name, }) }, getCodeImg() { wx.ajax({ method: 'GET', url: '?r=wtx/common/get-channel-wx-code', data: { ChannelType: 2, }, }).then((res) => { this.setData({ codeImg: res, }) }) }, }, })