武田基因病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.

205 lines
4.9 KiB

const app = getApp<IAppOption>()
Page({
data: {
popupShow: false,
// popupType: 'selectIdentity', // 选择您的身份
// popupType: 'bindDoctorReject', // 绑定失败
// popupType: 'bindDoctor', // 绑定成功
// popupType: 'bindDoctorQuestion', // 为什么绑定医生
// popupType: 'conformBindDoctorQuestion', // 确认绑定曾经扫码医生
popupType: 'conformBindDoctorConform', // 注册后绑定医生码
popupParams: {},
doctorList: [],
progress: 1,
2 weeks ago
treatment: {
followUpWeekInfo: {},
examDiffDays: '',
},
Days: '',
userInfo: {} as any,
2 weeks ago
isLoad: false,
},
onLoad() {
2 weeks ago
app.waitLogin({ type: 1 }).then(() => {
2 weeks ago
app.getUserInfo(1).then((userInfo) => {
this.setData({
userInfo,
2 weeks ago
isLoad: true,
Days: userInfo.Days.replace(
/(\d+)/g,
'<span style="font-size: 20px;font-weight:bold;color: rgba(255, 255, 255, 1);">$1</span>',
),
})
this.getBindDoctorList()
2 weeks ago
this.getTeratmentInfo()
const waitBindDoctorId = app.globalData.waitBindDoctorId
if (waitBindDoctorId) {
this.handleWaitBindDoctor(waitBindDoctorId)
} else if (userInfo.WaitBindDoctorId) {
this.handleCondormBindDoctor(userInfo.WaitBindDoctorId)
}
})
})
},
2 weeks ago
onShow() {
2 weeks ago
if (this.data.isLoad) {
2 weeks ago
this.getBindDoctorList()
2 weeks ago
this.getTeratmentInfo()
2 weeks ago
}
},
getBindDoctorList() {
wx.ajax({
method: 'GET',
url: '?r=wtx/account/get-bind-doctor-list',
data: {},
}).then((res) => {
this.setData({
doctorList: res,
})
})
},
2 weeks ago
getTeratmentInfo() {
wx.ajax({
method: 'GET',
url: '?r=wtx/treatment/get-index-info',
data: {},
}).then((res) => {
this.setData({
treatment: res,
2 weeks ago
progress: res.period - 1,
2 weeks ago
})
})
},
handleSwiperChange(e) {
this.setData({
progress: e.detail.current,
})
},
handleCondormBindDoctor(id) {
app.getDoctorInfo(id).then((res) => {
this.setData({
popupShow: true,
popupType: 'conformBindDoctorQuestion',
popupParams: {
name: res.doctorName,
avatar: res.doctorAvatar,
hostipal: res.hospitalName,
className: res.hospitalClassificationName,
levelName: res.hospitalLevelName,
},
})
})
},
handleWaitBindDoctor(id: string) {
app.globalData.waitBindDoctorId = ''
wx.ajax({
method: 'POST',
url: '?r=wtx/account/bind-doctor',
data: {
doctorId: id,
},
showMsg: false,
})
.then(() => {
app.getDoctorInfo(id).then((res) => {
this.setData({
popupShow: true,
popupType: 'bindDoctor',
popupParams: {
name: res.doctorName,
avatar: res.doctorAvatar,
hostipal: res.hospitalName,
className: res.hospitalClassificationName,
levelName: res.hospitalLevelName,
},
})
})
})
.catch((err) => {
if ([101, 102].includes(err.data.code)) {
this.setData({
popupShow: true,
popupType: 'bindDoctorReject',
popupParams: {
msg: err.data.msg || '请检查网络后重试',
},
})
} else {
wx.showToast({
icon: 'none',
title: err.data.msg || '请检查网络后重试',
})
}
})
},
handleBindDoctor() {
wx.navigateTo({
url: '/patient/pages/bindDoctor/index',
})
},
handleProgress(e: any) {
const { index } = e.currentTarget.dataset
this.setData({
progress: index,
})
},
handleAskPatient() {
wx.navigateTo({
url: '/patient/pages/askPatient/index',
})
},
handleCourse() {
const { progress } = this.data
wx.navigateTo({
url: `/patient/pages/course/index?current=${progress}`,
})
},
handleColtStat() {
wx.navigateTo({
url: '/patient/pages/coltStat/index',
})
},
handlePopupOk() {
const { popupType, userInfo } = this.data
if (popupType === 'bindDoctorReject') {
wx.navigateTo({
url: '/patient/pages/bindDoctor/index',
})
}
if (popupType === 'bindDoctor') {
this.getBindDoctorList()
}
if (popupType === 'conformBindDoctorQuestion') {
this.handleWaitBindDoctor(userInfo.WaitBindDoctorId)
}
this.setData({
popupShow: false,
popupType: '',
})
},
handlePopupCancel() {
const { popupType } = this.data
2 weeks ago
if (popupType === 'bindDoctor') {
this.getBindDoctorList()
}
if (popupType === 'conformBindDoctorQuestion') {
wx.ajax({
method: 'POST',
url: '?r=wtx/account/del-wait-bind-doctor',
data: {},
})
}
this.setData({
popupShow: false,
popupType: '',
})
},
})
export {}